Class FsDev

Represents a mounted filesystem device, such as the Save Data store for an Application / Profile pair.

Hierarchy

  • FsDev

Properties

Methods

Properties

url: URL

A URL instance that points to the root of the filesystem mount. You should use this to create file path references within the filesystem mount.

Example

const dataUrl = new URL('data.json', device.url);

Methods

  • Commits to the disk any write operations that have occurred on this filesystem mount since the previous commit.

    Failure to call this function after writes will cause the data to be lost after the application exits.

    Returns void

    Example

    const saveStateUrl = new URL('state', device.url);
    Switch.writeFileSync(saveStateUrl, 'my application state...');

    device.commit(); // Write operation is persisted to the disk
  • Unmounts the filesystem mount. Any filesytem operations attempting to use the mount path in the future will throw an error.

    Returns void

    Example

    Switch.readFileSync(device.url); // OK

    device.unmount();

    Switch.readFileSync(device.url); // ERROR THROWN!

Generated using TypeDoc