node-stratum-pool/node_modules/buffertools/package.json
Matthew Little b8d8f88296 updated
2014-01-06 20:04:56 -05:00

58 lines
6.4 KiB
JSON

{
"name": "buffertools",
"main": "buffertools",
"version": "2.0.0",
"keywords": [
"buffer",
"buffers"
],
"description": "Working with node.js buffers made easy.",
"homepage": "https://github.com/bnoordhuis/node-buffertools",
"author": {
"name": "Ben Noordhuis",
"email": "info@bnoordhuis.nl",
"url": "http://bnoordhuis.nl/"
},
"repository": {
"type": "git",
"url": "https://github.com/bnoordhuis/node-buffertools.git"
},
"engines": {
"node": ">=0.3.0"
},
"license": "ISC",
"readmeFilename": "README.md",
"scripts": {
"install": "node-gyp rebuild"
},
"gypfile": true,
"readme": "# node-buffertools\n\nUtilities for manipulating buffers.\n\n## Installing the module\n\nEasy! With [npm](http://npmjs.org/):\n\n\tnpm install buffertools\n\nFrom source:\n\n\tnode-gyp configure\n\tnode-gyp build\n\nNow you can include the module in your project.\n\n\trequire('buffertools').extend(); // extend Buffer.prototype\n\tvar buf = new Buffer(42); // create a 42 byte buffer\n\tbuf.clear(); // clear it!\n\nIf you don't want to extend the Buffer class's prototype (recommended):\n\n\tvar buffertools = require('buffertools');\n\tvar buf = new Buffer(42);\n\tbuffertools.clear(buf);\n\n## Methods\n\nNote that most methods that take a buffer as an argument, will also accept a string.\n\n### buffertools.extend([object], [object...])\n\nExtend the arguments with the buffertools methods. If called without arguments,\ndefaults to `[Buffer.prototype, SlowBuffer.prototype]`. Extending prototypes\nonly makes sense for classes that derive from `Buffer`.\n\nbuffertools v1.x extended the `Buffer` prototype by default. In v2.x, it is\nopt-in. The reason for that is that buffertools was originally developed for\nnode.js v0.3 (or maybe v0.2, I don't remember exactly when buffers were added)\nwhere the `Buffer` class was devoid of any useful methods. Over the years, it\nhas grown a number of utility methods, some of which conflict with the\nbuffertools methods of the same name, like `Buffer#fill()`.\n\n### Buffer#clear()\n### buffertools.clear(buffer)\n\nClear the buffer. This is equivalent to `Buffer#fill(0)`.\nReturns the buffer object so you can chain method calls.\n\n### Buffer#compare(buffer|string)\n### buffertools.compare(buffer, buffer|string)\n\nLexicographically compare two buffers. Returns a number less than zero\nif a < b, zero if a == b or greater than zero if a > b.\n\nBuffers are considered equal when they are of the same length and contain\nthe same binary data.\n\nSmaller buffers are considered to be less than larger ones. Some buffers\nfind this hurtful.\n\n### Buffer#concat(a, b, c, ...)\n### buffertools.concat(a, b, c, ...)\n\nConcatenate two or more buffers/strings and return the result. Example:\n\n\t// identical to new Buffer('foobarbaz')\n\ta = new Buffer('foo');\n\tb = new Buffer('bar');\n\tc = a.concat(b, 'baz');\n\tconsole.log(a, b, c); // \"foo bar foobarbaz\"\n\n\t// static variant\n\tbuffertools.concat('foo', new Buffer('bar'), 'baz');\n\n### Buffer#equals(buffer|string)\n### buffertools.equals(buffer, buffer|string)\n\nReturns true if this buffer equals the argument, false otherwise.\n\nBuffers are considered equal when they are of the same length and contain\nthe same binary data.\n\nCaveat emptor: If your buffers contain strings with different character encodings,\nthey will most likely *not* be equal.\n\n### Buffer#fill(integer|string|buffer)\n### buffertools.fill(buffer, integer|string|buffer)\n\nFill the buffer (repeatedly if necessary) with the argument.\nReturns the buffer object so you can chain method calls.\n\n### Buffer#fromHex()\n### buffertools.fromHex(buffer)\n\nAssumes this buffer contains hexadecimal data (packed, no whitespace)\nand decodes it into binary data. Returns a new buffer with the decoded\ncontent. Throws an exception if non-hexadecimal data is encountered.\n\n### Buffer#indexOf(buffer|string, [start=0])\n### buffertools.indexOf(buffer, buffer|string, [start=0])\n\nSearch this buffer for the first occurrence of the argument, starting at\noffset `start`. Returns the zero-based index or -1 if there is no match.\n\n### Buffer#reverse()\n### buffertools.reverse(buffer)\n\nReverse the content of the buffer in place. Example:\n\n\tb = new Buffer('live');\n\tb.reverse();\n\tconsole.log(b); // \"evil\"\n\n### Buffer#toHex()\n### buffertools.toHex(buffer)\n\nReturns the contents of this buffer encoded as a hexadecimal string.\n\n## Classes\n\nSingular, actually. To wit:\n\n## WritableBufferStream\n\nThis is a regular node.js [writable stream](http://nodejs.org/docs/v0.3.4/api/streams.html#writable_Stream)\nthat accumulates the data it receives into a buffer.\n\nExample usage:\n\n\t// slurp stdin into a buffer\n\tprocess.stdin.resume();\n\tostream = new WritableBufferStream();\n\tutil.pump(process.stdin, ostream);\n\tconsole.log(ostream.getBuffer());\n\nThe stream never emits 'error' or 'drain' events.\n\n### WritableBufferStream.getBuffer()\n\nReturn the data accumulated so far as a buffer.\n\n## TODO\n\n* Logical operations on buffers (AND, OR, XOR).\n* Add lastIndexOf() functions.\n\n## License\n\nCopyright (c) 2010, Ben Noordhuis <info@bnoordhuis.nl>\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted, provided that the above\ncopyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\nWITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\nANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\nWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\nACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\nOR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n",
"contributors": [
{
"name": "Ben Noordhuis",
"email": "info@bnoordhuis.nl"
},
{
"name": "Stefan Thomas",
"email": "justmoon@members.fsf.org"
},
{
"name": "Nathan Rajlich",
"email": "nathan@tootallnate.net"
},
{
"name": "Dane Springmeyer",
"email": "dane@dbsgeo.com"
},
{
"name": "Barret Schloerke",
"email": "schloerke@gmail.com"
}
],
"bugs": {
"url": "https://github.com/bnoordhuis/node-buffertools/issues"
},
"_id": "buffertools@2.0.0",
"_from": "buffertools@"
}