Utilities for converting files into Expo Assets
npm install expo-asset-utils> This package is no longer required for parsing assets, use expo-asset and expo-file-system instead.
``bash`
yarn add expo-asset-utils
Import the library into your JavaScript file:
`ts`
import * as AssetUtils from 'expo-asset-utils';
Given a reference to some asset, this will return a promise that resolves to an Expo.Asset that has been cached.
- Expo asset: Expo.Asset.fromModule(require('./image.png'))require('./image.png')
- static resource: 'https://upload.wikimedia.org/wikipedia/en/1/17/Batman-BenAffleck.jpg'
- remote image: 'file:///var/image.png'
- local file: 'asset-library:///var/image.png'
- asset library file: {uri: 'https://upload.wikimedia.org/wikipedia/en/1/17/Batman-BenAffleck.jpg'}
- React Native Image source:
| Property | Type | Description |
| ------------- | :-----------------------------------------------: | ------------------------------------------------ |
| fileReference | Expo.Asset, number, string, {uri: string} | This will resolve into a downloaded Expo.Asset |
Given a image URI string, this will return a base64 encoded string and the image size: { data: string, size: { width: number, height: number } }
| Property | Type | Description |
| -------- | :------: | ------------------------------------ |
| uri | string | This URI will be converted to base64 |
> Deprecated: Use (await resolveAsync()).localUri
> Deprecated: Use Asset.fromURI('...') from expo-asset`
> Deprecated
> Deprecated