# windows-com-port

> Node js Library to read and write in windows port using socket. Good for Arduino projects.

Latest version **1.4.1** (published 2020-06-19) · ISC license · 0 weekly downloads

## Install

```sh
npm install windows-com-port
pnpm add windows-com-port
yarn add windows-com-port
bun add windows-com-port
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.1 |
| Published | 2020-06-19 |
| First published | 2019-05-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 9.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Renato Seiji Miawaki |
| Maintainers | reytuty |
| Keywords | arduino, com port, windows port, write com port, read com port |

## Links

- npm: https://www.npmjs.com/package/windows-com-port
- Repository: https://github.com/reytuty/WindowsComPortCommunication
- Homepage: https://github.com/reytuty/WindowsComPortCommunication#readme
- Issues: https://github.com/reytuty/WindowsComPortCommunication/issues
- npm.io page: https://npm.io/package/windows-com-port

## Dependencies (3)

- [signals](https://npm.io/package/signals.md) ^1.0.0
- [serialport](https://npm.io/package/serialport.md) ^9.0.0
- [socketstream2event](https://npm.io/package/socketstream2event.md) ^1.0.4

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.4.1 (latest) — 2020-06-19
- 1.4.0 — 2020-06-10
- 1.3.5 — 2020-05-08
- 1.3.4 — 2020-05-08
- 1.3.3 — 2020-05-08
- 1.3.2 — 2020-05-08
- 1.3.1 — 2020-04-03
- 1.2.3 — 2020-04-03
- 1.3.0 — 2019-06-20
- 1.2.2 — 2019-06-17
- 1.2.1 — 2019-06-13
- 1.2.0 — 2019-06-13
- 1.1.0 — 2019-05-31
- 1.0.1 — 2019-05-02
- 1.0.0 — 2019-05-02

## README

# WindowsComPortCommunication
Node js Library to read and write in windows port using socket. Good for Arduino projects.

## Install

```

npm install windows-com-port

```

## Inport

```

const WindowsComPort = require('windows-com-port') ;

```

## Connect

```

var comPort = new WindowsComPort(start) ;
let port = "COM1" ;

//Listener on Ready
comPort.onReady.add(()=>{
    //its ready, show avaible ports
    let ports = comPort.getAvaiblePorts() ;
    console.log("Avaible ports", ports) ;
}) ;
comPort.onConnected.add((info)=>{
    console.log(info) ;
    //info has:
    //{totalPorts, totalConnected, ports}
    info.totalPorts;
    info.tltalConnected;
    info.ports.forEach((portInfo)=>{
        //inf has: {port:string, connected:bool}
        console.log(portInfo);
    });
});
comPort.connect() ;

```

## READ 

```

//TO READ
comPort.addOnData(port, (data)=>{
    console.log("Recived data on port ("+port+"):", data) ;
}) ;

```

## WRITE

```

//TO WRITE
try{
    var message = "TEST,1,2,3" ;
    comPort.write(port, message) ;
    console.log("Message sent to port", port, message)
} catch(e){
    console.log("Error writing port", e)
}

```

## Complete example

```

const WindowsComPort     = require('./index') ;

var comPort = new WindowsComPort(start) ;
let port = "COM1" ;

//Listener on Ready
comPort.onReady.add(()=>{
    //its ready, show avaible ports
    let ports = comPort.getAvaiblePorts() ;
    console.log("Avaible ports", ports) ;
}) ;

comPort.connect() ;

//TO READ
comPort.addOnData(port, (data)=>{
    console.log("Recived data on port ("+port+"):", data) ;
}) ;

//TO WRITE
try{
    var message = "TEST,1,2,3" ;
    comPort.write(port, message) ;
    console.log("Message sent to port", port, message)
} catch(e){
    console.log("Error writing port", e)
}


```

---
_Source: https://npm.io/package/windows-com-port · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
