1.1.3 • Published 7 years ago
bufferjs-web v1.1.3
Buffer.js
Translate ArrayBuffers to strings and vice versa in JavaScript. This library is mainly useful for sending WebSocket messages as Binary packets.
Browser
Insert the script tag into your markup:
<script src="https://cdn.jsdelivr.net/npm/bufferjs-web/dist/buffer.min.js"></script>
Usage in the browser:
Buff = window.Buff;
var buffer = Buff.Writer('a test string'); // Translates the string "test" info an ArrayBuffer.
var string = Buff.Reader(buffer); // Translates the ArrayBuffer back into the string "test".
Node.JS
Install with the command:
npm i bufferjs-web
Usage in Node.js:
const Buff = require('bufferjs-web');
var buffer = Buff.Writer('a test string'); // Translates the string "test" info an ArrayBuffer.
var string = Buff.Reader(buffer); // Translates the ArrayBuffer back into the string "test".