
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
divine-binary-object
Advanced tools
An easy way to store objects that contain binary data in JavaScript.
You can use typed objects to make sure that a value gets stored as a certian type.
Otherwise you can just make a normal JavaScript object with TypedArrays.
import { DBO } from "divine-binary-object";
/*
Normal Object mode
*/
(() => {
const buf = DBO.objectToBuffer({
v0: [
{
v0: new Uint8ClampedArray([1, 2, 3, 4]),
},
{
v0: new Uint16Array([1, 2, 3, 4]),
},
],
v1: 12.12,
v2: DBO.nodes._16ui(1212),
v3: "value 3",
v4: [1, 2, 3, 4, 5, 6, 7, 8],
v5: ["hello", "sup"],
v6: {
hello: "sup",
},
});
console.log("[OBJECT MODE]");
console.log(buf);
const obj = DBO.bufferToObject<any>(buf);
console.log(obj);
})();
const TNM = DBO.nodes;
/*
Typed Node Mode
*/
(() => {
const mmdData = TNM.object({
v0: TNM.array([
TNM.object({
v0: TNM.typedArray("8uic", [1, 2, 3, 4]),
}),
TNM.object({
v0: TNM.typedArray("16ui", [1, 2, 3, 4]),
}),
]),
v1: TNM._32f(12.12),
v2: TNM._16ui(1212),
v3: TNM.string("value 3"),
v4: TNM.typedArray("16ui", [1, 2, 3, 4, 5, 6, 7, 8]),
v5: TNM.stringArray(["hello", "sup"]),
v6: TNM.json({
hello: "sup",
}),
});
console.log("[TYPED NODE MODE]");
const buffer = DBO.toBuffer(mmdData);
console.log(buffer);
const object = DBO.bufferToObject(buffer);
console.log(object);
})();
[OBJECT MODE]
ArrayBuffer {
[Uint8Contents]: <00 03 08 02 00 76 00 30 06 03 08 02 00 76 00 30 19 0b 00 00 00 04 01 02 03 04 04 03 08 02 00 76 00 30 19 0d 00 00 00 04
00 01 00 02 00 03 00 04 04 07 08 02 00 76 00 31 11 40 28 3d 70 a3 d7 0a 3d 08 02 00 76 00 32 0d 04 bc 08 02 00 76 00 33 16 00 00 00 07 00 76 00 61 00 6c 00 75 00 65 00 20 00 33 08 ... 146 more bytes>,
byteLength: 246
}
{
v0: [ { v0: [Uint8ClampedArray] }, { v0: [Uint16Array] } ],
v1: 12.12,
v2: 1212,
v3: 'value 3',
v4: [
1, 2, 3, 4,
5, 6, 7, 8
],
v5: [ 'hello', 'sup' ],
v6: { hello: 'sup' }
}
[TYPED NODE MODE]
ArrayBuffer {
[Uint8Contents]: <00 03 08 02 00 76 00 30 06 03 08 02 00 76 00 30 19 0b 00 00 00 04 01 02 03 04 04 03 08 02 00 76 00 30 19 0d 00 00 00 04
00 01 00 02 00 03 00 04 04 07 08 02 00 76 00 31 0e 41 41 eb 85 08 02 00 76 00 32 0d 04 bc 08 02 00 76 00 33 16 00 00 00 07 00 76 00 61 00 6c 00 75 00 65 00 20 00 33 08 02 00 76 00 ... 101 more bytes>,
byteLength: 201
}
{
v0: [ { v0: [Uint8ClampedArray] }, { v0: [Uint16Array] } ],
v1: 12.119999885559082,
v2: 1212,
v3: 'value 3',
v4: Uint16Array(8) [
1, 2, 3, 4,
5, 6, 7, 8
],
v5: [ 'hello', 'sup' ],
v6: { hello: 'sup' }
}
FAQs
A TypeScript library working with binary data.
We found that divine-binary-object demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.