Merge pull request #12 from jwetzell/readosc-update

allow readosc to make use of remainingBytes in messageFromBuffer
This commit is contained in:
2024-10-13 15:40:21 -05:00
committed by GitHub
3 changed files with 14 additions and 9 deletions
+1 -1
View File
@@ -20,7 +20,7 @@
},
"license": "MIT",
"dependencies": {
"@jwetzell/osc": "0.2.2",
"@jwetzell/osc": "1.0.0",
"commander": "^11.0.0"
}
}
+12 -2
View File
@@ -10,8 +10,18 @@ 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));
let remainingBytes = data
while(remainingBytes.length > 0){
try {
const [message, bytesAfterMessage] = osc.messageFromBuffer(remainingBytes);
remainingBytes = bytesAfterMessage
console.log(JSON.stringify(message));
} catch (error) {
console.error({ error: error.toString() });
}
}
} catch (error) {
console.error({ error: error.toString() });
}
+1 -6
View File
@@ -39,18 +39,13 @@
"version": "0.1.0",
"license": "MIT",
"dependencies": {
"@jwetzell/osc": "0.2.2",
"@jwetzell/osc": "1.0.0",
"commander": "^11.0.0"
},
"bin": {
"readosc": "src/main.js"
}
},
"apps/readosc/node_modules/@jwetzell/osc": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/@jwetzell/osc/-/osc-0.2.2.tgz",
"integrity": "sha512-HobCAMnDDSrKfrMBrF5ySA8fKO8Qjkn2HDKysuV51sHrpXABKJFQt5OemIQgbnSMNWU0kZ0+FF9xRrivHHaDTg=="
},
"apps/sendosc": {
"version": "1.0.1",
"license": "MIT",