simple-stdout
v2.2.0
Published
Get any shell command's stdout as a string
Downloads
47
Readme
simple-stdout
Run a shell command and get the stdout as a string.
const name = await stdout('git config --get user.name')That's it. Just a tiny library with no frills.
Install
pnpm add simple-stdout
# or
yarn add simple-stdout
# or
npm install simple-stdoutUsage
import stdout from 'simple-stdout'
const name = await stdout('git config --get user.name')
// 'Gérald Genta'Need execFile instead? (Safer for untrusted input, no shell injection worries.)
import { stdoutFile } from 'simple-stdout'
const name = await stdoutFile('git', ['config', '--get', 'user.name'])
// 'Gérald Genta'