7.3.0 • Published 4 months ago
dagula v7.3.0
dagula
Suck a DAG out of a peer in the IPFS network.
Install
npm i dagula
Usage
import * as Dagula from 'dagula/p2p.js'
const libp2p = await Dagula.getLibp2p()
const peer = '/dns4/elastic.dag.house/tcp/443/wss/p2p/bafzbeibhqavlasjc7dvbiopygwncnrtvjd2xmryk5laib7zyjor6kf3avm'
const dagula = await Dagula.fromNetwork(libp2p, { peer })
// fetch entire DAG
const cid = 'bafybeig4qjehigdddcoka23crh2s3vrautbep3topuoqblb4chkvvhpilu'
for await (const block of dagula.get(cid)) {
console.log(`${block.cid} (${block.bytes.length} bytes)`)
}
// fetch a file/directory
const path = 'bafybeiggvykl7skb2ndlmacg2k5modvudocffxjesexlod2pfvg5yhwrqm/2998.png'
for await (const entry of dagula.getUnixfs(path)) {
console.log(`${entry.path} (${entry.size} bytes)`)
// note: use `entry.content()` to get file data
}
CLI
# fetch a complete DAG (output format is CAR)
dagula get bafybeidtzj4g33h4d76nfyznjfcejyigejrjpqfzm6ydapuhd26asjg5re > output.car
# fetch a UnixFS file
dagula unixfs get bafybeidtzj4g33h4d76nfyznjfcejyigejrjpqfzm6ydapuhd26asjg5re/path/to/data.txt
# fetch a specific block
dagula block get bafybeidtzj4g33h4d76nfyznjfcejyigejrjpqfzm6ydapuhd26asjg5re
# configure peer to use
dagula peer set /dns4/elastic.dag.house/tcp/443/ws/p2p/bafzbeibhqavlasjc7dvbiopygwncnrtvjd2xmryk5laib7zyjor6kf3avm
Contributing
Feel free to join in. All welcome. Open an issue!
License
Dual-licensed under MIT + Apache 2.0
7.3.0
4 months ago
7.2.2
8 months ago
7.2.1
8 months ago
7.1.2
9 months ago
7.2.0
8 months ago
7.1.1
9 months ago
7.0.2
9 months ago
7.1.0
9 months ago
7.0.1
9 months ago
7.0.0
12 months ago
6.0.1
1 year ago
6.0.2
1 year ago
5.0.0
1 year ago
4.2.0
1 year ago
4.1.0
2 years ago
4.0.0
2 years ago
4.1.1
2 years ago
3.1.1
2 years ago
3.1.0
2 years ago
3.0.0
2 years ago
2.2.0
2 years ago
2.1.2
2 years ago
2.1.1
2 years ago
2.1.0
2 years ago
2.0.6
2 years ago
2.0.5
2 years ago
2.0.4
2 years ago
2.0.3
2 years ago
2.0.2
2 years ago
2.0.1
2 years ago
2.0.0
2 years ago
1.3.0
2 years ago
1.2.0
2 years ago
1.1.0
2 years ago
1.0.0
2 years ago