{
  "_id": "buffer-writer",
  "maintainers": [
    {
      "email": "linus@folkdatorn.se",
      "name": "linusu"
    },
    {
      "email": "brian.m.carlson@gmail.com",
      "name": "brianc"
    }
  ],
  "keywords": [
    "buffer",
    "writer",
    "builder"
  ],
  "dist-tags": {
    "latest": "2.0.0"
  },
  "author": {
    "name": "Brian M. Carlson"
  },
  "_rev": "9-495431c7899c1f326b4fa85544fc4520",
  "description": "a fast, efficient buffer writer",
  "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",
  "repository": {
    "type": "git",
    "url": "git://github.com/brianc/node-buffer-writer.git"
  },
  "bugs": {
    "url": "https://github.com/brianc/node-buffer-writer/issues"
  },
  "license": "MIT",
  "versions": {
    "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"
      },
      "bugs": {
        "url": "https://github.com/brianc/node-buffer-writer/issues"
      },
      "_id": "buffer-writer@1.0.0",
      "dist": {
        "shasum": "6c29c3b2dea0c9e455a1f261a199a48a04f88b08",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/buffer-writer/-/buffer-writer-1.0.0.tgz",
        "integrity": "sha512-EwqHsY9HX59gLKIDAnnsa8G9FFdD7OlTZ6kVj0BXM1WSguvxH4g2FQPaWHtfT6EFWff5ISMr4fH1cZHvne/xWA==",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEUCIHbglAUO03rN4vgToGut8MKyL6Go5m7xFJV6GeyYIzwnAiEAqET8ZYMyT6N+Eic1yQHHtUDHWzbp7fKlGEccVZ77XD4="
          }
        ]
      },
      "_from": ".",
      "_npmVersion": "1.3.11",
      "_npmUser": {
        "name": "brianc",
        "email": "brian.m.carlson@gmail.com"
      },
      "maintainers": [
        {
          "name": "brianc",
          "email": "brian.m.carlson@gmail.com"
        }
      ],
      "directories": {}
    },
    "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"
        }
      ],
      "dist": {
        "shasum": "22a936901e3029afcd7547eb4487ceb697a3bf08",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/buffer-writer/-/buffer-writer-1.0.1.tgz",
        "integrity": "sha512-I5M7UuSeDn5aQR2BSH2+270w9qdd2Rd5LB/XhTcIRdSmeLueMNlY3BaMoHtoASmjEQf/NOAqMIZaoAMSpomW6w==",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEYCIQCRG0FcOTztm+7YRs9CJsf8kWJDD2ja8mJGPg28w2PytgIhANovvxNCq2F5jmL3sI27sEepnG9LzvtGh/tQqJTxsFmE"
          }
        ]
      },
      "_npmOperationalInternal": {
        "host": "packages-5-east.internal.npmjs.com",
        "tmp": "tmp/buffer-writer-1.0.1.tgz_1455554615929_0.2564993395935744"
      },
      "directories": {}
    },
    "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": {
        "integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw==",
        "shasum": "ce7eb81a38f7829db09c873f2fbb792c0c98ec04",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/buffer-writer/-/buffer-writer-2.0.0.tgz",
        "fileCount": 7,
        "unpackedSize": 13706,
        "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4vP0CRA9TVsSAnZWagAA+vAP/AnDhOaCJfyreAL0EINJ\nBZHo+oT51TnjhXBQvVt+jeTx15bEPpKGBixokln2Vz5GRL90tBdaCHHfUz4v\n9djgoBES7WAIAR8J7ctVXY1yjzIrVeqCDE2czxuwRylzXJc5vYS9rHUxyNqx\ny1oDYN3WzunEzKF+9X15+EAdCvH1XGGQLN2k3J5YPFfMfoeHSaNm0KboUiXv\n6Rx/PgarG97u4cKtD1+jeQD7uU1Fv+bQVHS1qkkhC9nVVtDdMcvFKWJnz0Qq\njsqS51OPnwbiP+I7mzBFQHd57z5E6xXQwXIw0fliCTVmigRgw9nbiZyg6cb4\n+KnIWZ95qsx4FfPU6pGkIdT+xFKR5Ak9NajLI5V0kYbxPYMX4Rl0HlkzKf5t\nnl48Zlj1WYqen+rJnfKb1m/iwhC0bHjpA8PaCCTcdgoJaWtQj9UcORUMAK8Y\nEQnmlxHAyRwAEZFIXOpG66utHxsU6Iw5Y/f7O69V2MpGRTWFwFKNFdRgSCpt\neF/bBDjlujsRZlaLd7Nvs8PagXUayH3xWJqvkjt0nNRsomx7ZlAEgbDNUH9r\nxu5jXlYIquBpx9N9HtwF/awTWadaQ2iK8XP5+4TLyul6wHvptVSBM3NjO89N\njdZ3FcyEwZR6+HLZ5o4AE5oKbwKCIvIIGx2AVt/qGtLeHqw7vsgp0gSQ3aXU\n04hf\r\n=YrKg\r\n-----END PGP SIGNATURE-----\r\n",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEUCIQCHJtIush7XKiDs2gc6WL7v0RHM6N0wOfjzzHzba+zj0wIgDMCzG+GIwfpGH2iP6gq/oGucrVkoBxQlhr2XYdGVf+0="
          }
        ]
      },
      "maintainers": [
        {
          "name": "brianc",
          "email": "brian.m.carlson@gmail.com"
        }
      ],
      "directories": {},
      "_npmOperationalInternal": {
        "host": "s3://npm-registry-packages",
        "tmp": "tmp/buffer-writer_2.0.0_1541600244248_0.6647835120572403"
      },
      "_hasShrinkwrap": false
    }
  },
  "name": "buffer-writer",
  "time": {
    "modified": "2026-05-23T07:06:50.112Z",
    "created": "2013-12-12T23:32:53.134Z",
    "1.0.0": "2013-12-12T23:32:53.677Z",
    "1.0.1": "2016-02-15T16:43:38.108Z",
    "2.0.0": "2018-11-07T14:17:24.372Z"
  },
  "readmeFilename": "README.md",
  "homepage": "https://github.com/brianc/node-buffer-writer#readme"
}