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
Parameter | Type |
---|---|
path | PathLike |
opts ? | FsFileOptions |
Returns
Overrides
Properties
Property | Type | Inherited from |
---|---|---|
lastModified | number | File .lastModified |
name | string | File .name |
webkitRelativePath | string | File .webkitRelativePath |
Accessors
size
get
size(): number
Returns the size of the Blob object, in bytes.
Returns
number
Overrides
type
get
type(): string
Returns the MIME type of the Blob object.
Returns
string
Inherited from
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
Overrides
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
Parameter | Type | Default value | Description |
---|---|---|---|
start | number | 0 | The start byte index. |
end | number | ... | The end byte index. |
type | string | '' | The content type of the new Blob. |
Returns
Inherited from
stat()
Returns
stream()
stream(opts
?): ReadableStream
<Uint8Array
>
Returns a stream that can be used to read the contents of the Blob.
Parameters
Parameter | Type |
---|---|
opts ? | FsFileStreamOptions |
Returns
Overrides
text()
text(): Promise
<string
>
Returns a promise that resolves with a string representation of the Blob object.
Returns
Promise
<string
>