*add options to api methods

This commit is contained in:
Derrick Hammer 2023-04-01 13:39:22 -04:00
parent bda0af49fa
commit aad02e4901
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 8 additions and 6 deletions

View File

@ -10,6 +10,7 @@
"p-defer": "^4.0.0" "p-defer": "^4.0.0"
}, },
"devDependencies": { "devDependencies": {
"@helia/unixfs": "^1.2.1",
"@types/node": "^18.0.6", "@types/node": "^18.0.6",
"prettier": "^2.7.1", "prettier": "^2.7.1",
"typescript": "^5.0.3" "typescript": "^5.0.3"

View File

@ -1,5 +1,6 @@
import { Client, factory } from "@lumeweb/libkernel-universal"; import { Client, factory } from "@lumeweb/libkernel-universal";
import defer from "p-defer"; import defer from "p-defer";
import { CatOptions, LsOptions, StatOptions } from "@helia/unixfs";
interface AbortableGenerator { interface AbortableGenerator {
abort: () => void; abort: () => void;
@ -11,16 +12,16 @@ export class IPFSClient extends Client {
return this.callModuleReturn("ready"); return this.callModuleReturn("ready");
} }
public async stat(cid: string) { public async stat(cid: string, options?: Partial<StatOptions>) {
return this.callModuleReturn("stat"); return this.callModuleReturn("stat", { options });
} }
public ls(cid: string): AbortableGenerator { public ls(cid: string, options?: Partial<LsOptions>): AbortableGenerator {
return this.connectModuleGenerator("ls", { cid }); return this.connectModuleGenerator("ls", { cid, options });
} }
public cat(cid: string): AbortableGenerator { public cat(cid: string, options?: Partial<CatOptions>): AbortableGenerator {
return this.connectModuleGenerator("cat", { cid }); return this.connectModuleGenerator("cat", { cid, options });
} }
public async ipns(cid: string): Promise<string> { public async ipns(cid: string): Promise<string> {