webcontainer-reactive-fs
v0.0.1
Published
Reactive fs for WebContainers
Downloads
2
Readme
webcontainer-reactive-fs
⚠️ Experimental. Expect breaking changes. Contributions welcome!
📦 Install
npm i webcontainer-reactive-fs
📖 Usage
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 file
watch(readme, () => console.log(readme.value))
readme.value = 'Testing' // Triggers watch
container.fs.writeFile('./readme.md', '## Goodbye World') // Also triggers watch
License
MIT License © 2022 Jacob Clevenger