*Add size property to normal files
This commit is contained in:
parent
a58f7fec4e
commit
927efddfed
|
@ -45,6 +45,7 @@ interface StatFileResponse {
|
||||||
directory: boolean;
|
directory: boolean;
|
||||||
files: StatFileSubfile[];
|
files: StatFileSubfile[];
|
||||||
timeout: boolean;
|
timeout: boolean;
|
||||||
|
size: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface StatFileSubfile {
|
interface StatFileSubfile {
|
||||||
|
@ -151,6 +152,7 @@ async function statFile(hash?: string, path?: string, fullPath?: string) {
|
||||||
directory: false,
|
directory: false,
|
||||||
files: [],
|
files: [],
|
||||||
timeout: false,
|
timeout: false,
|
||||||
|
size: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
client = client as IPFS;
|
client = client as IPFS;
|
||||||
|
@ -180,6 +182,9 @@ async function statFile(hash?: string, path?: string, fullPath?: string) {
|
||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { size } = await client.files.stat(`/ipfs/${exists.cid}`);
|
||||||
|
stats.size = size;
|
||||||
|
|
||||||
const { contentType } = await detectContentType(
|
const { contentType } = await detectContentType(
|
||||||
fullPath,
|
fullPath,
|
||||||
client.cat(exists.cid)
|
client.cat(exists.cid)
|
||||||
|
|
Loading…
Reference in New Issue