From 4763e4c2c39b28f2f8a14d2c36d2dbb8e094a46b Mon Sep 17 00:00:00 2001 From: Jameson Little Date: Sun, 31 Jul 2011 20:09:56 -0600 Subject: [PATCH] Example now uses built-in btoa instead of custom base64 encoding --- examples/index.html | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/index.html b/examples/index.html index 2c024f5..7265319 100644 --- a/examples/index.html +++ b/examples/index.html @@ -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);