You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 10, 2020. It is now read-only.
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
71
69
72
-
# API
70
+
# API Reference
73
71
74
72
We classify the API calls by 'core', 'extensions', 'tooling', and 'network', following the same API spec organization available at [ipfs/specs](https://github.com/ipfs/specs/tree/master/api).
75
73
76
74
The tests folder also contains great examples that can be used to understand how this client library interacts with the HTTP-API. You can find the [tests here](test/api).
77
75
78
-
79
-
## Callbacks and promises
80
-
81
-
If you do not pass in a callback all api functions will return a `Promise`, for example
82
-
83
-
```js
84
-
ipfs.id()
85
-
.then(function (id) {
86
-
console.log('my id is: ', id)
87
-
})
88
-
```
89
-
90
-
This relies on a global `Promise` object. If you are in an environemnt where that is not
91
-
yet available you need to bring your own polyfill.
92
-
93
-
## Reference
94
-
95
-
### Core
76
+
## Core
96
77
97
78
#### `version([callback])`
98
79
@@ -149,7 +130,7 @@ yet available you need to bring your own polyfill.
149
130
150
131
##### `log.tail([callback])`
151
132
152
-
###Extensions
133
+
## Extensions
153
134
154
135
#### `add(arrayOrBufferOrStream, [callback])`
155
136
@@ -179,7 +160,7 @@ yet available you need to bring your own polyfill.
179
160
180
161
-[tests](test/api/mount.spec.js)
181
162
182
-
###Tooling
163
+
## Tooling
183
164
184
165
#### `commands([callback])`
185
166
@@ -201,7 +182,7 @@ yet available you need to bring your own polyfill.
Copy file name to clipboardExpand all lines: README.md
+37-2Lines changed: 37 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,24 @@ IPFS API wrapper library in JavaScript
18
18
$ npm install --save ipfs-api
19
19
```
20
20
21
+
#### Running the daemon with the right port
22
+
23
+
To interact with the API, you need to have a local daemon running (at the moment; we have plans to make it work independently). It needs to be open on the right port: `5001`. This is the default.
24
+
25
+
```sh
26
+
# Show the ipfs config API port to check it is correct
See [API.md](API.md) and [`tests/api`](test/api) for details on available methods.
69
87
88
+
### Callbacks and promises
89
+
90
+
If you do not pass in a callback all API functions will return a `Promise`. For example:
91
+
92
+
```js
93
+
ipfs.id()
94
+
.then(function (id) {
95
+
console.log('my id is: ', id)
96
+
})
97
+
```
98
+
99
+
This relies on a global `Promise` object. If you are in an environment where that is not
100
+
yet available you need to bring your own polyfill.
101
+
70
102
## Contribute
71
103
72
-
Contributions are welcome! Please check out the [issues](https://github.com/ipfs/js-ipfs-api/issues).
104
+
The js-ipfs API is a work in progress. As such, there's a few things you can do right now to help out:
73
105
74
-
Some general things we always need are more tests. If you can add them, we'll work on making them pass (hopefully with you!).
106
+
***[Check out the existing issues](https://github.com/ipfs/js-ipfs-api/issues)**!
107
+
***Perform code reviews**. More eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs.
108
+
***Add tests**. There can never be enough tests.
109
+
***Contribute to the [FAQ repository](https://github.com/ipfs/faq/issues)** with any questions you have about IPFS or any of the relevant technology. A good example would be asking, 'What is a merkledag tree?'. If you don't know a term, odds are, someone else doesn't either. Eventually, we should have a good understanding of where we need to improve communications and teaching together to make IPFS and IPN better.
0 commit comments