Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

fix: remove node buffers #39

Merged
merged 3 commits into from
Jul 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .aegir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict'

module.exports = {
webpack: {
node: {
// this is needed until level stops using node buffers in browser code
Buffer: true
}
}
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
4 changes: 2 additions & 2 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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 () {}
})
})
Expand Down
2 changes: 1 addition & 1 deletion test/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down