Socket
Socket
Sign inDemoInstall

with-open-file

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

with-open-file - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

2

package.json
{
"name": "with-open-file",
"version": "0.1.1",
"version": "0.1.2",
"description": "Do stuff with an open file, knowing it will finally be closed",

@@ -5,0 +5,0 @@ "repository": "raphinesse/with-open-file",

@@ -18,16 +18,11 @@ # with-open-file [![Build Status](https://travis-ci.org/raphinesse/with-open-file.svg?branch=master)](https://travis-ci.org/raphinesse/with-open-file)

```js
const fs = require('fs-extra')
const withOpenFile = require('with-open-file')
const buf = Buffer.alloc(5)
withOpenFile('foo.txt', 'r', fd => {
return fs.read(fd, buf, 0, buf.length, 0)
// Process file using fd
})
//=> { bytesRead: 5, buffer: ... }
withOpenFile.sync('foo.txt', 'r', fd => {
return fs.readSync(fd, buf, 0, buf.length, 0)
// Process file using synchronously using fd
})
//=> 5
```

@@ -40,3 +35,3 @@

Returns the result of calling `callback` with the requested file descriptor.
Returns a `Promise` wrapping the result of calling `callback` with the requested file descriptor.

@@ -43,0 +38,0 @@ ### withOpenFile.sync(...openArgs, callback)

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