OptionalcloseObserve close before the token is invalidated.
fileThe token returned by open.
OptionallengthReturn a nonnegative Native file length.
fileOpen token.
Byte length.
OptionalloadOverride whole-file loading; otherwise Native runs open/length/read/close.
pathResource path.
Snapshot bytes or null on failure.
Open a source, returning null when it does not exist.
pathExact Native resource path.
Native-owned bytes, an existing stream, or null.
OptionalreadRead into independent scratch bytes, returning an integer in [0, size].
outputFixed scratch array; do not detach its buffer.
sizeMaximum requested bytes.
fileOpen token.
Exact bytes written.
OptionalseekImplement Native positioning.
fileOpen token.
offsetSigned C long byte offset.
originNative seek origin.
Whether positioning succeeded.
OptionaltellReturn a nonnegative Native byte position.
fileOpen token.
Byte position.
Synchronous file provider methods; omitted methods use Native byte storage.
Remarks
Methods are captured once and keep their original this. Open may return a byte snapshot or an existing memory/custom stream. File streams cannot be returned because they already use this provider. File byte snapshots use stdio seek semantics; custom streams preserve their own seek semantics. Callbacks cannot reenter Native APIs or return Promises. Resource preload obtains custom bytes on the owning thread and decodes images on workers.