Socket
Socket
Sign inDemoInstall

fs-minipass

Package Overview
Dependencies
3
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    fs-minipass

fs read and write streams based on minipass


Version published
Maintainers
1
Install size
94.9 kB
Created

Readme

Source

fs-minipass

Filesystem streams based on minipass.

4 classes are exported:

  • ReadStream
  • ReadStreamSync
  • WriteStream
  • WriteStreamSync

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.

const fsm = require('fs-minipass')
const readStream = new fsm.ReadStream('file.txt')
const writeStream = new fsm.WriteStream('output.txt')
writeStream.write('some file header or whatever\n')
readStream.pipe(writeStream)

FAQs

Last updated on 11 Sep 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc