Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@consento/codecs

Package Overview
Dependencies
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@consento/codecs

Serializable (named) codecs, including msgpack that work with typescript

  • 2.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

@consento/codecs

Extended, sealed version of codecs that supports msgpack and base32 encoding and decoding.

const codecs = require('@consento/codecs')
const json = codecs('base32')
const buffer = json.encode({ hello: 'world' }) // JSON buffer
json.decode(buffer)

codecs.msgpack // You can access the codecs directly

codecs.available /*
[
  'ascii',    'base32',
  'base32c',  'base32h',
  'base32hp', 'base32p',
  'base64',   'binary',
  'hex',      'json',
  'msgpack',  'ndjson',
  'ucs-2',    'ucs2',
  'utf-8',    'utf16-le',
  'utf16le',  'utf8'
]
*/;

codecs.has('hex') // true

for (const codec of codecs) {
  console.log(codec) /*
    Codec(string:ascii)
    Codec(string:base32)
    Codec(string:base32c)
    Codec(string:base32h)
    Codec(string:base32hp)
    Codec(string:base32p)
    Codec(string:base64)
    Codec(Buffer:binary)
    Codec(string:hex)
    Codec(any:json)
    Codec(any:msgpack)
    Codec(any:ndjson)
    Codec(string:ucs2)
    Codec(string:utf-8)
    Codec(string:utf16le)
  */
}

const extensionCodec = new codecs.msgpack.ExtensionCodec()
const extMsgpack = codecs.bindMsgPack({
  encode: { extensionCodec },
  decode: { extensionCodec }
})

License

MIT

Keywords

FAQs

Package last updated on 14 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc