function (path) {
    return this._getParentId(path).then((parentId) => {
      return this._request('POST', BASE_URL + '/drive/v2/files', {
        body: JSON.stringify({
          title: metaTitleFromFileName(baseName(path)),
          mimeType: GD_DIR_MIME_TYPE,
          parents: [{
            id: parentId
          }]
        }),
        headers: {
          'Content-Type': 'application/json; charset=UTF-8'
        }
      }).then((response) => {
        const meta = JSON.parse(response.responseText);
        return Promise.resolve(meta.id);
      });
    });
  }
function (path) {
    return this._getParentId(path).then((parentId) => {
      return this._request('POST', BASE_URL + '/drive/v2/files', {
        body: JSON.stringify({
          title: metaTitleFromFileName(baseName(path)),
          mimeType: GD_DIR_MIME_TYPE,
          parents: [{
            id: parentId
          }]
        }),
        headers: {
          'Content-Type': 'application/json; charset=UTF-8'
        }
      }).then((response) => {
        const meta = JSON.parse(response.responseText);
        return Promise.resolve(meta.id);
      });
    });
  }
function ( path ) { return this . _getParentId ( path ) . then ( ( parentId ) => { return this . _request ( 'POST' , BASE_URL + '/drive/v2/files' , { body : JSON . stringify ( { title : metaTitleFromFileName ( baseName ( path ) ) , mimeType : GD_DIR_MIME_TYPE , parents : [ { id : parentId } ] } ) , headers : { 'Content-Type' : 'application/json; charset=UTF-8' } } ) . then ( ( response ) => { const meta = JSON . parse ( response . responseText ) ; return Promise . resolve ( meta . id ) ; } ) ; } ) ; }
Create a directory.

Creates all parent directories as well if any of them didn't exist yet.

@param {string} path - Directory path
@returns {Promise} Resolves with the ID of the new directory

@private
Create a directory .