Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
slice a buffer into an array of sub-buffers
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README.md
index.js
package.json
test.js

README.md

buffer-slice

Slice a buffer into an array of sub-buffers of a specified size.

Very handy for UDP packets.

install

npm install buffer-slice

api

[Buffer buffers] = bufferSlice(Buffer buffer, int maxLengthOfSlice);

example

var bufferSlice = require('buffer-slice');

//slice a length 5 buffer into max length 2
var buffers = bufferSlice(Buffer([1, 2, 3, 4, 5]), 2);
console.log(buffers);
//<Buffer 1 2>
//<Buffer 3 4>
//<Buffer 5>

license

MIT

Something went wrong with that request. Please try again.