You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

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

Do stuff with an open file, knowing it will finally be closed

0.1.7
latest
Source
npmnpm
Version published
Weekly downloads
450K
0.45%
Maintainers
1
Weekly downloads
 
Created
Source

with-open-file Build Status

Do stuff with an open file, knowing it will finally be closed

Because the built-in way requires way too much boilerplate.

Install

$ npm install with-open-file

Usage

const withOpenFile = require('with-open-file')

withOpenFile('foo.txt', 'r', fd => {
  // Process file using fd
})

withOpenFile.sync('foo.txt', 'r', fd => {
  // Process file synchronously using fd
})

API

withOpenFile(...openArgs, callback)

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

withOpenFile.sync(...openArgs, callback)

Returns the result of calling callback with the requested file descriptor.

...openArgs

Arguments as supported by fs.openSync

callback

Type: function

License

MIT © Raphael von der Grün

Keywords

node

FAQs

Package last updated on 07 Nov 2019

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.