Add ResourceGetter util

This commit is contained in:
nelle 2023-11-06 02:59:10 -07:00
parent 7c4bad6ab0
commit 13879d2c9a

View file

@ -0,0 +1,14 @@
package group.ouroboros.potrogue.util
import java.net.URL
import java.nio.file.Files
import java.nio.file.Paths
class ResourceGetter {
fun downloadFile(url: URL, fileName: String) {
url.openStream().use { Files.copy(it, Paths.get(fileName)) }
}
//EXAMPLE USAGE
// ResourceGetter().downloadFile(URL("https://url.to/resource.txt"), "location/to/store/resource.txt")
}