@flowscripter/io-plugin-filesystem

中文文档
2.0.11发布于 2026/11/12MITES Module构建来源已验证近 30 天下载 2120

Local filesystem source/sink plugin for https://github.com/flowscripter/pluggable-io-framework

原始使用文档
文档目录8 节
  1. Key Features
  2. String and Structured Locations
  3. Bundled Bun Module Usage
  4. Development
  5. Documentation
  6. Overview
  7. API
  8. License

io-plugin-filesystem

version build docs license: MIT

Local filesystem source/sink plugin for pluggable-io-framework, loaded via dynamic-plugin-framework

Key Features

  • Implements the IOProviderFactory/IOProvider contract from pluggable-io-framework-api for the local filesystem - both source and sink.
  • Factory for the file protocol with the js payload kind. Locations are file: URLs (file:///foo or file:/foo) or bare paths, validated by filesystemLocationSchema (path, plus an optional filename for a single entry or a glob pattern for matching entries). toProviderInputs joins path and filename with the OS path separator into a LocationTarget.
  • Config: { rootPath?: string } (validated with Zod) - rootPath is optional, defaulting to "". All paths passed to provider methods are resolved and sandboxed against rootPath - a path that would escape it is rejected. rootPath: "" (or omitted) is an explicit sentinel for "no restriction" (full filesystem access), since POSIX "/" isn't a meaningful "everything" root on Windows (multiple drive letters, no single filesystem root). Locations parsed from strings always use the unrestricted config.
  • list (recursive, regex-filterable), getProperties (size/lastModified/isContainer plus a mode extension property), setProperties (lastModified plus a mode property validated by filesystemSettablePropertySchema), delete, createContainer and joinKey.
  • Readable handles implement RangeReadable (readRange(start, end) with an exclusive end). Writable handles implement ResumableWritable: resuming appends from the file's current size, reported as startOffset.
  • Multipart writes (concurrent byte-range parts written directly to file offsets via a single shared file handle) at a caller-supplied part size - getPartSizeConstraints reports unconstrained bounds with an 8MB default, since the local filesystem imposes no real part-size limits.
  • canDirectTransfer/directCopy/directMove: two FilesystemIOProvider instances with the same rootPath copy/move directly (cp/rename, with an EXDEV cross-device fallback to recursive copy+delete) instead of streaming. supportsRecursiveDirectTransfer is true - a directory sourcePath is copied/moved recursively in one directCopy/directMove call, preserving empty subdirectories.
  • Bundled (bun build --target bun) as a single-file plugin, loaded by dynamic-plugin-framework via import() - proven end to end in this repo's tests via a real LocalFolderPluginRepository, not just type-checking.
  • Discoverable via NpmPluginRepository (the mechanism behind dynamic-cli-framework's plugin add/plugin list commands): the package.json pluggable-io-framework field declares this package's extension points, so once installed into a CLI's local plugin store it is found without the consuming CLI needing a direct npm dependency on it - also proven end to end in this repo's tests, not just type-checking.

String and Structured Locations

A file location can be given in two forms:

  • A string: a file: URL (file:///foo or file:/foo, no host) or a bare path. parseLocationString returns only { path }, so a string always addresses the whole path as a container target. Strings are the convenient form for code holding a path or URL, and the form other providers use when they resolve a file location.
  • A structured location object, { path, filename?, pattern? }, validated by filesystemLocationSchema directly. It is needed to address a single file (filename, an entry target) or the files matching a glob (pattern, a pattern target), which a string cannot express.

Bundled Bun Module Usage

Loaded as a dynamic-plugin-framework plugin - see that project's docs for how a host application discovers and instantiates plugins. Direct usage of the bundle, where registry is a pluggable-io-framework ProviderRegistry (or any ProviderResolver):

import filesystemPlugin, {
  filesystemIOProviderFactory,
} from "https://unpkg.com/@flowscripter/io-plugin-filesystem/dist/bundle.js";

const provider = await filesystemIOProviderFactory.createProvider(
  { rootPath: "/data" },
  { resolver: registry },
);

Development

Install dependencies:

bun install

Test:

bun test

Bundle for usage as a dynamic-plugin-framework plugin:

bun run build

Format:

bunx oxfmt

Lint:

bunx oxlint index.ts src/ tests/

Generate HTML API Documentation:

bunx typedoc index.ts

Documentation

Overview

Refer to pluggable-io-framework-api and pluggable-io-framework for the contract and orchestration this plugin implements.

API

Link to auto-generated API docs:

API Documentation

License

MIT © Flowscripter

版本与发布记录

@flowscripter/io-plugin-filesystem 共发布 29 个版本,首次发布于 2026/08/16;过去 12 个月发布了 29 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.0.11latest2026/11/123 天前
2.0.102026/11/0510 天前
2.0.92026/10/2917 天前
2.0.82026/10/2620 天前
2.0.72026/10/2224 天前
2.0.62026/10/1927 天前

关于 @flowscripter/io-plugin-filesystem 的常见问题

@flowscripter/io-plugin-filesystem 是什么?

Local filesystem source/sink plugin for https://github.com/flowscripter/pluggable-io-framework

如何安装 @flowscripter/io-plugin-filesystem?

在项目目录运行 npm install @flowscripter/io-plugin-filesystem,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:typescript(^7.0.2)、@flowscripter/dynamic-plugin-framework(*)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@flowscripter/io-plugin-filesystem 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/flowscripter__io-plugin-filesystem 是否存在。

@flowscripter/io-plugin-filesystem 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@flowscripter/io-plugin-filesystem 可以商用吗?

@flowscripter/io-plugin-filesystem 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@flowscripter/io-plugin-filesystem 的下载量有多少?

根据 npm 官方下载统计,@flowscripter/io-plugin-filesystem 在 2026/10/15 – 2026/11/13 这 30 天内被下载 2,120 次,日均约 71 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@flowscripter/io-plugin-filesystem 还在维护吗?

最新版本 2.0.11 发布于 2026/11/12(3 天前);至今共发布 29 个版本,其中过去 12 个月发布了 29 个;首次发布于 2026/08/16。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。