{"name":"codecs","version":"1.2.0","description":"Create an binary encoder/decoder for json, utf-8 or custom types","main":"index.js","dependencies":{},"devDependencies":{"standard":"^8.5.0","tape":"^4.6.3"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"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":"a5934c6157bd69629f13c332f2c9051875e7ca82","_id":"codecs@1.2.0","_shasum":"5148549e3d156c5fa053d7cbb419715a0cf43d16","_from":".","_npmVersion":"2.15.11","_nodeVersion":"4.6.2","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"5148549e3d156c5fa053d7cbb419715a0cf43d16","tarball":"http://registry-npm.ywwl.com/codecs/download/codecs-1.2.0.tgz","integrity":"sha512-sBf0PJCjIOexPOUXNV6cCILw1py/Ie+VIXpdlDpZjlzhs3EQPImMvANka/e1GZj4E96pVITplVhLxpNiH2xMdQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID3cHXfy/D0Te9n2r+DKSfh3K7AWbwsX6vZ6X45LWxcZAiEApGZ8JQQi3OhYOvz72zDJJ8QcI0Uzs+J71st9Pi73VjE="}],"size":2488,"noattachment":false,"key":"/codecs/-/codecs-1.2.0.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/codecs-1.2.0.tgz_1479869438730_0.5935322807636112"},"directories":{},"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":1479869439080,"_cnpm_publish_time":1479869439080,"dist-tags":{"latest":"3.1.0"}}