let add_file = function(filename, filepath, blob, filetype) {
var sdcard = navigator.getDeviceStorage("sdcard");
var file = new Blob(['+blob+'], {
type: filetype,
});
var request = sdcard.addNamed(file, filepath + "/" + filename);
request.onsuccess = function() {
var name = this.result;
};
// An error typically occur if a file with the same name already exist
request.onerror = function() {
alert("Unable to write the file: " + this.error);
};
};