mirror of
https://github.com/jwetzell/osc-js.git
synced 2026-08-13 19:23:44 +00:00
add readosc tool
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "makeosc",
|
||||
"version": "0.0.1",
|
||||
"version": "0.1.0",
|
||||
"description": "Simple NodeJS utility for generating osc buffers",
|
||||
"main": "dist/main.js",
|
||||
"bin": {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
dist
|
||||
@@ -0,0 +1,20 @@
|
||||

|
||||
|
||||
# readosc
|
||||
|
||||
Simple NodeJS script for parsing OSC bytes from stdin.
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
Usage: readosc [options]
|
||||
|
||||
simple util to read osc packets from stdin
|
||||
|
||||
Options:
|
||||
-V, --version output the version number
|
||||
-h, --help display help for command
|
||||
```
|
||||
|
||||
- using npx `npx readosc@latest`
|
||||
- install using `npm install -g readosc@latest` and run `readosc`
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "readosc",
|
||||
"version": "0.1.0",
|
||||
"description": "Simple NodeJS utility for parsing osc buffers from stdin",
|
||||
"main": "dist/main.js",
|
||||
"bin": {
|
||||
"readosc": "dist/main.js"
|
||||
},
|
||||
"scripts": {
|
||||
"prebuild": "rimraf dist",
|
||||
"build": "esbuild src/main.js --bundle --platform=node --outfile=dist/main.js",
|
||||
"prepack": "npm run build"
|
||||
},
|
||||
"author": {
|
||||
"name": "Joel Wetzell",
|
||||
"email": "me@jwetzell.com",
|
||||
"url": "https://jwetzell.com"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jwetzell/osc-js.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jwetzell/osc": "0.2.2",
|
||||
"commander": "^11.0.0",
|
||||
"slip": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"esbuild": "0.24.0",
|
||||
"rimraf": "6.0.1"
|
||||
}
|
||||
}
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const { program } = require('commander');
|
||||
const osc = require('@jwetzell/osc');
|
||||
const packageInfo = require('../package.json');
|
||||
|
||||
program.name(packageInfo.name);
|
||||
program.version(packageInfo.version);
|
||||
program.description('simple util to read osc packets from stdin');
|
||||
program.action(() => {
|
||||
process.stdin.on('data', (data) => {
|
||||
try {
|
||||
const message = osc.messageFromBuffer(data);
|
||||
console.log(JSON.stringify(message));
|
||||
} catch (error) {
|
||||
console.error({ error: error.toString() });
|
||||
}
|
||||
});
|
||||
});
|
||||
program.parse();
|
||||
Reference in New Issue
Block a user