How to use the abstract-leveldown.AbstractLevelDOWN function in abstract-leveldown

To help you get started, we’ve selected a few abstract-leveldown examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / abstract-leveldown / abstract-leveldown-tests.ts View on Github external
import { AbstractLevelDOWN } from 'abstract-leveldown';

const test = (levelDown: AbstractLevelDOWN) => {
  levelDown.put("key", "value", (err?) => { });
  levelDown.put(1, "value", { something: true }, (err?) => { });

  levelDown.get("key", (err?) => { });
  levelDown.get(1, { something: true }, (err?) => { });
};
// $ExpectType void
test(new AbstractLevelDOWN('here'));
// $ExpectType void
test(AbstractLevelDOWN('there'));
// $ExpectType void
test(new AbstractLevelDOWN('here'));
// $ExpectType void
test(AbstractLevelDOWN('there'));
github DefinitelyTyped / DefinitelyTyped / types / abstract-leveldown / abstract-leveldown-tests.ts View on Github external
import { AbstractLevelDOWN } from 'abstract-leveldown';

const test = (levelDown: AbstractLevelDOWN) => {
  levelDown.put("key", "value", (err?) => { });
  levelDown.put(1, "value", { something: true }, (err?) => { });

  levelDown.get("key", (err?) => { });
  levelDown.get(1, { something: true }, (err?) => { });
};
// $ExpectType void
test(new AbstractLevelDOWN('here'));
// $ExpectType void
test(AbstractLevelDOWN('there'));
// $ExpectType void
test(new AbstractLevelDOWN('here'));
// $ExpectType void
test(AbstractLevelDOWN('there'));
github DefinitelyTyped / DefinitelyTyped / types / levelup / levelup-tests.ts View on Github external
import levelup from 'levelup';
import { AbstractLevelDOWN } from 'abstract-leveldown';

interface StringEncoding {
    encode(val: any): string;
    decode(val: string): any;
    buffer: boolean;
    type: string;
}

declare const stringEncoding: StringEncoding;

const db = levelup(new AbstractLevelDOWN('here'), {
    keyEncoding: stringEncoding,
    valueEncoding: stringEncoding
});

db.open();
db.close();
db.open((error) => {
});

db.close((error) => {
});

db.put("key", {});
db.put("key", {}, (error) => {});
db.put("key", {}, { sync: true}, (error) => {});
github medea / medeadown / medeadown.js View on Github external
, open = require('leveldown-open')

  , MedeaIterator = require('./medeaiterator')

  , MedeaDOWN = function (location) {
      if (!(this instanceof MedeaDOWN))
        return new MedeaDOWN(location)

      AbstractLevelDOWN.call(this, location)
      this.db = medea()
      this.keys = keydir()
    }

  , setImmediate = global.setImmediate || process.nextTick

require('util').inherits(MedeaDOWN, AbstractLevelDOWN)

MedeaDOWN.prototype._open = function (options, callback) {
  var self = this

  open(this.location, options, function (err) {
    if (err)
      return callback(err)

    self.db.open(self.location, function (err) {
      if (err)
        return callback(err)

      self.db.listKeys(function (err, keys) {
        keys.forEach(function (key) {
          self.keys.put(key)
        })