github.com/simpleiot/simpleiot@v0.18.3/frontend/lib/protobuf/file-chunk_pb.js (about) 1 // source: file-chunk.proto 2 /** 3 * @fileoverview 4 * @enhanceable 5 * @suppress {missingRequire} reports error on implicit type usages. 6 * @suppress {messageConventions} JS Compiler reports an error if a variable or 7 * field starts with 'MSG_' and isn't a translatable message. 8 * @public 9 */ 10 // GENERATED CODE -- DO NOT EDIT! 11 /* eslint-disable */ 12 // @ts-nocheck 13 14 var jspb = require('google-protobuf'); 15 var goog = jspb; 16 var global = 17 (typeof globalThis !== 'undefined' && globalThis) || 18 (typeof window !== 'undefined' && window) || 19 (typeof global !== 'undefined' && global) || 20 (typeof self !== 'undefined' && self) || 21 (function () { return this; }).call(null) || 22 Function('return this')(); 23 24 goog.exportSymbol('proto.pb.FileChunk', null, global); 25 goog.exportSymbol('proto.pb.FileChunk.State', null, global); 26 /** 27 * Generated by JsPbCodeGenerator. 28 * @param {Array=} opt_data Optional initial data array, typically from a 29 * server response, or constructed directly in Javascript. The array is used 30 * in place and becomes part of the constructed object. It is not cloned. 31 * If no data is provided, the constructed object will be empty, but still 32 * valid. 33 * @extends {jspb.Message} 34 * @constructor 35 */ 36 proto.pb.FileChunk = function(opt_data) { 37 jspb.Message.initialize(this, opt_data, 0, -1, null, null); 38 }; 39 goog.inherits(proto.pb.FileChunk, jspb.Message); 40 if (goog.DEBUG && !COMPILED) { 41 /** 42 * @public 43 * @override 44 */ 45 proto.pb.FileChunk.displayName = 'proto.pb.FileChunk'; 46 } 47 48 49 50 if (jspb.Message.GENERATE_TO_OBJECT) { 51 /** 52 * Creates an object representation of this proto. 53 * Field names that are reserved in JavaScript and will be renamed to pb_name. 54 * Optional fields that are not set will be set to undefined. 55 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. 56 * For the list of reserved names please see: 57 * net/proto2/compiler/js/internal/generator.cc#kKeyword. 58 * @param {boolean=} opt_includeInstance Deprecated. whether to include the 59 * JSPB instance for transitional soy proto support: 60 * http://goto/soy-param-migration 61 * @return {!Object} 62 */ 63 proto.pb.FileChunk.prototype.toObject = function(opt_includeInstance) { 64 return proto.pb.FileChunk.toObject(opt_includeInstance, this); 65 }; 66 67 68 /** 69 * Static version of the {@see toObject} method. 70 * @param {boolean|undefined} includeInstance Deprecated. Whether to include 71 * the JSPB instance for transitional soy proto support: 72 * http://goto/soy-param-migration 73 * @param {!proto.pb.FileChunk} msg The msg instance to transform. 74 * @return {!Object} 75 * @suppress {unusedLocalVariables} f is only used for nested messages 76 */ 77 proto.pb.FileChunk.toObject = function(includeInstance, msg) { 78 var f, obj = { 79 state: jspb.Message.getFieldWithDefault(msg, 1, 0), 80 seq: jspb.Message.getFieldWithDefault(msg, 2, 0), 81 data: msg.getData_asB64(), 82 filename: jspb.Message.getFieldWithDefault(msg, 4, "") 83 }; 84 85 if (includeInstance) { 86 obj.$jspbMessageInstance = msg; 87 } 88 return obj; 89 }; 90 } 91 92 93 /** 94 * Deserializes binary data (in protobuf wire format). 95 * @param {jspb.ByteSource} bytes The bytes to deserialize. 96 * @return {!proto.pb.FileChunk} 97 */ 98 proto.pb.FileChunk.deserializeBinary = function(bytes) { 99 var reader = new jspb.BinaryReader(bytes); 100 var msg = new proto.pb.FileChunk; 101 return proto.pb.FileChunk.deserializeBinaryFromReader(msg, reader); 102 }; 103 104 105 /** 106 * Deserializes binary data (in protobuf wire format) from the 107 * given reader into the given message object. 108 * @param {!proto.pb.FileChunk} msg The message object to deserialize into. 109 * @param {!jspb.BinaryReader} reader The BinaryReader to use. 110 * @return {!proto.pb.FileChunk} 111 */ 112 proto.pb.FileChunk.deserializeBinaryFromReader = function(msg, reader) { 113 while (reader.nextField()) { 114 if (reader.isEndGroup()) { 115 break; 116 } 117 var field = reader.getFieldNumber(); 118 switch (field) { 119 case 1: 120 var value = /** @type {!proto.pb.FileChunk.State} */ (reader.readEnum()); 121 msg.setState(value); 122 break; 123 case 2: 124 var value = /** @type {number} */ (reader.readInt32()); 125 msg.setSeq(value); 126 break; 127 case 3: 128 var value = /** @type {!Uint8Array} */ (reader.readBytes()); 129 msg.setData(value); 130 break; 131 case 4: 132 var value = /** @type {string} */ (reader.readString()); 133 msg.setFilename(value); 134 break; 135 default: 136 reader.skipField(); 137 break; 138 } 139 } 140 return msg; 141 }; 142 143 144 /** 145 * Serializes the message to binary data (in protobuf wire format). 146 * @return {!Uint8Array} 147 */ 148 proto.pb.FileChunk.prototype.serializeBinary = function() { 149 var writer = new jspb.BinaryWriter(); 150 proto.pb.FileChunk.serializeBinaryToWriter(this, writer); 151 return writer.getResultBuffer(); 152 }; 153 154 155 /** 156 * Serializes the given message to binary data (in protobuf wire 157 * format), writing to the given BinaryWriter. 158 * @param {!proto.pb.FileChunk} message 159 * @param {!jspb.BinaryWriter} writer 160 * @suppress {unusedLocalVariables} f is only used for nested messages 161 */ 162 proto.pb.FileChunk.serializeBinaryToWriter = function(message, writer) { 163 var f = undefined; 164 f = message.getState(); 165 if (f !== 0.0) { 166 writer.writeEnum( 167 1, 168 f 169 ); 170 } 171 f = message.getSeq(); 172 if (f !== 0) { 173 writer.writeInt32( 174 2, 175 f 176 ); 177 } 178 f = message.getData_asU8(); 179 if (f.length > 0) { 180 writer.writeBytes( 181 3, 182 f 183 ); 184 } 185 f = message.getFilename(); 186 if (f.length > 0) { 187 writer.writeString( 188 4, 189 f 190 ); 191 } 192 }; 193 194 195 /** 196 * @enum {number} 197 */ 198 proto.pb.FileChunk.State = { 199 NONE: 0, 200 DONE: 2, 201 ERROR: 3 202 }; 203 204 /** 205 * optional State state = 1; 206 * @return {!proto.pb.FileChunk.State} 207 */ 208 proto.pb.FileChunk.prototype.getState = function() { 209 return /** @type {!proto.pb.FileChunk.State} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); 210 }; 211 212 213 /** 214 * @param {!proto.pb.FileChunk.State} value 215 * @return {!proto.pb.FileChunk} returns this 216 */ 217 proto.pb.FileChunk.prototype.setState = function(value) { 218 return jspb.Message.setProto3EnumField(this, 1, value); 219 }; 220 221 222 /** 223 * optional int32 seq = 2; 224 * @return {number} 225 */ 226 proto.pb.FileChunk.prototype.getSeq = function() { 227 return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); 228 }; 229 230 231 /** 232 * @param {number} value 233 * @return {!proto.pb.FileChunk} returns this 234 */ 235 proto.pb.FileChunk.prototype.setSeq = function(value) { 236 return jspb.Message.setProto3IntField(this, 2, value); 237 }; 238 239 240 /** 241 * optional bytes data = 3; 242 * @return {!(string|Uint8Array)} 243 */ 244 proto.pb.FileChunk.prototype.getData = function() { 245 return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); 246 }; 247 248 249 /** 250 * optional bytes data = 3; 251 * This is a type-conversion wrapper around `getData()` 252 * @return {string} 253 */ 254 proto.pb.FileChunk.prototype.getData_asB64 = function() { 255 return /** @type {string} */ (jspb.Message.bytesAsB64( 256 this.getData())); 257 }; 258 259 260 /** 261 * optional bytes data = 3; 262 * Note that Uint8Array is not supported on all browsers. 263 * @see http://caniuse.com/Uint8Array 264 * This is a type-conversion wrapper around `getData()` 265 * @return {!Uint8Array} 266 */ 267 proto.pb.FileChunk.prototype.getData_asU8 = function() { 268 return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( 269 this.getData())); 270 }; 271 272 273 /** 274 * @param {!(string|Uint8Array)} value 275 * @return {!proto.pb.FileChunk} returns this 276 */ 277 proto.pb.FileChunk.prototype.setData = function(value) { 278 return jspb.Message.setProto3BytesField(this, 3, value); 279 }; 280 281 282 /** 283 * optional string fileName = 4; 284 * @return {string} 285 */ 286 proto.pb.FileChunk.prototype.getFilename = function() { 287 return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); 288 }; 289 290 291 /** 292 * @param {string} value 293 * @return {!proto.pb.FileChunk} returns this 294 */ 295 proto.pb.FileChunk.prototype.setFilename = function(value) { 296 return jspb.Message.setProto3StringField(this, 4, value); 297 }; 298 299 300 goog.object.extend(exports, proto.pb);