Class DeviceFS

A temporary file system that manages and interfaces with devices

Hierarchy (View Summary)

Constructors

Properties

_initialized: boolean = false
_mountPoint?: string

The last place this file system was mounted

attributes: ConstMap<FileSystemAttributes, keyof FileSystemAttributes, void> & Map<
    string,
    any,
> = ...

FileSystemAttributes

devices: Map<string, Device<any>> = ...
id: number

A unique ID for this kind of file system. Currently unused internally, but could be used for partition tables or something

label?: string
name: string

The name for this file system. For example, tmpfs for an in memory one

Methods

  • Commits a new file (well, a FILE or a DIRECTORY) to the file system with mode. Note: This will commit the transaction.

    Parameters

    • path: string

      The path to the new file.

    • options: PureCreationOptions

      The options to create the new file with.

    • data: Uint8Array

      The data to store at the file's data node.

    • syscall: string

    Returns Promise<Inode>

  • Commits a new file (well, a FILE or a DIRECTORY) to the file system with mode. Note: This will commit the transaction.

    Parameters

    • path: string

      The path to the new file.

    • options: PureCreationOptions

      The options to create the new file with.

    • data: Uint8Array

      The data to store at the file's data node.

    • syscall: string

    Returns Inode

    The Inode for the new file.

  • Finds the Inode of path.

    Parameters

    • tx: WrappedTransaction
    • path: string

      The path to look up.

    • syscall: string

    Returns Promise<Inode>

    memoize/cache

  • Finds the Inode of path.

    Parameters

    • tx: WrappedTransaction
    • path: string

      The path to look up.

    • syscall: string

    Returns Inode

    The Inode of the path p.

    memoize/cache

  • Opens the file at path with flag. The file must exist.

    Parameters

    • path: string

      The path to open.

    • flag: string

      The flag to use when opening the file.

    Returns File

  • Reads into a buffer

    Parameters

    • path: string
    • buffer: Uint8Array

      The buffer to read into. You must set the byteOffset and byteLength appropriately!

    • offset: number

      The offset into the file to start reading from

    • end: number

      The position in the file to stop reading

    Returns Promise<void>

  • Reads into a buffer

    Parameters

    • path: string
    • buffer: Uint8Array

      The buffer to read into. You must set the byteOffset and byteLength appropriately!

    • offset: number

      The offset into the file to start reading from

    • end: number

      The position in the file to stop reading

    Returns void

  • Remove all traces of path from the file system.

    Parameters

    • path: string

      The path to remove from the file system.

    • isDir: boolean

      Does the path belong to a directory, or a file?

    Returns Promise<void>

    Update mtime.

  • Remove all traces of path from the file system.

    Parameters

    • path: string

      The path to remove from the file system.

    • isDir: boolean

      Does the path belong to a directory, or a file?

    Returns void

    Update mtime.

  • Parameters

    • oldPath: string
    • newPath: string

    Returns Promise<void>

    Make rename compatible with the cache.

  • Updated the inode and data node at path

    Parameters

    • path: string
    • data: Uint8Array
    • stats: Readonly<Stats>

    Returns Promise<void>

    Ensure mtime updates properly, and use that to determine if a data update is required.

  • Updated the inode and data node at path

    Parameters

    • path: string
    • data: Uint8Array
    • stats: Readonly<Stats>

    Returns void

    Ensure mtime updates properly, and use that to determine if a data update is required.

  • Writes a buffer to a file

    Parameters

    • path: string
    • data: Uint8Array
    • offset: number

      The offset in the file to start writing

    Returns Promise<void>

  • Writes a buffer to a file

    Parameters

    • path: string
    • data: Uint8Array
    • offset: number

      The offset in the file to start writing

    Returns void