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

fibers-augment

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fibers-augment

Augment objects/namespaces to use fibers.

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

fibers-augment

Augment objects/namespaces to use fibers.

Usage

var fs = require('fs'),
    Fiber = require('fibers'),
    augment = require('fibers-augment')

// Augment a list of functions
augment(fs, {
  include: ['readdir', 'stat']
})

// readdir and stat are now augmented

Fiber(function() {
  // Get a list of files in the directory
  var fileNames = fs.readdir('.').wait()
  console.log('Found '+ fileNames.length+ ' files')

  // Stat each file
  for (var ii = 0; ii < fileNames.length; ++ii) {
    console.log(fs.stat(fileNames[ii]).wait())
  }
}).run()

You may also use exclude, in which case every function other than the listed onces will be augmented. e.g.

augment(fs, {exclude: ['exists']})

Or, to augment all functions:

augment(fs)

Sometimes you might find it helpful to augment a prototype:

augment(SomeClass.prototype)

Limitations

This library assumes that the asynchronous functions being augmented are implemented with the conventional callback paradigm, namely having a callback as its last argument, and that the callback is called with two arguments, with the first argument being error and the second argument being the result of the asynchronous function. All node.js standard library functions are implemented this way.

License

WTFPL.

Keywords

FAQs

Package last updated on 30 Jul 2013

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