src/dropbox.js
function (path) {
    const url = 'https://api.dropboxapi.com/2/files/delete';
    const requestBody = { path: getDropboxPath(path) };

    return this._request('POST', url, { body: requestBody }).then((response) => {
      if (response.status !== 200 && response.status !== 409) {
        return Promise.resolve({statusCode: response.status});
      }

      var responseBody = response.responseText;

      try {
        responseBody = JSON.parse(responseBody);
      } catch (e) {
        return Promise.reject(new Error('Invalid response body: ' + responseBody));
      }

      if (response.status === 409) {
        if (compareApiError(responseBody, ['path_lookup', 'not_found'])) {
          return Promise.resolve({statusCode: 404});
        }
        return Promise.reject(new Error('API error: ' + responseBody.error_summary));
      }

      return Promise.resolve({statusCode: 200});
    }).then((result) => {
      if (result.statusCode === 200 || result.statusCode === 404) {
        this._revCache.delete(path);
        delete this._itemRefs[path];
      }
      return Promise.resolve(result);
    }, (error) => {
      error.message = 'Could not delete Dropbox file or folder ("' + path + '"): ' + error.message;
      return Promise.reject(error);
    });
  }
function (path) {
    const url = 'https://api.dropboxapi.com/2/files/delete';
    const requestBody = { path: getDropboxPath(path) };

    return this._request('POST', url, { body: requestBody }).then((response) => {
      if (response.status !== 200 && response.status !== 409) {
        return Promise.resolve({statusCode: response.status});
      }

      var responseBody = response.responseText;

      try {
        responseBody = JSON.parse(responseBody);
      } catch (e) {
        return Promise.reject(new Error('Invalid response body: ' + responseBody));
      }

      if (response.status === 409) {
        if (compareApiError(responseBody, ['path_lookup', 'not_found'])) {
          return Promise.resolve({statusCode: 404});
        }
        return Promise.reject(new Error('API error: ' + responseBody.error_summary));
      }

      return Promise.resolve({statusCode: 200});
    }).then((result) => {
      if (result.statusCode === 200 || result.statusCode === 404) {
        this._revCache.delete(path);
        delete this._itemRefs[path];
      }
      return Promise.resolve(result);
    }, (error) => {
      error.message = 'Could not delete Dropbox file or folder ("' + path + '"): ' + error.message;
      return Promise.reject(error);
    });
  }
Deletes a file or a folder.

@param {string} path - the path to delete

@returns {Promise} A promise for an object with the following structure:
statusCode - HTTP status code

@private