From aad02e4901fb5847d6adfb7d4b69d1ad81cd89f7 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 1 Apr 2023 13:39:22 -0400 Subject: [PATCH] *add options to api methods --- package.json | 1 + src/index.ts | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index e48d92f..18eb432 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "p-defer": "^4.0.0" }, "devDependencies": { + "@helia/unixfs": "^1.2.1", "@types/node": "^18.0.6", "prettier": "^2.7.1", "typescript": "^5.0.3" diff --git a/src/index.ts b/src/index.ts index 360fb06..0aaaa4d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,6 @@ import { Client, factory } from "@lumeweb/libkernel-universal"; import defer from "p-defer"; +import { CatOptions, LsOptions, StatOptions } from "@helia/unixfs"; interface AbortableGenerator { abort: () => void; @@ -11,16 +12,16 @@ export class IPFSClient extends Client { return this.callModuleReturn("ready"); } - public async stat(cid: string) { - return this.callModuleReturn("stat"); + public async stat(cid: string, options?: Partial) { + return this.callModuleReturn("stat", { options }); } - public ls(cid: string): AbortableGenerator { - return this.connectModuleGenerator("ls", { cid }); + public ls(cid: string, options?: Partial): AbortableGenerator { + return this.connectModuleGenerator("ls", { cid, options }); } - public cat(cid: string): AbortableGenerator { - return this.connectModuleGenerator("cat", { cid }); + public cat(cid: string, options?: Partial): AbortableGenerator { + return this.connectModuleGenerator("cat", { cid, options }); } public async ipns(cid: string): Promise {