Save regular file to file storage

Hello,

I couldn’t find any example about how can we save regular file or stream of bytes to file storage. FileStorageUpload component is an UI component, but what about non-visual case.

I get a picture from external Web service. How can I save this image to applicaton local file storage?

Thnx

Use temporaryStorage#saveFile for save file from byte[] or InputStream to temporary storage.
And temporaryStorage.putFileIntoStorage for upload crated temtorary file in to storage.
Code
temporaryStorage.putFileIntoStorage(temporaryStorage.saveFile("MyFile".getBytes()), "MyFile.txt")
and result
image

Hi,

this is what I am searching but didn’t find. Thx. You save a lot of my time.