File tree 2 files changed +22
-14
lines changed
2 files changed +22
-14
lines changed Original file line number Diff line number Diff line change @@ -116,16 +116,22 @@ class Protobuf {
116
116
return this . mergeDecodes ( input ) ;
117
117
}
118
118
119
+ /**
120
+ * Parse Protobuf stream data
121
+ * @param {byteArray } input
122
+ * @param {any[] } args
123
+ * @returns {any[] }
124
+ */
119
125
static decodeStream ( input , args ) {
120
126
this . updateProtoRoot ( args [ 0 ] ) ;
121
127
this . showUnknownFields = args [ 1 ] ;
122
128
this . showTypes = args [ 2 ] ;
123
129
124
- let streams = new Protobuf ( input ) ;
125
- let output = [ ] ;
130
+ const streams = new Protobuf ( input ) ;
131
+ const output = [ ] ;
126
132
let objLength = streams . _varInt ( ) ;
127
133
while ( ! isNaN ( objLength ) && objLength > 0 ) {
128
- let subData = streams . data . slice ( streams . offset , streams . offset + objLength ) ;
134
+ const subData = streams . data . slice ( streams . offset , streams . offset + objLength ) ;
129
135
output . push ( this . mergeDecodes ( subData ) ) ;
130
136
streams . offset += objLength ;
131
137
objLength = streams . _varInt ( ) ;
Original file line number Diff line number Diff line change @@ -306,18 +306,20 @@ TestRegister.addTests([
306
306
{
307
307
name : "Protobuf Stream Decode: no schema" ,
308
308
input : "0d081c1203596f751a024d65202b0c0a0a0a066162633132331200" ,
309
- expectedOutput : JSON . stringify ( [ {
310
- "1" : 28 ,
311
- "2" : "You" ,
312
- "3" : "Me" ,
313
- "4" : 43
314
- } ,
315
- {
316
- "1" : {
317
- "1" : "abc123" ,
318
- "2" : { }
309
+ expectedOutput : JSON . stringify ( [
310
+ {
311
+ "1" : 28 ,
312
+ "2" : "You" ,
313
+ "3" : "Me" ,
314
+ "4" : 43
315
+ } ,
316
+ {
317
+ "1" : {
318
+ "1" : "abc123" ,
319
+ "2" : { }
320
+ }
319
321
}
320
- } ] , null , 4 ) ,
322
+ ] , null , 4 ) ,
321
323
recipeConfig : [
322
324
{
323
325
"op" : "From Hex" ,
You can’t perform that action at this time.
0 commit comments