nodestream-filesystem
v0.7.0
Published
Local filesystem adapter for Nodestream
Downloads
32
Maintainers
Readme
nodestream-filesystem
Local filesystem adapter for Nodestream
Identity: filesystem
Description
This adapter provides interface for Nodestream to transfer bytes between your app and the local filesystem storage on which the app runs.
Usage
Installation
npm install --save nodestream-filesystem
Configuration
This adapter has only one confuguration option - root
- a path to a folder where Nodestream should expect to find/write your files to. If you do not provide this option, then Nodestream will try its best to determine that path for you:
- By checking the presence of
require.main
and using it - By using the current working directory
In all these default cases, the target folder will be named .storage. If it does not exist, it will be created on first write.
Even with these defaults, you should always explicitly state where Nodestream should put your files. It's the only way to guarantee that you will not spend hours searching through your project's files trying to figure out where the hell did that file go. 😀
const Nodestream = require('nodestream')
const nodestream = new Nodestream({
adapter: 'filesystem',
config: {
// You MUST provide either an absolute path or nothing at all
// You can use array notation, the parts will be `path.join()`ed for you
root: [__dirname, '.storage']
}
})
License
This software is licensed under the BSD-3-Clause License. See the LICENSE file for more information.