0.0.1 • Published 1 year ago

webcontainer-reactive-fs v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

webcontainer-reactive-fs

NPM version

⚠️ 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