nx.js
NamespacesSwitchClasses

FsFile

The Switch.FsFile class is a special implementation of the global File class, which interacts with the system's physical file system.

It offers a convenient API for working with existing files, and also for writing files.

Extends

Constructors

new FsFile()

new FsFile(path, opts?): FsFile

Parameters

ParameterType
pathPathLike
opts?FsFileOptions

Returns

FsFile

Overrides

File.constructor

Properties

PropertyTypeDescriptionInherited from
lastModifiednumberMDN ReferenceFile.lastModified
namestringMDN ReferenceFile.name
webkitRelativePathstringMDN ReferenceFile.webkitRelativePath

Accessors

size

get size(): number

Returns the size of the Blob object, in bytes.

Returns

number

Overrides

File.size


type

get type(): string

Returns the MIME type of the Blob object.

Returns

string

Inherited from

File.type


writable

get writable(): WritableStream<string | BufferSource>

Returns

WritableStream<string | BufferSource>

Methods

arrayBuffer()

arrayBuffer(): Promise<ArrayBuffer>

Returns a promise that resolves with an ArrayBuffer representing the Blob's data.

Returns

Promise<ArrayBuffer>

Overrides

File.arrayBuffer


json()

json(): Promise<any>

Returns

Promise<any>


slice()

slice(start, end, type): Blob

Returns a new Blob object containing the data in the specified range of bytes of the source Blob.

Parameters

ParameterTypeDefault valueDescription
startnumber0The start byte index.
endnumber...The end byte index.
typestring''The content type of the new Blob.

Returns

Blob

Inherited from

File.slice


stat()

stat(): Promise<null | Stats>

Returns

Promise<null | Stats>


stream()

stream(opts?): ReadableStream<Uint8Array>

Returns a stream that can be used to read the contents of the Blob.

Parameters

ParameterType
opts?FsFileStreamOptions

Returns

ReadableStream<Uint8Array>

Overrides

File.stream


text()

text(): Promise<string>

Returns a promise that resolves with a string representation of the Blob object.

Returns

Promise<string>

Overrides

File.text

On this page