npm/fs-minipass

Name: fs-minipass

Owner: npm

Description: fs read and write streams based on minipass

Created: 2017-09-09 20:09:21.0

Updated: 2018-05-18 15:55:29.0

Pushed: 2018-03-25 23:05:08.0

Homepage: null

Size: 60

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

fs-minipass

Filesystem streams based on minipass.

4 classes are exported:

When using ReadStreamSync, all of the data is made available immediately upon consuming the stream. Nothing is buffered in memory when the stream is constructed. If the stream is piped to a writer, then it will synchronously read() and emit data into the writer as fast as the writer can consume it. (That is, it will respect backpressure.) If you call stream.read() then it will read the entire file and return the contents.

When using WriteStreamSync, every write is flushed to the file synchronously. If your writes all come in a single tick, then it'll write it all out in a single tick. It's as synchronous as you are.

The async versions work much like their node builtin counterparts, with the exception of introducing significantly less Stream machinery overhead.

USAGE

It's just streams, you pipe them or read() them or write() to them.

t fsm = require('fs-minipass')
t readStream = new fsm.ReadStream('file.txt')
t writeStream = new fsm.WriteStream('output.txt')
eStream.write('some file header or whatever\n')
Stream.pipe(writeStream)
ReadStream(path, options)

Path string is required, but somewhat irrelevant if an open file descriptor is passed in as an option.

Options:

WriteStream(path, options)

Path string is required, but somewhat irrelevant if an open file descriptor is passed in as an option.

Options:


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.