src/googledrive.js
function (path, options) {
    const fullPath = googleDrivePath(path);

    return this._getFileId(fullPath).then((id) => {
      if (!id) {
        // File doesn't exist. Ignore.
        return Promise.resolve({statusCode: 200});
      }

      return this._getMeta(id).then((meta) => {
        let etagWithoutQuotes;
        if ((typeof meta === 'object') && (typeof meta.etag === 'string')) {
          etagWithoutQuotes = removeQuotes(meta.etag);
        }
        if (options && options.ifMatch && (options.ifMatch !== etagWithoutQuotes)) {
          return {statusCode: 412, revision: etagWithoutQuotes};
        }

        return this._request('DELETE', BASE_URL + '/drive/v2/files/' + id, {}).then((response) => {
          if (response.status === 200 || response.status === 204) {
            return {statusCode: 200};
          } else {
            return Promise.reject("Delete failed: " + response.status + " (" + response.responseText + ")");
          }
        });
      });
    });
  }
function (path, options) {
    const fullPath = googleDrivePath(path);

    return this._getFileId(fullPath).then((id) => {
      if (!id) {
        // File doesn't exist. Ignore.
        return Promise.resolve({statusCode: 200});
      }

      return this._getMeta(id).then((meta) => {
        let etagWithoutQuotes;
        if ((typeof meta === 'object') && (typeof meta.etag === 'string')) {
          etagWithoutQuotes = removeQuotes(meta.etag);
        }
        if (options && options.ifMatch && (options.ifMatch !== etagWithoutQuotes)) {
          return {statusCode: 412, revision: etagWithoutQuotes};
        }

        return this._request('DELETE', BASE_URL + '/drive/v2/files/' + id, {}).then((response) => {
          if (response.status === 200 || response.status === 204) {
            return {statusCode: 200};
          } else {
            return Promise.reject("Delete failed: " + response.status + " (" + response.responseText + ")");
          }
        });
      });
    });
  }
function ( path , options ) { const fullPath = googleDrivePath ( path ) ; return this . _getFileId ( fullPath ) . then ( ( id ) => { if ( ! id ) { // File doesn't exist. Ignore. return Promise . resolve ( { statusCode : 200 } ) ; } return this . _getMeta ( id ) . then ( ( meta ) => { let etagWithoutQuotes ; if ( ( typeof meta === 'object' ) && ( typeof meta . etag === 'string' ) ) { etagWithoutQuotes = removeQuotes ( meta . etag ) ; } if ( options && options . ifMatch && ( options . ifMatch !== etagWithoutQuotes ) ) { return { statusCode : 412 , revision : etagWithoutQuotes } ; } return this . _request ( 'DELETE' , BASE_URL + '/drive/v2/files/' + id , { } ) . then ( ( response ) => { if ( response . status === 200 || response . status === 204 ) { return { statusCode : 200 } ; } else { return Promise . reject ( "Delete failed: " + response . status + " (" + response . responseText + ")" ) ; } } ) ; } ) ; } ) ; }
Delete a file.

@param {string} path - File path
@param {Object} options
@param {string} options.ifMatch - only delete the file if it's ETag
matches this string
@returns {Promise} Resolves with an object containing the status code

@protected
Delete a file .