https://github.com/tomokimiyauci/file-system-access
File System Access, based on WICG spec reference implementation
https://github.com/tomokimiyauci/file-system-access
file-system-access file-system-access-api wicg
Last synced: 17 days ago
JSON representation
File System Access, based on WICG spec reference implementation
- Host: GitHub
- URL: https://github.com/tomokimiyauci/file-system-access
- Owner: TomokiMiyauci
- License: mit
- Created: 2024-07-30T12:57:52.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-09-03T05:27:29.000Z (10 months ago)
- Last Synced: 2025-06-13T02:02:06.772Z (17 days ago)
- Topics: file-system-access, file-system-access-api, wicg
- Language: TypeScript
- Homepage: https://jsr.io/@miyauci/file-system-access
- Size: 230 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# file-system-access
> 🚧 WIP at
> [beta branch](https://github.com/TomokiMiyauci/file-system-access/tree/beta)[File System Access](https://wicg.github.io/file-system-access/) ponyfill for
server side runtime.This allows the native file dialog and the file system handle API to be used on
the server side.Complies with
[WICG, File System Access](https://github.com/WICG/file-system-access) and
[File System Standard](https://github.com/whatwg/fs).## Usage
`FileSystemAccess` binds the
[File System Access API](https://wicg.github.io/file-system-access/). The
constructor requires [adaptor](#adaptors).```ts
import { type Adaptor, FileSystemAccess } from "@miyauci/file-system-access";declare const adaptor: Adaptor;
const { showOpenFilePicker, showDirectoryPicker } = new FileSystemAccess(
adaptor,
);const [handle] = await showOpenFilePicker();
const writable = await handle.createWritable();
await writable.write("hello");
await writable.write("world");
await writable.close();const file = await handle.getFile();
await file.text(); // helloworld;
```### Adaptors
Adaptor is an abstraction that absorbs runtime differences.
#### Deno
Adaptor for deno runtime with asynchronous BLOB.
```ts
import { DenoAdaptor } from "@miyauci/file-system-access/deno";
import { FileSystemAccess } from "@miyauci/file-system-access";const adaptor = new DenoAdaptor();
const { showOpenFilePicker } = new FileSystemAccess(adaptor);
```When using `DenoAdaptor`, the following flags are required.
- `--unstable-ffi`
It also requires the following permission.
- `--allow-ffi`
- `--allow-read`(When read directory or file)
- `--allow-write`(When write file)#### Node
// TODO
#### Bun
// TODO
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md)
## License
[MIT](LICENSE) © 2024 Tomoki Miyauchi