Socket
Book a DemoInstallSign in
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

Source
npmnpm
Version
2.0.1
Version published
Weekly downloads
4
Maintainers
3
Weekly downloads
 
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)
  */
}

License

MIT

Keywords

codecs

FAQs

Package last updated on 21 Dec 2020

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