src/googledrive.js
function (path, body, contentType/*, options*/) {
    return this._getParentId(path).then((parentId) => {
      const fileName = baseName(path);
      const metadata = {
        title: metaTitleFromFileName(fileName),
        mimeType: contentType,
        parents: [{
          kind: "drive#fileLink",
          id: parentId
        }]
      };
      return this._request('POST', BASE_URL + '/upload/drive/v2/files?uploadType=resumable', {
        body: JSON.stringify(metadata),
        headers: {
          'Content-Type': 'application/json; charset=UTF-8'
        }
      }).then((response) => {
        return this._request('POST', response.getResponseHeader('Location'), {
          body: contentType.match(/^application\/json/) ? JSON.stringify(body) : body
        });
      });
    });
  }
function (path, body, contentType/*, options*/) {
    return this._getParentId(path).then((parentId) => {
      const fileName = baseName(path);
      const metadata = {
        title: metaTitleFromFileName(fileName),
        mimeType: contentType,
        parents: [{
          kind: "drive#fileLink",
          id: parentId
        }]
      };
      return this._request('POST', BASE_URL + '/upload/drive/v2/files?uploadType=resumable', {
        body: JSON.stringify(metadata),
        headers: {
          'Content-Type': 'application/json; charset=UTF-8'
        }
      }).then((response) => {
        return this._request('POST', response.getResponseHeader('Location'), {
          body: contentType.match(/^application\/json/) ? JSON.stringify(body) : body
        });
      });
    });
  }
Create a new file.

@param {string} path - File path
@param body - File content
@param {string} contentType - File content-type
@returns {Promise} Resolves with the response of the network request

@private