@flowscripter/io-plugin-filesystem-native
v1.0.7
Published
Native (Rust) local filesystem source/sink plugin for https://github.com/flowscripter/pluggable-io-framework
Downloads
1,290
Maintainers
Readme
io-plugin-filesystem-native
Native (Rust) local filesystem source/sink plugin for pluggable-io-framework, loaded via dynamic-plugin-framework
Key Features
- A second
fileprovider factory with thenativepayload kind and thehostmemory domain. It coexists with io-plugin-filesystem (filewith thejskind): both use the samefile:///...locations and the caller picks the implementation by payload kind. - Reads and writes run on Rust threads. Each reader or writer handle owns one I/O thread feeding or draining a bounded ring of buffers, and the JS side only calls non-blocking entry points, so the event loop is never blocked.
- Items carry
NativePayloadbuffers allocated by Rust. They reach a native sink without being copied into the JS heap. - Readable handles are
RangeReadableandFillReadable; writable handles areBufferProviderandResumableWritable, so a native to native copy takes the engine's lease path and the reader fills the writer's buffers directly. - Registers two zero-cost payload converters,
native[host]tojsandjstonative[host], so the registry can bridge this plugin to anyjsprovider when no common kind exists. - Locations,
getPropertiesandjoinKeybehave exactly as in io-plugin-filesystem. There is no listing, deleting,setProperties, container creation, multipart or direct transfer, so container and pattern targets are not supported. - The reference template for native providers: the ring, waker and handle model is generic and independent of the filesystem.
Usage
Install the plugin where a
pluggable-io-framework
host discovers plugins. With both filesystem plugins installed, the payload
kind selects the implementation (registry is a discovered
ProviderRegistry):
const { source, dest, options } = await registry.createProvidersForTransfer(
{ protocol: "file", location: { path: "/data", filename: "in.bin" } },
{ protocol: "file", location: { path: "/data", filename: "out.bin" } },
{ kind: PayloadKind.Native },
);
await copy(source.provider, source.target, dest.provider, dest.target, options);Further Details
License
MIT © Flowscripter
