*add options to api methods
This commit is contained in:
parent
bda0af49fa
commit
aad02e4901
|
@ -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"
|
||||||
|
|
13
src/index.ts
13
src/index.ts
|
@ -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> {
|
||||||
|
|
Loading…
Reference in New Issue