Class: FileWritableStream
Documentation / @wtf/platform-fs / writable / FileWritableStream
Defined in: packages/platform-fs/src/writable.ts:90
The writable of a file, a WritableStream of the standard’s chunks, over sink: each written
where it is, or where a write says, and the file grown with zeros to a write past its end; a
seek moves where it writes, and a truncate cuts or grows the file, and moves where it writes
back to its end where that is past it. size is what the file holds as it opens, as of
keepExistingData. A write as an object of no data, position or size its type needs is a
SyntaxError, a DOMException, and data of null, or a number that is no whole one from 0, a
TypeError. A chunk that fails aborts the sink, and errors the writable: the file is as it was. Its close() puts what was written in the file’s place; its abort() leaves it.
Extends
WritableStream<FileSystemWriteChunk>
Implements
Constructors
Constructor
new FileWritableStream(sink, size?): FileWritableStream;Defined in: packages/platform-fs/src/writable.ts:94
Parameters
| Parameter | Type | Default value |
|---|---|---|
sink | WritableSink | undefined |
size | number | 0 |
Returns
FileWritableStream
Overrides
WritableStream<FileSystemWriteChunk>.constructorProperties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
locked | readonly | boolean | The locked read-only property of the WritableStream interface returns a boolean indicating whether the WritableStream is locked to a writer. MDN Reference | FileSystemWritableFileStream.locked WritableStream.locked | - |
Methods
abort()
abort(reason?): Promise<void>;Defined in: typescript
The abort() method of the WritableStream interface aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.
Parameters
| Parameter | Type |
|---|---|
reason? | any |
Returns
Promise<void>
Implementation of
FileSystemWritableFileStream.abortInherited from
WritableStream.abortclose()
close(): Promise<void>;Defined in: typescript
The close() method of the WritableStream interface closes the associated stream. All chunks written before this method is called are sent before the returned promise is fulfilled.
Returns
Promise<void>
Implementation of
FileSystemWritableFileStream.closeInherited from
WritableStream.closegetWriter()
getWriter(): WritableStreamDefaultWriter<FileSystemWriteChunk>;Defined in: typescript
The getWriter() method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance. While the stream is locked, no other writer can be acquired until this one is released.
Returns
WritableStreamDefaultWriter<FileSystemWriteChunk>
Implementation of
FileSystemWritableFileStream.getWriterInherited from
WritableStream.getWriterseek()
seek(position): Promise<void>;Defined in: packages/platform-fs/src/writable.ts:169
Where it writes next, in bytes from the start.
Parameters
| Parameter | Type |
|---|---|
position | number |
Returns
Promise<void>
Implementation of
FileSystemWritableFileStream.seektruncate()
truncate(size): Promise<void>;Defined in: packages/platform-fs/src/writable.ts:174
Cuts the file to size, or grows it with zeros.
Parameters
| Parameter | Type |
|---|---|
size | number |
Returns
Promise<void>
Implementation of
FileSystemWritableFileStream.truncatewrite()
write(data): Promise<void>;Defined in: packages/platform-fs/src/writable.ts:161
Writes data, as a chunk of the stream: where it is, or as a write as an object says. The
writable is not locked while it writes, so a write after it is queued after it.
Parameters
| Parameter | Type |
|---|---|
data | FileSystemWriteChunk |
Returns
Promise<void>
Implementation of
FileSystemWritableFileStream.write