{"_id":"to-buffer","_rev":"4176685","name":"to-buffer","description":"Pass in a string, array, Buffer, Data View, or Uint8Array, and get a Buffer back.","dist-tags":{"latest":"1.2.2"},"maintainers":[{"name":"ljharb","email":""},{"name":"mafintosh","email":""}],"time":{"modified":"2026-03-01T21:35:25.000Z","created":"2016-02-15T20:04:36.934Z","1.2.2":"2025-09-24T23:13:41.914Z","1.2.1":"2025-06-20T06:15:25.734Z","1.2.0":"2025-06-17T22:28:11.124Z","1.1.1":"2018-04-26T14:56:24.701Z","1.1.0":"2017-04-12T19:46:13.233Z","1.0.1":"2016-02-15T20:05:54.031Z","1.0.0":"2016-02-15T20:04:36.934Z"},"users":{},"author":{"name":"Mathias Buus","url":"@mafintosh"},"repository":{"type":"git","url":"git+https://github.com/browserify/to-buffer.git"},"versions":{"1.2.2":{"name":"to-buffer","version":"1.2.2","description":"Pass in a string, array, Buffer, Data View, or Uint8Array, and get a Buffer back.","main":"index.js","sideEffects":false,"scripts":{"prepack":"npmignore --auto --commentLines=autogenerated","lint":"eslint --ext=js,mjs .","pretest":"npm run lint","tests-only":"nyc tape 'test/**/*'","test":"npm run tests-only","posttest":"npx npm@\">= 10.2\" audit --production","version":"auto-changelog && git add CHANGELOG.md","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""},"repository":{"type":"git","url":"git+https://github.com/browserify/to-buffer.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/browserify/to-buffer/issues"},"homepage":"https://github.com/browserify/to-buffer","dependencies":{"isarray":"^2.0.5","safe-buffer":"^5.2.1","typed-array-buffer":"^1.0.3"},"devDependencies":{"@ljharb/eslint-config":"^21.2.0","auto-changelog":"^2.5.0","available-typed-arrays":"^1.0.7","encoding":"^0.1.13","eslint":"=8.8.0","for-each":"^0.3.5","npmignore":"^0.3.1","nyc":"^10.3.2","tape":"^5.9.0"},"engines":{"node":">= 0.4"},"publishConfig":{"ignore":[".github/workflows",".eslintrc",".nycrc","test"]},"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","unreleased":false,"commitLimit":false,"backfillLimit":false,"hideCredit":true},"_id":"to-buffer@1.2.2","gitHead":"47c574df5d2f45acbc762ce2eaa760b1263a3ae9","_nodeVersion":"24.8.0","_npmVersion":"11.6.0","dist":{"shasum":"ffe59ef7522ada0a2d1cb5dfe03bb8abc3cdc133","size":5694,"noattachment":false,"key":"/to-buffer/-/to-buffer-1.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/to-buffer/download/to-buffer-1.2.2.tgz"},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"directories":{},"maintainers":[{"name":"ljharb","email":""},{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/to-buffer_1.2.2_1758755621747_0.47814871053285546"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-09-24T23:13:41.914Z","publish_time":1758755621914,"_source_registry_name":"default","_cnpm_publish_time":1758755621914},"1.2.1":{"name":"to-buffer","version":"1.2.1","description":"Pass in a string, array, Buffer, Data View, or Uint8Array, and get a Buffer back.","main":"index.js","sideEffects":false,"scripts":{"prepack":"npmignore --auto --commentLines=autogenerated","lint":"eslint --ext=js,mjs .","pretest":"npm run lint","tests-only":"nyc tape 'test/**/*'","test":"npm run tests-only","posttest":"npx npm@\">= 10.2\" audit --production","version":"auto-changelog && git add CHANGELOG.md","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""},"repository":{"type":"git","url":"git+https://github.com/browserify/to-buffer.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/browserify/to-buffer/issues"},"homepage":"https://github.com/browserify/to-buffer","dependencies":{"isarray":"^2.0.5","safe-buffer":"^5.2.1","typed-array-buffer":"^1.0.3"},"devDependencies":{"@ljharb/eslint-config":"^21.1.1","auto-changelog":"^2.5.0","available-typed-arrays":"^1.0.7","encoding":"^0.1.13","eslint":"=8.8.0","for-each":"^0.3.5","npmignore":"^0.3.1","nyc":"^10.3.2","tape":"^5.9.0"},"engines":{"node":">= 0.4"},"publishConfig":{"ignore":[".github/workflows","test"]},"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","unreleased":false,"commitLimit":false,"backfillLimit":false,"hideCredit":true},"_id":"to-buffer@1.2.1","gitHead":"07afa81f7281d5987258697d4624d8eb721f066e","_nodeVersion":"24.2.0","_npmVersion":"11.3.0","dist":{"shasum":"2ce650cdb262e9112a18e65dc29dcb513c8155e0","size":5725,"noattachment":false,"key":"/to-buffer/-/to-buffer-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/to-buffer/download/to-buffer-1.2.1.tgz"},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com","actor":{"name":"ljharb","email":"ljharb@gmail.com","type":"user"}},"directories":{},"maintainers":[{"name":"ljharb","email":""},{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/to-buffer_1.2.1_1750400125558_0.4380206988383526"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-06-20T06:15:25.734Z","publish_time":1750400125734,"_source_registry_name":"default","_cnpm_publish_time":1750400125734},"1.2.0":{"name":"to-buffer","version":"1.2.0","description":"Pass in a string, array, Buffer, Data View, or Uint8Array, and get a Buffer back.","main":"index.js","sideEffects":false,"scripts":{"prepack":"npmignore --auto --commentLines=autogenerated","lint":"eslint --ext=js,mjs .","pretest":"npm run lint","tests-only":"nyc tape 'test/**/*'","test":"npm run tests-only","posttest":"npx npm@\">= 10.2\" audit --production","version":"auto-changelog && git add CHANGELOG.md","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""},"repository":{"type":"git","url":"git+https://github.com/browserify/to-buffer.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/browserify/to-buffer/issues"},"homepage":"https://github.com/browserify/to-buffer","dependencies":{"isarray":"^2.0.5","safe-buffer":"^5.2.1"},"devDependencies":{"@ljharb/eslint-config":"^21.1.1","auto-changelog":"^2.5.0","available-typed-arrays":"^1.0.7","encoding":"^0.1.13","eslint":"=8.8.0","for-each":"^0.3.5","npmignore":"^0.3.1","nyc":"^10.3.2","tape":"^5.9.0"},"engines":{"node":">= 0.4"},"publishConfig":{"ignore":[".github/workflows","test"]},"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","unreleased":false,"commitLimit":false,"backfillLimit":false,"hideCredit":true},"_id":"to-buffer@1.2.0","gitHead":"6686e2ae4801c4428442c5267401ea66c82bd249","_nodeVersion":"24.2.0","_npmVersion":"11.3.0","dist":{"shasum":"0a602aa0409ba2ce4bcef8ba319958b169cbcfb5","size":5254,"noattachment":false,"key":"/to-buffer/-/to-buffer-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/to-buffer/download/to-buffer-1.2.0.tgz"},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com","actor":{"name":"ljharb","email":"ljharb@gmail.com","type":"user"}},"directories":{},"maintainers":[{"name":"ljharb","email":""},{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/to-buffer_1.2.0_1750199290873_0.9356416790873092"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-06-17T22:28:11.124Z","publish_time":1750199291124,"_source_registry_name":"default","_cnpm_publish_time":1750199291124},"1.1.1":{"name":"to-buffer","version":"1.1.1","description":"Pass in a string, get a buffer back. Pass in a buffer, get the same buffer back","main":"index.js","dependencies":{},"devDependencies":{"standard":"^6.0.5","tape":"^4.4.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/to-buffer.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/to-buffer/issues"},"homepage":"https://github.com/mafintosh/to-buffer","gitHead":"17a1aa27bfce0218979472cfe4776b50438e8857","_id":"to-buffer@1.1.1","_npmVersion":"5.6.0","_nodeVersion":"9.11.1","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"493bd48f62d7c43fcded313a03dcadb2e1213a80","size":1730,"noattachment":false,"key":"/to-buffer/-/to-buffer-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/to-buffer/download/to-buffer-1.1.1.tgz"},"maintainers":[{"name":"ljharb","email":""},{"name":"mafintosh","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/to-buffer_1.1.1_1524754584618_0.8258302631612433"},"_hasShrinkwrap":false,"publish_time":1524754584701,"_cnpm_publish_time":1524754584701},"1.1.0":{"name":"to-buffer","version":"1.1.0","description":"Pass in a string, get a buffer back. Pass in a buffer, get the same buffer back","main":"index.js","dependencies":{},"devDependencies":{"standard":"^6.0.5","tape":"^4.4.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/to-buffer.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/to-buffer/issues"},"homepage":"https://github.com/mafintosh/to-buffer","gitHead":"e70eedf2492df123ea19d1c52bf07bf2e590b080","_id":"to-buffer@1.1.0","_shasum":"375bc03edae5c35a8fa0b3fe95a1f3985db1dcfa","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.5","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"375bc03edae5c35a8fa0b3fe95a1f3985db1dcfa","size":1724,"noattachment":false,"key":"/to-buffer/-/to-buffer-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/to-buffer/download/to-buffer-1.1.0.tgz"},"maintainers":[{"name":"ljharb","email":""},{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/to-buffer-1.1.0.tgz_1492026371375_0.07645408087410033"},"directories":{},"publish_time":1492026373233,"_hasShrinkwrap":false,"_cnpm_publish_time":1492026373233},"1.0.1":{"name":"to-buffer","version":"1.0.1","description":"Pass in a string, get a buffer back. Pass in a buffer, get the same buffer back","main":"index.js","dependencies":{},"devDependencies":{"standard":"^6.0.5","tape":"^4.4.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"https://github.com/mafintosh/to-buffer.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/to-buffer/issues"},"homepage":"https://github.com/mafintosh/to-buffer","gitHead":"8b7b0403ce3ea12a20c53d154c28082918a310bc","_id":"to-buffer@1.0.1","_shasum":"91283f91a2a1935200dcb32a6aaeab5828955612","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.3","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"91283f91a2a1935200dcb32a6aaeab5828955612","size":1736,"noattachment":false,"key":"/to-buffer/-/to-buffer-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/to-buffer/download/to-buffer-1.0.1.tgz"},"maintainers":[{"name":"ljharb","email":""},{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-5-east.internal.npmjs.com","tmp":"tmp/to-buffer-1.0.1.tgz_1455566751907_0.7123836160171777"},"directories":{},"publish_time":1455566754031,"_cnpm_publish_time":1455566754031,"_hasShrinkwrap":false},"1.0.0":{"name":"to-buffer","version":"1.0.0","description":"WIP - nothing to see here","main":"index.js","dependencies":{},"devDependencies":{"standard":"^6.0.5","tape":"^4.4.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"https://github.com/mafintosh/to-buffer.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/to-buffer/issues"},"homepage":"https://github.com/mafintosh/to-buffer","gitHead":"b57a85697b94dfd17ffc2d8c90484ece06ff5e7f","_id":"to-buffer@1.0.0","_shasum":"9a3d84bc3418679add0251ae92d3e4c41b38af32","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.3","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"9a3d84bc3418679add0251ae92d3e4c41b38af32","size":1748,"noattachment":false,"key":"/to-buffer/-/to-buffer-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/to-buffer/download/to-buffer-1.0.0.tgz"},"maintainers":[{"name":"ljharb","email":""},{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-9-west.internal.npmjs.com","tmp":"tmp/to-buffer-1.0.0.tgz_1455566673200_0.9151617083698511"},"directories":{},"publish_time":1455566676934,"_cnpm_publish_time":1455566676934,"_hasShrinkwrap":false}},"readme":"# to-buffer <sup>[![Version Badge][2]][1]</sup>\n\nPass in a string, array, Buffer, Data View, or Uint8Array, and get a Buffer back.\n\n[![github actions][actions-image]][actions-url]\n[![coverage][codecov-image]][codecov-url]\n[![dependency status][5]][6]\n[![dev dependency status][7]][8]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\n[![npm badge][11]][1]\n\n\n```\nnpm install to-buffer\n```\n\n## Usage\n\n``` js\nvar toBuffer = require('to-buffer');\n\nconsole.log(toBuffer('hi')); // <Buffer 68 69>\nconsole.log(toBuffer(Buffer('hi'))); // <Buffer 68 69>\nconsole.log(toBuffer('6869', 'hex')); // <Buffer 68 69>\nconsole.log(toBuffer(43)); // throws\n```\n\n[1]: https://npmjs.org/package/to-buffer\n[2]: https://versionbadg.es/browserify/to-buffer.svg\n[5]: https://david-dm.org/browserify/to-buffer.svg\n[6]: https://david-dm.org/browserify/to-buffer\n[7]: https://david-dm.org/browserify/to-buffer/dev-status.svg\n[8]: https://david-dm.org/browserify/to-buffer#info=devDependencies\n[11]: https://nodei.co/npm/to-buffer.png?downloads=true&stars=true\n[license-image]: https://img.shields.io/npm/l/to-buffer.svg\n[license-url]: LICENSE\n[downloads-image]: https://img.shields.io/npm/dm/to-buffer.svg\n[downloads-url]: https://npm-stat.com/charts.html?package=to-buffer\n[codecov-image]: https://codecov.io/gh/browserify/to-buffer/branch/main/graphs/badge.svg\n[codecov-url]: https://app.codecov.io/gh/browserify/to-buffer/\n[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/browserify/to-buffer\n[actions-url]: https://github.com/browserify/to-buffer/actions\n","_attachments":{},"homepage":"https://github.com/browserify/to-buffer","bugs":{"url":"https://github.com/browserify/to-buffer/issues"},"license":"MIT"}