• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

ipfs/js-dag-service: Library for storing and replicating hash-linked data over t ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

ipfs/js-dag-service

开源软件地址:

https://github.com/ipfs/js-dag-service

开源编程语言:

TypeScript 99.2%

开源软件介绍:

DAGService

Chat on IRC Chat on Matrix GitHub package.json version npm (scoped) Release docs standard-readme compliant

DAGService is a library for storing and replicating hash-linked data over the IPFS network.

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.

This project was originally developed under the @textileio organization, and was contributed to the IPFS community for ongoing maintenance and development.

Table of Contents

Background

The 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 js-ipfs without much optimization -- we will continue to optimize further). It is also highly extensible, so developers need only include the features they need, keeping load times fast, and (d)Apps feeling snappy. Additionally, Textile needed a Typescript-based IPFS solution, and we think others will find the type safety useful as well. Feel free to use the Typescript declarations in your own projects.

Install

npm install dag-service

Usage

import { 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 libp2p host exported by default. We've also thrown in some useful interfaces to use when building on IPFS Lite, as well as the Buffer API for use in the browser.

API

See https://ipfs.github.io/js-dag-service/

Maintainers

Contribute

Feel 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

License

The js-dag-service project is dual-licensed under Apache 2.0 and MIT terms:




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
ipfs/benchmarks: Benchmarking for IPFS发布时间:2022-06-22
下一篇:
lalosh/ipfs-chat: Distributed peer-to-peer chat using IPFS发布时间:2022-06-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap