You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 10, 2020. It is now read-only.
> 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.
See [API.md](API.md) and [`tests/api`](test/api) for details on available methods.
105
+
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.
103
106
104
107
### Callbacks and promises
105
108
@@ -118,9 +121,40 @@ ipfs.id()
118
121
This relies on a global `Promise` object. If you are in an environment where that is not
119
122
yet available you need to bring your own polyfill.
120
123
124
+
### Utility functions
125
+
126
+
These utility functions are scoped behind the `ipfs.util`.
127
+
128
+
#### Add files or entire directories from the FileSystem to IPFS
129
+
130
+
> `ipfs.util.fsAdd(path, callback)`
131
+
132
+
Reads path from disk, if it is a directory, will add it recursively, if not, will add the file.
133
+
134
+
```JavaScript
135
+
```
136
+
137
+
#### Add a file from a URL to IPFS
138
+
139
+
> `ipfs.util.urlAdd(url, callback)`
140
+
141
+
```JavaScript
142
+
```
143
+
144
+
#### Add a file from a stream to IPFS
145
+
146
+
> `ipfs.util.streamAdd(stream, callback)`
147
+
148
+
This is very similar to `ipfs.files.add({path:'', content: stream})`. It is like the reverse of cat
149
+
150
+
```JavaScript
151
+
```
152
+
153
+
154
+
121
155
## Contribute
122
156
123
-
The js-ipfs API is a work in progress. As such, there's a few things you can do right now to help out:
157
+
The js-ipfs-api is a work in progress. As such, there's a few things you can do right now to help out:
124
158
125
159
***[Check out the existing issues](https://github.com/ipfs/js-ipfs-api/issues)**!
126
160
***Perform code reviews**. More eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs.
@@ -131,6 +165,10 @@ The js-ipfs API is a work in progress. As such, there's a few things you can do
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.
0 commit comments