INNER CODE UNIT · TypeScript
jsonl
serialport/node-serialport · packages/list/lib/index.ts:12
function jsonl(ports: PortInfo[]) {
ports.forEach(port => {
console.log(JSON.stringify(port))
})
}
const formatters: Record<string, undefined | ((ports: PortInfo[]) => void)> = {
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,
}