@@ -159,7 +159,6 @@ export class Transloadit {
159159 const {
160160 params = { } ,
161161 waitForCompletion = false ,
162- isResumable = true ,
163162 chunkSize : requestedChunkSize = Infinity ,
164163 uploadConcurrency = 10 ,
165164 timeout = 24 * 60 * 60 * 1000 , // 1 day
@@ -170,13 +169,6 @@ export class Transloadit {
170169 assemblyId,
171170 } = opts
172171
173- if ( ! isResumable ) {
174- process . emitWarning (
175- 'Parameter value isResumable = false is deprecated. All uploads will be resumable (using TUS) in the future' ,
176- 'DeprecationWarning'
177- )
178- }
179-
180172 // Keep track of how long the request took
181173 const startTimeMs = getHrTimeMs ( )
182174
@@ -242,25 +234,15 @@ export class Transloadit {
242234 method : 'post' ,
243235 timeout,
244236 params,
245- }
246-
247- if ( isResumable ) {
248- requestOpts . fields = {
237+ fields : {
249238 tus_num_expected_upload_files : allStreams . length ,
250- }
239+ } ,
251240 }
252241
253- // upload as form multipart or tus?
254- const formUploadStreamsMap : Record < string , Stream > = isResumable ? { } : allStreamsMap
255-
256- const result = await this . _remoteJson < Assembly > (
257- requestOpts ,
258- formUploadStreamsMap ,
259- onUploadProgress
260- )
242+ const result = await this . _remoteJson < Assembly > ( requestOpts )
261243 checkResult ( result )
262244
263- if ( isResumable && Object . keys ( allStreamsMap ) . length > 0 ) {
245+ if ( Object . keys ( allStreamsMap ) . length > 0 ) {
264246 await sendTusRequest ( {
265247 streamsMap : allStreamsMap ,
266248 assembly : result ,
@@ -678,7 +660,6 @@ export class Transloadit {
678660 private _appendForm (
679661 form : FormData ,
680662 params : KeyVal ,
681- streamsMap ?: Record < string , Stream > ,
682663 fields ?: Record < string , string | number >
683664 ) : void {
684665 const sigData = this . calcSignature ( params )
@@ -694,13 +675,6 @@ export class Transloadit {
694675 }
695676
696677 form . append ( 'signature' , signature )
697-
698- if ( streamsMap ) {
699- Object . entries ( streamsMap ) . forEach ( ( [ label , { stream, path } ] ) => {
700- const options = path ? undefined : { filename : label } // https://github.com/transloadit/node-sdk/issues/86
701- form . append ( label , stream , options )
702- } )
703- }
704678 }
705679
706680 // Implements HTTP GET query params, handling the case where the url already
@@ -743,11 +717,7 @@ export class Transloadit {
743717 // Responsible for making API calls. Automatically sends streams with any POST,
744718 // PUT or DELETE requests. Automatically adds signature parameters to all
745719 // requests. Also automatically parses the JSON response.
746- private async _remoteJson < T > (
747- opts : RequestOptions ,
748- streamsMap ?: Record < string , Stream > ,
749- onProgress : CreateAssemblyOptions [ 'onUploadProgress' ] = ( ) => { }
750- ) : Promise < T > {
720+ private async _remoteJson < T > ( opts : RequestOptions ) : Promise < T > {
751721 const {
752722 urlSuffix,
753723 url : urlInput ,
@@ -775,11 +745,9 @@ export class Transloadit {
775745
776746 if ( method === 'post' || method === 'put' || method === 'delete' ) {
777747 form = new FormData ( )
778- this . _appendForm ( form , params , streamsMap , fields )
748+ this . _appendForm ( form , params , fields )
779749 }
780750
781- const isUploadingStreams = streamsMap && Object . keys ( streamsMap ) . length > 0
782-
783751 const requestOpts : OptionsOfJSONResponseBody = {
784752 retry : this . _gotRetry ,
785753 body : form as FormData ,
@@ -792,18 +760,8 @@ export class Transloadit {
792760 responseType : 'json' ,
793761 }
794762
795- // For non-file streams transfer encoding does not get set, and the uploaded files will not get accepted
796- // https://github.com/transloadit/node-sdk/issues/86
797- // https://github.com/form-data/form-data/issues/394#issuecomment-573595015
798- if ( isUploadingStreams ) requestOpts . headers ! [ 'transfer-encoding' ] = 'chunked'
799-
800763 try {
801764 const request = got [ method ] < T > ( url , requestOpts )
802- if ( isUploadingStreams ) {
803- request . on ( 'uploadProgress' , ( { transferred, total } ) =>
804- onProgress ( { uploadedBytes : transferred , totalBytes : total } )
805- )
806- }
807765 const { body } = await request
808766 return body
809767 } catch ( err ) {
@@ -852,7 +810,6 @@ export interface CreateAssemblyOptions {
852810 [ name : string ] : Readable | intoStream . Input
853811 }
854812 waitForCompletion ?: boolean
855- isResumable ?: boolean
856813 chunkSize ?: number
857814 uploadConcurrency ?: number
858815 timeout ?: number
0 commit comments