New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fd-slicer

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fd-slicer - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

CHANGELOG.md

3

index.js

@@ -49,6 +49,5 @@ var fs = require('fs');

}
var buffer = new Buffer(toRead);
self.context.pend.go(function(cb) {
if (self.destroyed) return cb();
var buffer = new Buffer(toRead);
fs.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {

@@ -55,0 +54,0 @@ if (err) {

{
"name": "fd-slicer",
"version": "0.0.1",
"version": "0.0.2",
"description": "safely create multiple ReadStream or WriteStream objects from the same file descriptor",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -51,1 +51,42 @@ # fd-slicer

```
## API Documentation
### FdSlicer
```js
var FdSlicer = require('fd-slicer');
fs.open("file.txt", 'r', function(err, fd) {
if (err) throw err;
var fdSlicer = new FdSlicer(fd);
// ...
});
```
Make sure `fd` is a properly initialized file descriptor. If you want to
use `createReadStream` make sure you open it for reading and if you want
to use `createWriteStream` make sure you open it for writing.
#### Properties
##### fd
The file descriptor passed in.
#### Methods
##### createReadStream(options)
Creates a read stream based on the file descriptor. Passes `options` to
the `Readable` stream constructor. Accepts `start` and `end` options just
like `fs.createReadStream`.
The stream that this returns supports `destroy()` to cancel it.
##### createWriteStream(options)
Creates a write stream based on the file descriptor. Passes `options` to
the `Writable` stream constructor. Accepts the `start` option just
like `fs.createWriteStream`.
The stream that this returns supports `destroy()` to cancel it.
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