File Storage On IC

Hi, community,

I have skimmed through the documentation for an in-depth reference of storage on IC, couldn’t find it.

  • Can anybody share some insight on how it is possible to store files(i.e. .png, .pdf, .mp4, .mkv) on IC?
  • What is most optimal solution to store large files( >10MB ) on IC?
2 Likes
  • Can anybody share some insight on how it is possible to store files(i.e. .png, .pdf, .mp4, .mkv) on IC?

You just store them as bytes at any location in the canister you want.

  • What is most optimal solution to store large files( >10MB ) on IC?

Split them in chunks and save each chunk separately. Once you need a complete file - download chunks and merge them back on a user side.

2 Likes

Thank you @senior.joinu for your response. I am new to IC, reference links to docs or related example would be much appreciated.

@kpeacock I don’t mean to spam you. Just wanted to point out that there’s at least one other person who would probably appreciate a video tutorial on file management.

@Jesse I would love to enjoy your sense of humor if it could provide any value at all.

I wasn’t being humorous. I requested that Kyle make a video tutorial on how to do exactly what you’re asking in this post. I referenced this post and one other post as evidence that there are multiple people who would appreciate the tutorial. As a result, Kyle said that he’d make the tutorial when he gets the time.

so I’d say my comment actually did add some value if it results in a video tutorial explaining the very thing you’re requesting help with.

Hopefully this code helps:

This is how CanCan chunks video files. Basically, take a big byte array (i.e. Array<number>) and split it up!

Here’s another one:

The tricky part IMO is getting this byte array from a file. You might need to use blobs or ArrayBuffers or something like that… it’s in this code.

3 Likes

@Jesse thank you for your help and apology for misreading intent.

Thank you @jzxchiang , it’s very helpful indeed!

1 Like

Hi,

To add a point to this thread, in addition to the difficulty of implementing a large volume storage system using one or more canisters, there is the question of the price per GB.
The solution that consists of cutting up packets of bytes, with the goal of scalability, technical performance and efficiency, does not seem to me to be ideal with this technology today. But since dfinity has many advantages, I asked myself how to solve this problem.
I will combine my dApp with dfinity and ipfs, ipfs-cluster for large media, I store on dfinity an object which is a pointer to the ipfs CID so I keep the distributed attribute of the solution and I benefit from the existing interfaces for the management of these contents.
I can use either my ipfs infrastructure or existing online solutions.

For public media it seems to me an interesting alternative in terms of complexity and cost. I am now thinking about how to use a similar concept for media that need to be protected.

You can see on the forum a lot of threads by searching “bigMap”

Regards