I’m trying to use $cordovaFile.readAsArrayBuffer but I’m getting the following error
I tried some solutions from the forum but without success
function getFileBlob(url, cb) {
console.log(url);
var path = url.substring(0, url.lastIndexOf('/') + 1);
var filename = url.substring(url.lastIndexOf('/') + 1, url.length);
console.log('path', path);
console.log('file', filename);
$cordovaFile.readAsArrayBuffer(path, filename)
.then(function (success) {
var blob = new Blob([success], { type: 'image/jpeg' });
cb(blob);
}, function (error) {
onsole.error(error);
cb(null);
});
}
Error:
FileError code:5, message:“ENCODING_ERR”
My url: /file:///storage/emulated/0/Android/data/com.ionicframework.paypad443164/cache/.Pic.jpg
var path: /file:///storage/emulated/0/Android/data/com.ionicframework.paypad443164/cache/
var file: .Pic.jpg
Where am I going wrong?