JSFiddle - React, Tailwind, and code Playground
JavaScript
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 builder = new WebKitBlobBuilder();
builder.append(arr.buffer);
var blob = builder.getBlob();
/*fileWriter.onwriteend = function() {
// navigate to file, will download
location.href = fileEntry.toURL();
};*/
fileWriter.onwriteend = function() {
console.log(fileEntry.toURL());
}
fileWriter.write(blob);
}, function() {});
}, function() {});
}, function() {});