
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
jash.js allows you to more easily use node as a shell scripting facility. It will collate all output in an easy to consume way - avoiding pitfalls that can cause you to lose data.
You can call any commandline utility like this: (Why '$'? It's a shell prompt!)
var $ = require('jash');
$.ls('-l', '/tmp/foo', function(statusCode, stdout, stderr) {
console.log('files are', stdout);
}
or with your own callbacks for stdout and stderr. This is nice for long running processes and the like
var getStreamConsumer = function() {
return function(data) {
console.log('I got some data!', data);
};
};
$.tail('-f', '/var/log/foo.log', getStreamConsumer(), getStreamConsumer());
Since the child process is returned, you can also do whatever you want:
var child = $.ls('-l', '/tmp/foo');
child.stdout.on ...
child.stderr.on ...
child.on('exit') ...
The full API:
$.cmd(arg1, arg2, arg3, [options],[cb [, stdoutHandler, stdErrHandler]]);
where options is the options argument passed to child_process.spawn: http://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options
arguments can also be passed in an array as the first argument:
$.cmd([arg1, arg2, arg3], ...
When only one callback is passed, cb is a function that takes 3 arguments:
function(statusCode, stdout, stderr) { ...
You can also pass 3 callbacks:
cb = function(statusCode) ...
stdout = function(data) ...
stderr = function(data) ...
jash is written by Tom Fairfield <www.github.com/fairfieldt>
FAQs
node for commandline scripting
The npm package jash receives a total of 0 weekly downloads. As such, jash popularity was classified as not popular.
We found that jash 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.