Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

debug-nexttick

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

debug-nexttick

Print the tick number in debug mode

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

debug-nexttick

version status

Print the tick number in debug mode.

Usage

Command line

npm install -g debug-nexttick

tick-node -V

example/cli.js:

var n = 3

var rs = require('stream').Readable({
  read: function () {
    process.nextTick(function (prefix) {
      if (n) {
        rs.push(prefix + n-- + '\n')
      } else {
        rs.push(null)
      }
    }, 'DATA: ')
  },
})
rs.pipe(process.stdout)

Output:

⌘ NODE_DEBUG=stream tick-node example/cli.js
STREAM 59690: pipe count=1 opts=undefined
STREAM 59690: resume
---------- TICK 1 ----------
STREAM 59690: resume read 0
STREAM 59690: read 0
STREAM 59690: need readable false
STREAM 59690: length less than watermark true
STREAM 59690: do read
STREAM 59690: flow true
STREAM 59690: read undefined
STREAM 59690: need readable true
STREAM 59690: length less than watermark true
STREAM 59690: reading or ended false
---------- TICK 2 ----------
STREAM 59690: ondata
DATA: 3
STREAM 59690: read 0
STREAM 59690: need readable true
STREAM 59690: length less than watermark true
STREAM 59690: do read
---------- TICK 3 ----------
STREAM 59690: ondata
DATA: 2
STREAM 59690: read 0
STREAM 59690: need readable true
STREAM 59690: length less than watermark true
STREAM 59690: do read
---------- TICK 4 ----------
STREAM 59690: ondata
DATA: 1
STREAM 59690: read 0
STREAM 59690: need readable true
STREAM 59690: length less than watermark true
STREAM 59690: do read
---------- TICK 5 ----------
STREAM 59690: emitReadable true
STREAM 59690: emit readable
STREAM 59690: flow true
STREAM 59690: read undefined
---------- TICK 6 ----------
STREAM 59690: cleanup
---------- TICK 7 ----------

API

example/api.js:

require('debug-nexttick').polyfill()

var n = 3

var rs = require('stream').Readable({
  read: function () {
    process.nextTick(function (prefix) {
      if (n) {
        rs.push(prefix + n-- + '\n')
      } else {
        rs.push(null)
      }
    }, 'DATA: ')
  },
})
rs.pipe(process.stdout)

Output

⌘ NODE_DEBUG=stream,nexttick node example/api.js
STREAM 59678: pipe count=1 opts=undefined
STREAM 59678: resume
---------- TICK 1 ----------
STREAM 59678: resume read 0
STREAM 59678: read 0
STREAM 59678: need readable false
STREAM 59678: length less than watermark true
STREAM 59678: do read
STREAM 59678: flow true
STREAM 59678: read undefined
STREAM 59678: need readable true
STREAM 59678: length less than watermark true
STREAM 59678: reading or ended false
---------- TICK 2 ----------
STREAM 59678: ondata
DATA: 3
STREAM 59678: read 0
STREAM 59678: need readable true
STREAM 59678: length less than watermark true
STREAM 59678: do read
---------- TICK 3 ----------
STREAM 59678: ondata
DATA: 2
STREAM 59678: read 0
STREAM 59678: need readable true
STREAM 59678: length less than watermark true
STREAM 59678: do read
---------- TICK 4 ----------
STREAM 59678: ondata
DATA: 1
STREAM 59678: read 0
STREAM 59678: need readable true
STREAM 59678: length less than watermark true
STREAM 59678: do read
---------- TICK 5 ----------
STREAM 59678: emitReadable true
STREAM 59678: emit readable
STREAM 59678: flow true
STREAM 59678: read undefined
---------- TICK 6 ----------
STREAM 59678: cleanup
---------- TICK 7 ----------

API

require('debug-nexttick').polyfill()

polyfill(options)

process.nextTick will be hacked to print tick info.

options.color

Specify whether print colorful splitters.

Type: Boolean

Keywords

nextTick

FAQs

Package last updated on 08 Jan 2016

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