mirror of
https://github.com/Permissionless-Software-Foundation/ipfs-bch-wallet-consumer.git
synced 2026-09-21 16:52:03 -07:00
Using filename from file metadata
This commit is contained in:
@@ -54,7 +54,7 @@ class IpfsUseCases {
|
|||||||
// throw new Error('File has not been pinned. Not available.')
|
// throw new Error('File has not been pinned. Not available.')
|
||||||
// }
|
// }
|
||||||
|
|
||||||
await this.getCidMetadata({ cid })
|
const filename = await this.getCidMetadata({ cid })
|
||||||
|
|
||||||
const helia = this.adapters.ipfs.ipfs
|
const helia = this.adapters.ipfs.ipfs
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ class IpfsUseCases {
|
|||||||
}
|
}
|
||||||
const readStream = bufferToStream(fileBuf)
|
const readStream = bufferToStream(fileBuf)
|
||||||
|
|
||||||
const filename = 'test.jpg'
|
// const filename = 'test.jpg'
|
||||||
|
|
||||||
return { filename, readStream }
|
return { filename, readStream }
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -95,6 +95,10 @@ class IpfsUseCases {
|
|||||||
|
|
||||||
const metadata = await ipfsFiles.getFileMetadata({ cid })
|
const metadata = await ipfsFiles.getFileMetadata({ cid })
|
||||||
console.log('getCidMetadata() metadata: ', metadata)
|
console.log('getCidMetadata() metadata: ', metadata)
|
||||||
|
|
||||||
|
const filename = metadata.fileMetadata.filename
|
||||||
|
|
||||||
|
return filename
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error in getCidMetadata(): ', err)
|
console.error('Error in getCidMetadata(): ', err)
|
||||||
throw err
|
throw err
|
||||||
|
|||||||
Reference in New Issue
Block a user