You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sigonasr2
0785506fad
|
4 years ago | |
---|---|---|
.. | ||
.eslintrc.json | 4 years ago | |
.travis.yml | 4 years ago | |
index.js | 4 years ago | |
package.json | 4 years ago | |
readme.md | 4 years ago | |
test.js | 4 years ago |
readme.md
string-to-arraybuffer
Turn dataURI/base64/plain string into an ArrayBuffer.
var str2ab = require('string-to-arraybuffer')
// Plain 'Hello World!'
var abuf1 = str2ab('Hello World!')
// Base-64 'Hello World!'
var abuf2 = str2ab('SGVsbG8sIFdvcmxkIQ%3D%3D')
// Barebones data-uri 'Hello World!'
var abuf3 = str2ab('data:,Hello%2C%20World!')
// Base-64 data-uri 'Hello World!'
var abuf4 = str2ab('data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D')
Related
- arraybuffer-to-string − represent binary data in string
- data-uri-to-buffer − decode URI string to Buffer.
- to-array-buffer − convert anything to ArrayBuffer.