graceful-fs-stream
Graceful filesystem streams.
Provides both readable and writable filesystem streams that open the file on first read or write.
Because stream producers are not always stream consumers, it can be useful to create a stream without worrying if data has ever been read or written. It lazy opens or creates files. So it ensures a loose coupling between stream creation and file opening or creation. This can be useful in various use case where you can to create streams without accessing the file system yet.
Installation
npm install graceful-fs-stream --production
Usage
var fs = ; /** read stream */ var readable = fs;// file is no yet openreadable; /** write stream */ var writable = fs;// file is not yet openwritable;// file was just open
Note that if you try to close a stream directly, it won't crash badly.
Author
Nicolas Gryman |