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

Commit d40cb6c

Browse files
author
Alan Shaw
authoredNov 28, 2018
refactor: rename library to ipfs-http-client (#897)
BREAKING CHANGE: the `ipfs-api` library has been renamed to `ipfs-http-client`. Now install via `npm install ipfs-http-client`. Note that in the browser build the object attached to `window` is now `window.IpfsHttpClient`. License: MIT Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
1 parent 38bed14 commit d40cb6c

39 files changed

+324
-326
lines changed
 

‎CHANGELOG.md

+184-184
Large diffs are not rendered by default.

‎README.md

+36-38
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
</p>
1414

1515
<p align="center">
16-
<a href="https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fipfs%2Fjs-ipfs-api?ref=badge_small" alt="FOSSA Status"><img src="https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fipfs%2Fjs-ipfs-api.svg?type=small"/></a>
17-
<a href="https://ci.ipfs.team/job/ipfs/job/js-ipfs-api/job/master/"><img src="https://ci.ipfs.team/buildStatus/icon?job=ipfs/js-ipfs-api/master" /></a>
18-
<a href="https://codecov.io/gh/ipfs/js-ipfs-api"><img src="https://codecov.io/gh/ipfs/js-ipfs-api/branch/master/graph/badge.svg"></a>
16+
<a href="https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fipfs%2Fjs-ipfs-http-client?ref=badge_small" alt="FOSSA Status"><img src="https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fipfs%2Fjs-ipfs-http-client.svg?type=small"/></a>
17+
<a href="https://ci.ipfs.team/job/ipfs/job/js-ipfs-http-client/job/master/"><img src="https://ci.ipfs.team/buildStatus/icon?job=ipfs/js-ipfs-http-client/master" /></a>
18+
<a href="https://codecov.io/gh/ipfs/js-ipfs-http-client"><img src="https://codecov.io/gh/ipfs/js-ipfs-http-client/branch/master/graph/badge.svg"></a>
1919
<br>
20-
<a href="https://david-dm.org/ipfs/js-ipfs-api"><img src="https://david-dm.org/ipfs/js-ipfs-api.svg?style=flat-square" /></a>
20+
<a href="https://david-dm.org/ipfs/js-ipfs-http-client"><img src="https://david-dm.org/ipfs/js-ipfs-http-client.svg?style=flat-square" /></a>
2121
<a href="https://github.com/feross/standard"><img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square"></a>
2222
<a href="https://github.com/RichardLitt/standard-readme"><img src="https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square" /></a>
2323
<a href=""><img src="https://img.shields.io/badge/npm-%3E%3D3.0.0-orange.svg?style=flat-square" /></a>
@@ -51,7 +51,7 @@
5151
This module uses node.js, and can be installed through npm:
5252

5353
```bash
54-
npm install --save ipfs-api
54+
npm install --save ipfs-http-client
5555
```
5656

5757
We support both the Current and Active LTS versions of Node.js. Please see [nodejs.org](https://nodejs.org/) for what these currently are.
@@ -75,27 +75,27 @@ To interact with the API, you need to have a local daemon running. It needs to b
7575
### Importing the module and usage
7676

7777
```javascript
78-
var ipfsAPI = require('ipfs-api')
78+
var ipfsClient = require('ipfs-http-client')
7979

8080
// connect to ipfs daemon API server
81-
var ipfs = ipfsAPI('localhost', '5001', {protocol: 'http'}) // leaving out the arguments will default to these values
81+
var ipfs = ipfsClient('localhost', '5001', { protocol: 'http' }) // leaving out the arguments will default to these values
8282

8383
// or connect with multiaddr
84-
var ipfs = ipfsAPI('/ip4/127.0.0.1/tcp/5001')
84+
var ipfs = ipfsClient('/ip4/127.0.0.1/tcp/5001')
8585

8686
// or using options
87-
var ipfs = ipfsAPI({host: 'localhost', port: '5001', protocol: 'http'})
87+
var ipfs = ipfsClient({ host: 'localhost', port: '5001', protocol: 'http' })
8888

8989
// or specifying a specific API path
90-
var ipfs = ipfsAPI({host: '1.1.1.1', port: '80', 'api-path': '/ipfs/api/v0'})
90+
var ipfs = ipfsClient({ host: '1.1.1.1', port: '80', 'api-path': '/ipfs/api/v0' })
9191
```
9292

9393
### Importing a sub-module and usage
9494

9595
```javascript
96-
const bitswap = require('ipfs-api/src/bitswap')('/ip4/127.0.0.1/tcp/5001')
96+
const bitswap = require('ipfs-http-client/src/bitswap')('/ip4/127.0.0.1/tcp/5001')
9797

98-
bitswap.unwant(key, (err) => {
98+
bitswap.wantlist(key, (err) => {
9999
// ...
100100
})
101101
```
@@ -110,7 +110,7 @@ See the example in the [examples folder](/examples/bundle-browserify) to get a b
110110

111111
**through webpack**
112112

113-
See the example in the [examples folder](/examples/bundle-webpack) to get an idea on how to use js-ipfs-api with webpack.
113+
See the example in the [examples folder](/examples/bundle-webpack) to get an idea on how to use `js-ipfs-http-client` with webpack.
114114

115115
**from CDN**
116116

@@ -120,9 +120,9 @@ To always request the latest version, use the following:
120120

121121
```html
122122
<!-- loading the minified version -->
123-
<script src="https://unpkg.com/ipfs-api/dist/index.min.js"></script>
123+
<script src="https://unpkg.com/ipfs-http-client/dist/index.min.js"></script>
124124
<!-- loading the human-readable (not minified) version -->
125-
<script src="https://unpkg.com/ipfs-api/dist/index.js"></script>
125+
<script src="https://unpkg.com/ipfs-http-client/dist/index.js"></script>
126126
```
127127

128128
For maximum security you may also decide to:
@@ -134,26 +134,26 @@ For maximum security you may also decide to:
134134
Example:
135135

136136
```html
137-
<script src="https://unpkg.com/ipfs-api@9.0.0/dist/index.js"
137+
<script src="https://unpkg.com/ipfs-http-client@9.0.0/dist/index.js"
138138
integrity="sha384-5bXRcW9kyxxnSMbOoHzraqa7Z0PQWIao+cgeg327zit1hz5LZCEbIMx/LWKPReuB"
139139
crossorigin="anonymous"></script>
140140
```
141141

142-
CDN-based IPFS API provides the `IpfsApi` constructor as a method of the global `window` object. Example:
142+
CDN-based IPFS API provides the `IpfsHttpClient` constructor as a method of the global `window` object. Example:
143143

144144
```js
145-
const ipfs = window.IpfsApi('localhost', '5001')
145+
const ipfs = window.IpfsHttpClient('localhost', '5001')
146146
```
147147

148-
If you omit the host and port, the API will parse `window.host`, and use this information. This also works, and can be useful if you want to write apps that can be run from multiple different gateways:
148+
If you omit the host and port, the client will parse `window.host`, and use this information. This also works, and can be useful if you want to write apps that can be run from multiple different gateways:
149149

150150
```js
151-
const ipfs = window.IpfsApi()
151+
const ipfs = window.IpfsHttpClient()
152152
```
153153

154154
### CORS
155155

156-
In a web browser IPFS API (either browserified or CDN-based) might encounter an error saying that the origin is not allowed. This would be a CORS ("Cross Origin Resource Sharing") failure: IPFS servers are designed to reject requests from unknown domains by default. You can whitelist the domain that you are calling from by changing your ipfs config like this:
156+
In a web browser IPFS HTTP client (either browserified or CDN-based) might encounter an error saying that the origin is not allowed. This would be a CORS ("Cross Origin Resource Sharing") failure: IPFS servers are designed to reject requests from unknown domains by default. You can whitelist the domain that you are calling from by changing your ipfs config like this:
157157

158158
```bash
159159
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"http://example.com\"]"
@@ -165,8 +165,8 @@ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods "[\"PUT\", \"POS
165165

166166
If you wish to send custom headers with each request made by this library, for example, the Authorization header. You can use the config to do so:
167167

168-
```
169-
const ipfs = IpfsApi({
168+
```js
169+
const ipfs = ipfsClient({
170170
host: 'localhost',
171171
port: 5001,
172172
protocol: 'http',
@@ -182,7 +182,7 @@ const ipfs = IpfsApi({
182182

183183
[![IPFS Core API Compatible](https://cdn.rawgit.com/ipfs/interface-ipfs-core/master/img/badge.svg)](https://github.com/ipfs/interface-ipfs-core)
184184

185-
> `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. You can use it today to consult the methods available.
185+
> `js-ipfs-http-client` 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. You can use it today to consult the methods available.
186186
187187
#### Files
188188

@@ -329,18 +329,18 @@ const ipfs = IpfsApi({
329329

330330
#### Pubsub Caveat
331331

332-
**Currently, the [PubSub API only works in Node.js environment](https://github.com/ipfs/js-ipfs-api/issues/518)**
332+
**Currently, the [PubSub API only works in Node.js environment](https://github.com/ipfs/js-ipfs-http-client/issues/518)**
333333

334334
We currently don't support pubsub when run in the browser, and we test it with separate set of tests to make sure if it's being used in the browser, pubsub errors.
335335

336-
More info: https://github.com/ipfs/js-ipfs-api/issues/518
336+
More info: https://github.com/ipfs/js-ipfs-http-client/issues/518
337337

338338
This means:
339-
- You can use pubsub from js-ipfs-api in Node.js
340-
- You can use pubsub from js-ipfs-api in Electron
341-
(when js-ipfs-api is ran in the main process of Electron)
342-
- You can't use pubsub from js-ipfs-api in the browser
343-
- You can't use pubsub from js-ipfs-api in Electron's
339+
- You can use pubsub from js-ipfs-http-client in Node.js
340+
- You can use pubsub from js-ipfs-http-client in Electron
341+
(when js-ipfs-http-client is ran in the main process of Electron)
342+
- You can't use pubsub from js-ipfs-http-client in the browser
343+
- You can't use pubsub from js-ipfs-http-client in Electron's
344344
renderer process
345345
- You can use pubsub from js-ipfs in the browsers
346346
- You can use pubsub from js-ipfs in Node.js
@@ -360,14 +360,12 @@ A set of data types are exposed directly from the IPFS instance under `ipfs.type
360360
- [`ipfs.types.multibase`](https://github.com/multiformats/multibase)
361361
- [`ipfs.types.multihash`](https://github.com/multiformats/js-multihash)
362362
- [`ipfs.types.CID`](https://github.com/ipld/js-cid)
363-
- [`ipfs.types.dagPB`](https://github.com/ipld/js-ipld-dag-pb)
364-
- [`ipfs.types.dagCBOR`](https://github.com/ipld/js-ipld-dag-cbor)
365363

366364
#### Extra (util) functions
367365

368-
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`.
366+
Adding to the methods defined by [`interface-ipfs-core`](https://github.com/ipfs/interface-ipfs-core), `js-ipfs-http-client` exposes a set of extra utility methods. These utility functions are scoped behind the `ipfs.util`.
369367

370-
Complete documentation for these methods is coming with: https://github.com/ipfs/js-ipfs-api/pull/305
368+
Complete documentation for these methods is coming with: https://github.com/ipfs/js-ipfs-http-client/pull/305
371369

372370
##### Get endpoint configuration (host and port)
373371

@@ -395,9 +393,9 @@ We run tests by executing `npm test` in a terminal window. This will run both No
395393

396394
## Contribute
397395

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

400-
- **[Check out the existing issues](https://github.com/ipfs/js-ipfs-api/issues)**!
398+
- **[Check out the existing issues](https://github.com/ipfs/js-ipfs-http-client/issues)**!
401399
- **Perform code reviews**. More eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs.
402400
- **Add tests**. There can never be enough tests. Note that interface tests exist inside [`interface-ipfs-core`](https://github.com/ipfs/interface-ipfs-core/tree/master/js/src).
403401
- **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.
@@ -414,4 +412,4 @@ This module started as a direct mapping from the go-ipfs cli to a JavaScript imp
414412

415413
[MIT](LICENSE)
416414

417-
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fipfs%2Fjs-ipfs-api.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fipfs%2Fjs-ipfs-api?ref=badge_large)
415+
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fipfs%2Fjs-ipfs-http-client.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fipfs%2Fjs-ipfs-http-client?ref=badge_large)

‎examples/bundle-browserify/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# Bundle js-ipfs-api with Browserify!
1+
# Bundle js-ipfs-http-client with Browserify!
22

3-
> In this example, you will find a boilerplate you can use to guide yourself into bundling js-ipfs-api with browserify, so that you can use it in your own web app!
3+
> In this example, you will find a boilerplate you can use to guide yourself into bundling js-ipfs-http-client with browserify, so that you can use it in your own web app!
44
55
## Setup
66

7-
As for any js-ipfs-api example, **you need a running IPFS daemon**, you learn how to do that here:
7+
As for any js-ipfs-http-client example, **you need a running IPFS daemon**, you learn how to do that here:
88

99
- [Spawn a go-ipfs daemon](https://ipfs.io/docs/getting-started/)
1010
- [Spawn a js-ipfs daemon](https://github.com/ipfs/js-ipfs#usage)
1111

12-
**Note:** If you load your app from a different domain than the one the daemon is running (most probably), you will need to set up CORS, see https://github.com/ipfs/js-ipfs-api#cors to learn how to do that.
12+
**Note:** If you load your app from a different domain than the one the daemon is running (most probably), you will need to set up CORS, see https://github.com/ipfs/js-ipfs-http-client#cors to learn how to do that.
1313

1414
A quick (and dirty way to get it done) is:
1515

‎examples/bundle-browserify/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22

3-
var IPFS = require('ipfs-api')
3+
var IPFS = require('ipfs-http-client')
44

55
var ipfs = IPFS()
66

‎examples/bundle-browserify/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "bundle-browserify",
33
"version": "1.0.0",
4-
"description": "Bundle js-ipfs-api with Browserify",
4+
"description": "Bundle js-ipfs-http-client with Browserify",
55
"main": "index.js",
66
"scripts": {
77
"start": "browserify index.js > bundle.js && http-server -a 127.0.0.1 -p 8888"
@@ -11,7 +11,7 @@
1111
"license": "MIT",
1212
"devDependencies": {
1313
"browserify": "^13.1.1",
14-
"ipfs-api": "../../",
14+
"ipfs-http-client": "../../",
1515
"http-server": "~0.9.0"
1616
},
1717
"dependencies": {}

‎examples/bundle-webpack/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# Bundle js-ipfs-api with Webpack!
1+
# Bundle js-ipfs-http-client with Webpack!
22

3-
> In this example, you will find a boilerplate you can use to guide yourself into bundling js-ipfs-api with webpack, so that you can use it in your own web app!
3+
> In this example, you will find a boilerplate you can use to guide yourself into bundling js-ipfs-http-client with webpack, so that you can use it in your own web app!
44
55
## Setup
66

7-
As for any js-ipfs-api example, **you need a running IPFS daemon**, you learn how to do that here:
7+
As for any js-ipfs-http-client example, **you need a running IPFS daemon**, you learn how to do that here:
88

99
- [Spawn a go-ipfs daemon](https://ipfs.io/docs/getting-started/)
1010
- [Spawn a js-ipfs daemon](https://github.com/ipfs/js-ipfs#usage)
1111

12-
**Note:** If you load your app from a different domain than the one the daemon is running (most probably), you will need to set up CORS, see https://github.com/ipfs/js-ipfs-api#cors to learn how to do that.
12+
**Note:** If you load your app from a different domain than the one the daemon is running (most probably), you will need to set up CORS, see https://github.com/ipfs/js-ipfs-http-client#cors to learn how to do that.
1313

1414
A quick (and dirty way to get it done) is:
1515

‎examples/bundle-webpack/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "bundle-webpack",
33
"version": "1.0.0",
4-
"description": "Bundle js-ipfs-api with Webpack",
4+
"description": "Bundle js-ipfs-http-client with Webpack",
55
"scripts": {
66
"start": "node server.js"
77
},
@@ -11,7 +11,7 @@
1111
"devDependencies": {
1212
"babel-core": "^5.4.7",
1313
"babel-loader": "^5.1.2",
14-
"ipfs-api": "../../",
14+
"ipfs-http-client": "../../",
1515
"json-loader": "~0.5.3",
1616
"react": "~0.13.0",
1717
"react-hot-loader": "^1.3.0",

‎examples/bundle-webpack/src/App.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict'
22
const React = require('react')
3-
const ipfsAPI = require('ipfs-api')
3+
const ipfsClient = require('ipfs-http-client')
44

5-
const ipfs = ipfsAPI('localhost', '5001')
5+
const ipfs = ipfsClient('localhost', '5001')
66
const stringToUse = 'hello world from webpacked IPFS'
77

88
class App extends React.Component {

‎examples/name-api/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Install [go-ipfs](https://ipfs.io/docs/install/) and start the daemon.
66

7-
Configure CORS as suggested by the README https://github.com/ipfs/js-ipfs-api#cors
7+
Configure CORS as suggested by the README https://github.com/ipfs/js-ipfs-http-client#cors
88

99
```bash
1010
> ipfs daemon

‎examples/name-api/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</head>
1616

1717
<body>
18-
<h1>js-ipfs-api</h1>
18+
<h1>js-ipfs-http-client</h1>
1919
<h2><code>name.publish()</code> and <code>name.resolve()</code></h2>
2020
<p id="status" style="color: white; padding: .5em; background: blue">
2121
initializing...
@@ -58,7 +58,7 @@ <h3>Resolve an IPNS name</h3>
5858
</p>
5959
</div>
6060

61-
<script src="https://unpkg.com/ipfs-api/dist/index.js"></script>
61+
<script src="https://unpkg.com/ipfs-http-client/dist/index.js"></script>
6262
<script src="bundle.js"></script>
6363
</body>
6464
</html>

‎examples/name-api/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22

3-
const ipfs = window.IpfsApi('/ip4/127.0.0.1/tcp/5001')
3+
const ipfs = window.IpfsHttpClient('/ip4/127.0.0.1/tcp/5001')
44

55
const DOM = {
66
status: document.getElementById('status'),

‎examples/name-api/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "js-ipfs-api-example-name-publish-resolve",
2+
"name": "js-ipfs-http-client-example-name-publish-resolve",
33
"version": "1.0.0",
44
"description": "",
55
"main": "index.js",

‎examples/upload-file-via-browser/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# Upload file to IPFS via browser using js-ipfs-api
1+
# Upload file to IPFS via browser using js-ipfs-http-client
22

3-
> In this example, you will find a simple React app to upload a file to IPFS via the browser using js-ipfs-api and Webpack.
3+
> In this example, you will find a simple React app to upload a file to IPFS via the browser using js-ipfs-http-client and Webpack.
44
55
## Setup
66

7-
As for any js-ipfs-api example, **you need a running IPFS daemon**, you learn how to do that here:
7+
As for any js-ipfs-http-client example, **you need a running IPFS daemon**, you learn how to do that here:
88

99
- [Spawn a go-ipfs daemon](https://ipfs.io/docs/getting-started/)
1010
- [Spawn a js-ipfs daemon](https://github.com/ipfs/js-ipfs#usage)
1111

12-
**Note:** If you load your app from a different domain than the one the daemon is running (most probably), you will need to set up CORS, see https://github.com/ipfs/js-ipfs-api#cors to learn how to do that.
12+
**Note:** If you load your app from a different domain than the one the daemon is running (most probably), you will need to set up CORS, see https://github.com/ipfs/js-ipfs-http-client#cors to learn how to do that.
1313

1414
A quick (and dirty way to get it done) is:
1515

@@ -31,4 +31,4 @@ Now open your browser at `http://localhost:3000`
3131

3232
After uploading a file (left screen), and opening the uploaded file (right screen), you should see something like:
3333

34-
![App Screenshot](https://cdn.rawgit.com/ipfs/js-ipfs-api/320fcfc6155a771027bdf0cc661e37a407d35efb/examples/upload-file-via-browser/screenshot.png)
34+
![App Screenshot](https://cdn.rawgit.com/ipfs/js-ipfs-http-client/320fcfc6155a771027bdf0cc661e37a407d35efb/examples/upload-file-via-browser/screenshot.png)

‎examples/upload-file-via-browser/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "upload-file-via-browser",
33
"version": "1.0.0",
4-
"description": "Upload file to IPFS via browser using js-ipfs-api with Webpack",
4+
"description": "Upload file to IPFS via browser using js-ipfs-http-client with Webpack",
55
"scripts": {
66
"start": "node server.js"
77
},
@@ -13,7 +13,7 @@
1313
"devDependencies": {
1414
"babel-core": "~6.26.3",
1515
"babel-loader": "~8.0.4",
16-
"ipfs-api": "../../",
16+
"ipfs-http-client": "../../",
1717
"pull-file-reader": "~1.0.2",
1818
"react": "~16.6.3",
1919
"react-dom": "~16.6.3",

‎examples/upload-file-via-browser/src/App.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22
const React = require('react')
3-
const ipfsAPI = require('ipfs-api')
3+
const ipfsClient = require('ipfs-http-client')
44

55
// create a stream from a file, which enables uploads of big files without allocating memory twice
66
const fileReaderPullStream = require('pull-file-reader')
@@ -11,7 +11,7 @@ class App extends React.Component {
1111
this.state = {
1212
added_file_hash: null
1313
}
14-
this.ipfsApi = ipfsAPI('localhost', '5001')
14+
this.ipfs = ipfsClient('localhost', '5001')
1515

1616
// bind methods
1717
this.captureFile = this.captureFile.bind(this)
@@ -35,7 +35,7 @@ class App extends React.Component {
3535
saveToIpfs (file) {
3636
let ipfsId
3737
const fileStream = fileReaderPullStream(file)
38-
this.ipfsApi.add(fileStream, { progress: (prog) => console.log(`received: ${prog}`) })
38+
this.ipfs.add(fileStream, { progress: (prog) => console.log(`received: ${prog}`) })
3939
.then((response) => {
4040
console.log(response)
4141
ipfsId = response[0].hash
@@ -59,7 +59,7 @@ class App extends React.Component {
5959
wrapWithDirectory: true,
6060
progress: (prog) => console.log(`received: ${prog}`)
6161
}
62-
this.ipfsApi.add(fileDetails, options)
62+
this.ipfs.add(fileDetails, options)
6363
.then((response) => {
6464
console.log(response)
6565
// CID of wrapping directory is returned last

‎package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "ipfs-api",
2+
"name": "ipfs-http-client",
33
"version": "26.1.2",
44
"description": "A client library for the IPFS HTTP API",
55
"leadMaintainer": "Alan Shaw <alan@tableflip.io>",
@@ -9,7 +9,7 @@
99
"fs": false,
1010
"stream": "readable-stream",
1111
"http": "stream-http",
12-
"ipfs-api": false,
12+
"ipfs-http-client": false,
Has a conversation. Original line has a conversation.
1313
"ipfs": false
1414
},
1515
"scripts": {
@@ -74,7 +74,7 @@
7474
},
7575
"repository": {
7676
"type": "git",
77-
"url": "https://github.com/ipfs/js-ipfs-api"
77+
"url": "https://github.com/ipfs/js-ipfs-http-client"
7878
},
7979
"devDependencies": {
8080
"aegir": "^17.1.1",
@@ -178,7 +178,7 @@
178178
],
179179
"license": "MIT",
180180
"bugs": {
181-
"url": "https://github.com/ipfs/js-ipfs-api/issues"
181+
"url": "https://github.com/ipfs/js-ipfs-http-client/issues"
182182
},
183-
"homepage": "https://github.com/ipfs/js-ipfs-api"
183+
"homepage": "https://github.com/ipfs/js-ipfs-http-client"
184184
}

‎src/dag/get.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ module.exports = (send) => {
4747
(ipfsBlock, path, cb) => {
4848
const dagResolver = resolvers[ipfsBlock.cid.codec]
4949
if (!dagResolver) {
50-
const error = new Error('ipfs-api is missing DAG resolver for "' + ipfsBlock.cid.codec + '" multicodec')
50+
const error = new Error('ipfs-http-client is missing DAG resolver for "' + ipfsBlock.cid.codec + '" multicodec')
5151
error.missingMulticodec = ipfsBlock.cid.codec
5252
cb(error)
5353
return

‎src/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const loadCommands = require('./utils/load-commands')
66
const getConfig = require('./utils/default-config')
77
const sendRequest = require('./utils/send-request')
88

9-
function IpfsAPI (hostOrMultiaddr, port, opts) {
9+
function ipfsClient (hostOrMultiaddr, port, opts) {
1010
const config = getConfig()
1111

1212
try {
@@ -44,4 +44,4 @@ function IpfsAPI (hostOrMultiaddr, port, opts) {
4444
return cmds
4545
}
4646

47-
exports = module.exports = IpfsAPI
47+
module.exports = ipfsClient

‎src/utils/send-request.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const once = require('once')
99
const streamToValue = require('./stream-to-value')
1010
const streamToJsonValue = require('./stream-to-json-value')
1111
const request = require('./request')
12-
const log = require('debug')('ipfs-api:request')
12+
const log = require('debug')('ipfs-http-client:request')
1313

1414
// -- Internal
1515

‎test/commands.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const dirtyChai = require('dirty-chai')
66
const expect = chai.expect
77
chai.use(dirtyChai)
88

9-
const IPFSApi = require('../src')
9+
const ipfsClient = require('../src')
1010

1111
const f = require('./utils/factory')
1212

@@ -20,7 +20,7 @@ describe('.commands', function () {
2020
f.spawn({ initOptions: { bits: 1024 } }, (err, _ipfsd) => {
2121
expect(err).to.not.exist()
2222
ipfsd = _ipfsd
23-
ipfs = IPFSApi(_ipfsd.apiAddr)
23+
ipfs = ipfsClient(_ipfsd.apiAddr)
2424
done()
2525
})
2626
})

‎test/constructor.spec.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const expect = chai.expect
77
chai.use(dirtyChai)
88

99
const f = require('./utils/factory')
10-
const ipfsAPI = require('../src/index.js')
10+
const ipfsClient = require('../src/index.js')
1111

1212
function clientWorks (client, done) {
1313
client.id((err, id) => {
@@ -19,7 +19,7 @@ function clientWorks (client, done) {
1919
})
2020
}
2121

22-
describe('ipfs-api constructor tests', () => {
22+
describe('ipfs-http-client constructor tests', () => {
2323
describe('parameter permuations', () => {
2424
let apiAddr
2525
let ipfsd
@@ -42,27 +42,27 @@ describe('ipfs-api constructor tests', () => {
4242

4343
it('opts', (done) => {
4444
const splitted = apiAddr.split('/')
45-
clientWorks(ipfsAPI({
45+
clientWorks(ipfsClient({
4646
host: splitted[2],
4747
port: splitted[4],
4848
protocol: 'http'
4949
}), done)
5050
})
5151

5252
it('mutliaddr, opts', (done) => {
53-
clientWorks(ipfsAPI(apiAddr, { protocol: 'http' }), done)
53+
clientWorks(ipfsClient(apiAddr, { protocol: 'http' }), done)
5454
})
5555

5656
it('host, port', (done) => {
5757
const splitted = apiAddr.split('/')
5858

59-
clientWorks(ipfsAPI(splitted[2], splitted[4]), done)
59+
clientWorks(ipfsClient(splitted[2], splitted[4]), done)
6060
})
6161

6262
it('specify host, port and api path', (done) => {
6363
const splitted = apiAddr.split('/')
6464

65-
clientWorks(ipfsAPI({
65+
clientWorks(ipfsClient({
6666
host: splitted[2],
6767
port: splitted[4],
6868
'api-path': '/api/v0/'
@@ -72,7 +72,7 @@ describe('ipfs-api constructor tests', () => {
7272
it('host, port, opts', (done) => {
7373
const splitted = apiAddr.split('/')
7474

75-
clientWorks(ipfsAPI(splitted[2], splitted[4], { protocol: 'http' }), done)
75+
clientWorks(ipfsClient(splitted[2], splitted[4], { protocol: 'http' }), done)
7676
})
7777
})
7878
})

‎test/custom-headers.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const dirtyChai = require('dirty-chai')
77
const expect = chai.expect
88
chai.use(dirtyChai)
99

10-
const IPFSApi = require('../src')
10+
const ipfsClient = require('../src')
1111
const f = require('./utils/factory')
1212

1313
describe('custom headers', function () {
@@ -21,7 +21,7 @@ describe('custom headers', function () {
2121
f.spawn({ initOptions: { bits: 1024 } }, (err, _ipfsd) => {
2222
expect(err).to.not.exist()
2323
ipfsd = _ipfsd
24-
ipfs = IPFSApi({
24+
ipfs = ipfsClient({
2525
host: 'localhost',
2626
port: 6001,
2727
protocol: 'http',

‎test/dag.spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const series = require('async/series')
1111
const dagPB = require('ipld-dag-pb')
1212
const DAGNode = dagPB.DAGNode
1313
const CID = require('cids')
14-
const IPFSApi = require('../src')
14+
const ipfsClient = require('../src')
1515
const f = require('./utils/factory')
1616

1717
let ipfsd
@@ -24,7 +24,7 @@ describe('.dag', function () {
2424
(cb) => f.spawn({ initOptions: { bits: 1024 } }, (err, _ipfsd) => {
2525
expect(err).to.not.exist()
2626
ipfsd = _ipfsd
27-
ipfs = IPFSApi(_ipfsd.apiAddr)
27+
ipfs = ipfsClient(_ipfsd.apiAddr)
2828
cb()
2929
})
3030
], done)
@@ -79,7 +79,7 @@ describe('.dag', function () {
7979

8080
ipfs.dag.get(cid, (err, result) => {
8181
expect(result).to.not.exist()
82-
expect(err.message).to.equal('ipfs-api is missing DAG resolver for "raw" multicodec')
82+
expect(err.message).to.equal('ipfs-http-client is missing DAG resolver for "raw" multicodec')
8383
done()
8484
})
8585
})

‎test/diag.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const expect = chai.expect
77
chai.use(dirtyChai)
88
const platform = require('browser-process-platform')
99

10-
const IPFSApi = require('../src')
10+
const ipfsClient = require('../src')
1111
const f = require('./utils/factory')
1212

1313
describe('.diag', function () {
@@ -23,7 +23,7 @@ describe('.diag', function () {
2323
f.spawn({ initOptions: { bits: 1024 } }, (err, _ipfsd) => {
2424
expect(err).to.not.exist()
2525
ipfsd = _ipfsd
26-
ipfs = IPFSApi(_ipfsd.apiAddr)
26+
ipfs = ipfsClient(_ipfsd.apiAddr)
2727
done()
2828
})
2929
})

‎test/files-mfs.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const mh = require('multihashes')
1111
const CID = require('cids')
1212
const pull = require('pull-stream')
1313

14-
const IPFSApi = require('../src')
14+
const ipfsClient = require('../src')
1515
const f = require('./utils/factory')
1616
const expectTimeout = require('./utils/expect-timeout')
1717

@@ -41,7 +41,7 @@ describe('.files (the MFS API part)', function () {
4141
f.spawn({ initOptions: { bits: 1024 } }, (err, _ipfsd) => {
4242
expect(err).to.not.exist()
4343
ipfsd = _ipfsd
44-
ipfs = IPFSApi(_ipfsd.apiAddr)
44+
ipfs = ipfsClient(_ipfsd.apiAddr)
4545
done()
4646
})
4747
})

‎test/get.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const isNode = require('detect-node')
1111
const series = require('async/series')
1212
const loadFixture = require('aegir/fixtures')
1313

14-
const IPFSApi = require('../src')
14+
const ipfsClient = require('../src')
1515
const f = require('./utils/factory')
1616

1717
describe('.get (specific go-ipfs features)', function () {
@@ -34,7 +34,7 @@ describe('.get (specific go-ipfs features)', function () {
3434
(cb) => f.spawn({ initOptions: { bits: 1024 } }, (err, _ipfsd) => {
3535
expect(err).to.not.exist()
3636
ipfsd = _ipfsd
37-
ipfs = IPFSApi(_ipfsd.apiAddr)
37+
ipfs = ipfsClient(_ipfsd.apiAddr)
3838
cb()
3939
}),
4040
(cb) => ipfs.add(smallFile.data, cb)

‎test/interface.spec.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
const tests = require('interface-ipfs-core')
55
const isNode = require('detect-node')
66
const CommonFactory = require('./utils/interface-common-factory')
7-
const IPFSApi = require('../src')
7+
const ipfsClient = require('../src')
88
const isWindows = process.platform && process.platform === 'win32'
99

1010
describe('interface-ipfs-core tests', () => {
@@ -43,7 +43,7 @@ describe('interface-ipfs-core tests', () => {
4343
// config.replace
4444
{
4545
name: 'replace',
46-
reason: 'FIXME Waiting for fix on go-ipfs https://github.com/ipfs/js-ipfs-api/pull/307#discussion_r69281789 and https://github.com/ipfs/go-ipfs/issues/2927'
46+
reason: 'FIXME Waiting for fix on go-ipfs https://github.com/ipfs/js-ipfs-http-client/pull/307#discussion_r69281789 and https://github.com/ipfs/go-ipfs/issues/2927'
4747
}
4848
]
4949
})
@@ -96,21 +96,21 @@ describe('interface-ipfs-core tests', () => {
9696
// .add
9797
isNode ? null : {
9898
name: 'should add a nested directory as array of tupples',
99-
reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339'
99+
reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339'
100100
},
101101
isNode ? null : {
102102
name: 'should add a nested directory as array of tupples with progress',
103-
reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339'
103+
reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339'
104104
},
105105
// .addPullStream
106106
isNode ? null : {
107107
name: 'should add pull stream of valid files and dirs',
108-
reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339'
108+
reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339'
109109
},
110110
// .addReadableStream
111111
isNode ? null : {
112112
name: 'should add readable stream of valid files and dirs',
113-
reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339'
113+
reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339'
114114
},
115115
// .addFromStream
116116
isNode ? null : {
@@ -143,22 +143,22 @@ describe('interface-ipfs-core tests', () => {
143143
// .get
144144
isNode ? null : {
145145
name: 'should get a directory',
146-
reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339'
146+
reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339'
147147
},
148148
// .ls
149149
isNode ? null : {
150150
name: 'should ls with a base58 encoded CID',
151-
reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339'
151+
reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339'
152152
},
153153
// .lsPullStream
154154
isNode ? null : {
155155
name: 'should pull stream ls with a base58 encoded CID',
156-
reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339'
156+
reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339'
157157
},
158158
// .lsReadableStream
159159
isNode ? null : {
160160
name: 'should readable stream ls with a base58 encoded CID',
161-
reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339'
161+
reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339'
162162
}
163163
]
164164
})
@@ -234,7 +234,7 @@ describe('interface-ipfs-core tests', () => {
234234
reason: 'FIXME https://github.com/ipfs/interface-ipfs-core/pull/188#issuecomment-354673246 and https://github.com/ipfs/go-ipfs/issues/4778'
235235
} : null
236236
] : {
237-
reason: 'FIXME pubsub is not supported in the browser https://github.com/ipfs/js-ipfs-api/issues/518'
237+
reason: 'FIXME pubsub is not supported in the browser https://github.com/ipfs/js-ipfs-http-client/issues/518'
238238
}
239239
})
240240

@@ -265,7 +265,7 @@ describe('interface-ipfs-core tests', () => {
265265
}
266266

267267
nodes.push(_ipfsd)
268-
cb(null, IPFSApi(_ipfsd.apiAddr))
268+
cb(null, ipfsClient(_ipfsd.apiAddr))
269269
})
270270
}
271271
})

‎test/key.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const dirtyChai = require('dirty-chai')
77
const expect = chai.expect
88
chai.use(dirtyChai)
99

10-
const IPFSApi = require('../src')
10+
const ipfsClient = require('../src')
1111
const f = require('./utils/factory')
1212

1313
describe('.key', function () {
@@ -20,7 +20,7 @@ describe('.key', function () {
2020
f.spawn({ initOptions: { bits: 1024 } }, (err, _ipfsd) => {
2121
expect(err).to.not.exist()
2222
ipfsd = _ipfsd
23-
ipfs = IPFSApi(_ipfsd.apiAddr)
23+
ipfs = ipfsClient(_ipfsd.apiAddr)
2424
done()
2525
})
2626
})

‎test/log.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const dirtyChai = require('dirty-chai')
77
const expect = chai.expect
88
chai.use(dirtyChai)
99

10-
const IPFSApi = require('../src')
10+
const ipfsClient = require('../src')
1111
const f = require('./utils/factory')
1212

1313
describe('.log', function () {
@@ -20,7 +20,7 @@ describe('.log', function () {
2020
f.spawn({ initOptions: { bits: 1024 } }, (err, _ipfsd) => {
2121
expect(err).to.not.exist()
2222
ipfsd = _ipfsd
23-
ipfs = IPFSApi(_ipfsd.apiAddr)
23+
ipfs = ipfsClient(_ipfsd.apiAddr)
2424
done()
2525
})
2626
})

‎test/name.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const parallel = require('async/parallel')
1010
const series = require('async/series')
1111
const loadFixture = require('aegir/fixtures')
1212

13-
const IPFSApi = require('../src')
13+
const ipfsClient = require('../src')
1414
const f = require('./utils/factory')
1515

1616
const testfile = loadFixture('test/fixtures/testfile.txt')
@@ -31,7 +31,7 @@ describe('.name', () => {
3131
f.spawn({ initOptions: { bits: 1024 } }, (err, _ipfsd) => {
3232
expect(err).to.not.exist()
3333
ipfsd = _ipfsd
34-
ipfs = IPFSApi(_ipfsd.apiAddr)
34+
ipfs = ipfsClient(_ipfsd.apiAddr)
3535
cb()
3636
})
3737
},

‎test/node/swarm.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ const dirtyChai = require('dirty-chai')
77
const expect = chai.expect
88
chai.use(dirtyChai)
99

10-
const IPFSApi = require('../../src')
10+
const ipfsClient = require('../../src')
1111

1212
describe('.swarm.peers', function () {
1313
this.timeout(50 * 1000) // slow CI
1414

15-
const ipfs = IPFSApi('/ip4/127.0.0.1/tcp/5001')
15+
const ipfs = ipfsClient('/ip4/127.0.0.1/tcp/5001')
1616
const apiUrl = 'http://127.0.0.1:5001'
1717

1818
it('handles a peer response', (done) => {

‎test/ping.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ chai.use(dirtyChai)
1111
const parallel = require('async/parallel')
1212
const series = require('async/series')
1313

14-
const IPFSApi = require('../src')
14+
const ipfsClient = require('../src')
1515
const PingMessageStream = require('../src/utils/ping-message-stream')
1616
const f = require('./utils/factory')
1717

@@ -37,7 +37,7 @@ describe('.ping', function () {
3737
f.spawn({ initOptions: { bits: 1024 } }, (err, _ipfsd) => {
3838
expect(err).to.not.exist()
3939
ipfsd = _ipfsd
40-
ipfs = IPFSApi(_ipfsd.apiAddr)
40+
ipfs = ipfsClient(_ipfsd.apiAddr)
4141
cb()
4242
})
4343
},

‎test/pubsub-in-browser.spec.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
and we test it with separate set of tests to make sure
44
if it's being used in the browser, pubsub errors.
55
6-
More info: https://github.com/ipfs/js-ipfs-api/issues/518
6+
More info: https://github.com/ipfs/js-ipfs-http-client/issues/518
77
88
This means:
9-
- You can use pubsub from js-ipfs-api in Node.js
10-
- You can use pubsub from js-ipfs-api in Electron
11-
(when js-ipfs-api is ran in the main process of Electron)
9+
- You can use pubsub from js-ipfs-http-client in Node.js
10+
- You can use pubsub from js-ipfs-http-client in Electron
11+
(when js-ipfs-http-client is ran in the main process of Electron)
1212
13-
- You can't use pubsub from js-ipfs-api in the browser
14-
- You can't use pubsub from js-ipfs-api in Electron's
13+
- You can't use pubsub from js-ipfs-http-client in the browser
14+
- You can't use pubsub from js-ipfs-http-client in Electron's
1515
renderer process
1616
1717
- You can use pubsub from js-ipfs in the browsers
@@ -32,7 +32,7 @@ const dirtyChai = require('dirty-chai')
3232
const expect = chai.expect
3333
chai.use(dirtyChai)
3434

35-
const IPFSApi = require('../src')
35+
const ipfsClient = require('../src')
3636
const f = require('./utils/factory')
3737

3838
const expectedError = 'pubsub is currently not supported when run in the browser'
@@ -50,7 +50,7 @@ describe('.pubsub is not supported in the browser, yet!', function () {
5050
f.spawn({ initOptions: { bits: 1024 } }, (err, _ipfsd) => {
5151
expect(err).to.not.exist()
5252
ipfsd = _ipfsd
53-
ipfs = IPFSApi(_ipfsd.apiAddr)
53+
ipfs = ipfsClient(_ipfsd.apiAddr)
5454
done()
5555
})
5656
})

‎test/refs.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const waterfall = require('async/waterfall')
1010
const path = require('path')
1111
const fs = require('fs')
1212

13-
const IPFSApi = require('../src')
13+
const ipfsClient = require('../src')
1414
const f = require('./utils/factory')
1515

1616
describe('.refs', function () {
@@ -38,7 +38,7 @@ describe('.refs', function () {
3838
(cb) => f.spawn({ initOptions: { bits: 1024 } }, cb),
3939
(_ipfsd, cb) => {
4040
ipfsd = _ipfsd
41-
ipfs = IPFSApi(_ipfsd.apiAddr)
41+
ipfs = ipfsClient(_ipfsd.apiAddr)
4242
ipfs.addFromFs(filesPath, { recursive: true }, cb)
4343
},
4444
(hashes, cb) => {

‎test/repo.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const dirtyChai = require('dirty-chai')
66
const expect = chai.expect
77
chai.use(dirtyChai)
88

9-
const IPFSApi = require('../src')
9+
const ipfsClient = require('../src')
1010
const f = require('./utils/factory')
1111

1212
describe('.repo', function () {
@@ -19,7 +19,7 @@ describe('.repo', function () {
1919
f.spawn({ initOptions: { bits: 1024 } }, (err, _ipfsd) => {
2020
expect(err).to.not.exist()
2121
ipfsd = _ipfsd
22-
ipfs = IPFSApi(_ipfsd.apiAddr)
22+
ipfs = ipfsClient(_ipfsd.apiAddr)
2323
done()
2424
})
2525
})

‎test/request-api.spec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const dirtyChai = require('dirty-chai')
66
const expect = chai.expect
77
chai.use(dirtyChai)
88
const isNode = require('detect-node')
9-
const ipfsAPI = require('../src/index.js')
9+
const ipfsClient = require('../src/index.js')
1010
const ndjson = require('ndjson')
1111
const pump = require('pump')
1212

@@ -28,7 +28,7 @@ describe('\'deal with HTTP weirdness\' tests', () => {
2828
})
2929

3030
server.listen(6001, () => {
31-
ipfsAPI('/ip4/127.0.0.1/tcp/6001').config.replace('test/fixtures/r-config.json', (err) => {
31+
ipfsClient('/ip4/127.0.0.1/tcp/6001').config.replace('test/fixtures/r-config.json', (err) => {
3232
expect(err).to.not.exist()
3333
server.close(done)
3434
})
@@ -37,7 +37,7 @@ describe('\'deal with HTTP weirdness\' tests', () => {
3737
})
3838

3939
describe('trailer headers', () => {
40-
// TODO: needs fixing https://github.com/ipfs/js-ipfs-api/pull/624#issuecomment-344181950
40+
// TODO: needs fixing https://github.com/ipfs/js-ipfs-http-client/pull/624#issuecomment-344181950
4141
it.skip('should deal with trailer x-stream-error correctly', (done) => {
4242
if (!isNode) { return done() }
4343

@@ -52,7 +52,7 @@ describe('trailer headers', () => {
5252
})
5353

5454
server.listen(6001, () => {
55-
const ipfs = ipfsAPI('/ip4/127.0.0.1/tcp/6001')
55+
const ipfs = ipfsClient('/ip4/127.0.0.1/tcp/6001')
5656
/* eslint-disable */
5757
ipfs.add(Buffer.from('Hello there!'), (err, res) => {
5858
// TODO: error's are not being correctly

‎test/stats.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const dirtyChai = require('dirty-chai')
66
const expect = chai.expect
77
chai.use(dirtyChai)
88

9-
const IPFSApi = require('../src')
9+
const ipfsClient = require('../src')
1010
const f = require('./utils/factory')
1111

1212
describe('stats', function () {
@@ -19,7 +19,7 @@ describe('stats', function () {
1919
f.spawn({ initOptions: { bits: 1024 } }, (err, _ipfsd) => {
2020
expect(err).to.not.exist()
2121
ipfsd = _ipfsd
22-
ipfs = IPFSApi(_ipfsd.apiAddr)
22+
ipfs = ipfsClient(_ipfsd.apiAddr)
2323
done()
2424
})
2525
})

‎test/util.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const expect = chai.expect
88
chai.use(dirtyChai)
99
const isNode = require('detect-node')
1010

11-
const IPFSApi = require('../src')
11+
const ipfsClient = require('../src')
1212
const f = require('./utils/factory')
1313

1414
describe('.util', () => {
@@ -23,7 +23,7 @@ describe('.util', () => {
2323
f.spawn({ initOptions: { bits: 1024 } }, (err, _ipfsd) => {
2424
expect(err).to.not.exist()
2525
ipfsd = _ipfsd
26-
ipfs = IPFSApi(_ipfsd.apiAddr)
26+
ipfs = ipfsClient(_ipfsd.apiAddr)
2727
done()
2828
})
2929
})

‎test/utils/interface-common-factory.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
const each = require('async/each')
55
const IPFSFactory = require('ipfsd-ctl')
6-
const IPFSApi = require('../../src')
6+
const ipfsClient = require('../../src')
77

88
function createFactory (options) {
99
options = options || {}
@@ -29,7 +29,7 @@ function createFactory (options) {
2929
}
3030

3131
nodes.push(_ipfsd)
32-
cb(null, IPFSApi(_ipfsd.apiAddr))
32+
cb(null, ipfsClient(_ipfsd.apiAddr))
3333
})
3434
}
3535
})

0 commit comments

Comments
 (0)
This repository has been archived.