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

ipfs-shipyard/ipfs-blob-store: An abstract-blob-store compatible implementation ...

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

开源软件名称:

ipfs-shipyard/ipfs-blob-store

开源软件地址:

https://github.com/ipfs-shipyard/ipfs-blob-store

开源编程语言:

JavaScript 96.7%

开源软件介绍:

ipfs-blob-store

standard-readme compliant Dependency Status js-standard-style npm

An abstract-blob-store compatible implementation built using IPFS as the storage backend

Implements the abstract-blob-store, using IPFS for storage.

Install

npm install ipfs-blob-store

Usage

ipfs-blob-store uses the IPFS Files API to create the abstraction of a mutable filesystem over snapshots of Merkle DAGs (per mutation). You'll need to use the Files API directly to get the /ipfs/Qm... address of the filesystem root so that other IPFS nodes can retrieve it.

It requires an IPFS node to run - you can either specify a host/port combination to connect to a remote daemon, pass an instance of ipfs or nothing at all to have the blob store manage it's own IPFS node.

Self-managed IPFS node

const ipfsBlobStore = require('ipfs-blob-store')

const store = await ipfsBlobStore()

store.exists('/my-file.txt', (error, exists) => {
  // ...
})

Pre-configured IPFS node

const ipfsBlobStore = require('ipfs-blob-store')
const IPFS = require('ipfs')

const node = new IPFS({
  // some config here
})

node.once('ready', () => {
  const store = await ipfsBlobStore({
    ipfs: node
  })

  store.exists('/my-file.txt', (error, exists) => {
    // ...
  })
})

Remote IPFS daemon

const ipfsBlobStore = require('ipfs-blob-store')

const store = await ipfsBlobStore({
  host: '127.0.0.1',
  port: 5001
})

store.exists('/my-file.txt', (error, exists) => {
  // ...
})

Options

var options = {
  ipfs: null, // an instance of ipfs or ipfs-api
  port: 5001,   // default value
  host: '127.0.0.1', // default value
  baseDir: '/', // default value
  flush: true  // default value
}

const store = await ipfsBlobStore(options)

API

See abstract-blob-store for the blob store API.

Contribute

Feel free to join in. All welcome. Open an issue!

This repository falls under the IPFS Code of Conduct.

Want to hack on IPFS?

License

MIT




鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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