*add options to api methods
This commit is contained in:
parent
bda0af49fa
commit
aad02e4901
|
@ -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"
|
||||
|
|
13
src/index.ts
13
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<StatOptions>) {
|
||||
return this.callModuleReturn("stat", { options });
|
||||
}
|
||||
|
||||
public ls(cid: string): AbortableGenerator {
|
||||
return this.connectModuleGenerator("ls", { cid });
|
||||
public ls(cid: string, options?: Partial<LsOptions>): AbortableGenerator {
|
||||
return this.connectModuleGenerator("ls", { cid, options });
|
||||
}
|
||||
|
||||
public cat(cid: string): AbortableGenerator {
|
||||
return this.connectModuleGenerator("cat", { cid });
|
||||
public cat(cid: string, options?: Partial<CatOptions>): AbortableGenerator {
|
||||
return this.connectModuleGenerator("cat", { cid, options });
|
||||
}
|
||||
|
||||
public async ipns(cid: string): Promise<string> {
|
||||
|
|
Loading…
Reference in New Issue