File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed
Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -128,14 +128,27 @@ let git = {
128128
129129 // get data from response
130130
131- const reader = await resp . body . getReader ( ) ;
131+ const reader = resp . body . getReader ( ) ;
132+ let buffer = [ ] ;
132133
133- const readerResp = await reader . read ( ) ;
134-
135- const readerChunk = readerResp . value ;
136- const readerDone = readerResp . done ; // true if read all chunks
134+ async function readChunk ( ) {
135+
136+ const chunk = await reader . read ( ) ;
137+
138+ // if finished reading, return
139+ if ( chunk . done ) return ;
140+
141+ // add new chunk to buffer
142+ buffer = new Uint8Array ( [ ...buffer , ...chunk . value ] ) ;
143+
144+ // read next chunk
145+ return readChunk ( ) ;
146+
147+ }
137148
138- return readerChunk ;
149+ await readChunk ( ) ;
150+
151+ return buffer ;
139152
140153 } ,
141154
You can’t perform that action at this time.
0 commit comments