Security News
npm Updates Search Experience with New Objective Sorting Options
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
It's a subset of Edge Side Include standard implemented with promise-based interface.
...and more, take a look at test cases for complete list.
npm install nodesi
var ESI = require('nodesi');
var esi = new ESI();
esi.process('<esi:include src="http://full-resource-path/stuff.html" />').then(function(result) {
// result is a fetched html
});
var ESI = require('nodesi');
var esi = new ESI({
baseUrl: 'http://full-resource-path'
});
esi.process('<esi:include src="/stuff.html" />').then(function(result) {
// result is a fetched html
});
You can provide onError callback to a ESI constructor. It will recieve two arguments: source URL and error object.
It should return a string that will be put in place of errorous content.
var esi = new ESI({
onError: function(src, error) {
if(error.statusCode === 404) {
return 'Not found';
}
return '';
}
});
It's a common anti-pattern that libraries write to stdout w/o users permission.
We want to be nice so you can provide your own logging output with logTo
configuration option.
It's expected to be an object with "write" method on it that accepts a single string.
Logging to a custom object
var esi = new ESI({
logTo: {
write: function(log) {
// do some stuff with log string here
}
}
});
Logging to a standard output (same as console.log):
var esi = new ESI({
logTo: process.stdout
});
Logging to a file (possible, but please don't do that):
var logFile = require('fs').createWriteStream('./log.txt');
var esi = new ESI({
logTo: logFile
});
You can run performance tests with npm run perf [args]
This tool assumes you have Siege installed and added to your Path variable.
[args] are list of arguments that will be passed to Siege.
FAQs
ESI: the good parts in node.js
The npm package nodesi receives a total of 7,424 weekly downloads. As such, nodesi popularity was classified as popular.
We found that nodesi demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers 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
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.