memory-fs-stream
v1.1.0
Published
Convert memory-fs to stream
Downloads
821
Readme
memory-fs-stream
Convert memory-fs to Vinyl stream. Extracted from piped-webpack
API
const MemoryFileSystem = require('memory-fs');
const MemoryFSStream = require('memory-fs-stream');
let fs = new MemoryFileSystem();
fs.writeFileSync("/a/test/dir/file.txt", "Hello World");
let stream = new MemoryFSStream(fs);
// now stream will be vinyl stream of files in fs
Options
MemoryFSStream accept a second argument, an option object. Available options are:
- root: Use file only from this subfolder. Default to use all files
- close: Set to false to keep the stream open even after all files have been outputted. Useful when combined with modules that let you swap stream like duplexify
- filter: List of files to include, default to all files. Can be specified as:
- Array of full file path relative to the root (eg.
['path/to/file']
) - Function which will receive full file path. Returning
true
means the file will be included.
- Array of full file path relative to the root (eg.
License
memory-fs-stream is licensed under the MIT License