NodeJS ftw

NODE JS IS THE FUTURE:

#!/usr/bin/env node

/* Require dependencies */
const program = require('commander');
exec = require('child_process').exec

let listFunction = (directory,options) => {
const cmd = 'ls';
let params = [];
if (program.all) params.push('a');
if (program.list) params.push('l');
let fullCommand = params.length ? cmd + ' -' + params.join(''):cmd;
if (directory) fullCommand += ' ' + directory ;
console.log(`Comando a ejecutar: ${fullCommand}`);

let execCallback = (error, stdout, stderr) => {
if (error) console.log("exec error: " + error);
if (stdout) console.log("Result: " + stdout);
if (stderr) console.log("shell error: " + stderr);
};
exec(fullCommand, execCallback);
};

program
.option('-a, --all', 'output extra debugging')
.option('-l, --list', 'small pizza size')
.action(listFunction)

program.parse(process.argv);

Attached: njs.png (512x512, 6K)

Other urls found in this thread:

github.com/juliangruber/isarray
twitter.com/NSFWRedditVideo

That isn't impressive OP, most languages can do that.

How do you run node scripts out of a batch file?

>*clogs your disk with bloat*
nothing personnel, kiddo

Attached: what the fuck.png (263x137, 5K)

just install modules globally and enjoy

Why shouldn't I just use bash?

The first line of user's script is a hashbang that allows you to run it directly from bash like any other program

How can fucking codes take 200mb of space?

Million lines of code? What the fuck.

nodejs is fine if you code vanilla.
If you use any popular package is cancer, because it will fetch extra 200MB/40.000 files as dependencies.
Fucking cancer, I'd say.

I've made a few vanilla packages and they are just a few kb and a few files.
As a language and features nodejs is very good
>Has some quirks, but they are easy to understand

NodeJS is a terrible cancer it was born just to make happy all those code monkeys who couldn't bear to learn two different languages for server and client side for a web application.

I hate this mentality
>language is easy to use
>yeah it's because it's shit

It does have a shitload of benefits though. JS is an incredibly powerful language and having the same code for parsing and stuff in back and front is bliss. You're just butthurt because you are invested in languages that aren't as popular anymore

Looks like all the onions in the node ecosystem is reaching supercritical mass. No one who uses that shit really knows what the fuck they're doing anymore. Meme languages, frameworks and databases need to fucking die or we are going to fall apart as a technological society.

I think you don't understand the significant liabilities imposed by a dynamically-typed system such as NodeJS. Edgelords tried putting a bandaid on this with typescript, but all that does is make it even worse because now you have yet another layer of indirection before you can even start getting fucked in the ass by your poor solution architecture decisions.

The best was when the ES2019 specification was released. Everyone in these zoomer coding camps started losing their shit because javascript to them is supposed to be like assembly for the browser, when in fact it has a rich set of APIs that requires no fucking framework whatsoever to operate.
>Why are you changing the javascript API broooo, its gonna break our entire house of cards. Yikes!

>2007
"oh boy computers are getting so powerful to fast everything's gonna be amazingly snappy in the future"
>2019
waiting for node.js to squeeze out a response to your click through its constipated ringpiece

more like 10k lines of codes (half are params comments) and extra garbage

github.com/juliangruber/isarray

> used by 3,899,744 github repo
> 10 files
> size on disk: 10KB
>valuable content
var toString = {}.toString;

module.exports = Array.isArray || function (arr) {
return toString.call(arr) == '[object Array]';
};

truly the future there

>BASH
He was asking about batch files, moron. Not shell scripts.

oh nonononono looks like javascript isnt the only one? what the fuck do i do with my life now

Attached: file.png (241x34, 967)

>it was born just to make happy all those code monkeys who couldn't bear to learn two different languages for server and client side for a web application.

NIgga it's literally used mostly for front end client webapps.