在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:ipfs/js-dag-service开源软件地址:https://github.com/ipfs/js-dag-service开源编程语言:TypeScript 99.2%开源软件介绍:DAGService
DAGService is aiming to be a bare minimum needed for IPLD-based applications to interact with the IPFS network by getting and putting blocks to it. NOTE For now, this is a highly experimental library. Use with caution.
Table of ContentsBackgroundThe goal of DAGService to provied a minimal layer between data model of IPLD and full blown IPFS. It provides bare minimum functionality for any application to interact with the IPFS network (by getting and putting IPLD blocks) without having to deal with the complexities of operating a full IPFS node. It is an attempt to remake core piece of IPFS node reusable on it's own. Why?Because 99% of the time, a browser or mobile (d)App only needs to be able to add and get small bits of data over the IPFS network. This library provides that, in a much smaller package (currently less than 1/2 the size of Install
Usageimport { Peer, BlockStore } from "dag-service"
// Use any interface-datastore compliant store
import { MemoryDatastore } from "interface-datastore"
import Libp2p from "libp2p"
const store = new BlockStore(new MemoryDatastore())
const main = async () => {
// Bring your own libp2p host....
const host = new Libp2p({ ...libp2Options })
const lite = new Peer(store, host)
await lite.start()
const cid = "QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u"
const data = await lite.getFile(cid)
console.log(data.toString())
// Hello World
await lite.stop()
} There are also several useful examples included in the tests of this repo, with tools for creating a default APISee https://ipfs.github.io/js-dag-service/ MaintainersContributeFeel free to dive in! Open an issue or submit PRs. To contribute to IPFS in general, see the contributing guide. Project follows the IPFS Community Code of Conduct LicenseThe js-dag-service project is dual-licensed under Apache 2.0 and MIT terms:
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论