xiongzhu abfe06b311 first commit 2 yıl önce
..
test abfe06b311 first commit 2 yıl önce
.editorconfig abfe06b311 first commit 2 yıl önce
.gitattributes abfe06b311 first commit 2 yıl önce
.npmignore abfe06b311 first commit 2 yıl önce
CHANGELOG.md abfe06b311 first commit 2 yıl önce
LICENSE.md abfe06b311 first commit 2 yıl önce
README.md abfe06b311 first commit 2 yıl önce
bower.json abfe06b311 first commit 2 yıl önce
buffer-to-arraybuffer.js abfe06b311 first commit 2 yıl önce
package.json abfe06b311 first commit 2 yıl önce

README.md

buffer-to-arraybuffer

Convert Buffer to ArrayBuffer

Install

npm install buffer-to-arraybuffer

Usage

var bufferToArrayBuffer = require('buffer-to-arraybuffer');

var b = new Buffer(12);
b.write('abc', 0);

var ab = bufferToArrayBuffer(b);
String.fromCharCode.apply(null, new Uint8Array(ab)); // 'abc'

NOTE: If you only target node v4.3+, you can simply just do:

new Buffer([12]).buffer

License

MIT