{"name":"codecs","version":"3.1.0","description":"Create an binary encoder/decoder for json, utf-8 or custom types","main":"index.js","dependencies":{"b4a":"^1.6.3"},"devDependencies":{"brittle":"^3.2.1","compact-encoding":"^2.11.0","standard":"^17.0.0"},"scripts":{"test":"standard && brittle 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":"9ee152e3125b1c65f72c0027641f2e5f14bd2e28","_id":"codecs@3.1.0","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-Dqx8NwvBvnMeuPQdVKy/XEF71igjR5apxBvCGeV0pP1tXadOiaLvDTXt7xh+/5wI1ASB195mXQGJbw3Ml4YDWQ==","shasum":"34509aea31c34985b91aed07edbc3ff233b61f6e","tarball":"http://registry-npm.ywwl.com/codecs/download/codecs-3.1.0.tgz","fileCount":6,"unpackedSize":8030,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICOADv6yuLVvIHiYMZa2LcFP0ku0whyc4SJq4CaMoFAoAiAkAM71Q/mkp6hie1EKita5KPBQmcljfgWkvb3EoPNA2A=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkNTS6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr/WBAAi6YKXJr17CHmIzGaKFscpVRUlWIxELxrSU0LMXo84/DAh7Io\r\nfO5LVXDbvsPOTHwAlff/jagOk/YcECTTUJfSS5TfLUQny5f6xcH9Lct7u0Hf\r\n55wjvgvjWcv8Ji6Fu1+8h4P/ZpS28NZAAx1TF4DT7hrI3UNU+Z/0AgY3jpwN\r\nW8soiUvy4W3Pn/4vthdue5vlAmMlD3jPWUQgemtuzqyXDmb2ZciylguEENIM\r\nacd8D0Pk1EcI4rr9MEgzxpOGRTDKN9HggFEUYJei31Rn0hkp3jNFsETdbSWu\r\nAne5Gda0dJQHej7DWpty7WLx6gd79uuobREzjj5xNFoSo+kzDTWUMsoxNHu6\r\nZ8SNRtaJuWG0GVNe5us5XEbXkbajXp2elBEc3UUkrO5HnK0Qhtx9xvNJGyo3\r\npKkKpow3eerzvPGTGrszMh56oU6oUupWUWhcJedY4bY9NkcnzzLVweQU3gM9\r\ndFPhVqi4N6ggraPCDzMib/lC4st3GUtzREa6ahhjtghwevD2zZWdw4VlJWOt\r\nGfFlHXbhAxaFYk/8Yz8oyZj3deVJJaIURz0an/krY4rIoSKo5ND5Z7ySja8S\r\n0UOBSr45fEyEOL4/jmzcU1MvuJt57zotrd+WnbrOJq/+d2wEkzMUAjeOjY+J\r\nmpkWz9puPYBswPxwrGpW2v4fGRDUA4AXpDQ=\r\n=pkRr\r\n-----END PGP SIGNATURE-----\r\n","size":3113,"noattachment":false,"key":"/codecs/-/codecs-3.1.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.1.0_1681208506075_0.0357192166807232"},"_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":1681208506230,"_cnpm_publish_time":1681208506230,"dist-tags":{"latest":"3.1.0"}}