Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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
  • npm
  • Socket score

Version published
Weekly downloads
556K
decreased by-18.5%
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

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

  • 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