async upload() {
    let response;

    if (this._actions.init) {
      response = await this._doInit(this._actions.init);
      if (! (response.status >= 200 && response.status < 300)) {
        throw `'init' action failed with HTTP ${response.status}`;
      }
    }

    const parts = this._actions.parts || [];
    this._bytesTotal = this._file.size;
    this._bytesUploaded = this._bytesTotal - this._getBytesToUpload(parts);
    for (let i = 0; i < parts.length; i++) {
      console.log(`Uploading part ${i + 1}/${parts.length}`);
      response = await this._uploadPart(parts[i]);
      if (! (response.status >= 200 && response.status < 300)) {
        throw `'part upload failed for part ${i + 1}/${parts.length} with HTTP ${response.status}`;
      }
      this._bytesUploaded += this._getBytesForPart(parts[i]);
    }

    if (this._actions.commit) {
      response = await this._doCommit(this._actions.commit);
      if (! (response.status >= 200 && response.status < 300)) {
        throw `'commit' action failed with HTTP ${response.status}`;
      }
    }

    if (this._actions.verify) {
      response = await this._doVerify(this._actions.verify);
      if (response.status !== 200) {
        if (response.message) {
          throw response.message
        } else {
          throw `'verify' action failed with HTTP ${response.status}`;
        }
      }
    }
  }
/**
   * Upload a file using multipart-basic transfer mode
   *
   * @returns {Promise<void>}
   */
Upload a file using multipart-basic transfer mode
@returns {Promise}
Upload a file using multipart - basic transfer mode @returns { Promise }
async upload() {
    let response;
    if (this._actions.init) {
      response = await this._doInit(this._actions.init);
      if (! (response.status >= 200 && response.status < 300)) {
        throw `'init' action failed with HTTP ${response.status}`;
      }
    }
    const parts = this._actions.parts || [];
    this._bytesTotal = this._file.size;
    this._bytesUploaded = this._bytesTotal - this._getBytesToUpload(parts);
    for (let i = 0; i < parts.length; i++) {
      console.log(`Uploading part ${i + 1}/${parts.length}`);
      response = await this._uploadPart(parts[i]);
      if (! (response.status >= 200 && response.status < 300)) {
        throw `'part upload failed for part ${i + 1}/${parts.length} with HTTP ${response.status}`;
      }
      this._bytesUploaded += this._getBytesForPart(parts[i]);
    }
    if (this._actions.commit) {
      response = await this._doCommit(this._actions.commit);
      if (! (response.status >= 200 && response.status < 300)) {
        throw `'commit' action failed with HTTP ${response.status}`;
      }
    }
    if (this._actions.verify) {
      response = await this._doVerify(this._actions.verify);
      if (response.status !== 200) {
        if (response.message) {
          throw response.message
        } else {
          throw `'verify' action failed with HTTP ${response.status}`;
        }
      }
    }
  }
async upload ( ) { let response ; if ( this . _actions . init ) { response = await this . _doInit ( this . _actions . init ) ; if ( ! ( response . status >= 200 && response . status < 300 ) ) { throw ` ${ response . status } ` ; } } const parts = this . _actions . parts || [ ] ; this . _bytesTotal = this . _file . size ; this . _bytesUploaded = this . _bytesTotal - this . _getBytesToUpload ( parts ) ; for ( let i = 0 ; i < parts . length ; i ++ ) { console . log ( ` ${ i + 1 } ${ parts . length } ` ) ; response = await this . _uploadPart ( parts [ i ] ) ; if ( ! ( response . status >= 200 && response . status < 300 ) ) { throw ` ${ i + 1 } ${ parts . length } ${ response . status } ` ; } this . _bytesUploaded += this . _getBytesForPart ( parts [ i ] ) ; } if ( this . _actions . commit ) { response = await this . _doCommit ( this . _actions . commit ) ; if ( ! ( response . status >= 200 && response . status < 300 ) ) { throw ` ${ response . status } ` ; } } if ( this . _actions . verify ) { response = await this . _doVerify ( this . _actions . verify ) ; if ( response . status !== 200 ) { if ( response . message ) { throw response . message } else { throw ` ${ response . status } ` ; } } } }
Upload a file using multipart-basic transfer mode
 @returns {Promise<void>}
Upload a file using multipart - basic transfer mode @returns { Promise<void > }