Git Product home page Git Product logo

ipfs-blob-store's Introduction

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

ipfs-blob-store's People

Contributors

daviddias avatar achingbrain avatar travisperson avatar hacdias avatar dignifiedquire avatar jbenet avatar richardlitt avatar noffle avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.