Uh oh!
There was an error while loading. Please reload this page.
feat: add Motoko fileupload example - #205
Conversation
| The fileupload is done in chunks, to support uploading larger files than 2MB, which is the ingress limit. Uploaded files are stored in an asset canister, which can serve assets like image files. | ||
| ### Motoko backend | ||
| The backend functions are located in the `src/fileupload/main.mo` Motoko file. The backend can receive a batch of chunks of a file, when a file is uploaded in the frontend, and when the batch is complete, it stores the file in the asset canister. The backend also includes functionality to serve the file to the frontend. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| @@ -0,0 +1,8329 @@ | |||
| { | |||
There was a problem hiding this comment.
Should package-lock.json be checked in. Is it for the other examples? Perhaps @krpeacock or @chenyan-dfinity can advise
| switch (chunk) { | ||
| case (?{content}) { | ||
| content_chunks := Array.append<[Nat8]>(content_chunks, [content]); |
There was a problem hiding this comment.
| content_chunks := Array.append<[Nat8]>(content_chunks, [content]); | |
| content_chunks := Array.append<[Nat8]>(content_chunks, [content]); |
Array.append in a loop is quadratic. Is chunk_ids just [0,1, ...,n) for some consecutive indices? In that case, you could use Array.tabulate<[Nat8]>(n, func i { ...}) to create the outer array without fear of 0(n^2) behaviour.
There was a problem hiding this comment.
(but I don't fully grok this code, tbh)
| @@ -0,0 +1,165 @@ | |||
| import Text "mo:base/Text"; | |||
There was a problem hiding this comment.
ideally, ident by 2 not 4 spaces (as in your README, I think)
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Claudio Russo <claudio@dfinity.org>
Co-authored-by: Claudio Russo <claudio@dfinity.org>
Co-authored-by: Claudio Russo <claudio@dfinity.org>
Co-authored-by: Claudio Russo <claudio@dfinity.org>
Co-authored-by: Claudio Russo <claudio@dfinity.org>
Co-authored-by: Claudio Russo <claudio@dfinity.org>
Co-authored-by: Claudio Russo <claudio@dfinity.org>
Co-authored-by: Claudio Russo <claudio@dfinity.org>
Co-authored-by: Claudio Russo <claudio@dfinity.org>
Co-authored-by: Claudio Russo <claudio@dfinity.org>
Co-authored-by: Claudio Russo <claudio@dfinity.org>
Co-authored-by: Claudio Russo <claudio@dfinity.org>
Co-authored-by: Claudio Russo <claudio@dfinity.org>
Co-authored-by: Claudio Russo <claudio@dfinity.org>
Co-authored-by: Claudio Russo <claudio@dfinity.org>
Co-authored-by: Claudio Russo <claudio@dfinity.org>
Co-authored-by: Claudio Russo <claudio@dfinity.org>
Co-authored-by: Claudio Russo <claudio@dfinity.org>
Co-authored-by: Claudio Russo <claudio@dfinity.org>
krpeacock
commented
Mar 9, 2023
I think we could revisit this and get it in - most of the concerns were addressed. @carstenjacobsen would you like any support here? |
sa-github-api
commented
Jan 31, 2024
Dear @carstenjacobsen, In order to potentially merge your code in this open-source repository and therefore proceed with your contribution, we need to have your approval on DFINITY's CLA. If you decide to agree with it, please visit this issue and read the instructions there. Once you have signed it, re-trigger the workflow on this PR to see if your code can be merged. — The DFINITY Foundation |

No description provided.