Skip to content

Commit 7e6d191

Browse files
authored
Throw an error if fs is not available for FSCache
Meant to handle cases where the user sets `useFSCache` from an environment that doesn't support `fs`.
1 parent 022a1f9 commit 7e6d191

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/utils/hub.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,9 @@ export async function getModelFile(path_or_repo_id, filename, fatal = true, opti
451451
}
452452

453453
if (!cache && env.useFSCache) {
454-
// TODO throw error if not available
454+
if (!apis.IS_FS_AVAILABLE) {
455+
throw Error('File System Cache is not available in this environment.');
456+
}
455457

456458
// If `cache_dir` is not specified, use the default cache directory
457459
cache = new FileCache(options.cache_dir ?? env.cacheDir);

0 commit comments

Comments
 (0)