Skip to content

Commit

Permalink
Beta ipfs improving
Browse files Browse the repository at this point in the history
  • Loading branch information
olehmell committed Aug 23, 2023
1 parent 8a5832b commit 4984544
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/api/src/ipfs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,14 @@ export class SubsocialIpfsApi {
})
content[cidStr] = res.value
} else {
const res = await axios.get(
`${this._ipfsNodeUrl}/ipfs/${cid.toV1()}?timeout=${timeout}`
)
const data = res.data
const res = await this.client.cat(cid, { timeout })

if (typeof data === 'object') {
content[cidStr] = data
let data = ''
for await (const chunk of res) {
data += chunk.toString()
}

content[cidStr] = JSON.parse(data)
}
} catch (err) {
log.error(`Failed to load cid ${cid.toString()}:`, err)
Expand Down

0 comments on commit 4984544

Please sign in to comment.