Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
const formatters = {
text(ports) {
ports.forEach(port => {
console.log(`${port.path}\t${port.pnpId || ''}\t${port.manufacturer || ''}`)
})
},
json(ports) {
console.log(JSON.stringify(ports))
},
jsonl,
jsonline: jsonl,
}
bindings.list().then(formatters[args.format], err => {
console.error(JSON.stringify(err))
process.exit(1)
})
function listSerialPorts() {
return serialBingings.list().then(ports => {
return ports.map(port => port.comName)
})
}