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.
@@ -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>;
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shogun-relay-sdk",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "SDK for interacting with Shogun Relay API - HTTP client for IPFS, deals, registry, and network operations",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",