1.0.1 • Published 8 years ago

map-buffer v1.0.1

Weekly downloads
9
License
LSC
Repository
github
Last release
8 years ago

map-buffer Build Status

Creates a new Buffer with the results of calling a provided function on every element in this Buffer (ie. like Array.prototype.map but for buffers).

Usage example

const mapBuffer = require('map-buffer');

const buf = new Buffer([0x62,0x75,0x66,0x66,0x65,0x72]);

const new_buf = mapBuffer(buf, (value, index, original_buffer) => {
  return value === 0x62 ? 0x75 : value;
});

console.log(new_buf); // <Buffer 75 75 66 66 65 72>
1.0.1

8 years ago

1.0.0

8 years ago