The Node.js OS Scripting Framework is a kit of utilities and packages to write Node.js-based scripts for the operative system.
npm install --save nodejs-os-scripting-framework
This package is a unification of some of the most used utilities in Node.js when writting scripts for the operative system. One by one, their reason to be part of this package are:
- adm-zip: to zip and unzip files.
- chalk: to print colors by console.
- cli-table: to print tables by console.
- download: to download files from the net.
- fs-extra: to carry complex filesystem operations easily.
- globby: to find files by glob patterns.
- inquirer: to have a kit of complex user inputs.
- readline-sync: to ask user for inputs.
- spinnies: to show spinners easily.
- which: to find executables in the system, or not.
- xlsx: to read and write Excel files.
The dependencies are the following:
"adm-zip": "^0.5.10",
"chalk": "^5.3.0",
"download": "^8.0.0",
"fs-extra": "^11.2.0",
"globby": "^14.0.0",
"inquirer": "^9.2.12",
"readline-sync": "^1.4.10",
"spinnies": "^0.5.1",
"which": "^4.0.0",
"xlsx": "^0.18.5"
The references of the included packages are on:
- https://www.npmjs.com/package/adm-zip
- https://www.npmjs.com/package/chalk
- https://www.npmjs.com/package/cli-table
- https://www.npmjs.com/package/download
- https://www.npmjs.com/package/fs-extra
- https://www.npmjs.com/package/globby
- https://www.npmjs.com/package/inquirer
- https://www.npmjs.com/package/readline-sync
- https://www.npmjs.com/package/spinnies
- https://www.npmjs.com/package/which
- https://www.npmjs.com/package/xlsx
To use any of these packages, you can directly:
const nosf = require("nodejs-os-scripting-framework");
await nosf.load(); // Esta línea normaliza los imports de algunos paquetes
const {
admZip,
chalk,
cliTable
download,
fsExtra,
globby,
inquirer,
readlineSync,
spinnies,
which,
xlsx,
} = nosf;
You can find also the functions:
nosf.executeSync(command, options)
nosf.executeAsync(command, options)
await nosf.findFilesAsync(glob_pattern)
await nosf.dumpToExcel(file, array_of_objects)
Take a look to the test/test.js
file to see them in action in a fast mocha test.