{"name":"bufio","version":"1.2.2","keywords":["buffer","serialization"],"author":{"name":"Christopher Jeffrey","email":"chjjeffrey@gmail.com"},"license":"MIT","_id":"bufio@1.2.2","maintainers":[{"name":"chjj","email":"chjjeffrey@gmail.com"},{"name":"nodweber","email":"nodar.chkuaselidze@gmail.com"},{"name":"pinheadmz","email":"pinheadmz@gmail.com"}],"homepage":"https://github.com/bcoin-org/bufio","bugs":{"url":"https://github.com/bcoin-org/bufio/issues"},"dist":{"shasum":"60a1b21e176cc9d432d4a6c52a01312e735d1753","tarball":"http://registry-npm.ywwl.com/bufio/download/bufio-1.2.2.tgz","fileCount":14,"integrity":"sha512-sTsA0ka7sjge/bGUfjk00O/8kNfyeAvJjXXeyvgbXefIrf5GTp99W71qfmCP6FGHWbr4A0IjjM7dFj6bHXVMlw==","signatures":[{"sig":"MEYCIQCWeP1vtvGJuKI7nyuilWlZ3062Vt/M91JWSGPrtnqd0AIhAKOYUR7GX2TJNkhj5r42UPMluyctZXEGr14ir5N174Mz","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":113606,"size":15577,"noattachment":false,"key":"/bufio/-/bufio-1.2.2.tgz"},"main":"./lib/bufio.js","browser":{"./lib/custom":"./lib/custom-browser.js"},"engines":{"node":">=14.0.0"},"gitHead":"67aa9e5533d965cb8e57eaa2512e5861e885144d","scripts":{"lint":"eslint lib/ test/","test":"bmocha --reporter spec test/*-test.js","lint-types":"tsc -p ."},"_npmUser":{"name":"nodweber","email":"nodar.chkuaselidze@gmail.com"},"repository":{"url":"git://github.com/bcoin-org/bufio.git","type":"git"},"_npmVersion":"9.6.6","description":"Buffer and serialization utilities for javascript","directories":{},"_nodeVersion":"20.2.0","_hasShrinkwrap":false,"devDependencies":{"bmocha":"^2.1.0","bts-type-deps":"^0.0.3"},"_npmOperationalInternal":{"tmp":"tmp/bufio_1.2.2_1727862861680_0.33051193845141813","host":"s3://npm-registry-packages"},"readme":"# bufio\n\nBuffer and serialization utilities for javascript.\n\n## Usage\n\n``` js\nconst assert = require('assert');\nconst bio = require('bufio');\n\nconst bw = bio.write();\nbw.writeU64(100);\nbw.writeString('foo');\nconst data = bw.render();\n\nconst br = bio.read(data);\nassert(br.readU64() === 100);\nassert(br.readString(3) === 'foo');\n```\n\n## Struct Usage\n\n``` js\nconst bio = require('bufio');\n\nclass MyStruct extends bio.Struct {\n  constructor() {\n    super();\n    this.str = 'hello';\n    this.value = 0;\n  }\n\n  write(bw) {\n    bw.writeVarString(this.str, 'ascii');\n    bw.writeU64(this.value);\n    return this;\n  }\n\n  read(br) {\n    this.str = br.readVarString('ascii');\n    this.value = br.readU64();\n    return this;\n  }\n}\n\nconst obj = new MyStruct();\n\nconsole.log('Buffer:');\nconsole.log(obj.encode());\n\nconsole.log('Decoded:');\nconsole.log(MyStruct.decode(obj.encode()));\n\nconsole.log('Hex:');\nconsole.log(obj.toHex());\n\nconsole.log('Decoded:');\nconsole.log(MyStruct.fromHex(obj.toHex()));\n\nconsole.log('Base64:');\nconsole.log(obj.toBase64());\n```\n\n## Contribution and License Agreement\n\nIf you contribute code to this project, you are implicitly allowing your code\nto be distributed under the MIT license. You are also implicitly verifying that\nall code is your original work. `</legalese>`\n\n## License\n\n- Copyright (c) 2017, Christopher Jeffrey (MIT License).\n\nSee LICENSE for more info.\n","publish_time":1727862861854,"_cnpm_publish_time":1727862861854,"dist-tags":{"latest":"1.2.3"}}