It is my Computer Notes. Using Guide : object-key or object-key-key e.g. Step 1 Blog Search : [mysql-run] and then Step 2 ctrl+F [mysql-run] {bookMark me : Ctrl+D}
2013年10月24日 星期四
javascript-create-file-download
inf : http://stackoverflow.com/questions/7160720/create-a-file-using-javascript-in-chrome-on-client-side
window.webkitRequestFileSystem(window.TEMPORARY, 1024*1024, function(fs) {
fs.root.getFile('test.bin', {create: true}, function(fileEntry) {
fileEntry.createWriter(function(fileWriter) {
var arr = new Uint8Array(3);
arr[0] = 97;
arr[1] = 98;
arr[2] = 99;
var blob = new Blob([arr]);
fileWriter.addEventListener("writeend", function() {
// navigate to file, will download
location.href = fileEntry.toURL();
}, false);
fileWriter.write(blob);
}, function() {});
}, function() {});
}, function() {});
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言