JSFiddle - React, Tailwind, and code Playground

by saurabh_saxena

JavaScript

window.webkitRequestFileSystem(window.TEMPORARY, 1024*1024, function(fs) {
        fs.root.getFile('test', {create: true}, function(fileEntry) {
            fileEntry.createWriter(function(fileWriter) {
                var builder = new WebKitBlobBuilder();
                builder.append("Saurabh");
                builder.append("\n");
                builder.append("Saxena");
                
                var blob = builder.getBlob('text/plain');
    
                fileWriter.onwriteend = function() {
                    // navigate to file, will download
                    location.href = fileEntry.toURL();
                };
                fileWriter.write(blob);
            }, function() {});
        }, function() {});
    }, function() {});