![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Convert bash output to JavaScript Arrays/Objects and use JavaScript functions on it
bash2js convert bash output to JavaScript Arrays/Objects and lets you use JavaScript functions on it
# required NodeJS to work https://nodejs.org/
npm install -g bash2js
command | bash2js # converts output from "command" to an array/object and prints it
command | bash2js "map(col => col[0])" # converts output from "command", loops through it and prints column of index 0 from each line (expects output to be an array)
command | bash2js test # converts output from "command", prints property with key "test" (expects output to be an object)
command | bash2js "[0]" # converts output from "command", prints first index in the array (expects output to be an array)
command | bash2js > test.json # converts output from "command", saved output to "test.json"
ls -l # outputs
total 10
-rwxr-xr-x 1 user 1049089 1013 jul 22 11:18 index.js*
-rw-r--r-- 1 user 1049089 1074 jul 21 09:22 LICENSE
-rw-r--r-- 1 user 1049089 533 jul 22 11:20 package.json
-rw-r--r-- 1 user 1049089 74 jul 21 09:23 README.md
ls -l | bash2js # converts ls -l to an array and prints it
[
[ "total", 10 ],
[ "-rwxr-xr-x", 1, "user", 1049089, 1013, "jul", 22, "11:18", "index.js*" ],
[ "-rw-r--r--", 1, "user", 1049089, 1074, "jul", 21, "09:22", "LICENSE" ],
[ "-rw-r--r--", 1, "user", 1049089, 533, "jul", 22, "11:20", "package.json" ],
[ "-rw-r--r--", 1, "user", 1049089, 74, "jul", 21, "09:23", "README.md" ]
]
ls -l | bash2js "map(col => col[8])" # converts ls -l to an array of arrays and prints the element at index 8 in each array
index.js*
LICENSE
package.json
README.md
cat package.json | bash2js repository # converts package.json to a object and prints the repository field
{
"type": "git",
"url": "git+https://github.com/bellstrand/bash2js.git"
}
FAQs
Convert bash output to JavaScript Arrays/Objects and use JavaScript functions on it
The npm package bash2js receives a total of 3 weekly downloads. As such, bash2js popularity was classified as not popular.
We found that bash2js 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
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.