Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// #!/usr/bin/env node
const { Select } = require('enquirer')
const args = require('commander')
const SerialPort = require('@serialport/stream')
const { version } = require('../package.json')
const { OutputTranslator } = require('./output-translator')
SerialPort.Binding = require('@serialport/bindings')
const makeNumber = input => Number(input)
args
.version(version)
.usage('[options]')
.description('A basic terminal interface for communicating over a serial port. Pressing ctrl+c exits.')
.option('-l --list', 'List available ports then exit')
.option('-p, --path
const listPorts = async () => {
const ports = await SerialPort.list()
for (const port of ports) {
console.log(`${port.path}\t${port.pnpId || ''}\t${port.manufacturer || ''}`)
}
}
const SerialPort = require('@serialport/stream')
const Binding = require('@serialport/bindings')
const parsers = require('./parsers')
/**
* @type {AbstractBinding}
*/
SerialPort.Binding = Binding
/**
* @type {Parsers}
*/
SerialPort.parsers = parsers
module.exports = SerialPort
public create(path: string) {
const SerialPortNamespace = require('@serialport/stream');
const MockBinding = require('@serialport/binding-mock');
SerialPortNamespace.Binding = MockBinding;
MockBinding.createPort(path, { echo: true, record: true });
}
const SerialPort = require('@serialport/stream')
const Binding = require('@serialport/bindings')
const parsers = require('./parsers')
/**
* @type {AbstractBinding}
*/
SerialPort.Binding = Binding
/**
* @type {Parsers}
*/
SerialPort.parsers = parsers
module.exports = SerialPort