{"id":26080,"library":"piping2","title":"Piping2","description":"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.","status":"maintenance","version":"0.4.1","language":"javascript","source_language":"en","source_url":"git://github.com/nightwolfz/piping","tags":["javascript","live","code","reload","hot"],"install":[{"cmd":"npm install piping2","lang":"bash","label":"npm"},{"cmd":"yarn add piping2","lang":"bash","label":"yarn"},{"cmd":"pnpm add piping2","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"File watching library used to detect changes in project files.","package":"chokidar","optional":false}],"imports":[{"note":"piping2 is a CommonJS module, no ESM exports. Use require().","wrong":"import piping from 'piping2'","symbol":"default (function)","correct":"const piping = require('piping2')"},{"note":"The module exports a single function; destructuring does not work.","wrong":"const { piping } = require('piping2')","symbol":"piping() with options object","correct":"require('piping2')({ main: './server.js', hook: true })"},{"note":"Passing a string sets the 'main' option.","wrong":"require('piping2').default('./server.js')","symbol":"piping() with string argument","correct":"require('piping2')('./server.js')"}],"quickstart":{"code":"const piping = require('piping2');\nif (!piping({ main: './app.js', hook: false })) { return; }\nconsole.log('App hot-reloading with piping2!');","lang":"javascript","description":"Basic usage: require piping2, pass configuration, and only run app logic when piping returns true (worker process)."},"warnings":[{"fix":"Consider switching to nodemon or supervisor for production stability.","message":"Unstable cluster API used; crashes may occur on some Node versions.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Always wrap application logic in an `if (piping()) { ... }` block or guard with `return`.","message":"Your file is invoked twice: first by the master process (returns false), then by the worker (returns true).","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Set `hook: true` to only watch required files, but note that files required before piping() are not tracked.","message":"If 'hook' is false (default), all files in the main file's directory are watched. Use 'ignore' to exclude node_modules.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Pin chokidar version in your project's package.json if issues arise.","message":"Depends on chokidar, which may have breaking changes between major versions.","severity":"breaking","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `const piping = require('piping2')`","cause":"Importing piping2 using ESM `import piping from 'piping2'` fails because the module exports a CommonJS function.","error":"TypeError: piping is not a function"},{"fix":"Wrap your app code with `if (!require('piping2')()) { return; }`","cause":"Not guarding application logic with the `if (piping()) { ... }` pattern, so code executes in both master and worker processes.","error":"Your application code runs twice. Please check your piping setup."},{"fix":"Ensure the 'main' option points to an existing file, e.g., `./server.js`","cause":"File watching fails because the specified 'main' path does not exist or is incorrect.","error":"Error: ENOENT: no such file or directory, watch ..."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}