{"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":{"integrity":"sha512-nSWYToViFEpZXOxhtMQ6IDs76TN9xKIkHOu1KCr/iFiBcgzKuY1AFPZktuXN8r82FbZ/TXP9fwITszLgcp3eQg==","shasum":"ea8878bbb0156ce977ffe275370b3851ef1181d6","tarball":"http://registry-npm.ywwl.com/codecs/download/codecs-2.1.0.tgz","fileCount":6,"unpackedSize":5883,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJerCNICRA9TVsSAnZWagAAAlIP/33gK7caPbsuDOnRUcqp\nayKxRgboInw4HEzGawDwXcPrpxyrrPdzgiSKoEA6Y0UeoWpHyaBcdD8nMtE8\nuoM+ks30+jzhTKSnaCasBfoT66Mne11fQzKyOMgcffje7gYFOJtDEtoLt5Fx\nL4tdUQZCBBY1zAnhCNlu1MEk2AvUQcZItIJRCcZ4JKmiKk7avdazM5aMYJup\nHR1RIXRnbrZP+4Qtp7V4cA6DrFVecM6WYT6GBEGmE7K/OSjxUf1z+ezJd2Dn\nSS6AWVfhpRsxpEgcYg3GZOrFzfoYh0q5HKriTZtxIE/g3UzZ3HtTDudPcdt4\ncx33bIzsuvMnnapNixTAnr4Can+0JRVX8+r1IkZSZGDhqHXrw90nPGynANnF\n2aTV8pVBST0m5FIt2BqYIu8gk1B2WP2Av50s419Q3dfwyuzJt0plTkSKB3sH\ni9oPyl9RQnvmFVLs7sUksX5gP3kHy4fFee2b4R8GkT3AwpjWyJnyH+JZmi3c\nC5NTUlPQhm6wYsc6JlZ+8QicCYBimGbFqP+eOhUxF5EC3PeWAvrSnjMPl5im\nAZ54/BAu/up1m5TDtr1bBEPREMcy3WR2bumjDv6Ay+8FBxj6WND32KaRC1u7\n4elfTIHBcPkmdycw3RsXP5Z/UQgX4hV5E/SGydSso0L8rzxVg4DqAFVseWFz\nPWKU\r\n=cbqo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDNuSxFa0z8uROSBkPEjAGdyiVZ8JO1N/XQbW8LbGa4egIhALTE95sAe9DrX6W/Y13a0QEtM5tMd2J80ce/BvjjISK9"}],"size":2482,"noattachment":false,"key":"/codecs/-/codecs-2.1.0.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_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,"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":1588339527741,"_cnpm_publish_time":1588339527741,"dist-tags":{"latest":"3.1.0"}}