Detalhes do pacote

to-buffer

browserify15.7mMIT1.2.1

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

readme (leia-me)

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

changelog (log de mudanças)

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v1.2.1 - 2025-06-19

Commits

  • [Fix] handle non-Uint8Arrays in node < 3 7f8a881
  • [Tests] add coverage 286c96a
  • [Fix] provide a fallback for engines without ArrayBuffer.isView e336166
  • [Fix] correct error message b45247e

v1.2.0 - 2025-06-17

Commits

  • [New] replace with implementation from cipher-base 970adb5
  • [Tests] migrate from travis to GHA 8084393
  • [eslint] fix whitespace a62e651
  • [eslint] fix semicolon usage 4d85c63
  • [meta] add auto-changelog aa0279c
  • [readme] update URLs, add badges ff77d90
  • [lint] switch to eslint e45f467
  • [Fix] validate that arrays contain valid byte values c2fb75e
  • [Fix] restore previous implementation Array behavior cb93b75
  • [Tests] add nyc for coverage ab7026e
  • [Refactor] use safe-buffer.from instead of buffer-from 8e01307
  • [Fix] Replace Buffer.from with buffer-from d652e54
  • [Tests] use deepEqual over same alias 66a5548
  • [meta] add npmignore 90ce602
  • [Tests] move into a test dir, update tape 08aea81
  • Only apps should have lockfiles 16ccceb
  • [Tests] add coverage d2cba2e
  • [meta] update description 2cf2a20
  • [Fix] add safe-buffer, missing from 970adb5 d9a0dea
  • [meta] temporarily limit support to node v0.10 8dca458
  • [meta] add missing engines.node 35bdfcb
  • [Dev Deps] add missing peer dep 220143f
  • [meta] add sideEffects flag cd37473

v1.1.1 - 2018-04-26

Commits

  • use Buffer.from when avail eebe20e

v1.1.0 - 2017-04-12

Merged

  • Fix typo #2

Commits

v1.0.1 - 2016-02-15

Commits

v1.0.0 - 2016-02-15

Commits