function (path) {
    let id;

    if (path === '/') {
      // "root" is a special alias for the fileId of the root folder
      return Promise.resolve('root');
    } else if ((id = this._fileIdCache.get(path))) {
      // id is cached.
      return Promise.resolve(id);
    }
    // id is not cached (or file doesn't exist).
    // load parent folder listing to propagate / update id cache.
    return this._getFolder(parentPath(path)).then(() => {
      id = this._fileIdCache.get(path);
      if (!id) {
        if (path.substr(-1) === '/') {
          return this._createFolder(path).then(() => {
            return this._getFileId(path);
          });
        } else {
          return Promise.resolve();
        }
      }
      return Promise.resolve(id);
    });
  }
function (path) {
    let id;

    if (path === '/') {
      
      return Promise.resolve('root');
    } else if ((id = this._fileIdCache.get(path))) {
      
      return Promise.resolve(id);
    }
    
    
    return this._getFolder(parentPath(path)).then(() => {
      id = this._fileIdCache.get(path);
      if (!id) {
        if (path.substr(-1) === '/') {
          return this._createFolder(path).then(() => {
            return this._getFileId(path);
          });
        } else {
          return Promise.resolve();
        }
      }
      return Promise.resolve(id);
    });
  }
function ( path ) { let id ; if ( path === '/' ) { // "root" is a special alias for the fileId of the root folder return Promise . resolve ( 'root' ) ; } else if ( ( id = this . _fileIdCache . get ( path ) ) ) { // id is cached. return Promise . resolve ( id ) ; } // id is not cached (or file doesn't exist). // load parent folder listing to propagate / update id cache. return this . _getFolder ( parentPath ( path ) ) . then ( ( ) => { id = this . _fileIdCache . get ( path ) ; if ( ! id ) { if ( path . substr ( - 1 ) === '/' ) { return this . _createFolder ( path ) . then ( ( ) => { return this . _getFileId ( path ) ; } ) ; } else { return Promise . resolve ( ) ; } } return Promise . resolve ( id ) ; } ) ; }
Get the ID of a file.

@param {string} path - File path
@returns {Promise} Resolves with the ID

@private
Get the ID of a file .