platina
v1.0.0
Published
An advanced in-memory file system
Downloads
1
Readme
Platina
Platina is an advanced in-memory file system, closely resembling the NodeJS FileSystem API. Platina is ideal for use in your test suites and for applications requiring a virtual file system, such as compilers and asset bundlers.
npm i --save platina
Features
- JSFS-compatible API
- Synchronous and asynchronous operations using promises
- Growing number of NodeJS FileSystem API methods supported
- Efficient writes and reads of unpredictably sized data
- Fully working in a browser environment
API
import Platina from "platina"
const fs = new Platina()
// now do whatever what you'd do with a normal `fs` object
fs.writeFileSync('/test.txt', 'some content ...')
// ...
Refer to the official NodeJS FileSystem docs for the full documentation of the methods you can use. Should you find anything that does not comply with the official docs, please file an issue.
JSFS
Just as fs-extra, Platina fully integrates with JSFS, making it possible to create isolated file systems and more.
import Platina from "platina"
import isolate from "jsfs/isolate"
const fs = new Platina()
fs.mkdirSync('/foo')
newfs = isolate(fs, '/foo')
newfs.writeFileSync('/test.txt', 'foo bar baz') // will write to /foo/test.txt
Contributing
Need help? Found a bug? An inconsistency with the JSFS API, perhaps? Please open a new issue and we'll discuss how we can solve the problem!
License
The MIT License