probe-web / @probe-web/artifacts / FileArtifact
Class: FileArtifact
Defined in: index.ts:79
A file picked with the File System Access API; watchable.
Implements
Constructors
Constructor
new FileArtifact(handle): FileArtifact;Defined in: index.ts:85
Wrap a file handle, e.g. one from showOpenFilePicker or a drag-drop.
Parameters
| Parameter | Type | Description |
|---|---|---|
handle | FileHandleLike | The underlying file handle; pass it to rememberHandle to keep it across reloads. |
Returns
FileArtifact
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
handle | readonly | FileHandleLike | The underlying file handle; pass it to rememberHandle to keep it across reloads. | index.ts:85 |
Accessors
name
Get Signature
get name(): string;Defined in: index.ts:87
The file's name.
Returns
string
Stable name for caching/logs (file name or URL).
Implementation of
Methods
hasPermission()
hasPermission(): Promise<boolean>;Defined in: index.ts:90
True when read permission is already granted (no user gesture needed).
Returns
Promise<boolean>
ensurePermission()
ensurePermission(): Promise<boolean>;Defined in: index.ts:96
Re-acquire read permission after a reload (needs a user gesture if not granted).
Returns
Promise<boolean>
bytes()
bytes(): Promise<Uint8Array<ArrayBufferLike>>;Defined in: index.ts:103
Read the file's current contents.
Returns
Promise<Uint8Array<ArrayBufferLike>>
Implementation of
watch()
watch(onChange, opts?): () => void;Defined in: index.ts:109
Watch the file for changes with watchFile; returns a function that stops watching.
Parameters
| Parameter | Type |
|---|---|
onChange | (a) => void |
opts | WatchOptions |
Returns
() => void