Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
piping-no-error-suppression
Advanced tools
Keep your code piping hot! Live code reloading without additional binaries
There are already node "wrappers" that handle watching for file changes and restarting your application (such as node-supervisor), as well as reloading on crash, but I wasn't fond of having that. Piping adds "hot reloading" functionality to node, watching all your project files and reloading when anything changes, without requiring a "wrapper" binary.
Piping uses the currently unstable "cluster" API to spawn your application in a thread and then kill/reload it when necessary. Because of this, piping should be considered unstable and should not be used in production (why would you ever need live code reloading in production anyway). Currently, at least on windows, the cluster API seems stable enough for development.
Also check out piping-browser which does a similar job for the browser using browserify
npm install piping
Piping is not a binary, so you can continue using your current workflow for running your application ("wooo!"). Basic usage is as follows:
if (require("piping")()) {
// application logic here
express = require("express");
app = express();
app.listen(3000);
}
or in coffeescript:
if require("piping")()
# application logic here
express = require "express"
app = express()
app.listen 3000
This if condition is necessary because your file will be invoked twice, but should only actually do anything the second time, when it is spawned as a separate node process, supervised by piping. Piping returns true when its good to go.
the function returned by piping also accepts an options object. The following options are supported:
require.main.filename
, which should be sufficient provided you launch your application via "node yourapp.js". Other launch methods may require this to be set manually. If your app doesn't reload/reloads when it shouldn't, try changing this./(\/\.|~$)/
Example:
if (require("piping")({main:"./app/server.js",hook:true})){
// app logic
}
Piping can also be used just by passing a string. In this case, the string is taken to be the "main" option:
if (require("piping")("./app/server.js")){
// app logic
}
One negative of all the examples above is the extra indent added to your code. To avoid this, you can choose to return when piping is false:
if (!require("piping")()) { return; }
// application logic here
or in coffeescript:
if not require("piping")() then return
# application logic here
FAQs
Keep your code piping hot! Live code reloading without additional binaries
The npm package piping-no-error-suppression receives a total of 1 weekly downloads. As such, piping-no-error-suppression popularity was classified as not popular.
We found that piping-no-error-suppression demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.