Interface DeviceDriver<TData>

A device driver

interface DeviceDriver<TData = any> {
    isBuffered?: boolean;
    name: string;
    singleton?: boolean;
    close(file: DeviceFile<TData>): void;
    init(ino: number, options: object): DeviceInit<TData>;
    read(
        file: DeviceFile<TData>,
        buffer: ArrayBufferView<ArrayBufferLike>,
        offset?: number,
        length?: number,
        position?: number,
    ): number;
    readD(
        device: Device<TData>,
        buffer: Uint8Array<ArrayBufferLike>,
        offset: number,
        end: number,
    ): void;
    sync(file: DeviceFile<TData>): void;
    write(
        file: DeviceFile<TData>,
        buffer: Uint8Array<ArrayBufferLike>,
        offset: number,
        length: number,
        position?: number,
    ): number;
    writeD(
        device: Device<TData>,
        buffer: Uint8Array<ArrayBufferLike>,
        offset: number,
    ): void;
}

Type Parameters

  • TData = any

Properties

Methods

File operations

Properties

isBuffered?: boolean

Whether the device is buffered (a "block" device) or unbuffered (a "character" device)

false
name: string

The name of the device driver

singleton?: boolean

If true, only a single device can exist per device FS. Note that if this is unset or false, auto-named devices will have a number suffix

Methods

File operations

  • Synchronously read from a device file

    Parameters

    • file: DeviceFile<TData>
    • buffer: ArrayBufferView<ArrayBufferLike>
    • Optionaloffset: number
    • Optionallength: number
    • Optionalposition: number

    Returns number

    [BREAKING] Remove

  • Synchronously read from a device.

    Parameters

    • device: Device<TData>
    • buffer: Uint8Array<ArrayBufferLike>
    • offset: number
    • end: number

    Returns void

    [BREAKING] Rename to read

  • Synchronously write to a device file

    Parameters

    • file: DeviceFile<TData>
    • buffer: Uint8Array<ArrayBufferLike>
    • offset: number
    • length: number
    • Optionalposition: number

    Returns number

    [BREAKING] Remove

  • Synchronously write to a device

    Parameters

    • device: Device<TData>
    • buffer: Uint8Array<ArrayBufferLike>
    • offset: number

    Returns void

    [BREAKING] Rename to write