diff --git a/.aegir.js b/.aegir.js new file mode 100644 index 0000000..f176614 --- /dev/null +++ b/.aegir.js @@ -0,0 +1,10 @@ +'use strict' + +module.exports = { + webpack: { + node: { + // this is needed until level stops using node buffers in browser code + Buffer: true + } + } +} diff --git a/package.json b/package.json index bd28419..40e203f 100644 --- a/package.json +++ b/package.json @@ -37,14 +37,14 @@ }, "homepage": "https://github.com/ipfs/js-datastore-level#readme", "dependencies": { - "datastore-core": "^1.1.0", - "interface-datastore": "^1.0.2", + "datastore-core": "^2.0.0", + "interface-datastore": "^2.0.0", "level": "^5.0.1" }, "devDependencies": { - "aegir": "^22.0.0", + "aegir": "^25.0.0", "chai": "^4.2.0", - "cids": "^0.8.0", + "cids": "^0.8.3", "dirty-chai": "^2.0.1", "level-mem": "^5.0.1", "rimraf": "^3.0.0" diff --git a/src/index.js b/src/index.js index c52b961..26a20f6 100644 --- a/src/index.js +++ b/src/index.js @@ -133,7 +133,7 @@ class LevelDatastore extends Adapter { it = map(it, ({ key, value }) => { const res = { key: new Key(key, false) } if (values) { - res.value = Buffer.from(value) + res.value = value } return res }) diff --git a/test/index.spec.js b/test/index.spec.js index 60d1f8b..d4ab1ee 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -6,8 +6,8 @@ chai.use(require('dirty-chai')) const expect = chai.expect const levelmem = require('level-mem') const level = require('level') -const os = require('os') const LevelStore = require('../src') +const { utils } = require('interface-datastore') describe('LevelDatastore', () => { describe('initialization', () => { @@ -43,7 +43,7 @@ describe('LevelDatastore', () => { ;[levelmem, level].forEach(database => { describe(`interface-datastore ${database.name}`, () => { require('interface-datastore/src/tests')({ - setup: () => new LevelStore(`${os.tmpdir()}/datastore-level-test-${Math.random()}`, { db: database }), + setup: () => new LevelStore(utils.tmpdir(), { db: database }), teardown () {} }) }) diff --git a/test/node.js b/test/node.js index 2cf0115..8bc6ca6 100644 --- a/test/node.js +++ b/test/node.js @@ -63,7 +63,7 @@ describe('LevelDatastore', () => { const cids = [] for await (const e of store.query({})) { - cids.push(new CID(1, 'dag-cbor', e.key.toBuffer())) + cids.push(new CID(1, 'dag-cbor', e.key.uint8Array())) } expect(cids[0].version).to.be.eql(0)