Class: FileSyncAccessHandle
Documentation / @wtf/platform-fs / sync-access / FileSyncAccessHandle
Defined in: packages/platform-fs/src/sync-access.ts:70
The standard’s sync access handle, over the file an adapter opened, or opens: given a function,
at the handle’s first call but close(), so a handle that is never used holds nothing. It reads
and writes at at, or at its cursor, where the call before ended; reads to the end of the file
at most, and of nothing past it; and writes past the end, the file grown with zeros. truncate
moves the cursor back to the new end where it was past it. After close(), each call but
close() fails an InvalidStateError.
Implements
Constructors
Constructor
new FileSyncAccessHandle(file): FileSyncAccessHandle;Defined in: packages/platform-fs/src/sync-access.ts:76
Parameters
| Parameter | Type |
|---|---|
file | | SyncAccessFile | (() => SyncAccessFile) |
Returns
FileSyncAccessHandle
Methods
close()
close(): void;Defined in: packages/platform-fs/src/sync-access.ts:132
Lets the file go.
Returns
void
Implementation of
FileSystemSyncAccessHandle.closeflush()
flush(): void;Defined in: packages/platform-fs/src/sync-access.ts:128
Writes through to where the file is kept.
Returns
void
Implementation of
FileSystemSyncAccessHandle.flushgetSize()
getSize(): number;Defined in: packages/platform-fs/src/sync-access.ts:124
How many bytes the file holds.
Returns
number
Implementation of
FileSystemSyncAccessHandle.getSizeread()
read(buffer, options?): number;Defined in: packages/platform-fs/src/sync-access.ts:95
Reads into buffer, from at or the cursor, to the end of the file at most: how many bytes.
Parameters
| Parameter | Type |
|---|---|
buffer | ArrayBufferLike | ArrayBufferView<ArrayBufferLike> |
options? | FileSystemReadWriteOptions |
Returns
number
Implementation of
FileSystemSyncAccessHandle.readtruncate()
truncate(newSize): void;Defined in: packages/platform-fs/src/sync-access.ts:118
Cuts the file to newSize bytes, or grows it with zeros; the cursor moves back to the end.
Parameters
| Parameter | Type |
|---|---|
newSize | number |
Returns
void
Implementation of
FileSystemSyncAccessHandle.truncatewrite()
write(buffer, options?): number;Defined in: packages/platform-fs/src/sync-access.ts:107
Writes buffer, at at or the cursor: how many bytes.
Parameters
| Parameter | Type |
|---|---|
buffer | ArrayBufferLike | ArrayBufferView<ArrayBufferLike> |
options? | FileSystemReadWriteOptions |
Returns
number
Implementation of
FileSystemSyncAccessHandle.write