how to store a file in a note while receiving the file from curl response ?

Hi,

I'm currently trying to build a plugin that at some point will have to download a file from an external server and store it in a note.

Do you know if it is possible to do so while keeping cloud compatibleness ?