sql.js
sql.js copied to clipboard
Add support for opening URLs (lazy database file)
I've added support for opening URLs using FS.createLazyFile
API of Emscripten. I've modified api.coffee
and worker.coffee
respectively.
It might be also useful to document somewhere (README or the API docs?) that the following headers must be present for the file to be lazy-loaded (see library_fs.js:1703
):
-
Accept-Ranges: bytes
-
Content-Length
-
Content-Encoding
(if other thanidentity
)
Care must be taken that these headers are accessible from XHR requests, thus appropriate CORS headers (e.g. Access-Control-Expose-Headers
) must be set accordingly.
See https://boramalper.github.io/client-side-sqlite/ for a demo.