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

fd-slicer

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fd-slicer

safely create multiple ReadStream or WriteStream objects from the same file descriptor

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16M
decreased by-0.26%
Maintainers
2
Weekly downloads
 
Created

What is fd-slicer?

The fd-slicer npm package provides tools for creating slicer streams that allow you to read slices of a file without having to load the entire file into memory. This is particularly useful for handling large files or for applications that need to process or transmit parts of files efficiently.

What are fd-slicer's main functionalities?

Creating a slice stream from a file descriptor

This code demonstrates how to open a file, create a slicer from its file descriptor, and then create a readable stream that reads a specific part of the file (from byte 100 to 200).

const fs = require('fs');
const fdSlicer = require('fd-slicer');

fs.open('path/to/file', 'r', (err, fd) => {
  if (err) throw err;
  var slicer = fdSlicer.createFromFd(fd);
  var stream = slicer.createReadStream({start: 100, end: 200});
  stream.on('data', (chunk) => {
    console.log('Data chunk:', chunk);
  });
  stream.on('end', () => {
    console.log('Stream ended');
  });
});

Other packages similar to fd-slicer

Keywords

FAQs

Package last updated on 03 Jun 2018

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