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

Commit 4e011d4

Browse files
committed
feat(API): kick off ipfs-api next generation
1 parent 6948370 commit 4e011d4

File tree

3 files changed

+54
-221
lines changed

3 files changed

+54
-221
lines changed

API.md

Lines changed: 0 additions & 204 deletions
This file was deleted.

README.md

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# js-ipfs-api
1+
ipfs-api
2+
========
23

34
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
45
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)
@@ -9,7 +10,9 @@
910
[![Travis CI](https://travis-ci.org/ipfs/js-ipfs-api.svg?branch=master)](https://travis-ci.org/ipfs/js-ipfs-api)
1011
[![Circle CI](https://circleci.com/gh/ipfs/js-ipfs-api.svg?style=svg)](https://circleci.com/gh/ipfs/js-ipfs-api)
1112

12-
> A client library for the IPFS HTTP API, implemented in JavaScript.
13+
> A client library for the IPFS HTTP API, implemented in JavaScript. This client library implements the [interface-ipfs-core](https://github.com/ipfs/interface-ipfs-core) enabling applications to change between a embebed js-ipfs node and any remove IPFS node without having to change the code. In addition, this client library implements a set of utility functions.
14+
15+
![](https://github.com/ipfs/interface-ipfs-core/raw/master/img/badge.png)
1316

1417
## Table of Contents
1518

@@ -106,12 +109,38 @@ $ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"http://exam
106109
107110
`js-ipfs-api` follows the spec defined by [`interface-ipfs-core`](https://github.com/ipfs/interface-ipfs-core), which concerns the interface to expect from IPFS implementations. This interface is a currently active endeavor - expect it to be complete in the next few weeks (August 2016). You can use it today to consult the methods available.
108111

109-
### Extra API methods
112+
### Utility functions
110113

111-
Adding to the methods defined by [`interface-ipfs-core`](https://github.com/ipfs/interface-ipfs-core), `js-ipfs-api` exposes a set of extra utility methods.
114+
Adding to the methods defined by [`interface-ipfs-core`](https://github.com/ipfs/interface-ipfs-core), `js-ipfs-api` exposes a set of extra utility methods. These utility functions are scoped behind the `ipfs.util`.
112115

113116
Complete documentation for these methods is coming with: https://github.com/ipfs/js-ipfs-api/pull/305
114117

118+
119+
#### Add files or entire directories from the FileSystem to IPFS
120+
121+
> `ipfs.util.fsAdd(path, callback)`
122+
123+
Reads path from disk, if it is a directory, will add it recursively, if not, will add the file.
124+
125+
```JavaScript
126+
```
127+
128+
#### Add a file from a URL to IPFS
129+
130+
> `ipfs.util.urlAdd(url, callback)`
131+
132+
```JavaScript
133+
```
134+
135+
#### Add a file from a stream to IPFS
136+
137+
> `ipfs.util.streamAdd(stream, callback)`
138+
139+
This is very similar to `ipfs.files.add({path:'', content: stream})`. It is like the reverse of cat
140+
141+
```JavaScript
142+
```
143+
115144
### Callbacks and promises
116145

117146
If you do not pass in a callback all API functions will return a `Promise`. For example:
@@ -135,9 +164,13 @@ yet available you need to bring your own polyfill.
135164

136165
We run tests by executing `npm test` in a terminal window. This will run both Node.js and Browser tests, both in Chrome and PhantomJS. To ensure that the module conforms with the [`interface-ipfs-core`](https://github.com/ipfs/interface-ipfs-core) spec, we run the batch of tests provided by the interface module, which can be found [here](https://github.com/ipfs/interface-ipfs-core/tree/master/src).
137166

167+
168+
169+
>>>>>>> kick off ipfs-api next generation
170+
138171
## Contribute
139172

140-
The js-ipfs API is a work in progress. As such, there's a few things you can do right now to help out:
173+
The js-ipfs-api is a work in progress. As such, there's a few things you can do right now to help out:
141174

142175
* **[Check out the existing issues](https://github.com/ipfs/js-ipfs-api/issues)**!
143176
* **Perform code reviews**. More eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs.
@@ -148,6 +181,10 @@ The js-ipfs API is a work in progress. As such, there's a few things you can do
148181

149182
[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)
150183

184+
## Historical context
185+
186+
This module started as a direct mapping from the go-ipfs cli to a JavaScript implementation, although this was useful and familiar to a lot of developers that were coming to IPFS for the first time, it also created some confusion on how to operate the core of IPFS and have access to the full capacity of the protocol. After much consideration, we decided to create `interface-ipfs-core` with the goal of standardizing the interface of a core implementation of IPFS, and keep the utility functions the IPFS community learned to use and love, such as reading files from disk and storing them directly to IPFS.
187+
151188
## License
152189

153190
[MIT](LICENSE)

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@
44
"description": "A client library for the IPFS API",
55
"main": "lib/index.js",
66
"jsnext:main": "src/index.js",
7+
"scripts": {
8+
"test": "gulp test",
9+
"test:node": "gulp test:node",
10+
"test:browser": "gulp test:browser",
11+
"lint": "aegir-lint",
12+
"build": "gulp build",
13+
"release": "gulp release",
14+
"release-minor": "gulp release --type minor",
15+
"release-major": "gulp release --type major",
16+
"coverage": "gulp coverage",
17+
"coverage-publish": "aegir-coverage publish"
18+
},
719
"dependencies": {
820
"async": "^2.0.1",
921
"babel-runtime": "^6.11.6",
@@ -41,18 +53,6 @@
4153
"stream-http": "^2.3.1",
4254
"streamifier": "^0.1.1"
4355
},
44-
"scripts": {
45-
"test": "gulp test",
46-
"test:node": "gulp test:node",
47-
"test:browser": "gulp test:browser",
48-
"lint": "aegir-lint",
49-
"build": "gulp build",
50-
"release": "gulp release",
51-
"release-minor": "gulp release --type minor",
52-
"release-major": "gulp release --type major",
53-
"coverage": "gulp coverage",
54-
"coverage-publish": "aegir-coverage publish"
55-
},
5656
"pre-commit": [
5757
"lint",
5858
"test"

0 commit comments

Comments
 (0)