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

Commit

Permalink
feat(API): kick off ipfs-api next generation
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Aug 14, 2016
1 parent 6948370 commit 4e011d4
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 221 deletions.
204 changes: 0 additions & 204 deletions API.md

This file was deleted.

47 changes: 42 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# js-ipfs-api
ipfs-api
========

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

> A client library for the IPFS HTTP API, implemented in JavaScript.
> 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.
![](https://github.com/ipfs/interface-ipfs-core/raw/master/img/badge.png)

## Table of Contents

Expand Down Expand Up @@ -106,12 +109,38 @@ $ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"http://exam
`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.

### Extra API methods
### Utility functions

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.
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`.

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


#### Add files or entire directories from the FileSystem to IPFS

> `ipfs.util.fsAdd(path, callback)`
Reads path from disk, if it is a directory, will add it recursively, if not, will add the file.

```JavaScript
```

#### Add a file from a URL to IPFS

> `ipfs.util.urlAdd(url, callback)`
```JavaScript
```

#### Add a file from a stream to IPFS

> `ipfs.util.streamAdd(stream, callback)`
This is very similar to `ipfs.files.add({path:'', content: stream})`. It is like the reverse of cat

```JavaScript
```

### Callbacks and promises

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

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).



>>>>>>> kick off ipfs-api next generation
## Contribute

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

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

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

## Historical context

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.

## License

[MIT](LICENSE)
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@
"description": "A client library for the IPFS API",
"main": "lib/index.js",
"jsnext:main": "src/index.js",
"scripts": {
"test": "gulp test",
"test:node": "gulp test:node",
"test:browser": "gulp test:browser",
"lint": "aegir-lint",
"build": "gulp build",
"release": "gulp release",
"release-minor": "gulp release --type minor",
"release-major": "gulp release --type major",
"coverage": "gulp coverage",
"coverage-publish": "aegir-coverage publish"
},
"dependencies": {
"async": "^2.0.1",
"babel-runtime": "^6.11.6",
Expand Down Expand Up @@ -41,18 +53,6 @@
"stream-http": "^2.3.1",
"streamifier": "^0.1.1"
},
"scripts": {
"test": "gulp test",
"test:node": "gulp test:node",
"test:browser": "gulp test:browser",
"lint": "aegir-lint",
"build": "gulp build",
"release": "gulp release",
"release-minor": "gulp release --type minor",
"release-major": "gulp release --type major",
"coverage": "gulp coverage",
"coverage-publish": "aegir-coverage publish"
},
"pre-commit": [
"lint",
"test"
Expand Down

0 comments on commit 4e011d4

Please sign in to comment.