Cordova plugin for downloading base64 data as binary file.
- Installation
- Download base64 as binary
- Show downloaded file in preview
- Authors and Contributors
- Professional Support
Get the latest code from github and install:
cordova plugin add https://github.com/openlabs/cordova-binary-file-handler
This plugin will add a global function writeTofile
which can be used to save the base64
file as a binary to the filesystem. In success callback you can get the URI of the binary file
saved in the filesystem.
writeTofile(fileName, base64Data, successCallback, ErrorCallback);
fileName | The name you want to save your file as. |
base64Data | base64Data which needs to be saved as binary. |
successCallback | Success callback to get file path of saved file. |
errorCallback | Callback for handling error. |
writeTofile('filename.pdf', base64Data, function(filePath) {
// Successfully saved base64Data as binary.
console.log('Your file is stored at', filePath);
}, function() {
// Error
});
This plugin can also be used for previewing the downloaded file inside your cordova app.
Opening the file can come handy for printing it or for opening it in an external app. For example open a pdf with acrobat reader, chrome or just print it directly.
A global function quickLookFile
is added which takes file URI and opens it in preview
inside your app.
quickLookFile(fileURI, successCallBack, errorCallback);
fileURI | Path of file on the file system. |
successCallback | Success callback |
errorCallback | Callback for handling error. |
This plugin was built at Openlabs.
This plugin is professionally supported by Openlabs. If you are looking for on-site teaching or consulting support, contact our sales and support teams.