{"_id":"codecs","_rev":"1645539","name":"codecs","description":"Create an binary encoder/decoder for json, utf-8 or custom types","dist-tags":{"latest":"3.0.0"},"maintainers":[{"name":"mafintosh","email":""}],"time":{"modified":"2021-11-22T11:36:04.000Z","created":"2016-11-22T22:20:40.208Z","3.0.0":"2021-11-22T11:16:09.864Z","2.2.0":"2020-11-26T12:31:34.633Z","2.1.0":"2020-05-01T13:25:27.741Z","2.0.0":"2019-03-15T14:38:27.818Z","1.2.1":"2018-03-11T00:09:01.939Z","1.2.0":"2016-11-23T02:50:39.080Z","1.1.0":"2016-11-22T22:41:34.372Z","1.0.0":"2016-11-22T22:20:40.208Z"},"users":{},"author":{"name":"Mathias Buus","url":"@mafintosh"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/codecs.git"},"versions":{"3.0.0":{"name":"codecs","version":"3.0.0","description":"Create an binary encoder/decoder for json, utf-8 or custom types","main":"index.js","dependencies":{"b4a":"^1.1.1"},"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":"2cf2e38b78f55816793d7a94468f8355d334f1b7","_id":"codecs@3.0.0","_nodeVersion":"16.8.0","_npmVersion":"6.14.15","dist":{"shasum":"bbb37610c904263ea949f8da6a182b8fc4cc24fc","size":2913,"noattachment":false,"key":"/codecs/-/codecs-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/codecs/download/codecs-3.0.0.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/codecs_3.0.0_1637579769724_0.8466010380856013"},"_hasShrinkwrap":false,"publish_time":1637579769864,"_cnpm_publish_time":1637579769864},"2.2.0":{"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":{"shasum":"9efe60f367482a9f9d69b4daebb73b421038ab37","size":2934,"noattachment":false,"key":"/codecs/-/codecs-2.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/codecs/download/codecs-2.2.0.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/codecs_2.2.0_1606393894486_0.6095344431196166"},"_hasShrinkwrap":false,"publish_time":1606393894633,"_cnpm_publish_time":1606393894633},"2.1.0":{"name":"codecs","version":"2.1.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":"4262195cfbe46cc7d12bc11d828324973817ea96","_id":"codecs@2.1.0","_nodeVersion":"12.16.2","_npmVersion":"6.14.4","dist":{"shasum":"ea8878bbb0156ce977ffe275370b3851ef1181d6","size":2482,"noattachment":false,"key":"/codecs/-/codecs-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/codecs/download/codecs-2.1.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/codecs_2.1.0_1588339527587_0.8886120717151078"},"_hasShrinkwrap":false,"publish_time":1588339527741,"_cnpm_publish_time":1588339527741},"2.0.0":{"name":"codecs","version":"2.0.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":"8e474d39b5449f479940904d0b623c788135ddc1","_id":"codecs@2.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.1","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"680d1d4ac8ac3c8adbaa625c7ce06c6ee5792b50","size":2404,"noattachment":false,"key":"/codecs/-/codecs-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/codecs/download/codecs-2.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/codecs_2.0.0_1552660707699_0.3487675780054098"},"_hasShrinkwrap":false,"publish_time":1552660707818,"_cnpm_publish_time":1552660707818},"1.2.1":{"name":"codecs","version":"1.2.1","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":"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":"dc31db020744f7513e19a6df993238ad4ea040b3","_id":"codecs@1.2.1","_npmVersion":"5.6.0","_nodeVersion":"9.7.1","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"10155c751578919883bd87e425db04af86a0188c","size":2470,"noattachment":false,"key":"/codecs/-/codecs-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/codecs/download/codecs-1.2.1.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/codecs_1.2.1_1520726941893_0.1678146896009587"},"_hasShrinkwrap":false,"publish_time":1520726941939,"_cnpm_publish_time":1520726941939},"1.2.0":{"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","size":2488,"noattachment":false,"key":"/codecs/-/codecs-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/codecs/download/codecs-1.2.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/codecs-1.2.0.tgz_1479869438730_0.5935322807636112"},"directories":{},"publish_time":1479869439080,"_cnpm_publish_time":1479869439080,"_hasShrinkwrap":false},"1.1.0":{"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","size":2348,"noattachment":false,"key":"/codecs/-/codecs-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/codecs/download/codecs-1.1.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/codecs-1.1.0.tgz_1479854492658_0.8161561207380146"},"directories":{},"publish_time":1479854494372,"_cnpm_publish_time":1479854494372,"_hasShrinkwrap":false},"1.0.0":{"name":"codecs","version":"1.0.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":"95af36ea0198771ae9d1f9f3e92575b0da503f1c","_id":"codecs@1.0.0","_shasum":"3c7282b746aa8f21f901270569322f737e71b537","_from":".","_npmVersion":"2.15.11","_nodeVersion":"4.6.2","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"3c7282b746aa8f21f901270569322f737e71b537","size":2130,"noattachment":false,"key":"/codecs/-/codecs-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/codecs/download/codecs-1.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/codecs-1.0.0.tgz_1479853238275_0.267765881260857"},"directories":{},"publish_time":1479853240208,"_cnpm_publish_time":1479853240208,"_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\n[![Build Status](https://github.com/mafintosh/codecs/workflows/Build%20Status/badge.svg)](https://github.com/mafintosh/codecs/actions?query=workflow%3A%22Build+Status%22)\n\nUseful to support value encodings similar to leveldb's.\n\n## Usage\n\n``` js\nvar codecs = require('codecs')\nvar json = codecs('json')\n\nconsole.log(json.encode({hello: 'world'})) // new Buffer('{\"hello\":\"world\"}')\nconsole.log(json.decode(new Buffer('{\"hello\":\"world\"}'))) // {hello: 'world'}\n```\n\n## API\n\n#### `var 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.\n\n#### `var buf = codec.encode(value)`\n\nEncode a value to a buffer.\n\n#### `var value = codec.decode(buf)`\n\nDecode a buffer to a value.\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/mafintosh/codecs","bugs":{"url":"https://github.com/mafintosh/codecs/issues"},"license":"MIT"}