new Encoder()
Transform JavaScript values into CBOR bytes. The `Writable` side of
the stream is in object mode.
Extends
- stream.Transform
Classes
Methods
-
<static> encode(objs)
-
Encode one or more JavaScript objects, and return a Buffer containing the CBOR bytes.
Parameters:
Name Type Argument Description objsany <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 typeany funany Returns:
- Type
- encodeFunction