🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
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
Version published
Weekly downloads
18M
3.04%
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

createReadStream

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