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

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

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ipfs-blob-store's Issues

Move to IPFS Shipyard?

Now we have an org to incubate projects that not part of the core implementation of the protocol or discussion of the spec. That org is ipfs-shipyard created from ipfs/team-mgmt#448

Short description:

IPFS Shipyard is a venue for the community to pursue and collaborate on research experiments, products, code libraries and more around the IPFS project. It is where innovation in userland happens and where we discover and form new primitives to push to the core of IPFS.

Sounds good?

immutable or mutable?

@travisperson (without looking at the code on #2 yet)

  • is this a blob store where i can do put(k, v) and v = get(k) (that is backed by a merkledag), or one where i do obj = get(ipfsPath)?

  • One thing i'd be looking for is a read only blob store to the ipfs dag. (maybe thats why the test suite doesn't pass? mutability?)

  • Maybe a mutable version can use an ipns key? something like:

    var ipnsBlobStore = require('ipns-blob-store')
    var pivateKey = getMyPrivateKey(...)
    
    var ibs = ipnsBlobStore(privateKey) // instance based on name at hash(publicKey)
    ibs.put(k, v)
    v = ibs.get(k)
  • I wonder if the immutable ipfs only blob store is enough for pulling things out for reginabox? cc @bengl

/me takes a look at #2

Does this still require a daemon?

I saw this note:

ipfs-blob-store today requires a running IPFS daemon to talk to over HTTP. This module will be able to be entirely self-contained once js-ipfs is complete.

However, js-ipfs looks like it now has feature parity so is this still true?

file not available when writestream ends

File not found by the time the stream ends. (Using the cb param on createWriteStream works though)

var ws = store.createWriteStream({
  key: 'cookso'
})

ws.write('hello world\n')
ws.end(function () {
  var rs = store.createReadStream({
    key: 'cookso'
  })

  rs.pipe(process.stdout)
})

Read MFS file from remote node example

Hi @daviddias., can you please provide an example or the way for remote read. see below example for more clarity:

If file called 'abc.png' is added in node 1 using ipfs.files.write(..)
how i can read/pull that file using the name 'abc.png' but not by multi-hash from other node 2

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.