An abstract-blob-store compatible implementation built using IPFS as the storage backend
Implements the abstract-blob-store, using IPFS for storage.
npm install ipfs-blob-store
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.
const ipfsBlobStore = require('ipfs-blob-store')
const store = await ipfsBlobStore()
store.exists('/my-file.txt', (error, exists) => {
// ...
})
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) => {
// ...
})
})
const ipfsBlobStore = require('ipfs-blob-store')
const store = await ipfsBlobStore({
host: '127.0.0.1',
port: 5001
})
store.exists('/my-file.txt', (error, exists) => {
// ...
})
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)
See abstract-blob-store for the blob store API.
Feel free to join in. All welcome. Open an issue!
This repository falls under the IPFS Code of Conduct.
MIT