mirror of
https://github.com/jwetzell/osc-js.git
synced 2026-08-24 08:19:04 +00:00
have readosc make use of remaining bytes
This commit is contained in:
@@ -10,8 +10,18 @@ program.description('simple util to read osc packets from stdin');
|
|||||||
program.action(() => {
|
program.action(() => {
|
||||||
process.stdin.on('data', (data) => {
|
process.stdin.on('data', (data) => {
|
||||||
try {
|
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) {
|
} catch (error) {
|
||||||
console.error({ error: error.toString() });
|
console.error({ error: error.toString() });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user