{"_id":"bser@2.1.2","bugs":{"url":"https://github.com/facebook/watchman/issues"},"dist":{"shasum":"3052372d49a1bc2a25e68c267697af5e823e147a","tarball":"http://registry-npm.ywwl.com/bser/download/bser-2.1.2.tgz","fileCount":4,"integrity":"sha512-V2o8YS2EhrKMO9AumnkK0ynynfFlsajpYupwq7S46H5mhcanwxDkNTw3K67wPIcKTH1ffkA4vhMOtAc7gRmPZw==","signatures":[{"sig":"MEUCIF5B0zrqqQVOlKQs8j6R1zT5gkTFy0EMKaHGBr3/fHCTAiEA0UXJfLT4tOua20Qo1rDUlu2A8ydwUevYs2uwW1RovLU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIA9WDdZjL6bqtWacIqx9EtKmS2sCkxAcmuKTT9NP0OeWAiBPYHmpWcKYHKniYH21xOnda69ZmPiSDDPvk2PrnZTYJA=="}],"unpackedSize":19168,"size":6196,"noattachment":false,"key":"/bser/-/bser-2.1.2.tgz"},"main":"index.js","name":"bser","author":{"url":"http://wezfurlong.org","name":"Wez Furlong","email":"wez@fb.com"},"license":"MIT","scripts":{"test":"node test/bser.js"},"version":"2.1.2","_npmUser":{"name":"fb-watchman","email":"source_control@meta.com"},"homepage":"https://facebook.github.io/watchman/docs/bser.html","keywords":["bser","binary","protocol"],"repository":{"url":"git+https://github.com/facebook/watchman.git","type":"git"},"_npmVersion":"11.16.0","description":"JavaScript implementation of the BSER Binary Serialization","directories":{"test":"test"},"maintainers":[{"name":"wez","email":"wez@wezfurlong.org"},{"name":"kassens","email":"jkassens@fb.com"},{"name":"fb-watchman","email":"source_control@meta.com"}],"_nodeVersion":"24.18.1","dependencies":{"node-int64":"^0.4.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/bser_2.1.2_1791566982547_0.5932357468516714"},"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":1791566982631,"_cnpm_publish_time":1791566982631,"dist-tags":{"latest":"2.1.2"}}