{"name":"codecs","version":"1.1.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":"d31f9e1eb09d57704bff0812fd07341f39f44642","_id":"codecs@1.1.0","_shasum":"bf59c5da58039e3e48b6f9616ec82c21f12ea36a","_from":".","_npmVersion":"2.15.11","_nodeVersion":"4.6.2","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"bf59c5da58039e3e48b6f9616ec82c21f12ea36a","tarball":"http://registry-npm.ywwl.com/codecs/download/codecs-1.1.0.tgz","integrity":"sha512-0/BpaA89sdc0RKvuI5MjwHUUJIg7SeDbFYIL1fkDBp6upTuFjMC7QxGdB8iZl07siI02bsgNn2rWq+FJ4gAnlQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCMStiPe6z6HXTsTHDJaTPrQinQmWX+X4VsxMOjMfCogwIgdveFklL49lLWpyx3hYKhssWGgkJU5tFDhvM9ipJoPhE="}],"size":2348,"noattachment":false,"key":"/codecs/-/codecs-1.1.0.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/codecs-1.1.0.tgz_1479854492658_0.8161561207380146"},"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":1479854494372,"_cnpm_publish_time":1479854494372,"dist-tags":{"latest":"3.1.0"}}