@@ -206,32 +206,33 @@ describe('test', () => {
206
206
const { request } = await import ( './request.js' ) ;
207
207
208
208
const progress = Progress ( ) ;
209
- progress . subscribe ( {
210
- next : e => console . log ( 'DOWNLOAD' , e )
211
- } ) ;
209
+ progress . subscribe ( { next : e => console . log ( 'DOWNLOAD' , e ) } ) ;
210
+
212
211
const byteRate = TransferRate ( MBYTE , SECOND ) ;
213
- byteRate . subscribe ( {
214
- next : e => console . log ( 'RATE' , e )
215
- // complete: () => console.log('complete')
216
- } ) ;
212
+ byteRate . subscribe ( { next : e => console . log ( 'RATE' , e ) } ) ;
213
+
217
214
const estimateTime = EstimateTime ( SECOND ) ;
218
- estimateTime . subscribe ( {
219
- next : e => console . log ( 'ESTIMATE' , e )
215
+ estimateTime . subscribe ( { next : e => console . log ( 'ESTIMATE' , e ) } ) ;
216
+
217
+ const fileMap = {
218
+ VIDEO_170MB :
219
+ 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4' ,
220
+ VIDEO_13MB :
221
+ 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4' ,
222
+ SvgContentLengthValid : 'https://upload.wikimedia.org/wikipedia/commons/4/4f/SVG_Logo.svg' ,
223
+ SvgContentLengthInvalid : 'https://upload.wikimedia.org/wikipedia/commons/8/84/Example.svg'
224
+ } ;
225
+
226
+ const req = new Request ( new URL ( fileMap . SvgContentLengthInvalid ) , {
227
+ method : 'GET'
220
228
} ) ;
221
- // https://api.github.com/repos/mediaelement/mediaelement-files/contents/big_buck_bunny.mp4
222
- // https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4
223
- // https://upload.wikimedia.org/wikipedia/commons/8/84/Example.svg
224
- // https://upload.wikimedia.org/wikipedia/commons/4/4f/SVG_Logo.svg
225
-
226
- const req = new Request (
227
- new URL ( 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4' ) ,
228
- {
229
- method : 'GET'
230
- }
231
- ) ;
232
229
233
230
const value = await lastValueFrom (
234
- of ( req ) . pipe ( request ( { download : [ progress , byteRate , estimateTime ] } ) , resolveBlob ( ) )
231
+ of ( req ) . pipe (
232
+ request ( { download : [ progress , byteRate , estimateTime ] } ) ,
233
+ resolveBlob ( )
234
+ //
235
+ )
235
236
) ;
236
237
console . log ( 'FINAL' , value ) ;
237
238
writeFileSync ( 'programming.mp4' , global . Buffer . from ( await value . arrayBuffer ( ) ) ) ;
0 commit comments