js-ipfs icon indicating copy to clipboard operation
js-ipfs copied to clipboard

A fully offline, CAR-centric js-ipfs node

Open ikreymer opened this issue 3 years ago • 0 comments

Description:

I'm wondering if it'd be possible to support a fully offline, no-network, in-memory instance of js-ipfs that is designed to be used to only import, export CAR files, or add data directly, while supporting existing apis (or at least the workable subset).

I guess this functionality is sort of provided by web3-storage/ipfs-car, but the interface there is fairly different.

The goal would be to provide similar functionality, but with the standard ipfs apis, as well as ability to specify a custom blockstore from web3-storage/ipfs-car blockstores.

Could look something like:

const ipfs = await IPFS.create({"offline": true, blockstore: new MemoryBlockStore()})
...
ipfs.add(...)
...
ipfs.dag.put(...)
...
// export
const CAR = await ipfs.dag.export(...)

Probably at least the ipfs.files, ipfs.dag, ipfs.object apis could be supported?

This would allow for switching between an offline, CAR-only environment, and a 'live' environment, w/o having to use two different sets of APIs / systems.

Is this something that might be feasible in some way (or not?), or perhaps alternatively, something that could be built on top of web3-storage/ipfs-car itself. (If that repo is better place for this, feel free to move there!)

ikreymer avatar Aug 11 '22 06:08 ikreymer