https://github.com/s00d/serialport-node-rs
https://github.com/s00d/serialport-node-rs
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/s00d/serialport-node-rs
- Owner: s00d
- License: mit
- Created: 2021-12-21T12:59:36.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-21T13:22:31.000Z (over 4 years ago)
- Last Synced: 2025-03-16T03:24:37.867Z (about 1 year ago)
- Language: Rust
- Size: 163 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# serialport-node-rs
> serialport project for writing node package with napi-rs and serialport-rc.
## Install this test package
```
npm i serialport-node-rs --save
```
## Example
```js
import { portsList, Port } from 'serialport-node-rs'
let posts = portsList();
console.log(posts)
for (let i in posts) {
let port: Port|null = null;
try {
console.log("connection...", i)
port = new Port(i);
} catch (e) {
console.log("connection error", e)
continue;
}
console.log("port", port)
setInterval(() => {
try {
console.log("AT")
port!.write('AT')
console.log(port!.read()) // string buffer
} catch (e) {
console.log("connection read", e)
}
}, 1000)
}
```
## Release package
Ensure you have set you **NPM_TOKEN** in `GitHub` project setting.
In `Settings -> Secrets`, add **NPM_TOKEN** into it.
When you want release package:
```
npm version [ | major | minor | patch | premajor | preminor | prepatch | prerelease [--preid=] | from-git]
git push
```
GitHub actions will do the rest job for you.