Registry / devops / piping2

piping2

JSON →
library0.4.1jsnpmunverified

Piping2 is a hot-reload utility for Node.js that automatically restarts your application when files change, without requiring a wrapper binary. Version 0.4.1 is the latest stable release. Unlike nodemon or node-supervisor, it uses the cluster API to spawn your app in a worker process, enabling clean restarts without external daemons. It supports transpiler integration (e.g., Babel), file watching via chokidar, and optional require hook for selective monitoring. This package is considered unstable and intended for development only. Note that piping2 is a fork of the original piping package, with no active maintenance.

npm install piping2
INSTALL
IMPORT
SIG · PIPING2
P
piping2
devopsjavascriptv0.4.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (function)
const piping = require('piping2')
import piping from 'piping2'
piping2 is a CommonJS module, no ESM exports. Use require().
piping() with options object
require('piping2')({ main: './server.js', hook: true })
const { piping } = require('piping2')
The module exports a single function; destructuring does not work.
piping() with string argument
require('piping2')('./server.js')
require('piping2').default('./server.js')
Passing a string sets the 'main' option.

Basic usage: require piping2, pass configuration, and only run app logic when piping returns true (worker process).

const piping = require('piping2'); if (!piping({ main: './app.js', hook: false })) { return; } console.log('App hot-reloading with piping2!');
piping --version
Debug
Known issues
breakingUnstable cluster API used; crashes may occur on some Node versions.
fix
Consider switching to nodemon or supervisor for production stability.
affects: >=0.0.0
gotchaYour file is invoked twice: first by the master process (returns false), then by the worker (returns true).
fix
Always wrap application logic in an `if (piping()) { ... }` block or guard with `return`.
affects: >=0.0.0
gotchaIf 'hook' is false (default), all files in the main file's directory are watched. Use 'ignore' to exclude node_modules.
fix
Set `hook: true` to only watch required files, but note that files required before piping() are not tracked.
affects: >=0.0.0
breakingDepends on chokidar, which may have breaking changes between major versions.
fix
Pin chokidar version in your project's package.json if issues arise.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: piping is not a function
Importing piping2 using ESM `import piping from 'piping2'` fails because the module exports a CommonJS function.
fix
Use `const piping = require('piping2')`
Your application code runs twice. Please check your piping setup.
Not guarding application logic with the `if (piping()) { ... }` pattern, so code executes in both master and worker processes.
fix
Wrap your app code with `if (!require('piping2')()) { return; }`
Error: ENOENT: no such file or directory, watch ...
File watching fails because the specified 'main' path does not exist or is incorrect.
fix
Ensure the 'main' option points to an existing file, e.g., `./server.js`
Upgrade
Version history
0.4.1latest on npm
Audit
Dependencies
chokidarrequiredFile watching library used to detect changes in project files.
Agent activity
2 hits · last 30 days
node
2
Resources
piping2 — npm install piping2 · libregistry