File tree 3 files changed +18
-5
lines changed
3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 1
- { "engineHash" : " d1cb68d " , "specHash" : " 9919482" , "version" : " 1.3.0" }
1
+ { "engineHash" : " ab2fc63 " , "specHash" : " 9919482" , "version" : " 1.3.0" }
Original file line number Diff line number Diff line change @@ -186,7 +186,7 @@ export function decodeBase64ByteStream(data: string): Readable {
186
186
: eval ( 'require' ) ( 'stream' ) . Readable . from ( Buffer . from ( data , 'base64' ) ) ;
187
187
}
188
188
189
- export async function readByteStream ( byteStream : Readable ) {
189
+ export async function readByteStream ( byteStream : Readable ) : Promise < Buffer > {
190
190
const buffers : Buffer [ ] = [ ] ;
191
191
for await ( const data of byteStream ) {
192
192
buffers . push ( data ) ;
Original file line number Diff line number Diff line change @@ -226,8 +226,15 @@ export async function fetch(
226
226
options
227
227
)
228
228
: options ;
229
-
230
- const requestInit = await createRequestInit ( fetchOptions ) ;
229
+ const fileStreamBuffer = fetchOptions . fileStream
230
+ ? await readByteStream ( fetchOptions . fileStream )
231
+ : void 0 ;
232
+ const requestInit = await createRequestInit ( {
233
+ ...fetchOptions ,
234
+ fileStream : fileStreamBuffer
235
+ ? generateByteStreamFromBuffer ( fileStreamBuffer )
236
+ : void 0 ,
237
+ } ) ;
231
238
232
239
const { params = { } } = fetchOptions ;
233
240
const response = await nodeFetch (
@@ -287,7 +294,13 @@ export async function fetch(
287
294
await fetchOptions . auth . refreshToken ( fetchOptions . networkSession ) ;
288
295
289
296
// retry the request right away
290
- return fetch ( resource , { ...fetchOptions , numRetries : numRetries + 1 } ) ;
297
+ return fetch ( resource , {
298
+ ...fetchOptions ,
299
+ numRetries : numRetries + 1 ,
300
+ fileStream : fileStreamBuffer
301
+ ? generateByteStreamFromBuffer ( fileStreamBuffer )
302
+ : void 0 ,
303
+ } ) ;
291
304
}
292
305
293
306
const isRetryable =
You can’t perform that action at this time.
0 commit comments