Skip to content

Commit 256a9c7

Browse files
committed
upgrade lib method
1 parent 25917ba commit 256a9c7

File tree

5 files changed

+392
-537
lines changed

5 files changed

+392
-537
lines changed

lib/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,15 @@ export const getAllLiveGateway = async (
3636
const listLoop: unknown[] = [];
3737
const finalUrl: string[] = [];
3838
const getHash = ipfsUrl.replace('ipfs://', '');
39+
const dataHash = getHash.split('/');
3940

41+
let urlGet = gateways[0].replace('{hash}', dataHash[0]);
42+
43+
for (let index = 1; index < dataHash.length; index++) {
44+
urlGet = urlGet + '/' + dataHash[index];
45+
}
46+
47+
listLoop.push(axios.get(urlGet, { timeout: 3000 }));
4048
gateways.forEach(async item => {
4149
const dataHash = getHash.split('/');
4250
let url = item.replace('{hash}', dataHash[0]);

0 commit comments

Comments
 (0)