Hi guys I am trying to download a Base64 file but I get (we can't open this file) see the image and my code below
_thisSearchView.$scope.downloadViewAttachment = function (firstId) {
var idValue = couchObjectId.substr(4, couchObjectId.indexOf('_rev=') - 4);
$http.defaults.headers.common['Authorization'] = "Basic " + _thisSearchView.$scope.config.params.COUCHDB_SERVER_KEY;
$http({
method: "GET",
url: _thisSearchView.$scope.config.params.COUCHDB_SERVER_URL + idValue + '/' + attachName,
}).then(function mySuccess(response) {
try {
var blob = new Blob([response.data], {
type: "text/plain;charset=utf-8"
});
saveAs(blob, attachName);
}
catch (ex) {
console.log(ex);
}
}, function myError(response) {
if (response.status === 404) {
_thisSearchView.$scope.downloadViewArchDcoument();
}
});
};