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

    This represents a FileSystem Structure that can create and open directories/files and persist them in one. This class is using PersistentFileSystemRoot, PersistentFileSystemDirectory and PersistentFileSystemFile Recipes & FileSystemDirectory and FileSystemFile types from IFileSystem interface in order to accomplish this FileSystem structure.

    Implements

    Index

    Constructors

    Properties

    onFilePersisted: OEvent<
        (data: { fileHash: SHA256Hash<BLOB>; fileName: string }) => void,
    > = ...
    onRootUpdate:
        | null
        | ((rootHash: SHA256Hash<PersistentFileSystemDirectory>) => Promise<void>) = null

    Accessors

    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

      • pathName: string

        The file path

      • mode: number

        The desired mode

      Returns Promise<number>

      • Returns 0 for success
    • Overwrites a file if the file already exist in the folder, otherwise, adds the file.

      Parameters

      • directoryPath: string
      • fileHash: SHA256Hash<BLOB>
      • fileName: string
      • fileMode: number = 0o0100666

      Returns Promise<void>

    • 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

        The src path

      • dest: string

        The dest path

      Returns Promise<number>

      • 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

      • pathName: string

      Returns Promise<number>

      • Returns 0 for success