string-arraybuffer
Version:
A npm module for easy conversion from string to arraybuffer and from arraybuffer to string.
36 lines (20 loc) • 679 B
Markdown
> Easily convert string to arrayBuffer and from arrayBuffer to string
Useful when dealling with a function which accepts arraybuffer or return arraybuffer.
```
$ npm install string-arraybuffer
```
```js
const string_arraybuffer = require('string-arraybuffer');
arraybuffer_result = string_arraybuffer.str2ab("I love Africa")
//=> Uint8Array [ 73, 32, 108, 111, 118, 101, 32, 65, 102, 114, 105, 99, 97 ]
string_arraybuffer.ab2str(arraybuffer_result)
//=> "I love Africa"
```
MIT © [Andrews Agyemang Opoku](http://fandrews.com)