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

Commit

Permalink
next generation of the ipfs-api
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Aug 4, 2016
1 parent 848cb87 commit 8ae12a3
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 370 deletions.
204 changes: 0 additions & 204 deletions API.md

This file was deleted.

48 changes: 43 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 All @@ -20,7 +23,7 @@
- [In the Browser through `<script>` tag](#in-the-browser-through-script-tag)
- [CORS](#cors)
- [Usage](#usage)
- [Callbacks and promises](#callbacks-and-promises)
- [Callbacks and Promises](#callbacks-and-promises)
- [Contribute](#contribute)
- [License](#license)

Expand Down Expand Up @@ -99,7 +102,7 @@ $ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"http://exam

## Usage

See [API.md](API.md) and [`tests/api`](test/api) for details on available methods.
See [interface-ipfs-core](https://github.com/ipfs/interface-ipfs-core) for the standard IPFS API. In addition, this module implements a set of utility functions.

### Callbacks and promises

Expand All @@ -118,9 +121,40 @@ ipfs.id()
This relies on a global `Promise` object. If you are in an environment where that is not
yet available you need to bring your own polyfill.

### Utility functions

These utility functions are scoped behind the `ipfs.util`.

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



## 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 @@ -131,6 +165,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)
29 changes: 15 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,20 @@
"name": "ipfs-api",
"version": "6.0.3",
"description": "A client library for the IPFS API",
"main": "lib/index.js",
"main": "src/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.0-rc.5",
"babel-runtime": "^6.6.1",
Expand All @@ -20,6 +32,7 @@
"ndjson": "^1.4.3",
"promisify-es6": "^1.0.1",
"qs": "^6.1.0",
"streamifier": "^0.1.1",
"wreck": "^7.0.2"
},
"engines": {
Expand All @@ -40,18 +53,6 @@
"stream-http": "^2.2.0",
"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 Expand Up @@ -94,4 +95,4 @@
"url": "https://github.com/ipfs/js-ipfs-api/issues"
},
"homepage": "https://github.com/ipfs/js-ipfs-api"
}
}

0 comments on commit 8ae12a3

Please sign in to comment.