Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit 0b32373

Browse files
committed
Merge pull request #220 from ipfs/fix/object-patch
Fix/object patch
2 parents 2938470 + a185c92 commit 0b32373

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1172
-437
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ node_js:
44
- '5'
55
- stable
66

7+
addons:
8+
firefox: 'latest'
9+
710
before_script:
811
- export DISPLAY=:99.0
912
- sh -e /etc/init.d/xvfb start

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,20 @@ If you omit the host and port, the api will parse `window.host`, and use this in
4949
var ipfs = window.ipfsAPI()
5050
```
5151

52+
### Using Promises
53+
54+
If you do not pass in a callback all api functions will return a `Promise`, for example
55+
56+
```js
57+
ipfs.id()
58+
.then(function (id) {
59+
console.log('my id is: ', id)
60+
})
61+
```
62+
63+
This relies on a global `Promise` object. If you are in an environemnt where that is not
64+
yet available you need to bring your own polyfill.
65+
5266
#### Gotchas
5367

5468
When using the api from script tag for things that require buffers (`ipfs.add`, for example), you will have to use either the exposed `ipfs.Buffer`, that works just like a node buffer, or use this [browser buffer](https://github.com/feross/buffer).

dist/ipfsapi.js

Lines changed: 464 additions & 236 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ipfsapi.min.js

Lines changed: 12 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const runSequence = require('run-sequence')
55

66
require('require-dir')('tasks')
77

8-
gulp.task('default', done => {
8+
gulp.task('default', (done) => {
99
runSequence(
1010
'lint',
1111
'test',

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ipfs-api",
3-
"version": "2.11.0",
3+
"version": "2.13.1",
44
"description": "A client library for the IPFS API",
55
"main": "src/index.js",
66
"dependencies": {
@@ -22,19 +22,21 @@
2222
},
2323
"devDependencies": {
2424
"babel-core": "^6.1.21",
25-
"babel-eslint": "^5.0.0-beta6",
25+
"babel-eslint": "^5.0.0-beta9",
2626
"babel-loader": "^6.2.0",
2727
"babel-plugin-transform-runtime": "^6.1.18",
2828
"babel-preset-es2015": "^6.0.15",
2929
"babel-runtime": "^6.3.19",
3030
"chai": "^3.4.1",
3131
"concurrently": "^1.0.0",
32-
"eslint-config-standard": "^4.4.0",
32+
"eslint": "^2.0.0-rc.0",
33+
"eslint-config-standard": "^5.1.0",
34+
"eslint-plugin-promise": "^1.0.8",
3335
"eslint-plugin-standard": "^1.3.1",
3436
"glob-stream": "5.3.1",
3537
"gulp": "^3.9.0",
3638
"gulp-bump": "^1.0.0",
37-
"gulp-eslint": "^1.0.0",
39+
"gulp-eslint": "^2.0.0-rc-3",
3840
"gulp-filter": "^3.0.1",
3941
"gulp-git": "^1.6.0",
4042
"gulp-load-plugins": "^1.0.0",
@@ -43,7 +45,7 @@
4345
"gulp-tag-version": "^1.3.0",
4446
"gulp-util": "^3.0.7",
4547
"https-browserify": "0.0.1",
46-
"ipfsd-ctl": "^0.8.0",
48+
"ipfsd-ctl": "^0.8.1",
4749
"json-loader": "^0.5.3",
4850
"karma": "^0.13.11",
4951
"karma-chrome-launcher": "^0.2.1",

src/api/add.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const Wreck = require('wreck')
22

3-
module.exports = send => {
3+
module.exports = (send) => {
44
return function add (files, opts, cb) {
55
if (typeof (opts) === 'function' && cb === undefined) {
66
cb = opts

src/api/block.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const argCommand = require('../cmd-helpers').argCommand
44

5-
module.exports = send => {
5+
module.exports = (send) => {
66
return {
77
get: argCommand(send, 'block/get'),
88
stat: argCommand(send, 'block/stat'),

src/api/cat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
const argCommand = require('../cmd-helpers').argCommand
44

5-
module.exports = send => {
5+
module.exports = (send) => {
66
return argCommand(send, 'cat')
77
}

src/api/commands.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
const command = require('../cmd-helpers').command
44

5-
module.exports = send => {
5+
module.exports = (send) => {
66
return command(send, 'commands')
77
}

0 commit comments

Comments
 (0)