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

Commit 3401f0b

Browse files
committed
Merge pull request #191 from ipfs/docs/readme
Update README Docs + remove unmaintained examples
2 parents 3afd1bf + 259fccd commit 3401f0b

File tree

8 files changed

+50
-124
lines changed

8 files changed

+50
-124
lines changed

README.md

+50-44
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,49 @@ If are using this module in a browser with something like browserify, then you w
6161
$ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"http://example.com\"]"
6262
```
6363

64-
## API
64+
## Usage
6565

66-
### Level 1 Commands
67-
Level 1 commands are simple commands
66+
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/blob/ipfs/api/api/core/README.md)
6867

69-
#### add
68+
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: https://github.com/ipfs/js-ipfs-api/tree/master/test/api
69+
70+
### Core
71+
72+
##### Block
73+
74+
##### Object
75+
76+
**Curl**
77+
```sh
78+
curl 'http://localhost:5001/api/v0/object/get?arg=QmYEqnfCZp7a39Gxrgyv3qRS4MoCTGjegKV6zroU3Rvr52&stream-channels=true' --compressed
79+
```
80+
81+
**Response**
82+
```js
83+
{
84+
Links: [{
85+
Name: string,
86+
Hash: string,
87+
Size: number
88+
}, ...],
89+
Data: string
90+
}
91+
```
92+
*Data is base64 encoded.*
93+
94+
##### Pin
95+
96+
97+
-------------------------------------------------------
98+
99+
### Extensions
100+
101+
102+
-------------------------------------------------------
103+
104+
### Tooling
105+
106+
##### add
70107

71108
Add a file (where file is any data) to ipfs returning the hash and name. The
72109
name value will only be set if you are actually sending a file. A single or
@@ -83,6 +120,7 @@ ipfs.add(files, function(err, res) {
83120
})
84121
})
85122
```
123+
86124
`files` can be a mixed array of filenames or buffers of data. A single value is
87125
also acceptable.
88126

@@ -111,11 +149,12 @@ curl 'http://localhost:5001/api/v0/add?stream-channels=true' \
111149

112150

113151

114-
#### cat
152+
##### cat
115153

116154
Retrieve the contents of a single hash, or array of hashes.
117155

118156
**Usage**
157+
119158
```javascript
120159
ipfs.cat(hashs, function(err, res) {
121160
if(err || !res) return console.error(err)
@@ -131,6 +170,7 @@ ipfs.cat(hashs, function(err, res) {
131170
```
132171

133172
**Curl**
173+
134174
```sh
135175
curl "http://localhost:5001/api/v0/cat?arg=<hash>&stream-channels=true"
136176
```
@@ -139,7 +179,7 @@ curl "http://localhost:5001/api/v0/cat?arg=<hash>&stream-channels=true"
139179

140180
The response is either a readable stream, or a string.
141181

142-
#### ls
182+
##### ls
143183
Get the node structure of a hash. Included in it is a hash and array to links.
144184

145185
**Usage**
@@ -179,46 +219,12 @@ curl "http://localhost:5001/api/v0/ls?arg=<hash>&stream-channels=true"
179219
}
180220
```
181221

222+
##### Update
182223

183-
**version**
184-
185-
**commands**
186-
187-
### Level 2 Commands
188-
Level 2 commands are simply named spaced wrapped commands
189-
190-
#### Config
191-
192-
#### Update
193-
194-
#### Mount
195-
196-
#### Diag
197-
198-
#### Block
199-
200-
#### Object
201-
202-
**Curl**
203-
```sh
204-
curl 'http://localhost:5001/api/v0/object/get?arg=QmYEqnfCZp7a39Gxrgyv3qRS4MoCTGjegKV6zroU3Rvr52&stream-channels=true' --compressed
205-
```
224+
-------------------------------------------------------
206225

207-
**Response**
208-
```js
209-
{
210-
Links: [{
211-
Name: string,
212-
Hash: string,
213-
Size: number
214-
}, ...],
215-
Data: string
216-
}
217-
```
218-
*Data is base64 encoded.*
226+
### Network
219227

220-
#### Swarm
221228

222-
#### Pin
223229

224-
#### Gateway
230+
-------------------------------------------------------

examples/add.js

-22
This file was deleted.

examples/cat.js

-18
This file was deleted.

examples/files/hello.txt

-1
This file was deleted.

examples/files/ipfs.txt

-1
This file was deleted.

examples/ipfs-add.js

-12
This file was deleted.

examples/ls.js

-18
This file was deleted.

examples/version.js

-8
This file was deleted.

0 commit comments

Comments
 (0)