async operations
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 13.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
I know you can create a sql instance of an uint8array and make operations on that.
but i wonder: is it possible to just load a simple File instead of a Uint8Array?
i would like to load a read-only database and being able to do:
// load file from <input type="file">
const file = input.files[0]
// Create a database from a file without reading everything into memory
const db = new SQL.Database(file)
// Prepare an sql statement
const stmt = db.prepare("SELECT * FROM sqlite_master")
// Bind values to the parameters and fetch the results of the query
const result = await stmt.getAsObject()
// note: using await
The idea would just be for sql.js to slice the part of the file that is needed without loading the hole thing into memory
and kind of doing: await file.slice(start, end).arrayBuffer() operations instead
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named; start at the SQL.Database constructor and the File.slice(start, end).arrayBuffer() flow described in the issue. Determine whether a File can support the requested read-only database and asynchronous stmt.getAsObject() usage without loading the whole file into memory.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, sqlite
- Domain
- database, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100