File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ const {
6565
6666const kHandle = Symbol ( 'kHandle' ) ;
6767const kState = Symbol ( 'kState' ) ;
68+ const kIndex = Symbol ( 'kIndex' ) ;
6869const kType = Symbol ( 'kType' ) ;
6970const kLength = Symbol ( 'kLength' ) ;
7071const kArrayBufferPromise = Symbol ( 'kArrayBufferPromise' ) ;
@@ -325,17 +326,17 @@ class Blob {
325326 return new lazyReadableStream ( {
326327 async start ( ) {
327328 this [ kState ] = await self . arrayBuffer ( ) ;
329+ this [ kIndex ] = 0 ;
328330 } ,
329331
330332 pull ( controller ) {
331- if ( this [ kState ] . byteLength <= kMaxChunkSize ) {
332- controller . enqueue ( new Uint8Array ( this [ kState ] ) ) ;
333+ if ( this [ kState ] . byteLength - this [ kIndex ] <= kMaxChunkSize ) {
334+ controller . enqueue ( new Uint8Array ( this [ kState ] , this [ kIndex ] ) ) ;
333335 controller . close ( ) ;
334336 this [ kState ] = undefined ;
335337 } else {
336- const slice = this [ kState ] . slice ( 0 , kMaxChunkSize ) ;
337- this [ kState ] = this [ kState ] . slice ( kMaxChunkSize ) ;
338- controller . enqueue ( new Uint8Array ( slice ) ) ;
338+ controller . enqueue ( new Uint8Array ( this [ kState ] , this [ kIndex ] , kMaxChunkSize ) ) ;
339+ this [ kIndex ] += kMaxChunkSize ;
339340 }
340341 }
341342 } ) ;
You can’t perform that action at this time.
0 commit comments