truncate method
The truncate()
method of the FileSystemWritableFileStream
interface resizes the file associated with the stream to the specified
size in bytes.
If the size specified is larger than the current file size the file is
padded with 0x00
bytes.
The file cursor is also updated when truncate()
is called.
If the offset is smaller than the size, it remains unchanged.
If the offset is larger than size, the offset is set to that size.
This ensures that subsequent writes do not error.
No changes are written to the actual file on disk until the stream has been closed. Changes are typically written to a temporary file instead.
Implementation
external JSPromise<JSAny?> truncate(int size);