gfs

graceful-fs-stream

Graceful filesystem streams.

Showing:

Popularity

Downloads/wk

808

GitHub Stars

1

Maintenance

Last Commit

4yrs ago

Contributors

1

Package

Dependencies

0

Size (min+gzip)

0.5KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

graceful-fs-stream

NPM Build Status Dependency Status Gittip


Graceful filesystem streams.

Provides both readable and writable filesystem streams that open files 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.
gfs 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 cases where you want to create streams without accessing the file system yet.

Installation

npm install graceful-fs-stream --production

Usage

var fs = require('graceful-fs-stream');

/** read stream */

var readable = fs.createReadStream(file);
// file is no yet open
readable.once('data', function() {
    // file was just open
});

/** write stream */

var writable = fs.createWriteStream(path);
// file is not yet open
writable.write('hey');
// file was just open

Note that if you try to close a stream directly, it won't crash badly.

Author

twitter/ngryman
Nicolas Gryman

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100