Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 7165bf7

Browse files
authored
docs: add upgrade guide for ESM release (#4098)
Adds upgrade guide and updates core-api docs with API changes
1 parent 74aee8b commit 7165bf7

File tree

16 files changed

+157
-33
lines changed

16 files changed

+157
-33
lines changed

docs/MODULE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,14 +377,14 @@ Aside from the default export, `ipfs` exports various types and utilities that a
377377
- [`crypto`](https://www.npmjs.com/package/libp2p-crypto)
378378
- [`isIPFS`](https://www.npmjs.com/package/is-ipfs)
379379
- [`Buffer`](https://www.npmjs.com/package/buffer)
380-
- [`PeerId`](https://www.npmjs.com/package/peer-id)
380+
- [`PeerId`](https://docs.libp2p.io/concepts/peer-id/)
381381
- [`PeerInfo`](https://www.npmjs.com/package/peer-info)
382382
- [`multiaddr`](https://www.npmjs.com/package/multiaddr)
383383
- [`multibase`](https://www.npmjs.com/package/multibase)
384384
- [`multihash`](https://www.npmjs.com/package/multihashes)
385385
- [`multihashing`](https://www.npmjs.com/package/multihashing-async)
386386
- [`multicodec`](https://www.npmjs.com/package/multicodec)
387-
- [`CID`](https://www.npmjs.com/package/cids)
387+
- [`CID`](https://docs.ipfs.io/concepts/content-addressing)
388388

389389
These can be accessed like this, for example:
390390

docs/core-api/BITSWAP.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ A great source of [examples][] can be found in the tests for this API.
6262

6363
| Name | Type | Default | Description |
6464
| ---- | ---- | ------- | ----------- |
65-
| peerId | [PeerId][], [CID][], `String` or `Uint8Array` | A peer ID to return the wantlist for |
65+
| peerId | [PeerId][] | A peer ID to return the wantlist for |
6666

6767
### Options
6868

@@ -159,7 +159,7 @@ The returned object contains the following keys:
159159

160160
- `provideBufLen` is an integer.
161161
- `wantlist` (array of [CID][cid]s)
162-
- `peers` (array of peer IDs represented by strings)
162+
- `peers` (array of [PeerId][peerId]s)
163163
- `blocksReceived` is a [BigInt][1]
164164
- `dataReceived` is a [BigInt][1]
165165
- `blocksSent` is a [BigInt][1]
@@ -192,6 +192,6 @@ A great source of [examples][] can be found in the tests for this API.
192192

193193
[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt
194194
[examples]: https://github.com/ipfs/js-ipfs/blob/master/packages/interface-ipfs-core/src/bitswap
195-
[cid]: https://www.npmjs.com/package/cids
196-
[peerid]: https://www.npmjs.com/package/peer-id
195+
[cid]: https://docs.ipfs.io/concepts/content-addressing
196+
[peerid]: https://docs.libp2p.io/concepts/peer-id/
197197
[AbortSignal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal

docs/core-api/BLOCK.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,4 +226,4 @@ A great source of [examples][] can be found in the tests for this API.
226226
[multihash]: https://github.com/multiformats/multihash
227227
[examples]: https://github.com/ipfs/js-ipfs/blob/master/packages/interface-ipfs-core/src/block
228228
[AbortSignal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
229-
[cid]: https://www.npmjs.com/package/cids
229+
[cid]: https://docs.ipfs.io/concepts/content-addressing

docs/core-api/DAG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,6 @@ console.log(result)
289289
A great source of [examples][] can be found in the tests for this API.
290290

291291
[examples]: https://github.com/ipfs/js-ipfs/blob/master/packages/interface-ipfs-core/src/dag
292-
[cid]: https://www.npmjs.com/package/cids
292+
[cid]: https://docs.ipfs.io/concepts/content-addressing
293293
[AbortSignal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
294294
[CAR file]: https://ipld.io/specs/transport/car/

docs/core-api/DHT.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
| Name | Type | Description |
4141
| ---- | ---- | ----------- |
42-
| peerId | [PeerID][] or [CID][] | The Peer ID of the node to find |
42+
| peerId | [PeerID][] | The Peer ID of the node to find |
4343

4444
### Options
4545

@@ -61,7 +61,7 @@ An optional object which may have the following keys:
6161
```JavaScript
6262
const info = await ipfs.dht.findPeer('QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt')
6363

64-
console.log(info.id)
64+
console.log(info.id.toString())
6565
/*
6666
QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt
6767
*/
@@ -191,15 +191,15 @@ Prints objects like:
191191
192192
{
193193
extra: 'dial backoff',
194-
id: 'QmWtewmnzJiQevJPSmG9s8aC7yRfK2WXTCdRc1pCbDFu6z',
194+
id: PeerId('QmWtewmnzJiQevJPSmG9s8aC7yRfK2WXTCdRc1pCbDFu6z'),
195195
responses: [
196196
{
197197
addrs: [
198198
Multiaddr(/ip4/127.0.0.1/tcp/4001),
199199
Multiaddr(/ip4/172.20.0.3/tcp/4001),
200200
Multiaddr(/ip4/35.178.190.196/tcp/1024)
201201
],
202-
id: 'QmRz5Nth4jTFuJJKcjyb6uwvrhxWbruRvamKY2PJxwJKw8'
202+
id: PeerId('QmRz5Nth4jTFuJJKcjyb6uwvrhxWbruRvamKY2PJxwJKw8')
203203
}
204204
],
205205
type: 1
@@ -258,15 +258,15 @@ Prints objects like:
258258
259259
{
260260
extra: 'dial backoff',
261-
id: 'QmWtewmnzJiQevJPSmG9s8aC7yRfK2WXTCdRc1pCbDFu6z',
261+
id: PeerId('QmWtewmnzJiQevJPSmG9s8aC7yRfK2WXTCdRc1pCbDFu6z'),
262262
responses: [
263263
{
264264
addrs: [
265265
Multiaddr(/ip4/127.0.0.1/tcp/4001),
266266
Multiaddr(/ip4/172.20.0.3/tcp/4001),
267267
Multiaddr(/ip4/35.178.190.196/tcp/1024)
268268
],
269-
id: 'QmRz5Nth4jTFuJJKcjyb6uwvrhxWbruRvamKY2PJxwJKw8'
269+
id: PeerId('QmRz5Nth4jTFuJJKcjyb6uwvrhxWbruRvamKY2PJxwJKw8')
270270
}
271271
],
272272
type: 1
@@ -288,7 +288,7 @@ A great source of [examples][] can be found in the tests for this API.
288288

289289
## `ipfs.dht.query(peerId, [options])`
290290

291-
> Find the closest Peer IDs to a given Peer ID by querying the DHT.
291+
> Find the closest Peer IDs to a given Peer ID or CID by querying the DHT.
292292
293293
### Parameters
294294

@@ -331,7 +331,7 @@ Prints objects like:
331331
Multiaddr(/ip4/172.20.0.3/tcp/4001),
332332
Multiaddr(/ip4/35.178.190.196/tcp/1024)
333333
],
334-
id: 'QmRz5Nth4jTFuJJKcjyb6uwvrhxWbruRvamKY2PJxwJKw8'
334+
id: PeerId('QmRz5Nth4jTFuJJKcjyb6uwvrhxWbruRvamKY2PJxwJKw8')
335335
}
336336
],
337337
type: 1
@@ -345,6 +345,6 @@ https://github.com/libp2p/go-libp2p-core/blob/6e566d10f4a5447317a66d64c7459954b9
345345
A great source of [examples][] can be found in the tests for this API.
346346

347347
[examples]: https://github.com/ipfs/js-ipfs/blob/master/packages/interface-ipfs-core/src/dht
348-
[peerid]: https://www.npmjs.com/package/peer-id
349-
[cid]: https://www.npmjs.com/package/cids
348+
[peerid]: https://docs.libp2p.io/concepts/peer-id/
349+
[cid]: https://docs.ipfs.io/concepts/content-addressing
350350
[AbortSignal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal

docs/core-api/FILES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ for await (const file of ipfs.files.ls('/screenshots')) {
10241024

10251025
[b]: https://www.npmjs.com/package/buffer
10261026
[file]: https://developer.mozilla.org/en-US/docs/Web/API/File
1027-
[cid]: https://www.npmjs.com/package/cids
1027+
[cid]: https://docs.ipfs.io/concepts/content-addressing
10281028
[blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob
10291029
[IPFS Path]: https://www.npmjs.com/package/is-ipfs#isipfspathpath
10301030
[MFS Path]: https://docs.ipfs.io/guides/concepts/mfs/

docs/core-api/KEY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,5 +288,5 @@ console.log(key)
288288
A great source of [examples][] can be found in the tests for this API.
289289

290290
[examples]: https://github.com/ipfs/js-ipfs/blob/master/packages/interface-ipfs-core/src/key
291-
[cid]: https://www.npmjs.com/package/cids
291+
[cid]: https://docs.ipfs.io/concepts/content-addressing
292292
[AbortSignal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal

docs/core-api/MISCELLANEOUS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,5 +300,5 @@ A great source of [examples](https://github.com/ipfs/js-ipfs/blob/master/package
300300
[examples]: https://github.com/ipfs/js-ipfs/blob/master/packages/interface-ipfs-core/src/miscellaneous
301301
[rs]: https://www.npmjs.com/package/readable-stream
302302
[ps]: https://www.npmjs.com/package/pull-stream
303-
[cid]: https://www.npmjs.com/package/cids
303+
[cid]: https://docs.ipfs.io/concepts/content-addressing
304304
[AbortSignal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal

docs/core-api/NAME.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ A great source of [examples][examples-pubsub] can be found in the tests for this
226226

227227
| Name | Type | Description |
228228
| ---- | ---- | ----------- |
229-
| value | `String` | An IPNS address such as `/ipns/ipfs.io` |
229+
| value | `PeerId` or `string` | An IPNS address such as `/ipns/ipfs.io` |
230230

231231
### Options
232232

@@ -261,5 +261,5 @@ A great source of [examples][] can be found in the tests for this API.
261261

262262
[examples]: https://github.com/ipfs/js-ipfs/blob/master/packages/interface-ipfs-core/src/name
263263
[examples-pubsub]: https://github.com/ipfs/js-ipfs/blob/master/packages/interface-ipfs-core/src/name-pubsub
264-
[cid]: https://www.npmjs.com/package/cids
264+
[cid]: https://docs.ipfs.io/concepts/content-addressing
265265
[AbortSignal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal

docs/core-api/PIN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,5 +634,5 @@ A great source of [examples][] can be found in the tests for this API.
634634
[Stat]: #stat
635635
[PinCount]: #pincount
636636
[examples]: https://github.com/ipfs/js-ipfs/blob/master/packages/interface-ipfs-core/src/pin
637-
[cid]: https://www.npmjs.com/package/cids
637+
[cid]: https://docs.ipfs.io/concepts/content-addressing
638638
[AbortSignal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal

0 commit comments

Comments
 (0)