Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wheatjs/webcontainer-reactive-fs
Reactive fs for WebContainers
https://github.com/wheatjs/webcontainer-reactive-fs
Last synced: 4 days ago
JSON representation
Reactive fs for WebContainers
- Host: GitHub
- URL: https://github.com/wheatjs/webcontainer-reactive-fs
- Owner: wheatjs
- License: mit
- Created: 2023-03-14T02:19:24.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-03-14T02:19:35.000Z (over 1 year ago)
- Last Synced: 2024-11-02T01:42:28.442Z (11 days ago)
- Language: TypeScript
- Size: 67.4 KB
- Stars: 31
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# webcontainer-reactive-fs
[![NPM version](https://img.shields.io/npm/v/webcontainer-reactive-fs?color=a1b858&label=)](https://www.npmjs.com/package/webcontainer-reactive-fs)
> ⚠️ Experimental. Expect breaking changes. Contributions welcome!
## 📦 Install
```bash
npm i webcontainer-reactive-fs
```## 📖 Usage
```ts
import { WebContainer } from '@webcontainer/api'
import { createReactiveFs } from 'webcontainer-reactive-fs'const container = await WebContainer.boot()
const fs = createReactiveFs(container)const readme = fs.useFile('./readme.md')
readme.value = '# Hello World' // Write to file
readme.value += '\n This is some text' // Append to filewatch(readme, () => console.log(readme.value))
readme.value = 'Testing' // Triggers watch
container.fs.writeFile('./readme.md', '## Goodbye World') // Also triggers watch
```## License
[MIT](./LICENSE) License © 2022 [Jacob Clevenger](https://github.com/jacobclevenger)