Created
April 14, 2022 23:29
-
-
Save MCarlomagno/5d1c5a794da405b5f5b1d8e713df0d17 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async getFilesMetadata(): Promise<PersssistFile[]> { | |
const methods = this.contract.methods; | |
const filesCount = await methods.fileCount().call(); | |
const filesMetadata: PersssistFile[] = []; | |
for (var i = filesCount; i >= 1; i--) { | |
const file = await methods.files(i).call() | |
filesMetadata.push({ | |
fileId: file.id, | |
fileName: file.fileName, | |
filePath: file.filePath, | |
fileSize: file.fileSize, | |
fileType: file.fileType, | |
uploader: file.uploader | |
}); | |
} | |
return filesMetadata; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment