lib/index.js
function uploadRequest(res, fileObject, showProgress) {
  var url = res.url;
  var expiration = res.expiration;
  var hmac = res.hmac;
  var uuid = res.uuid;
  var file = fileObject.file;
  var uid = fileObject.uid;

  var upload_url = buildUploadURL(url, uuid, expiration, hmac, file.name);

  return new Promise(function (resolve, reject) {
    reqs[uid] = _superagent2.default.put(upload_url).send(file).set({
      'Accept': 'application/json',
      'Content-Type': 'application/json'
    }).on('progress', function (e) {
      showProgress(e, fileObject);
    }).end(function (err, res) {
      delete reqs[uid];

      // throw a custom error message
      if (err) return reject(customError('uploadRequest', err));

      resolve(res);
    });
  });
}
function uploadRequest(res, fileObject, showProgress) {
  var url = res.url;
  var expiration = res.expiration;
  var hmac = res.hmac;
  var uuid = res.uuid;
  var file = fileObject.file;
  var uid = fileObject.uid;

  var upload_url = buildUploadURL(url, uuid, expiration, hmac, file.name);

  return new Promise(function (resolve, reject) {
    reqs[uid] = _superagent2.default.put(upload_url).send(file).set({
      'Accept': 'application/json',
      'Content-Type': 'application/json'
    }).on('progress', function (e) {
      showProgress(e, fileObject);
    }).end(function (err, res) {
      delete reqs[uid];

      // throw a custom error message
      if (err) return reject(customError('uploadRequest', err));

      resolve(res);
    });
  });
}
function uploadRequest ( res , fileObject , showProgress ) { var url = res . url ; var expiration = res . expiration ; var hmac = res . hmac ; var uuid = res . uuid ; var file = fileObject . file ; var uid = fileObject . uid ; var upload_url = buildUploadURL ( url , uuid , expiration , hmac , file . name ) ; return new Promise ( function ( resolve , reject ) { reqs [ uid ] = _superagent2 . default . put ( upload_url ) . send ( file ) . set ( { 'Accept' : 'application/json' , 'Content-Type' : 'application/json' } ) . on ( 'progress' , function ( e ) { showProgress ( e , fileObject ) ; } ) . end ( function ( err , res ) { delete reqs [ uid ] ; // throw a custom error message if ( err ) return reject ( customError ( 'uploadRequest' , err ) ) ; resolve ( res ) ; } ) ; } ) ; }
uploadRequest
Assign an XHR request to the `reqs` hash using the `uid`.
@param  {Object} res - the response from presignRequest()
@param  {File Object} file
@param  {Function} on progress event handler
@return  {Promise}
uploadRequest Assign an XHR request to the reqs hash using the uid .