json singh
1 min readMay 11, 2019

--

const util = require('util');
const exec = util.promisify(require('child_process').exec);

async function lsExample() {
const { stdout, stderr } = await exec('ls');
console.log('stdout:', stdout);
console.log('stderr:', stderr);
}
lsExample();

You can use something like this as well, using bashcommands in the node are pretty straightforward. Even better you can use something find ./ -name "*.json" to access all the json files under the current dir Tested this on ubuntu, not sure about windows and mac.

--

--

json singh
json singh

Responses (1)