Have ideas to improve npm?Join in the discussion! »

    buffer-to-arraybuffer

    0.0.6 • Public • Published

    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

    Keywords

    Install

    npm i buffer-to-arraybuffer

    DownloadsWeekly Downloads

    160,655

    Version

    0.0.6

    License

    MIT

    Unpacked Size

    4.98 kB

    Total Files

    9

    Last publish

    Collaborators

    • avatar