{"name":"codecs","version":"2.2.0","description":"Create an binary encoder/decoder for json, utf-8 or custom types","main":"index.js","dependencies":{},"devDependencies":{"standard":"^12.0.1","tape":"^4.10.1"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/codecs.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/codecs/issues"},"homepage":"https://github.com/mafintosh/codecs","gitHead":"8ab2f972a45758f9a397a57a1c669230ad8daeef","_id":"codecs@2.2.0","_nodeVersion":"14.15.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-+xi2ENsvchtUNa8oBUU58gHgmyN6BEEeZ8NIEgeQ0XnC+AoyihivgZYe+OOiNi+fLy/NUowugwV5gP8XWYDm0Q==","shasum":"9efe60f367482a9f9d69b4daebb73b421038ab37","tarball":"http://registry-npm.ywwl.com/codecs/download/codecs-2.2.0.tgz","fileCount":6,"unpackedSize":7253,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfv6AmCRA9TVsSAnZWagAAeSIP/iAR072/aag7vQXyp/Au\n4RzAskbzu128a7fx2Ymc/UVQDFJtzwPHHDEq1CCt6GK7Y5DczPkpYRGxGu3F\nvv9RoYjIwftfnF6NzuUCdI/P6zfjMyxVPA/bJ73V6RWa4ST/LDr1sRnQID5r\nESE3yd1CiXeuTtnsEPZIJykRgcJ52DKYpkU9D5rcGJcwSf1+RVEQ44DxTMsF\n+hQeO6daI0LHDJWljl1Bcl/vdVS+4HdzwY29nmkrG6SEAGqTyh1KHfepIo41\nwKyt1fvUpR7wn17zsx5FYJcE0GprWSwVkCykvrI+Jlti3vU2sXR+9MJ6qH2g\nxauvtzi5qWomEzMEGjdDSMeyWKnpdlQbEyVhPJjCh7hF+rrlWb4cbfCIrfP6\ncdYE987lJ9xPEPUle2+Eg80GXk6y4kqz+02atfuMt0+HmQV57p1zpFna6Xo3\ncynx3dhg3xag1kG1lf/See9tB3SACbYZbsbDUU6YIRgQ84PhneKQxazyQO00\nniW+ml5yASkTmM9RbrL2MMLjK36TZR6P89ytQN+Bd2t5pueBlo5/h+YNtc7f\n9p/jD1Erijk68u3UwXR8brBBCiUlv+F5UB808kJuznpPTcb28IYLbmXaAfoo\njPfpvo4oz4tlmSjo5AxKFKjTWh86au9WVcCAOAxf/Y+jcUg7n9ikeJEezv4W\nWscj\r\n=zqw9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHCFRSxQdTmSXuk0LwH1qobPZ9X0VS6HvCD4gZAH4LOoAiBprr0pKWtIeJMQ1XwRvY/qIxtIspDgMpwibbjoW8eP5A=="}],"size":2934,"noattachment":false,"key":"/codecs/-/codecs-2.2.0.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/codecs_2.2.0_1606393894486_0.6095344431196166"},"_hasShrinkwrap":false,"readme":"# codecs\n\nCreate an binary encoder/decoder for Node's build in types like, json, utf-8, hex.\n\n```\nnpm install codecs\n```\n\nUseful to support value encodings similar to leveldb's.\n\n## Usage\n\n``` js\nconst codecs = require('codecs')\nconst json = codecs('json')\n\nconsole.log(json.encode({ hello: 'world' })) // Buffer.from('{\"hello\":\"world\"}')\nconsole.log(json.decode(new Buffer('{\"hello\":\"world\"}'))) // { hello: 'world' }\n```\n\n## API\n\n#### `const codec = codecs(type, [fallback])`\n\nCreate a new codec.\n\nSupported types are\n\n* utf8\n* json\n* [ndjson](http://ndjson.org/)\n* binary\n* hex\n* ascii\n* base64\n* ucs2\n* ucs-2\n* utf16le\n* utf-16le\n* binary\n\nIf an unknown type is passed-in, the `fallback` is used if given, else `binary`.\nIf you want to use a custom codec you can pass in an object containing a an `encode` and `decode` method and that will be returned.\nIf you pass a [compact encoder](https://github.com/compact-encoding/compact-encoding), then it will be converted into a codec for you and returned.\n\n#### `const buf = codec.encode(value)`\n\nEncode a value to a buffer.\n\n#### `const value = codec.decode(buf)`\n\nDecode a buffer to a value.\n\n## License\n\nMIT\n","publish_time":1606393894633,"_cnpm_publish_time":1606393894633,"dist-tags":{"latest":"3.1.0"}}