https://kotlinlang.org logo
Title
s

spierce7

07/06/2022, 8:42 PM
Is it possible to download a file from the local file system using ktor?
b

Big Chungus

07/06/2022, 9:10 PM
Yes, google "static resources ktor"
s

spierce7

07/07/2022, 12:00 AM
oh - I meant downloading using the client, not serving from the server. Thank you for your answer though!
b

Big Chungus

07/07/2022, 6:23 AM
Ah then ofc no.
l

Landry Norris

07/07/2022, 2:39 PM
I remember something about the internal io layer wanting to support files. I don’t see why file://{path} wouldn’t work, but I’m not 100% sure.
I’d imagine Windows would be iffy, but on Unix-like systems, ports are files and files are files.
b

Big Chungus

07/07/2022, 2:40 PM
Everything is a file in unix, love that 😀
d

David Nedrow

07/07/2022, 10:04 PM
If you already have the file locally, why would you need to download it? Or do you mean you want to upload the local file to a remote server?
s

spierce7

07/08/2022, 12:35 AM
I was just looking for a consistent way multiplatform to access resources in test and prod environments
a

andylamax

07/08/2022, 11:35 PM
if its a filesystem, and you need to test it i n multiplatform way, I'd recommend checking okio