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

cnysa

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cnysa

A tool for understanding async-hooks

  • 0.2.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

cnysa (unpronouncible) is a module that allows you to see information about what the async_hooks module is doing under the covers.

Note: This module currently uses the colors module.

Pre-Require Hook

Pre-require cynsa/register in your application:

node --require cynsa/register app.js

If cnysa.json exists in the current working directory, it will be used as the configuration passed to the Cnysa constructor as described below.

API

const { Cnysa } = require('cnysa');

new Cnysa(options)

All options are optional.

  • options.width: Maximum number of characters to print on a single line before wrapping. Defaults to the current terminal width.
  • options.ignoreTypes: String or RegExp to filter out AsyncResource types.
  • options.highlightTypes: String or RegExp to highlight certain AsyncResource types and their descendants.

Cnysa#enable()

Starts recording async events and registers a process exit hook.

Cnysa#disable()

Stops recording async events and unregisters the process exit hook.

Understanding output

For each AsyncResource, a time line will be printed, with a number of colored symbols:

  • Green * represents the async resource creation.
  • Red * represents its destruction.
  • Blue {...} represent running in an async scope.
  • Gray - indicates the lifetime of the resource creation, and is bookended by * symbols.

Examples

node --require cnysa/register -e "fs.readFile('package.json', (err, contents) => { console.log('done reading') })"

Keywords

FAQs

Package last updated on 16 Apr 2018

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