shogun-relay-sdk 1.2.4 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/ipfs.d.ts +7 -0
- package/dist/modules/ipfs.js +15 -0
- package/package.json +1 -1
package/dist/modules/ipfs.d.ts
CHANGED
|
@@ -19,6 +19,13 @@ export declare class IpfsModule {
|
|
|
19
19
|
contentType?: string;
|
|
20
20
|
}>, userAddress?: string): Promise<any>;
|
|
21
21
|
cat(cid: string): Promise<Buffer>;
|
|
22
|
+
/**
|
|
23
|
+
* Cat a file from an IPFS directory using a relative path
|
|
24
|
+
* @param directoryCid The CID of the directory
|
|
25
|
+
* @param filePath The relative path to the file within the directory (e.g., "index.html" or "css/style.css")
|
|
26
|
+
* @returns Promise with file content as Buffer
|
|
27
|
+
*/
|
|
28
|
+
catFromDirectory(directoryCid: string, filePath: string): Promise<Buffer>;
|
|
22
29
|
pinAdd(cid: string): Promise<any>;
|
|
23
30
|
pinRm(cid: string): Promise<any>;
|
|
24
31
|
pinLs(): Promise<any>;
|
package/dist/modules/ipfs.js
CHANGED
|
@@ -59,6 +59,21 @@ class IpfsModule {
|
|
|
59
59
|
responseType: "arraybuffer",
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Cat a file from an IPFS directory using a relative path
|
|
64
|
+
* @param directoryCid The CID of the directory
|
|
65
|
+
* @param filePath The relative path to the file within the directory (e.g., "index.html" or "css/style.css")
|
|
66
|
+
* @returns Promise with file content as Buffer
|
|
67
|
+
*/
|
|
68
|
+
async catFromDirectory(directoryCid, filePath) {
|
|
69
|
+
const fullPath = `${directoryCid}/${filePath}`;
|
|
70
|
+
return this.client.post(`/api/v1/ipfs/api/v0/cat?arg=${encodeURIComponent(fullPath)}`, null, {
|
|
71
|
+
responseType: "arraybuffer",
|
|
72
|
+
headers: {
|
|
73
|
+
"Content-Length": "0",
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
}
|
|
62
77
|
async pinAdd(cid) {
|
|
63
78
|
return this.client.post("/api/v1/ipfs/pin/add", { cid });
|
|
64
79
|
}
|
package/package.json
CHANGED