to-buffer

Pass in a string, array, Buffer, Data View, or Uint8Array, and get a Buffer back.

MIT 7 个版本
安装
npm install to-buffer
yarn add to-buffer
pnpm add to-buffer
bun add to-buffer
README

to-buffer Version Badge

Pass in a string, array, Buffer, Data View, or Uint8Array, and get a Buffer back.

github actions coverage dependency status dev dependency status License Downloads

npm badge

npm install to-buffer

Usage

var toBuffer = require('to-buffer');

console.log(toBuffer('hi')); // <Buffer 68 69>
console.log(toBuffer(Buffer('hi'))); // <Buffer 68 69>
console.log(toBuffer('6869', 'hex')); // <Buffer 68 69>
console.log(toBuffer(43)); // throws
版本列表
1.2.2 2025-09-24
1.2.1 2025-06-20
1.2.0 2025-06-17
1.1.1 2018-04-26
1.1.0 2017-04-12
1.0.1 2016-02-15
1.0.0 2016-02-15