mirror of
https://github.com/jwetzell/osc-js.git
synced 2026-09-10 08:29:32 +00:00
fix issue with buffer padding
This commit is contained in:
+1
-1
@@ -77,7 +77,7 @@ const oscTypeConverterMap: { [key: string]: OSCTypeConverter } = {
|
|||||||
const sizeBuffer = oscTypeConverterMap.i.toBuffer(data.length);
|
const sizeBuffer = oscTypeConverterMap.i.toBuffer(data.length);
|
||||||
if (sizeBuffer) {
|
if (sizeBuffer) {
|
||||||
const padSize = 4 - (data.length % 4);
|
const padSize = 4 - (data.length % 4);
|
||||||
const padBuffer = Buffer.from(Array(padSize).fill(0));
|
const padBuffer = padSize < 4 ? Buffer.from(Array(padSize).fill(0)) : Buffer.from([]);
|
||||||
return Buffer.concat([sizeBuffer, data, padBuffer]);
|
return Buffer.concat([sizeBuffer, data, padBuffer]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user