Quark #

Modules #

Quark v1.4.0 Documentation

Contents

quark/jsonb #

default #

default.binaryify(obj) #

Convert a JSON object to binary format.

binaryify(obj: any): Buffer

Parameters:

  • obj — - The object to convert.

Returns: - 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.

parse(buf: Uint8Array): any

Parameters:

  • buf — - The binary data to parse.

Returns: - 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.