Class: Encoder

Encoder


new Encoder()

Transform JavaScript values into CBOR bytes. The `Writable` side of the stream is in object mode.

Extends

  • stream.Transform

Classes

Encoder

Methods


<static> encode(objs)

Encode one or more JavaScript objects, and return a Buffer containing the CBOR bytes.
Parameters:
Name Type Argument Description
objs any <repeatable>
the objects to encode
Returns:
- the encoded objects
Type
Buffer

addSemanticType(type, fun)

Add an encoding function to the list of supported semantic types. This is useful for objects for which you can't add an encodeCBOR method
Parameters:
Name Type Description
type any
fun any
Returns:
Type
encodeFunction