upload(uploadOptions, doneCallback, failCallback) {
    uploadOptions = uploadOptions || {};

    if (this.isFolder) {
      throw new Error("A folder cannot be uploaded");
    }

    this._setMetadata(uploadOptions);

    const uploadMessage = new message.UploadFile(this.bucket, this.key)
        .entity(this._data, this._type)
        .acl(this._acl);

    uploadMessage.progress(uploadOptions.progress);

    if (this._size) {
      uploadMessage.contentLength(this._size);
    }

    if (this._mimeType) {
      uploadMessage.mimeType(this._mimeType);
    }

    this._conditional(uploadMessage, uploadOptions);

    this._db.addToBlackList(this.id);
    return this._db.send(uploadMessage).then((response) => {
      this._data = null;
      this._type = null;

      this.fromJSON(response.entity);
      return this;
    }).then(doneCallback, failCallback);
  }
/**
   * Uploads the file content which was provided in the constructor or by uploadOptions.data
   * @param {object=} uploadOptions The upload options
   * @param {string|Blob|File|ArrayBuffer|json=} uploadOptions.data The initial file content, which will be uploaded by
   * invoking {@link #upload} later on.
   * @param {string=} uploadOptions.type A optional type hint used to correctly interpret the provided data
   * @param {string=} uploadOptions.mimeType The mimType of the file. Defaults to the mimeType of the provided data if
   * it is a file object, blob or data-url
   * @param {string=} uploadOptions.eTag The optional current ETag of the file
   * @param {string=} uploadOptions.lastModified The optional last modified date
   * @param {Acl=} uploadOptions.acl The file acl which will be set, if the file is uploaded afterwards
   * @param {boolean} [uploadOptions.force=false] force the upload and overwrite any existing files without validating it
   * @param {connector.Message~progressCallback} [uploadOptions.progress] listen to progress changes during upload
   * @param {binding.File~fileCallback=} doneCallback The callback is invoked after the upload succeed successfully
   * @param {binding.File~failCallback=} failCallback The callback is invoked if any error is occurred
   * @return {Promise<binding.File>} A promise which will be fulfilled with this file object where the metadata is updated
   */
Uploads the file content which was provided in the constructor or by uploadOptions.data
@param {object=} uploadOptions The upload options
@param {string|Blob|File|ArrayBuffer|json=} uploadOptions.data The initial file content, which will be uploaded by
invoking  #upload later on.
@param {string=} uploadOptions.type A optional type hint used to correctly interpret the provided data
@param {string=} uploadOptions.mimeType The mimType of the file.
Uploads the file content which was provided in the constructor or by uploadOptions . data @param { object = } uploadOptions The upload options @param { string|Blob|File|ArrayBuffer|json = } uploadOptions . data The initial file content which will be uploaded by invoking #upload later on . @param { string = } uploadOptions . type A optional type hint used to correctly interpret the provided data @param { string = } uploadOptions . mimeType The mimType of the file .
upload(uploadOptions, doneCallback, failCallback) {
    uploadOptions = uploadOptions || {};
    if (this.isFolder) {
      throw new Error("A folder cannot be uploaded");
    }
    this._setMetadata(uploadOptions);
    const uploadMessage = new message.UploadFile(this.bucket, this.key)
        .entity(this._data, this._type)
        .acl(this._acl);
    uploadMessage.progress(uploadOptions.progress);
    if (this._size) {
      uploadMessage.contentLength(this._size);
    }
    if (this._mimeType) {
      uploadMessage.mimeType(this._mimeType);
    }
    this._conditional(uploadMessage, uploadOptions);
    this._db.addToBlackList(this.id);
    return this._db.send(uploadMessage).then((response) => {
      this._data = null;
      this._type = null;
      this.fromJSON(response.entity);
      return this;
    }).then(doneCallback, failCallback);
  }
upload ( uploadOptions , doneCallback , failCallback ) { uploadOptions = uploadOptions || { } ; if ( this . isFolder ) { throw new Error ( "A folder cannot be uploaded" ) ; } this . _setMetadata ( uploadOptions ) ; const uploadMessage = new message . UploadFile ( this . bucket , this . key ) . entity ( this . _data , this . _type ) . acl ( this . _acl ) ; uploadMessage . progress ( uploadOptions . progress ) ; if ( this . _size ) { uploadMessage . contentLength ( this . _size ) ; } if ( this . _mimeType ) { uploadMessage . mimeType ( this . _mimeType ) ; } this . _conditional ( uploadMessage , uploadOptions ) ; this . _db . addToBlackList ( this . id ) ; return this . _db . send ( uploadMessage ) . then ( ( response ) => { this . _data = null ; this . _type = null ; this . fromJSON ( response . entity ) ; return this ; } ) . then ( doneCallback , failCallback ) ; }
Uploads the file content which was provided in the constructor or by uploadOptions.data
 @param {object=} uploadOptions The upload options
 @param {string|Blob|File|ArrayBuffer|json=} uploadOptions.data The initial file content, which will be uploaded by
 invoking {@link #upload} later on.
Uploads the file content which was provided in the constructor or by uploadOptions . data @param { object = } uploadOptions The upload options @param { string|Blob|File|ArrayBuffer|json = } uploadOptions . data The initial file content which will be uploaded by invoking { @link #upload } later on .