src/googledrive.js
function (id, path, body, contentType, options) {
    const metadata = {
      mimeType: contentType
    };
    const headers = {
      'Content-Type': 'application/json; charset=UTF-8'
    };

    if (options && options.ifMatch) {
      headers['If-Match'] = '"' + options.ifMatch + '"';
    }

    return this._request('PUT', BASE_URL + '/upload/drive/v2/files/' + id + '?uploadType=resumable', {
      body: JSON.stringify(metadata),
      headers: headers
    }).then((response) => {
      if (response.status === 412) {
        return (response);
      } else {
        return this._request('PUT', response.getResponseHeader('Location'), {
          body: contentType.match(/^application\/json/) ? JSON.stringify(body) : body
        });
      }
    });
  }
function (id, path, body, contentType, options) {
    const metadata = {
      mimeType: contentType
    };
    const headers = {
      'Content-Type': 'application/json; charset=UTF-8'
    };

    if (options && options.ifMatch) {
      headers['If-Match'] = '"' + options.ifMatch + '"';
    }

    return this._request('PUT', BASE_URL + '/upload/drive/v2/files/' + id + '?uploadType=resumable', {
      body: JSON.stringify(metadata),
      headers: headers
    }).then((response) => {
      if (response.status === 412) {
        return (response);
      } else {
        return this._request('PUT', response.getResponseHeader('Location'), {
          body: contentType.match(/^application\/json/) ? JSON.stringify(body) : body
        });
      }
    });
  }
function ( id , path , body , contentType , options ) { const metadata = { mimeType : contentType } ; const headers = { 'Content-Type' : 'application/json; charset=UTF-8' } ; if ( options && options . ifMatch ) { headers [ 'If-Match' ] = '"' + options . ifMatch + '"' ; } return this . _request ( 'PUT' , BASE_URL + '/upload/drive/v2/files/' + id + '?uploadType=resumable' , { body : JSON . stringify ( metadata ) , headers : headers } ) . then ( ( response ) => { if ( response . status === 412 ) { return ( response ) ; } else { return this . _request ( 'PUT' , response . getResponseHeader ( 'Location' ) , { body : contentType . match ( / ^application\/json / ) ? JSON . stringify ( body ) : body } ) ; } } ) ; }
Update an existing file.

@param {string} id - File ID
@param {string} path - File path
@param body - File content
@param {string} contentType - File content-type
@param {Object} options
@param {string} options.ifMatch - Only update the file if its ETag
matches this string
@returns {Promise} Resolves with the response of the network request

@private
Update an existing file .