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

Commit

Permalink
feat: add open method (#2)
Browse files Browse the repository at this point in the history
* feat: add open method

* chore: rm yarn.lock

* chore: update deps
  • Loading branch information
dignifiedquire authored and daviddias committed Mar 23, 2017
1 parent 4fe5371 commit 99c7409
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7,636 deletions.
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
},
"homepage": "https://github.com/ipfs/js-datastore-fs#readme",
"dependencies": {
"datastore-core": "^0.1.0",
"datastore-core": "^0.2.0",
"graceful-fs": "^4.1.11",
"interface-datastore": "^0.1.0",
"interface-datastore": "^0.1.1",
"level-js": "^2.2.4",
"leveldown": "^1.6.0",
"levelup": "^1.3.5",
Expand All @@ -44,15 +44,16 @@
"write-file-atomic": "^1.3.1"
},
"devDependencies": {
"aegir": "^10.0.0",
"aegir": "^11.0.1",
"async": "^2.1.5",
"chai": "^3.5.0",
"cids": "^0.4.1",
"flow-bin": "^0.41.0",
"cids": "^0.4.2",
"dirty-chai": "^1.2.2",
"flow-bin": "^0.42.0",
"memdown": "^1.2.4",
"rimraf": "^2.6.1"
},
"contributors": [
"Friedel Ziegelmayer <dignifiedquire@gmail.com>"
]
}
}
5 changes: 5 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ class FsDatastore {
}
}

open (callback /* : Callback<void> */) /* : void */ {
this._openOrCreate()
setImmediate(callback)
}

/**
* Check if the path actually exists.
* @private
Expand Down
8 changes: 5 additions & 3 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
/* eslint-env mocha */
'use strict'

const chai = require('chai')
chai.use(require('dirty-chai'))
const expect = chai.expect
const pull = require('pull-stream')
const path = require('path')
const expect = require('chai').expect
const mkdirp = require('mkdirp')
const rimraf = require('rimraf')
const waterfall = require('async/waterfall')
Expand Down Expand Up @@ -94,7 +96,7 @@ describe('FsDatastore', () => {
pull(
fs.query({}),
pull.collect((err, res) => {
expect(err).to.not.exist
expect(err).to.not.exist()
expect(res).to.have.length(23)
done()
})
Expand All @@ -116,7 +118,7 @@ describe('FsDatastore', () => {
),
(cb) => flatfs.get(key, cb)
], (err, res) => {
expect(err).to.not.exist
expect(err).to.not.exist()
expect(res[0]).to.have.length(23)
expect(res[1]).to.be.eql(expected)

Expand Down
Loading

0 comments on commit 99c7409

Please sign in to comment.