I'm getting the URL to a sqlite db file on my server from the browser url using query string.
So in the app I have the file url.
Then I'm calling an angular $http.get function on that url.
This gives me the data in the file, but the library I'm using to read the data requires a file object.
Is there a way to create a file object from the paramiters inside $http.get? The parameters are data, status, headers, and config, I also have the file name.
I've tried constructing a blob but I keep getting an error saying "the database disk image is malformed." Here is the blob construction Inside the $http.get function:
...
var blob = [];
var blob2 = {fileName:null};
$http.get(fileName).
success(function (data, status, headers, config) {
blob[0] = data;
var theBlob = new Blob(blob, {name:fileName},{status:status},{headers:headers},{config:config}, {type : ''});
var r = new FileReader();
r.onload = function () {
var Uints = new Uint8Array(r.result);
db = new SQL.Database(Uints);
...
I've also tried building the blob by adding the $http.get data, status, headers, and config parts as more parts of the blob[] array, and passing that to the new Blob constructor...
Any help would be really appreciated, thanks!