db.js 1008 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. var level = require('level');
  2. var database = {
  3. init: function(){
  4. const db = level('./mydb');
  5. },
  6. open: function(callback){
  7. return this.db.open(callback);
  8. },
  9. close: function(callback){
  10. return this.db.close(callback);
  11. },
  12. put: function(key, value, options, callback){
  13. return this.db.put(key, value, options, callback);
  14. },
  15. get: function(key, options, callback){
  16. return this.db.get(key, options, callback);
  17. },
  18. del: function(key, options, callback){
  19. return this.db.del(key, options, callback);
  20. },
  21. batch: function(array, options, callback){
  22. return this.db.batch(array, options, callback);
  23. },
  24. isOpen: function(){
  25. return this.db.isOpen();
  26. },
  27. isClosed: function(){
  28. return this.db.isClosed();
  29. },
  30. createReadStream: function(options){
  31. return this.db.createReadStream(options);
  32. },
  33. createKeyStream: function(options){
  34. return this.db.createKeyStream(options);
  35. },
  36. createValueStream: function(options){
  37. return this.db.createValueStream(options);
  38. }
  39. };
  40. module.exports = database;