mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
http: make download_file() return an optional
This commit is contained in:
@@ -5,14 +5,13 @@ module http
|
||||
|
||||
import os
|
||||
|
||||
pub fn download_file(url string, out string) bool {
|
||||
pub fn download_file(url string, out string)? {
|
||||
$if debug_http? {
|
||||
println('download file url=$url out=$out')
|
||||
}
|
||||
s := get(url) or {
|
||||
return false
|
||||
return error(err)
|
||||
}
|
||||
os.write_file(out, s.text)
|
||||
return true
|
||||
// download_file_with_progress(url, out, empty, empty)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user