goldies
    Preparing search index...

    Function parseJSONFromBytes

    • Parses a JSON object from a Buffer or Uint8Array. Works in Node.js and browsers.

      Parameters

      • bytes: Uint8Array

        The Buffer or Uint8Array containing the JSON string (a Buffer is a Uint8Array).

      Returns unknown

      The parsed JSON object.

      const buffer = Buffer.from('{"key": "value"}', 'utf-8');
      const result = parseJSONFromBytes(buffer); // { key: 'value' }