{"_id":"replace-buffer","_rev":"2971624","name":"replace-buffer","description":"Replace matches in a Buffer","dist-tags":{"latest":"1.2.1"},"maintainers":[{"name":"kevva","email":""}],"time":{"modified":"2023-05-22T08:58:33.000Z","created":"2017-08-13T12:17:03.333Z","1.2.1":"2017-08-15T21:16:04.280Z","1.2.0":"2017-08-14T18:24:42.464Z","1.1.0":"2017-08-14T07:46:39.820Z","1.0.0":"2017-08-13T12:17:03.333Z"},"users":{},"author":{"name":"Kevin Mårtensson","email":"kevinmartensson@gmail.com","url":"github.com/kevva"},"repository":{"type":"git","url":"git+https://github.com/kevva/replace-buffer.git"},"versions":{"1.2.1":{"name":"replace-buffer","version":"1.2.1","description":"Replace matches in a Buffer","license":"MIT","repository":{"type":"git","url":"git+https://github.com/kevva/replace-buffer.git"},"author":{"name":"Kevin Mårtensson","email":"kevinmartensson@gmail.com","url":"github.com/kevva"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["all","buffer","global","many","match","matches","modify","multiple","needle","replace","replacement","replacer","search","text"],"devDependencies":{"ava":"*","xo":"*"},"gitHead":"df4283883454fbdbd2bd9613d47a28e87be9ff89","bugs":{"url":"https://github.com/kevva/replace-buffer/issues"},"homepage":"https://github.com/kevva/replace-buffer#readme","_id":"replace-buffer@1.2.1","_npmVersion":"5.3.0","_nodeVersion":"8.3.0","_npmUser":{"name":"kevva","email":"kevinmartensson@gmail.com"},"dist":{"shasum":"6c188c61445ba91569284b17b8fa119f04a07eb0","size":2065,"noattachment":false,"key":"/replace-buffer/-/replace-buffer-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/replace-buffer/download/replace-buffer-1.2.1.tgz"},"maintainers":[{"name":"kevva","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/replace-buffer-1.2.1.tgz_1502831763356_0.6777133271098137"},"directories":{},"publish_time":1502831764280,"_hasShrinkwrap":false,"_cnpm_publish_time":1502831764280,"_cnpmcore_publish_time":"2021-12-16T16:10:57.658Z"},"1.2.0":{"name":"replace-buffer","version":"1.2.0","description":"Replace matches in a Buffer","license":"MIT","repository":{"type":"git","url":"git+https://github.com/kevva/replace-buffer.git"},"author":{"name":"Kevin Mårtensson","email":"kevinmartensson@gmail.com","url":"github.com/kevva"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["all","buffer","global","many","match","matches","modify","multiple","needle","replace","replacement","replacer","search","text"],"devDependencies":{"ava":"*","xo":"*"},"gitHead":"38ffde96f29657f8836bfdba3096a97dcb9ca1d1","bugs":{"url":"https://github.com/kevva/replace-buffer/issues"},"homepage":"https://github.com/kevva/replace-buffer#readme","_id":"replace-buffer@1.2.0","_npmVersion":"5.3.0","_nodeVersion":"6.11.2","_npmUser":{"name":"kevva","email":"kevinmartensson@gmail.com"},"dist":{"shasum":"263d00b15fd9c1f1e9f8634db6175a8e1869092d","size":2067,"noattachment":false,"key":"/replace-buffer/-/replace-buffer-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/replace-buffer/download/replace-buffer-1.2.0.tgz"},"maintainers":[{"name":"kevva","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/replace-buffer-1.2.0.tgz_1502735081598_0.030368685256689787"},"directories":{},"publish_time":1502735082464,"_hasShrinkwrap":false,"_cnpm_publish_time":1502735082464,"_cnpmcore_publish_time":"2021-12-16T16:10:58.066Z"},"1.1.0":{"name":"replace-buffer","version":"1.1.0","description":"Replace matches in a Buffer","license":"MIT","repository":{"type":"git","url":"git+https://github.com/kevva/replace-buffer.git"},"author":{"name":"Kevin Mårtensson","email":"kevinmartensson@gmail.com","url":"github.com/kevva"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["all","buffer","global","many","match","matches","modify","multiple","needle","replace","replacement","replacer","search","text"],"devDependencies":{"ava":"*","xo":"*"},"gitHead":"db2e944258b9a992ad8e7ad73486d5d28a50ce4e","bugs":{"url":"https://github.com/kevva/replace-buffer/issues"},"homepage":"https://github.com/kevva/replace-buffer#readme","_id":"replace-buffer@1.1.0","_npmVersion":"5.3.0","_nodeVersion":"8.3.0","_npmUser":{"name":"kevva","email":"kevinmartensson@gmail.com"},"dist":{"shasum":"514c61ca920fac5f2d2fd9196ea301009366beba","size":2046,"noattachment":false,"key":"/replace-buffer/-/replace-buffer-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/replace-buffer/download/replace-buffer-1.1.0.tgz"},"maintainers":[{"name":"kevva","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/replace-buffer-1.1.0.tgz_1502696798888_0.28098061471246183"},"directories":{},"publish_time":1502696799820,"_hasShrinkwrap":false,"_cnpm_publish_time":1502696799820,"_cnpmcore_publish_time":"2021-12-16T16:10:58.496Z"},"1.0.0":{"name":"replace-buffer","version":"1.0.0","description":"Replace matches in a Buffer","license":"MIT","repository":{"type":"git","url":"git+https://github.com/kevva/replace-buffer.git"},"author":{"name":"Kevin Mårtensson","email":"kevinmartensson@gmail.com","url":"github.com/kevva"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["all","buffer","global","many","match","matches","modify","multiple","needle","replace","replacement","replacer","search","text"],"devDependencies":{"ava":"*","xo":"*"},"gitHead":"ae6b475806d24e9069ba3e414128bfc87c68ea82","bugs":{"url":"https://github.com/kevva/replace-buffer/issues"},"homepage":"https://github.com/kevva/replace-buffer#readme","_id":"replace-buffer@1.0.0","_npmVersion":"5.3.0","_nodeVersion":"8.3.0","_npmUser":{"name":"kevva","email":"kevinmartensson@gmail.com"},"dist":{"shasum":"bd68a256e78e898057e44041312ca36c223de6f2","size":1942,"noattachment":false,"key":"/replace-buffer/-/replace-buffer-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/replace-buffer/download/replace-buffer-1.0.0.tgz"},"maintainers":[{"name":"kevva","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/replace-buffer-1.0.0.tgz_1502626622475_0.7663627089932561"},"directories":{},"publish_time":1502626623333,"_hasShrinkwrap":false,"_cnpm_publish_time":1502626623333,"_cnpmcore_publish_time":"2021-12-16T16:10:58.763Z"}},"readme":"# replace-buffer [![Build Status](https://travis-ci.org/kevva/replace-buffer.svg?branch=master)](https://travis-ci.org/kevva/replace-buffer)\n\n> Replace matches in a Buffer\n\n\n## Install\n\n```\n$ npm install replace-buffer\n```\n\n\n## Usage\n\n```js\nconst replaceBuffer = require('replace-buffer');\n\nconst input = Buffer.from('My friend has a dog. I want a dog too!');\n\nreplaceBuffer(input, 'dog', 'unicorn').toString();\n//=> 'My friend has a unicorn. I want a unicorn too!'\n```\n\n\n## API\n\n### replaceBuffer(input, needle, replacement, [options])\n\nReturns a new `Buffer` with all needle matches replaced with replacement.\n\n#### input\n\nType: `Buffer`\n\n`Buffer` to work on.\n\n#### needle\n\nType: `string`\n\nString to match in `input`.\n\n#### replacement\n\nType: `string` `Function`\n\nReplacement for needle matches.\n\nIf a function, it receives the following arguments; the `needle`, the match count, and the `input`:\n\n```js\nreplaceBuffer(Buffer.from('Foo Unicorn Bar'), 'Unicorn', (needle, matchCount, input) => `${needle}❤️`);\n//=> 'Foo Unicorn❤️ Bar'\n```\n\n#### options\n\nType: `Object`\n\n##### fromIndex\n\nType: `number`<br>\nDefault: `0`\n\nIndex at which to start replacing.\n\n\n## License\n\nMIT © [Kevin Mårtensson](http://github.com/kevva)\n","_attachments":{},"homepage":"https://github.com/kevva/replace-buffer#readme","bugs":{"url":"https://github.com/kevva/replace-buffer/issues"},"license":"MIT"}