abstract-leveldownstore for Node.js and browsers.
levelup allows you to pass a
db option to its constructor. This overrides the default
// Note that if multiple instances point to the same location,// the db will be shared, but only per process.var levelup =var db =db
Your data is discarded when the process ends or you release a reference to the database. Note as well, though the internals of
memdown operate synchronously -
levelup does not.
Running our example gives:
hey: you done
memdown requires a ES5-capable browser. If you're using one that's isn't (e.g. PhantomJS, Android < 4.4, IE < 10) then you will need es5-shim.
Even though it's in memory, the location parameter does do something.
has a global cache, which it uses to save databases by the path string.
So for instance if you create these two instances:
var db1 = ;var db2 = ;
Then they will actually share the same data, because the
'foo' string is the same.
You may clear this global store using
By default, it doesn't delete the store but replaces it with a new one, so the open instance of
memdown will not be affected.
clearGlobalStore takes a single parameter, which if truthy clears the store strictly by deleting each individual key:
; // delete each individual key
If you are using
memdown somewhere else while simultaneously clearing the global store in this way, then it may throw an error or cause unexpected results.
In addition to the regular
npm test, you can test
memdown in a browser of choice with:
npm run test-browser-local
To check code coverage:
npm run coverage
memdown is Copyright (c) 2013-2017 Rod Vagg @rvagg and licensed under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.