Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@isaacs/fs-minipass

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@isaacs/fs-minipass

fs read and write streams based on minipass

  • 4.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @isaacs/fs-minipass?

@isaacs/fs-minipass is a minimalistic file system streaming library for Node.js. It provides a simplified interface for reading and writing files using streams, making it easier to handle file operations in an efficient and non-blocking manner.

What are @isaacs/fs-minipass's main functionalities?

Reading Files

This feature allows you to read files using a stream. The code sample demonstrates how to create a ReadStream to read the contents of 'example.txt' and log each chunk of data to the console.

const { ReadStream } = require('@isaacs/fs-minipass');
const fs = require('fs');

const readStream = new ReadStream('example.txt');
readStream.on('data', (chunk) => {
  console.log('Read chunk:', chunk.toString());
});
readStream.on('end', () => {
  console.log('Finished reading file');
});

Writing Files

This feature allows you to write data to files using a stream. The code sample demonstrates how to create a WriteStream to write 'Hello, world!' to 'output.txt' and log a message when the writing is finished.

const { WriteStream } = require('@isaacs/fs-minipass');
const fs = require('fs');

const writeStream = new WriteStream('output.txt');
writeStream.write('Hello, world!');
writeStream.end();
writeStream.on('finish', () => {
  console.log('Finished writing to file');
});

Piping Streams

This feature allows you to pipe data from a read stream to a write stream, effectively copying the contents of one file to another. The code sample demonstrates how to read from 'example.txt' and write to 'copy.txt' using streams.

const { ReadStream, WriteStream } = require('@isaacs/fs-minipass');
const fs = require('fs');

const readStream = new ReadStream('example.txt');
const writeStream = new WriteStream('copy.txt');

readStream.pipe(writeStream);
writeStream.on('finish', () => {
  console.log('Finished copying file');
});

Other packages similar to @isaacs/fs-minipass

FAQs

Package last updated on 18 Apr 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc