The IPFS options required to connect to this MockIPFS node. These can be passed
directly to IPFS.create
from ipfs-http-client to create a real IPFS client
that connects to this mock node.
Mock IPFS add requests, mocking the behaviour of the add command while ensuring that the added content is never actually sent to a real IPFS node.
Mock IPFS add requests containing certain types of content, mocking the behaviour of the add command while ensuring that the added content is never actually sent to a real IPFS node.
Rest
...content: (string | Uint8Array | { Mock IPFS cat requests, returning fake content instead of the real content for the given CID.
This takes an optional CID argument. If not provided, the mock will match all cat requests for any CID.
Optional
cid: stringMock IPFS get requests, returning fake content instead of the real content for the given CID.
This takes an optional CID argument. If not provided, the mock will match all get requests for any CID.
Optional
cid: stringMock the behaviour of IPNS name publishing.
This takes an optional name argument to match. If not provided, the defined behaviour will apply for all IPFS resolutions for any name.
Optional
nameKey: stringMock the behaviour of IPNS name resolutions.
This takes an optional name argument to match. If not provided, the defined behaviour will apply for all IPFS resolutions for any name.
Optional
name: stringMock the behaviour of IPFS pinning.
This takes an optional CID argument. If not provided, the mock will match pinning of any CID.
Optional
cid: stringMock the behaviour of IPFS pin listing.
Mock the behaviour of IPFS pinning to a remote service
This takes an optional CID argument. If not provided, the mock will match remote pinning of any CID.
Optional
cid: stringMock the behaviour of IPFS remote pinning service listing.
Mock the behaviour of IPFS pin removal.
This takes an optional CID argument. If not provided, the mock will match unpinning of any CID.
Optional
cid: stringGenerated using TypeDoc
A MockIPFS node provides default behaviours and allows defining custom behaviour rules to simulate interactions with the IPFS network without requiring a full node or access to the real IPFS network.
This should not be created directly: instead, call then
getLocal()
orgetRemote()
methods exported from this module.Once you have a MockIPFS node, you can start defining rules using any of the
forX()
methods. Each method returns a rule builder, allowing you to add extra matching constraints, followed by athenX()
final method which enables the rule, returning a promise that resolves once the rule is constructed and active.