@refinio/one.models
    Preparing search index...

    This is a convenience implementation for readonly file systems with small files.

    Write support might be added later.

    In order to use it you only have to specify the directory structure as a hierarchy of maps, like

        super();
        this.setRootDirectory(
            new Map<string, EasyDirectoryEntry>([
                ['chats.json', {type: 'regularFile', content: this.loadTopics.bind(this)}],
                ['channels.json', {type: 'regularFile', content: this.loadChannels.bind(this)}],
                ['chats', {type: 'directory', content: new Map()}]
            ])
        );
    

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Methods

    • Change the permissions.

      Can throw:

      • FS_ERRORS.FSE-ENOENT when the parent dir does not exist or the given mode is not a file type
      • FS_ERRORS.FSE-EACCES-W if the parent directory does not have write permission

      Parameters

      • path: string
      • _mode: number

      Returns Promise<number>

      • Returns 0 for success
    • Creates a directory.

      Can throw:

      • FS_ERRORS.FSE-ENOENT when the parent dir does not exist or the given mode is not a dir type
      • FS_ERRORS.FSE-EXISTS when the current path already exists
      • FS_ERRORS.FSE-EACCES-W if the parent directory does not have write permission

      Parameters

      • directoryPath: string

        The wanted dir path

      • _dirMode: number

      Returns Promise<void>

    • Creates a file otherwise

      Can throw:

      • FS_ERRORS.FSE-ENOENT when the parent dir does not exist or the given mode is not a file type
      • FS_ERRORS.FSE-EXISTS when the current path already exists
      • FS_ERRORS.FSE-EACCES-W if the parent directory does not have write permission

      Parameters

      • directoryPath: string

        The directory where the file will be saved

      • _fileHash: SHA256Hash<BLOB>
      • _fileName: string
      • _fileMode: number

      Returns Promise<void>

    • Reads a file in chunks by a given len and position.

      Can throw:

      • FS_ERRORS.FSE-CHUNK-R if the platform does not support chunked reading. This is supported only on Node. This happen if the check for Platform is not nodejs.
      • FS_ERRORS.FSE-ENOENT if the file does not exist
      • FS_ERRORS.FSE-EACCES-R if the file does not have read permission

      Parameters

      • path: string
      • length: number
      • position: number

      Returns Promise<FileSystemFile>

      • The content of the file
    • Rename file.

      Can throw:

      • FS_ERRORS.FSE-ENOENT when the parent dir does not exist or the given mode is not a file type
      • FS_ERRORS.FSE-EACCES-W if the parent directory does not have write permission

      Parameters

      • _src: string
      • dest: string

        The dest path

      Returns Promise<number>

      • Returns 0 for success
    • Deletes a directory

      Can throw:

      • FS_ERRORS.FSE-ENOENT if the dir does not exist
      • FS_ERRORS.FSE-EACCES-W if the dir does not have write permission

      Parameters

      • path: string

      Returns Promise<number>

      Returns 0 for success

    • Creates a symlink.

      Can throw:

      • FS_ERRORS.FSE-ENOENT when the parent dir does not exist or the given mode is not a file type
      • FS_ERRORS.FSE-EXISTS when the current path already exists
      • FS_ERRORS.FSE-EACCES-W if the parent directory does not have write permission

      Parameters

      • src: string

        The src path

      • _dest: string

      Returns Promise<void>

      • Returns 0 for success
    • Deletes a file or a symlink.

      Can throw:

      • FS_ERRORS.FSE-ENOENT if the file does not exist
      • FS_ERRORS.FSE-EACCES-W if the file does not have write permission

      Parameters

      • path: string

      Returns Promise<number>

      • Returns 0 for success