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 Sep 28, 2021. It is now read-only.
- feat: CID support, added resolver.cid
- feat: basic support for HAMD sharded directory
- not real support, we need ipfs.resolve for that
- fix: return data from raw dag without resolv step
Known Issues:
- missing tests for CIDv1
License: MIT
Signed-off-by: Marcin Rataj <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+14-4
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,10 @@
18
18
19
19
## Usage
20
20
21
-
This project consists on creating a HTTP response from an IPFS Hash. This response can be a file, a directory list view or the entry point of a web page.
21
+
22
+
### Creating HTTP Response
23
+
24
+
This project creates a HTTP response for an IPFS Path. This response can be a file, a HTML with directory listing or the entry point of a web page.
This module also exports the used ipfs resolver, which should be used when the response needs to be customized.
35
+
### Using protocol-agnostic resolver
36
+
37
+
This module also exports the used ipfs `resolver`, which should be used when the response needs to be customized or non-HTTP transport is used:
33
38
34
39
```js
35
40
const { resolver } =require('ipfs-http-response')
36
41
37
-
resolver.multihash(ipfsNode, ipfsPath)
42
+
resolver.cid(ipfsNode, ipfsPath)
38
43
.then((result) => {
39
44
...
40
45
})
41
46
```
42
47
48
+
If `ipfsPath` points at a directory, `resolver.cid` will throw Error `This dag node is a directory` with a `cid` attribute that can be passed to `resolver.directory`:
49
+
50
+
43
51
```js
44
52
const { resolver } =require('ipfs-http-response')
45
53
46
-
resolver.directory(node, path, multihash)
54
+
resolver.directory(ipfsNode, ipfsPath, cid)
47
55
.then((result) => {
48
56
...
49
57
})
50
58
```
51
59
60
+
`result` will be either a `string` with HTML directory listing or an array with CIDs of `index` pages present in inspected directory.
0 commit comments