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 @@ -64,6 +64,7 @@ const {
6464
6565const kHandle = Symbol ( 'kHandle' ) ;
6666const kState = Symbol ( 'kState' ) ;
67+ const kIndex = Symbol ( 'kIndex' ) ;
6768const kType = Symbol ( 'kType' ) ;
6869const kLength = Symbol ( 'kLength' ) ;
6970const kArrayBufferPromise = Symbol ( 'kArrayBufferPromise' ) ;
@@ -323,17 +324,17 @@ class Blob {
323324 return new lazyReadableStream ( {
324325 async start ( ) {
325326 this [ kState ] = await self . arrayBuffer ( ) ;
327+ this [ kIndex ] = 0 ;
326328 } ,
327329
328330 pull ( controller ) {
329- if ( this [ kState ] . byteLength <= kMaxChunkSize ) {
330- controller . enqueue ( new Uint8Array ( this [ kState ] ) ) ;
331+ if ( this [ kState ] . byteLength - this [ kIndex ] <= kMaxChunkSize ) {
332+ controller . enqueue ( new Uint8Array ( this [ kState ] , this [ kIndex ] ) ) ;
331333 controller . close ( ) ;
332334 this [ kState ] = undefined ;
333335 } else {
334- const slice = this [ kState ] . slice ( 0 , kMaxChunkSize ) ;
335- this [ kState ] = this [ kState ] . slice ( kMaxChunkSize ) ;
336- controller . enqueue ( new Uint8Array ( slice ) ) ;
336+ controller . enqueue ( new Uint8Array ( this [ kState ] , this [ kIndex ] , kMaxChunkSize ) ) ;
337+ this [ kIndex ] += kMaxChunkSize ;
337338 }
338339 }
339340 } ) ;
You can’t perform that action at this time.
0 commit comments