{"_id":"buffer-more-ints","_rev":"250903","name":"buffer-more-ints","description":"Add support for more integer widths to Buffer","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"dwragg","email":"david@wragg.org"}],"time":{"modified":"2021-06-03T16:13:28.000Z","created":"2012-09-24T21:00:01.433Z","1.0.0":"2018-04-01T07:39:36.698Z","0.0.2":"2013-10-09T08:00:11.218Z","0.0.1":"2012-09-24T21:00:01.433Z"},"users":{},"author":{"name":"David Wragg","email":"david@wragg.org"},"repository":{"type":"git","url":"git+https://github.com/dpw/node-buffer-more-ints.git"},"versions":{"1.0.0":{"name":"buffer-more-ints","version":"1.0.0","author":{"name":"David Wragg","email":"david@wragg.org"},"description":"Add support for more integer widths to Buffer","homepage":"https://github.com/dpw/node-buffer-more-ints","license":"MIT","repository":{"type":"git","url":"git+https://github.com/dpw/node-buffer-more-ints.git"},"main":"buffer-more-ints.js","devDependencies":{"nodeunit":""},"scripts":{"test":"node ./node_modules/nodeunit/bin/nodeunit buffer-more-ints-tests.js"},"gitHead":"b9da8e1dcb666c313127fe6ce7549f043bab230a","bugs":{"url":"https://github.com/dpw/node-buffer-more-ints/issues"},"_id":"buffer-more-ints@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.11.1","_npmUser":{"name":"dwragg","email":"david@wragg.org"},"dist":{"shasum":"ef4f8e2dddbad429ed3828a9c55d44f05c611422","size":5668,"noattachment":false,"key":"/buffer-more-ints/-/buffer-more-ints-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/buffer-more-ints/download/buffer-more-ints-1.0.0.tgz"},"maintainers":[{"name":"dwragg","email":"david@wragg.org"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/buffer-more-ints_1.0.0_1522568376612_0.9176015388968026"},"_hasShrinkwrap":false,"publish_time":1522568376698,"_cnpm_publish_time":1522568376698},"0.0.2":{"name":"buffer-more-ints","version":"0.0.2","author":{"name":"David Wragg","email":"david@wragg.org"},"description":"Add support for more integer widths to Buffer","homepage":"https://github.com/dpw/node-buffer-more-ints","repository":{"type":"git","url":"https://github.com/dpw/node-buffer-more-ints.git"},"main":"buffer-more-ints.js","devDependencies":{"nodeunit":""},"scripts":{"test":"node ./node_modules/nodeunit/bin/nodeunit buffer-more-ints-tests.js"},"readmeFilename":"README.md","bugs":{"url":"https://github.com/dpw/node-buffer-more-ints/issues"},"_id":"buffer-more-ints@0.0.2","dist":{"shasum":"26b3885d10fa13db7fc01aae3aab870199e0124c","size":5747,"noattachment":false,"key":"/buffer-more-ints/-/buffer-more-ints-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/buffer-more-ints/download/buffer-more-ints-0.0.2.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"dwragg","email":"david@wragg.org"},"maintainers":[{"name":"dwragg","email":"david@wragg.org"}],"directories":{},"publish_time":1381305611218,"_cnpm_publish_time":1381305611218,"_hasShrinkwrap":false},"0.0.1":{"name":"buffer-more-ints","version":"0.0.1","author":{"name":"David Wragg","email":"david@wragg.org"},"description":"Add support for more integer widths to Buffer","homepage":"https://github.com/dpw/node-buffer-more-ints","repository":{"type":"git","url":"https://github.com/dpw/node-buffer-more-ints.git"},"main":"buffer-more-ints.js","devDependencies":{"nodeunit":""},"scripts":{"test":"node ./node_modules/nodeunit/bin/nodeunit buffer-more-ints-tests.js"},"_id":"buffer-more-ints@0.0.1","dist":{"shasum":"be1f59ffd646ce148f6f5b8c8e223270af6912a5","size":4994,"noattachment":false,"key":"/buffer-more-ints/-/buffer-more-ints-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/buffer-more-ints/download/buffer-more-ints-0.0.1.tgz"},"_npmVersion":"1.1.61","_npmUser":{"name":"dwragg","email":"david@wragg.org"},"maintainers":[{"name":"dwragg","email":"david@wragg.org"}],"directories":{},"publish_time":1348520401433,"_cnpm_publish_time":1348520401433,"_hasShrinkwrap":false}},"readme":"# buffer-more-ints: Add support for more integer widths to Buffer\n\n[![Build Status](https://travis-ci.org/dpw/node-buffer-more-ints.png)](https://travis-ci.org/dpw/node-buffer-more-ints)\n\nNode's Buffer only supports reading and writing integers of a limited\nrange of widths.  This module provides support for more widths, so\nthat integers from 1 to 8 bytes (64 bits) can be accessed.  The\nsupport takes two forms. Firstly, as stand-alone functions similar to\nthe integer reading/writing methods of Buffer:\n\n    $ node\n    > var moreints = require('buffer-more-ints')\n    undefined\n    > moreints.readInt64BE(new Buffer(\"0000deadbeef0000\", \"hex\"), 0).toString(16)\n    'deadbeef0000'\n\nRead and write functions for the regular widths (8, 16, 32) are also\npresent in this module, for consistency.\n\nThe second form is methods patched into `Buffer.prototype`, installed\nby requiring `'buffer-more-ints/polyfill'`:\n\n    $ node\n    > require('buffer-more-ints/polyfill')\n    {}\n    > new Buffer(\"0000deadbeef0000\", \"hex\").readInt64BE(0).toString(16)\n    'deadbeef0000'\n\nbuffer-more-ints/polyfill also adds methods `readIntBE`, `writeIntBE`,\nand their LE and UInt counterparts, which take an initial argument\ngiving the width of the integer in bytes:\n\n    > var b = new Buffer(3);\n    > b.writeIntLE(3, -123456, 0);\n    > b.toString('hex')\n    'c01dfe'\n    > b.readIntLE(3, 0);\n    -123456\n\nThe functions added by buffer-more-ints are all implemented in terms\nof the core Buffer functions.  Part way through writing the code, I\ndiscovered that node.js currently implements those in JavaScript, so\nthis doesn't lead to performance benefits.  But should node ever\nswitch to implementing its Buffer operations natively, this\nmodule should get a speed boost.\n\n## Limitations\n\nAs JavaScript uses IEEE754 doubles for numbers, the contiguous range\nof integers it can represent is [-2^53 - 1, 2^53 - 1].  So only\ninteger widths up to 6 bytes or 48 bits can be read exactly.  Reads of\n7 or 8 bytes (56 or 64 bits) will return the closest value that can be\nrepresented as a JavaScript number.\n\nIn certain situations it might be important to check that a JavaScript\nnumber was read exactly.  The `isContiguousInt` or\n`Buffer.isContiguousInt` (polyfill) function will determine this:\n\n    > Buffer.isContiguousInt(0x1fffffffffffff);\n    true\n    > Buffer.isContiguousInt(0x20000000000000);\n    false\n\nAnd `assertContiguousInt` asserts that a number is so:\n\n    > Buffer.assertContiguousInt(0x1fffffffffffff);\n    undefined\n    > Buffer.assertContiguousInt(0x20000000000000);\n    AssertionError: number cannot be represented as a contiguous integer\n","_attachments":{},"homepage":"https://github.com/dpw/node-buffer-more-ints","bugs":{"url":"https://github.com/dpw/node-buffer-more-ints/issues"},"license":"MIT"}