Last active
September 13, 2017 15:54
-
-
Save gauravmehla/9bd54d58a5bb76929f1fbc31a8a2d67a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function savebase64AsFile(folderPath, fileName, base64, contentType){ | |
| var DataBlob = b64toBlob(base64,contentType); | |
| window.resolveLocalFileSystemURL(folderPath, function(dir) { | |
| dir.getFile(fileName, {create:true}, function(file) { | |
| file.createWriter(function(fileWriter) { | |
| fileWriter.write(DataBlob); | |
| fileWriter.onwrite = function(){ | |
| console.log('File written successfully.'); | |
| } | |
| }, function(){ | |
| alert('Unable to save file in path '+ folderPath); | |
| }); | |
| }); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment