nx.js
NamespacesSwitchClasses

FileSystem

Properties

PropertyTypeDescription
urlnull | URLA 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', fileSystem.url);

Methods

mount()

mount(name): URL

Mounts the FileSystem such that filesystem operations may be used.

Parameters

ParameterTypeDescription
namestringThe name of the mount for filesystem paths. By default, a random name is generated. Shouldn't exceed 31 characters, and shouldn't have a trailing colon.

Returns

URL


openBis()

static openBis(id): FileSystem

Opens a file system partition specified by its BisPartitionId.

Parameters

ParameterTypeDescription
idnumberThe BisPartitionId of the partition to open.

Returns

FileSystem

Example

import { BisPartitionId } from '@nx.js/constants';
 
// Open and mount the "User" partition
const fs = Switch.FileSystem.openBis(BisPartitionId.User);
const url = fs.mount();
 
// Read the file entries at the root of the partition
console.log(Switch.readDirSync(url));

On this page