{"name":"bser","version":"1.0.0","description":"JavaScript implementation of the BSER Binary Protocol","main":"index.js","directories":{"test":"test"},"scripts":{"test":"node test/bser.js"},"repository":{"type":"git","url":"https://github.com/facebook/bser.js"},"keywords":["bser","binary","protocol"],"author":{"name":"wez"},"license":"BSD-2-Clause","bugs":{"url":"https://github.com/facebook/bser.js/issues"},"homepage":"https://github.com/facebook/bser.js","dependencies":{"node-int64":"^0.4.0"},"gitHead":"57f16766487a5d6976aa8105afa25fcc1bf27e35","_id":"bser@1.0.0","_shasum":"380ce5c7c2efe37723eb6cbe0a4ad871e7119d01","_from":".","_npmVersion":"2.13.3","_nodeVersion":"3.0.0","_npmUser":{"name":"amasad","email":"amjad.masad@gmail.com"},"maintainers":[{"name":"amasad","email":"amjad.masad@gmail.com"}],"dist":{"shasum":"380ce5c7c2efe37723eb6cbe0a4ad871e7119d01","tarball":"http://registry-npm.ywwl.com/bser/download/bser-1.0.0.tgz","integrity":"sha512-En9IdPCGaRdc5sU6pZsWHGzLN8I2Wfe3lywSgnoFCDrufEEVNCNFge24mTXgbLTCtL+6VBvV/QP1zjUm7KA5zA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDIaHmfU5PfgvJsoy6ppmhUnzCu3uQA/ks/53hjyTmUZgIhAJ8mtVO96bqKrTowQRMdU0JyE31SnyjSLlcGV0c2Gdyv"}],"size":8334,"noattachment":false,"key":"/bser/-/bser-1.0.0.tgz"},"readme":"# BSER Binary Serialization\n\nBSER is a binary serialization scheme that can be used as an alternative to JSON.\nBSER uses a framed encoding that makes it simpler to use to stream a sequence of\nencoded values.\n\nIt is intended to be used for local-IPC only and strings are represented as binary\nwith no specific encoding; this matches the convention employed by most operating\nsystem filename storage.\n\nFor more details about the serialization scheme see\n[Watchman's docs](https://facebook.github.io/watchman/docs/bser.html).\n\n## API\n\n```js\nvar bser = require('bser');\n```\n\n### bser.loadFromBuffer\n\nThe is the synchronous decoder; given an input string or buffer,\ndecodes a single value and returns it.  Throws an error if the\ninput is invalid.\n\n```js\nvar obj = bser.loadFromBuffer(buf);\n```\n\n### bser.dumpToBuffer\n\nSynchronously encodes a value as BSER.\n\n```js\nvar encoded = bser.dumpToBuffer(['hello']);\nconsole.log(bser.loadFromBuffer(encoded)); // ['hello']\n```\n\n### BunserBuf\n\nThe asynchronous decoder API is implemented in the BunserBuf object.\nYou may incrementally append data to this object and it will emit the\ndecoded values via its `value` event.\n\n```js\nvar bunser = new bser.BunserBuf();\n\nbunser.on('value', function(obj) {\n  console.log(obj);\n});\n```\n\nThen in your socket `data` event:\n\n```js\nbunser.append(buf);\n```\n\n## Example\n\nRead BSER from socket:\n\n```js\nvar bunser = new bser.BunserBuf();\n\nbunser.on('value', function(obj) {\n  console.log('data from socket', obj);\n});\n\nvar socket = net.connect('/socket');\n\nsocket.on('data', function(buf) {\n  bunser.append(buf);\n});\n```\n\nWrite BSER to socket:\n\n```js\nsocket.write(bser.dumpToBuffer(obj));\n```\n","publish_time":1440397914849,"_cnpm_publish_time":1440397914849,"dist-tags":{"latest":"2.1.2"}}