{"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":{"integrity":"sha512-WXvpJRAgc693oqYvZte9uYEiL5YHtfrxyEq12uVny9oBJ1k37zSva5vVz7trsnt6R9Y15hEgOSC7VFZT2pfYnA==","shasum":"680d1d4ac8ac3c8adbaa625c7ce06c6ee5792b50","tarball":"http://registry-npm.ywwl.com/codecs/download/codecs-2.0.0.tgz","fileCount":6,"unpackedSize":5597,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJci7jkCRA9TVsSAnZWagAA1UYQAJE8k7NM2P75j2EQtdmF\ne3CAe/u+8Sl3c2bh7lpPS25LcehCm4GeGZts/9IDXk7o+ZKWTMXVxYf4sjDu\nMHYfyYvxyi6Waudpv2yYfA0zjuI4Zuevw4yqr2W4AXV0PT74e21B34PLVIsy\n8cTY01lUps1gk0mNh57UojE/4H81zJ81LLkan76gWNup9jMpE2hmNE4w68by\n6qZ6HeLg6psu/Mac+R7zqxiVxvypT4EcxbxiBx5wxRj+XVWcd/t6GIYK0GfE\nA+OV6sVI8PJO6gf+ds9PDrJr71uuq7DHiIcqUDpGde6Gfe1rpTvYGHn7+UNV\nTMjFkLcRvQvtq+pCB/4rHOmuN4cZe6c3AcoQag++gXxxamwJuK4QH/EKGQXX\nZv6y8T1sPEMqG69polHv3YXGqD3xmN3ezT07xkBtWvXxHf0jgttf2LkQS5Zx\nLdFD/v3WY083WlpaB9EQ5WXQAltg565fs9Cht/odR6lg8mxbfu2IxfeUlUJf\nuPDsDwK2O4/jnvaLpARnWtlg8pV41YUihYjrwwCSKnrAxTJC65NqQfMHSKP3\nX6S3+oc73t6jvRSs/06fuFfCTSe0bpmW36Mf+icoOxbuE8//yxhF9E9NIbRV\nVLWVFF+/3JIm1YcGzvp81LCPlJKBv0aaWTWbj+5nCxedsds+J40eTEenjiSp\ntxg6\r\n=8d9e\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF+OGSnXKSC1Sx3uukqd5ohuJjHi5l5usw29/p9GsbyJAiBs9AJVow7w9W+gWC4Sp5Gh/8RfmMaEY5YVCrgMC8k9FQ=="}],"size":2404,"noattachment":false,"key":"/codecs/-/codecs-2.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/codecs_2.0.0_1552660707699_0.3487675780054098"},"_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":1552660707818,"_cnpm_publish_time":1552660707818,"dist-tags":{"latest":"3.1.0"}}