July 1, 2020
The nice thing about the built-in child_process
package's spawn
command for executing shell commands with Node.js, is that you can easily get access to the output of that command.
This way, you can see what the terminal command is doing:
const { spawn } = require('child_process')
const command = spawn('git clone https://github.com/benborgers/potion', {
shell: true
})
command.stdout.on('data', data => console.log(data.toString()))
command.stderr.on('data', data => console.error(data.toString()))
Now, the output of your spawn
shell command will be streamed to the console in real time.
Tufts Meal Plan Wrapped
Mar 2, 2024
Building an e-ink picture frame that displays an iCloud photo album
Jan 9, 2024
2023 in review
Jan 5, 2024
Subscribe to my newsletter for a monthly round-up of new blog posts and projects Iām working on!