3 ms·
I've often looked for a simple human readable file-based DB-like system like this. Are there other competing packages like this?
by yodon 6y ago
I've often looked for a simple human readable file-based DB-like system like this. Are there other competing packages like this?
- LVB 6y agoThis is sort of in the space: https://github.com/msiemens/tinydb https://github.com/msiemens/tinydb
- graderjs 6y agoI just had a quick search, didn't turn up much but there is this https://github.com/pksunkara/nosqlite https://github.com/pksunkara/nosqlite I could add a section
- asaibx 6y agoThere's always recutils [0] which uses a plain text database format stored in files called recfiles. [0] https://labs.tomasino.org/gnu-recutils/ https://labs.tomasino.org/gnu-recutils/
- graderjs 6y agoI should add that I was inspired by recutils and considered using it before making this. The appeal of using common Unix tools to play with a database is a motivation for me
- jitl 6y agoI feel like many static site generators have more-or-less filesystem-as-database. Some are more specialized than others. Many SSGs have standardized around the format of `YAML: Metadata\n\n---\n\nContent`, and expose a query interface over the YAML metadata. But, most static site generators don't generally have create/update API - just a read API. A reason you don't see much in the "tree of simple files as my DB" space is that the whole point of it is to be trivially simple to understand, and thus, to implement. Now, with file DBs, it's actually quite important to use atomic writes, so that a crash or concurrent operations don't produce errors. For example, the package posted above can corrupt data if there's concurrent writers to the same data file, because all the writes are non-atomic fs.writeFileSync(). What this database should do instead is write to a tempfile, and then rename the tempfile to replace the destination. That way, you get simple last-write-wins semantics with no possibility of creating invalid JSONs.
- legulere 6y agoDBASE is largely text-based
- leoncvlt 6y agoThis is something I wrote for a small electron application that needed some simple database functionality: https://www.npmjs.com/package/minim-json-db https://www.npmjs.com/package/minim-json-db Like the OP, stores data locally in .json files, and uses a simple MongoDB-inspired API
- graderjs 6y agoThanks! I'll add to related projects