*Make files array an object with name and size
This commit is contained in:
parent
05c4fc40d9
commit
d3e234c7b7
|
@ -42,10 +42,15 @@ interface StatFileResponse {
|
|||
contentType: string | null;
|
||||
error: any;
|
||||
directory: boolean;
|
||||
files: string[];
|
||||
files: StatFileSubfile[];
|
||||
timeout: boolean;
|
||||
}
|
||||
|
||||
interface StatFileSubfile {
|
||||
name: string;
|
||||
size: number;
|
||||
}
|
||||
|
||||
async function initIpfs() {
|
||||
if (client) {
|
||||
if (client instanceof Promise) {
|
||||
|
@ -161,7 +166,12 @@ async function statFile(hash?: string, path?: string, fullPath?: string) {
|
|||
|
||||
if (exists?.type === "directory") {
|
||||
stats.directory = true;
|
||||
stats.files = exists.node.Links.map((item) => item.Name) as string[];
|
||||
stats.files = exists.node.Links.map((item) => {
|
||||
return {
|
||||
name: item.Name,
|
||||
size: item.Tsize,
|
||||
} as StatFileSubfile;
|
||||
});
|
||||
return stats;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue