From 86d59ef0acf71cd21573246dd2e23f871cfee210 Mon Sep 17 00:00:00 2001 From: salgozino Date: Wed, 5 Jun 2024 16:45:52 -0300 Subject: [PATCH] fix: upload files without a wrapper directory. - remove .png in the filename --- src/index.ts | 2 +- src/utils/ipfs-publish.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 11237f9..e27b43d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -88,7 +88,7 @@ async function main() { for (let attemptIPFS = 1; attemptIPFS <= 5; attemptIPFS++) { try { ipfsResponse = await ipfsPublish( - `${token.symbol}.png`, + `${token.symbol}`, resizedImageBuffer, ) console.info(` Done.`) diff --git a/src/utils/ipfs-publish.ts b/src/utils/ipfs-publish.ts index be5458c..b1d4c36 100644 --- a/src/utils/ipfs-publish.ts +++ b/src/utils/ipfs-publish.ts @@ -16,7 +16,7 @@ async function ipfsPublish( ): Promise<{ hash: string; path: string }[]> { // Return an array of objects with a hash property const buffer = Buffer.from(data); - const cid = await filebase.storeDirectory([new File([buffer], fileName)]); + const cid = await filebase.storeBlob(new File([buffer], fileName), fileName); return [{ hash: cid, path: `${cid}/${fileName}` }]; // Return an array }