@keel-ai/asset
v0.1.0
Published
Asset resolution + remote asset caching for Keel.
Downloads
225
Maintainers
Readme
@keel-ai/asset
Asset resolution (bundled) + remote asset caching. Counterpart of
expo-asset.
Install
keel install @keel-ai/assetUsage
import { resolve, downloadAsync } from '@keel-ai/asset';
// Bundled asset — wraps RN's Image.resolveAssetSource.
const logo = resolve(require('./assets/logo.png'));
console.log(logo.uri); // file:// or asset:// path
console.log(logo.width); // intrinsic width in points / DP
// Remote asset — downloads + caches to a local file, returns the URI.
const cached = await downloadAsync('https://example.com/image.png');
console.log(cached.localUri); // file:///.../caches/<hash>.pngPlatform mapping
| API | iOS | Android |
|---|---|---|
| resolve() | RN's Image.resolveAssetSource (JS-side) | RN's Image.resolveAssetSource (JS-side) |
| downloadAsync() | URLSession.shared.downloadTask → caches/ directory | OkHttpClient → cacheDir |
resolve() is a thin JS wrapper around RN's built-in — no native code needed. downloadAsync() is the only native-side method.
