File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ interface UploadOptions {
3232
3333 onProgress ?: ( ( bytesSent : number , bytesTotal : number ) => void ) | null
3434 onChunkComplete ?: ( ( chunkSize : number , bytesAccepted : number , bytesTotal : number ) => void ) | null
35- onSuccess ?: ( ( ) => void ) | null
35+ onSuccess ?: ( ( payload : OnSuccessPayload ) => void ) | null
3636 onError ?: ( ( error : Error | DetailedError ) => void ) | null
3737 onShouldRetry ?:
3838 | ( ( error : DetailedError , retryAttempt : number , options : UploadOptions ) => boolean )
@@ -59,6 +59,10 @@ interface UploadOptions {
5959 httpStack ?: HttpStack
6060}
6161
62+ interface OnSuccessPayload {
63+ lastResponse : HttpResponse
64+ }
65+
6266interface UrlStorage {
6367 findAllUploads ( ) : Promise < PreviousUpload [ ] >
6468 findUploadsByFingerprint ( fingerprint : string ) : Promise < PreviousUpload [ ] >
Original file line number Diff line number Diff line change @@ -27,8 +27,9 @@ const upload = new tus.Upload(file, {
2727 console . log ( bytesSent , bytesTotal , `${ percentage } %` )
2828 } ,
2929 onChunkComplete : ( _chunkSize : number , _bytesAccepted : number ) => { } ,
30- onSuccess : ( ) => {
30+ onSuccess : ( payload : tus . OnSuccessPayload ) => {
3131 console . log ( 'Download from %s complete' , upload . url )
32+ console . log ( 'Response header' , payload . lastResponse . getHeader ( 'X-Info' ) )
3233 } ,
3334 onError : ( error : Error | DetailedError ) => {
3435 console . error ( `Failed because: ${ error } ` )
You can’t perform that action at this time.
0 commit comments