Homepage
Recent Changes
Search:
History of 2020-06-01 Node modules working as command-line scripts
2020-06-01
06:20 UTC
Revision 1
. . . .
mbork
–
Recently, I wanted to run one Node.JS CLI script from another. Of course, being in a hurry and KISS and whatnot, I decided to just use child_process.execFileSync with node as the first argument, but this is of course grossly inefficient. What if I could write a module usable both from the command line and other code? Well, it turns out that not only is this doable, but actually easy and robust.