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

Commit a640ef2

Browse files
authored
docs: recommend jsdelivr to users and add download counts to the README
Refs #2826
1 parent c81c680 commit a640ef2

File tree

6 files changed

+19
-21
lines changed

6 files changed

+19
-21
lines changed

examples/browser-script-tag/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
You can use IPFS in your in-browser JavaScript code with just a `<script>` tag.
44

55
```html
6-
<script src="https://unpkg.com/ipfs/dist/index.min.js"></script>
6+
<script src="https://cdn.jsdelivr.net/npm/ipfs/dist/index.min.js"></script>
77
```
88

99
This exposes a global `Ipfs`; you can get a node by making a `new Ipfs()`.

examples/browser-video-streaming/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ The fact that HLS content is just "a bunch of files" makes it a good choice for
1717
The hls.js library ships with an HTTP based content loader only, but it's fortunately possible to configure custom content loaders as well, which is what makes IPFS streaming possible in this case. A loader implementation that fetches content using js-ipfs can be found [here](https://www.npmjs.com/package/hlsjs-ipfs-loader), and is easy to use on a regular HTML page:
1818

1919
```html
20-
<script src="https://unpkg.com/ipfs/dist/index.js"></script>
20+
<script src="https://cdn.jsdelivr.net/npm/ipfs/dist/index.min.js"></script>
2121
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
22-
<script src="https://unpkg.com/[email protected]/dist/index.js"></script>
22+
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
2323
```
2424

2525
## Generating HLS content

examples/browser-video-streaming/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<body>
33
<video id="video" controls></video>
44
<script src="./node_modules/ipfs/dist/index.js"></script>
5-
<script src="https://unpkg.com/hlsjs-ipfs[email protected]/dist/index.js"></script>
5+
<script src="https://cdn.jsdelivr.net/npm/ipfs/dist/index.min.js"></script>
66
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
77
<script src="streaming.js"></script>
88
</body>

packages/ipfs-http-client/README.md

+11-7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
<a href="https://github.com/RichardLitt/standard-readme"><img src="https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square" /></a>
2424
<a href=""><img src="https://img.shields.io/badge/npm-%3E%3D3.0.0-orange.svg?style=flat-square" /></a>
2525
<a href=""><img src="https://img.shields.io/badge/Node.js-%3E%3D10.0.0-orange.svg?style=flat-square" /></a>
26+
<a href="https://www.npmjs.com/package/ipfs-http-client"><img src="https://img.shields.io/npm/dm/ipfs-http-client.svg" /></a>
27+
<a href="https://www.jsdelivr.com/package/npm/ipfs-http-client"><img src="https://data.jsdelivr.com/v1/package/npm/ipfs-http-client/badge"/></a>
2628
<br>
2729
</p>
2830

@@ -128,26 +130,28 @@ See the example in the [examples folder](examples/bundle-webpack) to get an idea
128130

129131
**from CDN**
130132

131-
Instead of a local installation (and browserification) you may request a remote copy of IPFS API from [unpkg CDN](https://unpkg.com/).
133+
Instead of a local installation (and browserification) you may request a remote copy of IPFS API from [jsDelivr](https://www.jsdelivr.com/package/npm/ipfs).
132134

133-
To always request the latest version, use the following:
135+
To always request the latest version, use one of the following examples:
134136

135137
```html
136-
<script src="https://unpkg.com/ipfs-http-client/dist/index.min.js"></script>
137-
```
138+
<!-- loading the minified version using jsDelivr -->
139+
<script src="https://cdn.jsdelivr.net/npm/ipfs-http-client/dist/index.min.js"></script>
138140

139-
Note: remove the `.min` from the URL to get the human-readable (not minified) version.
141+
<!-- loading the human-readable (not minified) version jsDelivr -->
142+
<script src="https://cdn.jsdelivr.net/npm/ipfs-http-client/dist/index.js"></script>
143+
```
140144

141145
For maximum security you may also decide to:
142146

143147
* reference a specific version of IPFS API (to prevent unexpected breaking changes when a newer latest version is published)
144-
* [generate a SRI hash](https://www.srihash.org/) of that version and use it to ensure integrity
148+
* [generate a SRI hash](https://www.srihash.org/) of that version and use it to ensure integrity. Learn more also at the [jsdelivr website](https://www.jsdelivr.com/using-sri-with-dynamic-files)
145149
* set the [CORS settings attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) to make anonymous requests to CDN
146150

147151
Example:
148152

149153
```html
150-
<script src="https://unpkg.com/ipfs-http-client@9.0.0/dist/index.js"
154+
<script src="https://www.jsdelivr.com/package/npm/ipfs-http-client"
151155
integrity="sha384-5bXRcW9kyxxnSMbOoHzraqa7Z0PQWIao+cgeg327zit1hz5LZCEbIMx/LWKPReuB"
152156
crossorigin="anonymous"></script>
153157
```

packages/ipfs/CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ Signed-off-by: Alan Shaw <[email protected]>
492492
* all IPLD formats included
493493
* In browser application bundle `require('ipfs')` bundled with webpack/browserify/etc.
494494
* only `ipld-dag-pb`, `ipld-dag-cbor` and `ipld-raw` included
495-
* CDN bundle `<script src="https://unpkg.com/ipfs/dist/index.min.js"></script>`
495+
* CDN bundle `<script src="https://cdn.jsdelivr.net/npm/ipfs/dist/index.min.js"></script>`
496496
* all IPLD formats included
497497

498498
Co-Authored-By: hugomrdias <[email protected]>

packages/ipfs/README.md

+3-9
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
<a href="https://github.com/feross/standard"><img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat"></a>
2828
<a href=""><img src="https://img.shields.io/badge/npm-%3E%3D6.0.0-orange.svg?style=flat" /></a>
2929
<a href=""><img src="https://img.shields.io/badge/Node.js-%3E%3D10.0.0-orange.svg?style=flat" /></a>
30+
<a href="https://www.npmjs.com/package/ipfs"><img src="https://img.shields.io/npm/dm/ipfs.svg" /></a>
31+
<a href="https://www.jsdelivr.com/package/npm/ipfs"><img src="https://data.jsdelivr.com/v1/package/npm/ipfs/badge"/></a>
3032
<br>
3133
</p>
3234

@@ -165,16 +167,8 @@ Once installed, please follow the [Getting Started Guide](https://docs.ipfs.io/i
165167

166168
Learn how to bundle with browserify and webpack in the [`examples`](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs/examples) folder.
167169

168-
You can also load it using a `<script>` using the [unpkg](https://unpkg.com) CDN **or** the [jsDelivr](https://www.jsdelivr.com/package/npm/ipfs) CDN. Inserting one of the following lines will make an `Ipfs` object available in the global namespace.
170+
You can also load it using a `<script>` using the [jsDelivr](https://www.jsdelivr.com/package/npm/ipfs) CDN. Inserting one of the following lines will make an `Ipfs` object available in the global namespace.
169171

170-
```html
171-
<!-- loading the minified version using unpkg -->
172-
<script src="https://unpkg.com/ipfs/dist/index.min.js"></script>
173-
174-
<!-- loading the human-readable (not minified) version using unpkg -->
175-
<script src="https://unpkg.com/ipfs/dist/index.js"></script>
176-
```
177-
**OR THIS:**
178172

179173
```html
180174
<!-- loading the minified version using jsDelivr -->

0 commit comments

Comments
 (0)