Quark #

Modules #

Quark v1.3.0 Documentation


quark/jsonb #

default #

default.binaryify(obj) #

Convert a JSON object to binary format.

  • @param obj: any - The object to convert.
  • @return Buffer - The binary representation of the object.

For example:
const jsonb = require('quark/jsonb');
const binaryData = jsonb.binaryify({ key: 'value' });
console.log(binaryData); // Outputs the binary data.

  • @throws {Error} - If the object cannot be serialized.

default.parse(buf) #

Parse a binary buffer back to a JSON object.

  • @param buf: Uint8Array - The binary data to parse.
  • @return any - The parsed JSON object.

For example:
const jsonb = require('quark/jsonb');
const jsonData = jsonb.parse(binaryData);
console.log(jsonData); // Outputs the original JSON object.

  • @throws {Error} - If the buffer cannot be parsed.