Skip to content

Commit

Permalink
Updated dataset download
Browse files Browse the repository at this point in the history
  • Loading branch information
ulises-jeremias committed Oct 21, 2023
1 parent 3f88cd4 commit 6c9f903
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions datasets/loader.v
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct RawDownload {
target string
}

fn load_from_url(data RawDownload) !string {
fn load_from_url(data RawDownload) ! {
datasets_cache_dir := get_cache_dir('datasets')

if !os.is_dir(datasets_cache_dir) {
Expand All @@ -33,15 +33,10 @@ fn load_from_url(data RawDownload) !string {
}

if os.is_file(cache_file_path) {
return os.read_file(cache_file_path)
return
}

res := http.get(data.url)!
content := res.body

os.write_file(cache_file_path, content)!

return content
http.download_file(data.url, cache_file_path)!
}

[params]
Expand Down

0 comments on commit 6c9f903

Please sign in to comment.