filesysteminfile
The filesysteminfile allows you to create and update filesystems for use as storage devices.
filesysteminfile IDL
interface FileSystemInFile {
constructor(String path);
Promise<String> getFilename();
Promise<long long> getSize();
Promise<void> format(String fileSystem);
Promise<void> mount();
Promise<void> unmount();
};
ON THIS PAGE
Object Creation
To create a filesysteminfile object, load the @brightsign/filesysteminfile module using the Node.js® require() method:
var FileSystemInFile = require('@brightsign/filesysteminfile');
var fsif = new FileSystemInFile("/storage/sd/usbstore.img"); // Node's native 'fs' can create an .img file
filesysteminfile
Use this interface to configure a filesysteminfile.
getFilename()
Promise<String> getFilename()
Gets the name of the file that was used to create FileSystemInFile.
getSize()
Retrieves the size (in bytes) of the filesystem file used to create the FileSystemInFile class.
format()
Creates the specified filesystem in a file that already exists. The supported filesystem types are "fat" and "exfat".
mount()
Mounts the filesystem. There is no need to format the filesystem if it already exists and is formatted.
The return string is filepath and the return value is the path to where the filesystem has been mounted. It cannot be mounted more than once.
unmount()
Unmounts the filesystem.
Example
The example below creates a file system, formats, mounts, and unmounts it using the npm package fs,
You can also reference our public github example which uses a BrightSign device as a filesystem over USB.