Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for opening a database from a data uri or base64 blob #34

Closed
ghost opened this issue Sep 27, 2013 · 1 comment
Closed

Add support for opening a database from a data uri or base64 blob #34

ghost opened this issue Sep 27, 2013 · 1 comment

Comments

@ghost
Copy link

ghost commented Sep 27, 2013

I want to embed a small SQLite database as a base64 encoded data uri in a web page. I'd like to be able to open the database via passing in the data uri, or the actual decoded blob.

See also: dataURItoBlob

@danhalliday
Copy link

I think this works out of the box, just calling SQL.open(data). To open a database from a file, so something like:

var input = document.querySelectorAll('#file-input')[0].files[0];
var reader = new FileReader();

reader.onload = function(e) {
    // reader.result is your data blob.
};

reader.readAsBinaryString(input);

Perhaps reader.readAsDataURL() might help you also.

@lovasoa lovasoa closed this as completed Jun 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants