Big News: Socket Selected for OpenAI's Cybersecurity Grant Program.Details
Socket
Book a DemoSign in
Socket

buffer-replace

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

buffer-replace

Like String#replace but for buffers

latest
Source
npmnpm
Version
2.0.0
Version published
Weekly downloads
88K
-4.34%
Maintainers
1
Weekly downloads
 
Created
Source

buffer-replace

Like String#replace, but for buffers.

Usage

const replace = require('buffer-replace');

replace(Buffer('foo:bar'), ':', '-')
// Buffer('foo-bar')

replace(Buffer('foo-beep-bar'), '-beep-', '-');
// Buffer('foo-bar')

replace('foo-beep-bar', '-beep-', '-');
// Buffer('foo-bar')

Installation

$ npm install buffer-replace

API

replace(buf, a, b)

Replace all occurences of a in buf with b. All arguments can be either buffers or strings, but the return value is always a buffer.

License

MIT

FAQs

Package last updated on 28 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts