Example now uses built-in btoa instead of custom base64 encoding
This commit is contained in:
parent
84f5e0b4df
commit
4763e4c2c3
1 changed files with 10 additions and 1 deletions
|
@ -19,11 +19,20 @@
|
|||
url,
|
||||
base64;
|
||||
|
||||
function uint8ToString(buf) {
|
||||
var i, length, out = '';
|
||||
for (i = 0, length = buf.length; i < length; i += 1) {
|
||||
out += String.fromCharCode(buf[i]);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
out = tape.append('output.txt', 'This is test1!');
|
||||
out = tape.append('dir/out.txt', 'This is test2! I changed up the directory');
|
||||
out = tape.append('arr.txt', utils.stringToUint8('This is a Uint8Array!'));
|
||||
|
||||
base64 = utils.uint8ToBase64(out);
|
||||
base64 = btoa(uint8ToString(out));
|
||||
|
||||
url = "data:application/tar;base64," + base64;
|
||||
window.open(url);
|
||||
|
|
Loading…
Add table
Reference in a new issue