*headers not needed
This commit is contained in:
parent
bd27bf47f1
commit
80f6103180
14
src/index.ts
14
src/index.ts
|
@ -33,39 +33,37 @@ export async function refreshGatewayList() {
|
||||||
export async function fetchIpfs(
|
export async function fetchIpfs(
|
||||||
hash: string,
|
hash: string,
|
||||||
path = "",
|
path = "",
|
||||||
headers = {},
|
|
||||||
receiveUpdate: DataFn
|
receiveUpdate: DataFn
|
||||||
) {
|
) {
|
||||||
if (!ipfsPath(`/ipfs/{${hash}`)) {
|
if (!ipfsPath(`/ipfs/{${hash}`)) {
|
||||||
throw new Error("Invalid hash");
|
throw new Error("Invalid hash");
|
||||||
}
|
}
|
||||||
return doFetch("fetchIpfs", { hash, path, headers }, receiveUpdate);
|
return doFetch("fetchIpfs", { hash, path }, receiveUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function statIpfs(hash: string, path = "", headers = {}) {
|
export async function statIpfs(hash: string, path = "") {
|
||||||
if (!ipfsPath(`/ipfs/{${hash}`)) {
|
if (!ipfsPath(`/ipfs/{${hash}`)) {
|
||||||
throw new Error("Invalid hash");
|
throw new Error("Invalid hash");
|
||||||
}
|
}
|
||||||
return doFetch("statIpfs", { hash, path, headers });
|
return doFetch("statIpfs", { hash, path });
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchIpns(
|
export async function fetchIpns(
|
||||||
hash: string,
|
hash: string,
|
||||||
path = "",
|
path = "",
|
||||||
headers = {},
|
|
||||||
receiveUpdate: DataFn
|
receiveUpdate: DataFn
|
||||||
) {
|
) {
|
||||||
if (!ipnsPath(`/ipns/{${hash}`)) {
|
if (!ipnsPath(`/ipns/{${hash}`)) {
|
||||||
throw new Error("Invalid hash");
|
throw new Error("Invalid hash");
|
||||||
}
|
}
|
||||||
return doFetch("fetchIpns", { hash, path, headers }, receiveUpdate);
|
return doFetch("fetchIpns", { hash, path }, receiveUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function statIpns(hash: string, path = "", headers = {}) {
|
export async function statIpns(hash: string, path = "") {
|
||||||
if (!ipnsPath(`/ipns/{${hash}`)) {
|
if (!ipnsPath(`/ipns/{${hash}`)) {
|
||||||
throw new Error("Invalid hash");
|
throw new Error("Invalid hash");
|
||||||
}
|
}
|
||||||
return doFetch("statIpns", { hash, path, headers });
|
return doFetch("statIpns", { hash, path });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function doFetch(method: string, data: any, receiveUpdate?: DataFn) {
|
async function doFetch(method: string, data: any, receiveUpdate?: DataFn) {
|
||||||
|
|
Loading…
Reference in New Issue