Skip to content

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

ts
new FileArtifact(handle): FileArtifact;

Defined in: index.ts:85

Wrap a file handle, e.g. one from showOpenFilePicker or a drag-drop.

Parameters

ParameterTypeDescription
handleFileHandleLikeThe underlying file handle; pass it to rememberHandle to keep it across reloads.

Returns

FileArtifact

Properties

PropertyModifierTypeDescriptionDefined in
handlereadonlyFileHandleLikeThe underlying file handle; pass it to rememberHandle to keep it across reloads.index.ts:85

Accessors

name

Get Signature

ts
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

ArtifactSource.name

Methods

hasPermission()

ts
hasPermission(): Promise<boolean>;

Defined in: index.ts:90

True when read permission is already granted (no user gesture needed).

Returns

Promise<boolean>


ensurePermission()

ts
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()

ts
bytes(): Promise<Uint8Array<ArrayBufferLike>>;

Defined in: index.ts:103

Read the file's current contents.

Returns

Promise<Uint8Array<ArrayBufferLike>>

Implementation of

ArtifactSource.bytes


watch()

ts
watch(onChange, opts?): () => void;

Defined in: index.ts:109

Watch the file for changes with watchFile; returns a function that stops watching.

Parameters

ParameterType
onChange(a) => void
optsWatchOptions

Returns

() => void

Implementation of

ArtifactSource.watch