{"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":{"integrity":"sha512-tYnev/H2/q+dedb6/sDDvJLwzD2GqYIe8d7fKnyM2KxUKJ3xf/D7xG0nO/4WCT1yU1HQTvTq1o43QSQGmHcEmA==","shasum":"bbb37610c904263ea949f8da6a182b8fc4cc24fc","tarball":"http://registry-npm.ywwl.com/codecs/download/codecs-3.0.0.tgz","fileCount":6,"unpackedSize":7127,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhm3v5CRA9TVsSAnZWagAALtEP/3tGfDFaDfNOp2QWvod8\nNDSnHDZmRVhCx2qSkcs6cZmCf8iMwTsxQcy5u5LFz2niIsrxodP2zvfIQJln\n6z+kJUs1yYXQo6KSrI8cMXImwyc9tz0iIi5NKD3X6/hR0nBBxkE5PFaJYw0r\nvnIQo/6Iv37dw2SqqO2kxtNqMga7kw3euMMCxIJH7N5d6pdbaGPw+jiv8s7v\ns+emX2prDgvAX9MVdkKdqyZ5bl74tisET8ifttc25WBXFL6Yldxx7v5Ia+5f\nIsAd6z8Wi5NeDrTqp6YiCidQl4x5h+mt48+w3TUkdvg4Mf8uXM967oE/wWJa\nV95MTinD9Q0hnvb/YJ6rpHJNoqlVoWRJ/Xr7NWfmkb7QZzqqlczRIPOdB13X\nzIlEdECrO0tSI2ygkZ9fof5miP3FAHWp68GdLxefkj4uPnoi7SxK64ArVATL\nW42DA0M+d5/tNemt9KGVtkX/AMxG5gw0y290d9u2YqRJV/jTjo0N1uuj8Hrv\nooxiYBx0ZB+RWHD1pXa+cdtCh73u24NrXOns1vUTUhGV2b1oFltjMu00VAqn\nbgu0fh3xzokBy6qmQ5U2zsHHyUsLSbEIC3M7Pu18LsBlbaX8qiBgVyR8aQ5o\nxC9xV/WFj90GEmidABX9zgsQwePLoGxvZ06WJomZPP3AuALRtZFe+d3iJvxk\nSHeS\r\n=3faw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCCoguvn2RcrXqK/ZyeG8p7ahbGd9N6TjaQUuGe/KkfogIgWqW4j51xH/9S2lny++yUaDLTXOgJWovN7dElLzskLXc="}],"size":2913,"noattachment":false,"key":"/codecs/-/codecs-3.0.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_3.0.0_1637579769724_0.8466010380856013"},"_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":1637579769864,"_cnpm_publish_time":1637579769864,"dist-tags":{"latest":"3.1.0"}}