Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graceful-fs

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graceful-fs - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

29

graceful-fs.js
// this keeps a queue of opened file descriptors, and will make
// fs operations wait until some have closed before trying to open more.
var fs = require("fs")
, FastList = require("fast-list")
// there is such a thing as TOO graceful.
if (fs.open === gracefulOpen) return
var FastList = require("fast-list")
, queue = new FastList()

@@ -9,11 +14,13 @@ , curOpen = 0

exports = module.exports = fs
fs.MIN_MAX_OPEN = 64
fs.MAX_OPEN = 1024
fs._open = fs.open
fs._openSync = fs.openSync
fs._close = fs.close
fs._closeSync = fs.closeSync
var originalOpen = fs.open
, originalOpenSync = fs.openSync
, originalClose = fs.close
, originalCloseSync = fs.closeSync

@@ -31,3 +38,5 @@

fs.open = function (path, flags, mode, cb) {
fs.open = gracefulOpen
function gracefulOpen (path, flags, mode, cb) {
if (typeof mode === "function") cb = mode, mode = null

@@ -56,3 +65,3 @@ if (typeof cb !== "function") cb = noop

curOpen ++
fs._open(path, flags, mode, function (er, fd) {
originalOpen.call(fs, path, flags, mode, function (er, fd) {
if (er) {

@@ -68,3 +77,3 @@ onclose()

curOpen ++
return fs._openSync(path, flags, mode)
return originalOpenSync.call(fs, path, flags, mode)
}

@@ -88,3 +97,3 @@

cb = cb || noop
fs._close(fd, function (er) {
originalClose.call(fs, fd, function (er) {
onclose()

@@ -97,3 +106,3 @@ cb(er)

onclose()
return fs._closeSync(fd)
return originalCloseSync.call(fs, fd)
}

@@ -100,0 +109,0 @@

@@ -5,3 +5,3 @@ {

"description": "fs monkey-patching to avoid EMFILE and other problems",
"version": "1.1.1",
"version": "1.1.2",
"repository": {

@@ -8,0 +8,0 @@ "type": "git",

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