persistent file storage with NODEFS
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 13.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
To allow persistent file storage with NODEFS, and real time update of a SQLITE file instead of loading the whole thing at startup and writing it down using export, I had to changed the class constructor, the close function and debug an issue related to emscriten :
api.coffee : temporary random filename replaced by NODEFS mount relative filename
constructor: (data) ->
@filename = '/extfs/'+data
FS.mkdir '/extfs'
FS.mount NODEFS, {root:'.'}, '/extfs'
@handleError sqlite3_open @filename, apiTemp
@db = getValue(apiTemp, 'i32')
@statements = {} # A list of all prepared statements of the database
'close': ->
stmt['free']() for _,stmt of @statements
@handleError sqlite3_close_v2 @db
@db = null
Makefile: modified to ensure closure don't break NODEFS
optimized: EMFLAGS= --memory-init-file 0 --closure 0 -O3 -s INLINING_LIMIT=50
emscripten / src / library_nodefs.js : modified to avoid file "DeleteOnClose" bug under windows
stream.nfd = fs.openSync(path, NODEFS.flagsToPermissionString(stream.flags & 0xFFFF));
// instead of :
// stream.nfd = fs.openSync(path, NODEFS.flagsToPermissionString(stream.flags));
Perhaps the constructor could take an optional argument to specify witch file system to use (MEMFS / NODEFS / IDBFS / ...
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
Review api.coffee for the constructor and close changes, Makefile for the optimized flags, and emscripten/src/library_nodefs.js for the Windows DeleteOnClose workaround. Confirm how NODEFS should persist and update a SQLite file in real time, and define whether the constructor should support other filesystems such as MEMFS or IDBFS.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, sqlite, wasm
- Domain
- databases, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100