Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@MCarlomagno
Created April 14, 2022 23:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MCarlomagno/5d1c5a794da405b5f5b1d8e713df0d17 to your computer and use it in GitHub Desktop.
Save MCarlomagno/5d1c5a794da405b5f5b1d8e713df0d17 to your computer and use it in GitHub Desktop.
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