Git Product home page Git Product logo

Comments (5)

kronolynx avatar kronolynx commented on August 26, 2024

The most interesting I have found is level, which bundles levelup, leveldown and encoding-down
https://www.npmjs.com/package/level

  • level
    • exports a function that returns a levelup instance when invoked
    • bundles the current release of levelup and leveldown
    • leverages encodings using encoding-down
  • levelup
    • Fast and simple storage.
    • A Node.js wrapper for abstract-leveldown
  • leveldown
    • provides a pure C++ binding to LevelDB
  • LevelDB
    • Is a simple key-value store built by Google
    • supports arbitrary byte arrays as both keys and values, singular get, put and delete operations, batched put and delete, bi-directional iterators and simple compression using the very fast Snappy algorithm.
  • encoding-down
    • It allows you to specify an encoding to use for keys and values independently
    • The encoding is applied to all read and write operations
    • The default encoding is utf8 which ensures you'll always get back a string. You can also provide a custom encoding like bytewise - or your own

from sheikah.

kronolynx avatar kronolynx commented on August 26, 2024

After checking more storage solutions I think this one is better for our needs as it offers serialization:
https://www.npmjs.com/package/lowdb

lowdb

  • Small JSON database for Node, Electron and the browser. Powered by Lodash
  • Syntax
    db.get('posts')
       .push({ id: 1, title: 'lowdb is awesome'})
       .write()
  • FileSync, FileAsync and LocalStorage accept custom serialize and deserialize functions. You can use them to add encryption logic
    const adapter = new FileSync('db.json', {
      serialize: (data) => encrypt(JSON.stringify(data))
      deserialize: (data) => JSON.parse(decrypt(data))
    })

from sheikah.

aesedepece avatar aesedepece commented on August 26, 2024

Even though I like the lowdb API the most, I have a couple of concerns about such solution:

  • It seems to me that FileSync handles data as text and writes to the DB file in text mode, so an encoding like base64 would be needed to represent encrypted data and thus we are forced to bear a 33% expansion.
  • Its robustness and consistency is questioned for non-trivial use cases, and it has no error correction at all (see discussion here).Their own README says it becomes unreliable as the DB file grows.

Regarding Level, it's true that being a pure key/value store, it lacks rich QL capabilities. But apart from that, it is much stronger than lowdb in the two areas I'm more concerned about:

  • It supports binary mode by instatiating levelup with { encoding: 'binary' }. In addition, it has native compression (Google's Snappy).
  • LevelDB is not totally free from corruption, but has been proven to be a reasonably solid solution for embedded DBs (i.e.: Bitcoin Core uses LevelDB for storing the whole blockchain).

@kronolynx What do you think?

from sheikah.

kronolynx avatar kronolynx commented on August 26, 2024

@aesedepece after reading the discussion and your arguments, I think level should be used.

from sheikah.

aesedepece avatar aesedepece commented on August 26, 2024

Great, we can consider this done. OK to close.

from sheikah.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.