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

Commit

Permalink
docs: Update README.md (#4192)
Browse files Browse the repository at this point in the history
Added infura header
  • Loading branch information
ac12644 committed Sep 2, 2022
1 parent 8f351a8 commit cb3533a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/ipfs-http-client/README.md
Expand Up @@ -33,6 +33,7 @@
- [Importing the module and usage](#importing-the-module-and-usage)
- [In a web browser](#in-a-web-browser)
- [Custom Headers](#custom-headers)
- [Infura Header](#Infura-header)
- [Global Timeouts](#global-timeouts)
- [Development](#development)
- [Testing](#testing)
Expand Down Expand Up @@ -350,6 +351,23 @@ const ipfs = create({
})
```

### Infura Header

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

```js
const auth =
'Basic ' + Buffer.from(INFURA_ID + ':' + INFURA_SECRET_KEY).toString('base64');
const client = ipfsClient.create({
host: 'ipfs.infura.io',
port: 5001,
protocol: 'https',
headers: {
authorization: auth,
},
});
```

### Global Timeouts

To set a global timeout for *all* requests pass a value for the `timeout` option:
Expand Down

0 comments on commit cb3533a

Please sign in to comment.