wasm_pack/cache.rs
1//! Getting and configuring wasm-pack's binary cache.
2
3use anyhow::Result;
4use binary_install::Cache;
5use std::env;
6use std::path::Path;
7
8/// Get wasm-pack's binary cache.
9pub fn get_wasm_pack_cache() -> Result<Cache> {
10 if let Ok(path) = env::var("WASM_PACK_CACHE") {
11 Ok(Cache::at(Path::new(&path)))
12 } else {
13 Cache::new("wasm-pack")
14 }
15}