Skip to main content
Version: v4.5

Resumable File Upload

Below methods are exposed with encapsulating various steps in resumable upload.

  • It either accepts readable file stream or html file object. Keep filename in opts.filename if stream is being sent.
  • These methods are intelligent enough to find out whether file is interrupted or not. if interrupted it resumes from where it was interrupted otherwise it uploads from the beginning. Consumer of this method never worry about it, just invoke the method with the file like normal file upload
  • Keep opts.onComplete to get callback once file upload is completed

Methods#

  • IafManage.addFileResumable - Upload/resumes a file.
  • IafFile.uploadFileResumable - Uploads/resumes a file, It also encapsulates item service api calls.
  • IafManage.cancelFileUpload - It just invokes cancel file upload api in file svc
  • IafFile.cancelResumableFileUpload - Invokes cancel file upload api in file svc, It also make appropriate changes in item service

Samples#

IafFile#

let container = {  "_id":"5be40777857aba0001433ec7",  "_namespaces":["proj_qP6xZivX"],  "_userAttributes":{    "path":"/"  }};
let opts = {};opts.onComplete = () => {/*Success call back*/}opts.onProgress = (bytesUploaded, bytesTotal) => {/* Progress call back*/ }opts.onError = (e)=> {/*Error callback*/}
IafFile.uploadFileResumable(container,file,opts);

IafManage#

let opts = {};opts.onComplete = () => {/*Success call back*/}opts.onProgress = (bytesUploaded, bytesTotal) => {/* Progress call back*/ }opts.onError = (e)=> {/*Error callback*/}
// It either accepts stream or file object, keep filename in opts if file is a stream.IafManage.addFileResumable(file,namespaces,parents,opts);