All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.dirigible.dev-tools.persistence.PlatformFileSystem.js Maven / Gradle / Ivy

There is a newer version: 10.6.27
Show newest version
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import * as Common from '../common/common.js';  // eslint-disable-line no-unused-vars
import * as TextUtils from '../text_utils/text_utils.js';  // eslint-disable-line no-unused-vars

export class PlatformFileSystem {
  /**
   * @param {string} path
   * @param {string} type
   */
  constructor(path, type) {
    this._path = path;
    this._type = type;
  }

  /**
   * @param {string} path
   * @return {!Promise}
   */
  getMetadata(path) {
    return Promise.resolve(/** @type ?{modificationTime: !Date, size: number} */ (null));
  }

  /**
   * @return {!Array}
   */
  initialFilePaths() {
    return [];
  }

  /**
   * @return {!Array}
   */
  initialGitFolders() {
    return [];
  }

  /**
   * @return {string}
   */
  path() {
    return this._path;
  }

  /**
   * @return {string}
   */
  embedderPath() {
    throw new Error('Not implemented');
  }

  /**
   * @return {string}
   */
  type() {
    // TODO(kozyatinskiy): remove type, overrides should implement this interface.
    return this._type;
  }

  /**
   * @param {string} path
   * @param {?string} name
   * @return {!Promise}
   */
  async createFile(path, name) {
    return Promise.resolve(null);
  }

  /**
   * @param {string} path
   * @return {!Promise}
   */
  deleteFile(path) {
    return Promise.resolve(false);
  }

  /**
   * @param {string} path
   * @return {!Promise}
   */
  requestFileBlob(path) {
    return Promise.resolve(/** @type {?Blob} */ (null));
  }

  /**
   * @param {string} path
   * @returns {!Promise}
   */
  async requestFileContent(path) {
    return {error: ls`Unable to read files with this implementation.`, isEncoded: false};
  }

  /**
   * @param {string} path
   * @param {string} content
   * @param {boolean} isBase64
   */
  setFileContent(path, content, isBase64) {
    throw new Error('Not implemented');
  }

  /**
   * @param {string} path
   * @param {string} newName
   * @param {function(boolean, string=)} callback
   */
  renameFile(path, newName, callback) {
    callback(false);
  }

  /**
   * @param {string} path
   */
  addExcludedFolder(path) {
  }

  /**
   * @param {string} path
   */
  removeExcludedFolder(path) {
  }

  fileSystemRemoved() {
  }

  /**
   * @param {string} folderPath
   * @return {boolean}
   */
  isFileExcluded(folderPath) {
    return false;
  }

  /**
   * @return {!Set}
   */
  excludedFolders() {
    return new Set();
  }

  /**
   * @param {string} query
   * @param {!Common.Progress.Progress} progress
   * @return {!Promise>}
   */
  searchInPath(query, progress) {
    return Promise.resolve([]);
  }

  /**
   * @param {!Common.Progress.Progress} progress
   */
  indexContent(progress) {
    setImmediate(() => progress.done());
  }

  /**
   * @param {string} path
   * @return {string}
   */
  mimeFromPath(path) {
    throw new Error('Not implemented');
  }

  /**
   * @param {string} path
   * @return {boolean}
   */
  canExcludeFolder(path) {
    return false;
  }

  /**
   * @param {string} path
   * @return {!Common.ResourceType.ResourceType}
   */
  contentType(path) {
    throw new Error('Not implemented');
  }

  /**
   * @param {string} url
   * @return {string}
   */
  tooltipForURL(url) {
    throw new Error('Not implemented');
  }

  /**
   * @return {boolean}
   */
  supportsAutomapping() {
    throw new Error('Not implemented');
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy