Published Jan 17 2023
Hereβs how I ran a shell command from a Node.js script.
First I imported child
from child_process
:
import * as child from 'node:child_process'
//or
const child = require('node:child_process')
Then you can call child.exec()
like this:
child.exec(`mkdir test`)
I wrote an entire book on this topic π
© 2023 Flavio Copes
using
Notion to Site.
Follow on Twitter
Solopreneur? Wannabe? Adventure awaits