From 927efddfed4379ae952f9ff84f28a86cdf727885 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Fri, 5 Aug 2022 20:04:57 -0400 Subject: [PATCH] *Add size property to normal files --- src/rpc/ipfs.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/rpc/ipfs.ts b/src/rpc/ipfs.ts index c5573d3..9c243fd 100644 --- a/src/rpc/ipfs.ts +++ b/src/rpc/ipfs.ts @@ -45,6 +45,7 @@ interface StatFileResponse { directory: boolean; files: StatFileSubfile[]; timeout: boolean; + size: number; } interface StatFileSubfile { @@ -151,6 +152,7 @@ async function statFile(hash?: string, path?: string, fullPath?: string) { directory: false, files: [], timeout: false, + size: 0, }; client = client as IPFS; @@ -180,6 +182,9 @@ async function statFile(hash?: string, path?: string, fullPath?: string) { return stats; } + const { size } = await client.files.stat(`/ipfs/${exists.cid}`); + stats.size = size; + const { contentType } = await detectContentType( fullPath, client.cat(exists.cid)