MCPcopy Create free account
hub / github.com/denoland/std / encodeCbor

Function encodeCbor

cbor/encode_cbor.ts:38–43  ·  view source on GitHub ↗
(value: CborType)

Source from the content-addressed store, hash-verified

36 * @returns A {@link Uint8Array} representing the encoded data.
37 */
38export function encodeCbor(value: CborType): Uint8Array {
39 const output = new Uint8Array(calcEncodingSize(value));
40 const o = encode(value, output, 0);
41 if (o !== output.length) return output.subarray(0, o);
42 return output;
43}

Calls 2

calcEncodingSizeFunction · 0.90
encodeFunction · 0.90

Tested by

no test coverage detected