{"_id":"buffer-writer","_rev":"82554","name":"buffer-writer","description":"a fast, efficient buffer writer","dist-tags":{"latest":"2.0.0"},"maintainers":[{"name":"brianc","email":"brian.m.carlson@gmail.com"},{"name":"linusu","email":""}],"time":{"modified":"2021-06-03T10:26:19.000Z","created":"2013-12-12T23:32:53.677Z","2.0.0":"2018-11-07T14:17:24.372Z","1.0.1":"2016-02-15T16:43:38.108Z","1.0.0":"2013-12-12T23:32:53.677Z"},"users":{},"author":{"name":"Brian M. Carlson"},"repository":{"type":"git","url":"git://github.com/brianc/node-buffer-writer.git"},"versions":{"2.0.0":{"name":"buffer-writer","version":"2.0.0","description":"a fast, efficient buffer writer","main":"index.js","scripts":{"test":"mocha --throw-deprecation"},"repository":{"type":"git","url":"git://github.com/brianc/node-buffer-writer.git"},"keywords":["buffer","writer","builder"],"author":{"name":"Brian M. Carlson"},"license":"MIT","devDependencies":{"mocha":"5.2.0"},"engines":{"node":">=4"},"gitHead":"39d3adbd57b7e53c5e28ef972eb4b07590f38e99","bugs":{"url":"https://github.com/brianc/node-buffer-writer/issues"},"homepage":"https://github.com/brianc/node-buffer-writer#readme","_id":"buffer-writer@2.0.0","_npmVersion":"6.2.0","_nodeVersion":"10.9.0","_npmUser":{"name":"brianc","email":"brian.m.carlson@gmail.com"},"dist":{"shasum":"ce7eb81a38f7829db09c873f2fbb792c0c98ec04","size":4217,"noattachment":false,"key":"/buffer-writer/-/buffer-writer-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/buffer-writer/download/buffer-writer-2.0.0.tgz"},"maintainers":[{"name":"brianc","email":"brian.m.carlson@gmail.com"},{"name":"linusu","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/buffer-writer_2.0.0_1541600244248_0.6647835120572403"},"_hasShrinkwrap":false,"publish_time":1541600244372,"_cnpm_publish_time":1541600244372},"1.0.1":{"name":"buffer-writer","version":"1.0.1","description":"a fast, efficient buffer writer","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git://github.com/brianc/node-buffer-writer.git"},"keywords":["buffer","writer","builder"],"author":{"name":"Brian M. Carlson"},"license":"MIT","devDependencies":{"mocha":"~1.8.1","benchmark":"~1.0.0","microtime":"~0.3.3","bench":"~0.3.5","okay":"0.0.2","cloned":"0.0.1","rmdir":"~1.0.0","async":"~0.2.6"},"gitHead":"d7c48cb142d87d76662954359bf1abcd25144329","bugs":{"url":"https://github.com/brianc/node-buffer-writer/issues"},"homepage":"https://github.com/brianc/node-buffer-writer#readme","_id":"buffer-writer@1.0.1","_shasum":"22a936901e3029afcd7547eb4487ceb697a3bf08","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.5.0","_npmUser":{"name":"brianc","email":"brian.m.carlson@gmail.com"},"maintainers":[{"name":"brianc","email":"brian.m.carlson@gmail.com"},{"name":"linusu","email":""}],"dist":{"shasum":"22a936901e3029afcd7547eb4487ceb697a3bf08","size":5487,"noattachment":false,"key":"/buffer-writer/-/buffer-writer-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/buffer-writer/download/buffer-writer-1.0.1.tgz"},"_npmOperationalInternal":{"host":"packages-5-east.internal.npmjs.com","tmp":"tmp/buffer-writer-1.0.1.tgz_1455554615929_0.2564993395935744"},"directories":{},"publish_time":1455554618108,"_cnpm_publish_time":1455554618108,"_hasShrinkwrap":false},"1.0.0":{"name":"buffer-writer","version":"1.0.0","description":"a fast, efficient buffer writer","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git://github.com/brianc/node-buffer-writer.git"},"keywords":["buffer","writer","builder"],"author":{"name":"Brian M. Carlson"},"license":"MIT","devDependencies":{"mocha":"~1.8.1","benchmark":"~1.0.0","microtime":"~0.3.3","bench":"~0.3.5","okay":"0.0.2","cloned":"0.0.1","rmdir":"~1.0.0","async":"~0.2.6"},"readmeFilename":"README.md","bugs":{"url":"https://github.com/brianc/node-buffer-writer/issues"},"_id":"buffer-writer@1.0.0","dist":{"shasum":"6c29c3b2dea0c9e455a1f261a199a48a04f88b08","size":4681,"noattachment":false,"key":"/buffer-writer/-/buffer-writer-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/buffer-writer/download/buffer-writer-1.0.0.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"brianc","email":"brian.m.carlson@gmail.com"},"maintainers":[{"name":"brianc","email":"brian.m.carlson@gmail.com"},{"name":"linusu","email":""}],"directories":{},"publish_time":1386891173677,"_cnpm_publish_time":1386891173677,"_hasShrinkwrap":false}},"readme":"# buffer-writer\n\n[![Build Status](https://secure.travis-ci.org/brianc/node-buffer-writer.png?branch=master)](http://travis-ci.org/brianc/node-buffer-writer)\n\nFast & efficient buffer writer used to keep memory usage low by internally recycling a single large buffer.\n\nUsed as the binary protocol writer in [node-postgres](https://github.com/brianc/node-postgres)\n\nSince postgres requires big endian encoding, this only writes big endian numbers for now, but can & probably will easily be extended to write little endian as well.\n\nI'll admit this has a few postgres specific things I might need to take out in the future, such as `addHeader`\n\n## api\n\n`var writer = new (require('buffer-writer')());`\n\n### writer.addInt32(num)\n\nWrites a 4-byte big endian binary encoded number to the end of the buffer.\n\n### writer.addInt16(num)\n\nWrites a 2-byte big endian binary encoded number to the end of the buffer.\n\n### writer.addCString(string)\n\nWrites a string to the buffer `utf8` encoded and adds a null character (`\\0`) at the end.\n\n### var buffer = writer.addHeader(char)\n\nWrites the 5 byte PostgreSQL required header to the beginning of the buffer. (1 byte for character, 1 BE Int32 for length of the buffer)\n\n### var buffer = writer.join()\n\nCollects all data in the writer and joins it into a single, new buffer.\n\n### var buffer = writer.flush(char)\n\nWrites the 5 byte postgres required message header, collects all data in the writer and joins it into a single, new buffer, and then resets the writer.\n\n## thoughts\n\nThis is kind of node-postgres specific.  If you're interested in using this for a more general purpose thing, lemme know.\nI would love to work with you on getting this more reusable for your needs.\n\n## license\n\nMIT\n","_attachments":{},"homepage":"https://github.com/brianc/node-buffer-writer#readme","bugs":{"url":"https://github.com/brianc/node-buffer-writer/issues"},"license":"MIT"}