0.9.7 • Published 1 year ago
@polywrap/ipfs-plugin-js v0.9.7
@polywrap/ipfs-plugin-js
IPFS Plugin allows the Polywrap JS Client to interact with IPFS.
Usage
import { PolywrapClient } from "@polywrap/client-js";
import {
initTestEnvironment,
providers,
stopTestEnvironment,
} from "@polywrap/test-env-js";
import { ipfsPlugin } from "@polywrap/ipfs-plugin-js";
import createIpfsClient from "@polywrap/ipfs-http-client-lite";
// IPFS
export async function foo({
await initTestEnvironment();
const ipfsPluginUri = "wrap://ens/ipfs.polywrap.eth";
ipfs = createIpfsClient(providers.ipfs);
const sampleFileTextContents = "Hello World!";
const sampleFileBuffer = Buffer.from(sampleFileTextContents, "utf-8");
let ipfsAddResult = await ipfs.add(sampleFileBuffer);
// initialize client with the ipfs plugin
client = new PolywrapClient({
plugins: [
{
uri: ipfsPluginUri,
plugin: ipfsPlugin({
provider: providers.ipfs,
}),
},
],
});
// and query ipfs
const response = await client.invoke<string>({
ipfsPluginUri,
method: "cat",
input: {
cid: sampleFileIpfsInfo.hash.toString(),
},
});
// or instantiate the plugin
const plugin = ipfsPlugin({
provider: providers.ipfs,
});
// and query ipfs
const response' = await plugin.cat(
{ cid: sampleFileIpfsInfo.hash.toString() },
client
);
await stopTestEnvironment();
})
For more usage examples see src/__tests__
.
API
Full API in src/schema.graphql
0.9.7
1 year ago
0.9.6
1 year ago
0.9.5
1 year ago
0.10.0-pre.7
1 year ago
0.10.0-pre.6
1 year ago
0.10.0-pre.3
1 year ago
0.10.0-pre.4
1 year ago
0.10.0-pre.1
1 year ago
0.10.0-pre.5
1 year ago
0.9.4
2 years ago
0.9.3
2 years ago
0.10.0-pre.0
2 years ago
0.9.0
2 years ago
0.9.2
2 years ago
0.9.1
2 years ago
0.8.0
2 years ago
0.5.0
2 years ago
0.4.1
2 years ago
0.7.0
2 years ago
0.6.0
2 years ago
0.4.0
2 years ago
0.3.0
2 years ago
0.2.0
2 years ago
0.1.1
2 years ago
0.1.0
2 years ago
0.0.1-prealpha.93
2 years ago
0.0.1-prealpha.92
2 years ago
0.0.1-prealpha.91
2 years ago
0.0.1-prealpha.90
2 years ago
0.0.1-prealpha.89
2 years ago
0.0.1-prealpha.88
2 years ago
0.0.1-prealpha.87
2 years ago
0.0.1-prealpha.86
2 years ago