@svizzle/utils/buffer-any

Methods

(static) jsonBufferToAny() → {*}

Source:
Since:
  • 0.17.0

Convert a buffer representing a json object into a javascript object

Example
> encoder = new TextEncoder()
undefined
> buffer = encoder.encode('{"a": 1}')
Uint8Array(8) [
  123, 34, 97,  34,
  58, 32, 49, 125
]
> jsonBufferToAny(buffer)
{ a: 1 }
Parameters:
Type Description
typedArray

the input buffer

Returns:
  • the decoded buffer
Type
*