#assets #download #toml #https #test

bin+lib test-assets-ureq

Download test assets with ureq, managing them outside of git

3 releases (breaking)

0.5.0 Jan 20, 2025
0.4.0 Jan 20, 2025
0.3.0 Nov 9, 2024

#560 in Development tools

Download history 603/week @ 2024-11-05 1005/week @ 2024-11-12 342/week @ 2024-11-19 732/week @ 2024-11-26 142/week @ 2024-12-03 131/week @ 2024-12-10 167/week @ 2024-12-17 391/week @ 2024-12-24 936/week @ 2024-12-31 523/week @ 2025-01-07 686/week @ 2025-01-14 549/week @ 2025-01-21

2,714 downloads per month
Used in 3 crates

MIT/Apache

19KB
243 lines

Test Assets

github crates.io docs.rs build status

Download test assets, managing them outside of git.

Changes from being a fork of test-assets:

  • Use rust library ureq and avoid compiling curl for test binaries
  • Includes backoff support

Library

Compiler support: requires rustc 1.74.1+

Add the following to your Cargo.toml file:

[dependencies]
test-assets-ureq = "0.5.0"

For example, add the following information into the project toml file.

[test_assets.test_00]
filename = "out.squashfs"
hash = "976c1638d8c1ba8014de6c64b196cbd70a5acf031be10a8e7f649536193c8e78"
url = "https://wcampbell.dev/squashfs/testing/test_00/out.squashfs"

In your rust code, add the following to download using that previous file.

let file_content = fs::read_to_string("test.toml").unwrap();
let parsed: TestAsset = toml::de::from_str(&file_content).unwrap();
let assets = parsed.values();
dl_test_files_backoff(&assets, "test-assets", true, Duration::from_secs(1)).unwrap();

Binary

If test-assets are needed outside of the Rust code, a binary is provided to download them.

$ curl -L https://github.com/wcampbell0x2a/test-assets-ureq/releases/download/v0.5.0/dl-v0.5.0-x86_64-unknown-linux-musl.tar.gz -o dl.tar.gz
$ tar -xvf dl.tar.gz
$ ./dl test-assets.toml

Dependencies

~4–5.5MB
~99K SLoC