studiox-streamer/backend/bin.mjs

34 lines
640 B
JavaScript
Executable file

import minimist from 'minimist'
import { run } from './server.mjs'
import createDebug from 'debug'
const debug = createDebug('streamer')
main().catch(onerror)
async function main () {
const args = minimist(process.argv.slice(2), {
default: {
port: 3030,
host: '0.0.0.0',
input: 'alsa:default',
output: 'alsa:default',
dev: false
},
alias: {
p: 'port',
h: 'host',
i: 'input',
o: 'output',
d: 'dev'
}
})
await run(args)
}
function onerror (err) {
if (err) console.error(err instanceof Error ? err.message : String(err))
debug(err)
process.exit(1)
}