npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@expo-harmony/expo-image-loader

v57.0.1-harmony.1

Published

HarmonyOS port of expo-image-loader

Downloads

445

Readme

@expo-harmony/expo-image-loader

GitHub 仓库

为 HarmonyOS 上的 React Native 应用提供 Expo ImageLoader 的原生实现,与官方 expo-image-loader 配套使用。

安装

本包适配 Expo SDK 57。

引入本包前,需要确保应用使用的 HarmonyOS SDK 至少为 API 13(HarmonyOS 5.0.1)。

npm install @expo-harmony/expo-image-loader expo-image-loader@~57.0.1

API 对照表

Constants

ImageLoaderInterfaceKey

类型:ExpoServiceKey<ImageLoaderInterface>。用于取得 ImageLoaderInterface 接口。

Methods

ImageLoaderInterface.loadImageForDisplayFromURL(url)

参数 url 的类型为 string。返回 Promise<image.PixelMap>,解析为供展示的图片。返回图片保持原始尺寸,不做降采样;动画图片只取第一帧,系统能读到 EXIF 方向时按方向摆正。

支持以下地址形式:

  • http://、https:// 远程地址。应用启用 Network Kit 的 HTTP 响应缓存时,展示请求会遵循系统和服务器的缓存规则。响应大小不能超过 100 MiB。
  • 应用沙箱内的绝对路径,以 / 开头。
  • file:// 地址,需要应用已经获得该文件的访问授权。
  • data:image/<subtype>[;参数];base64,<数据> 地址。协议、媒体类型和 base64 标记不区分大小写;数据中的空白会被忽略,末尾填充字符 = 可以省略。
  • asset://path 对应 rawfile/assets/path;resource://RAWFILE/path、rawfile://path、rawfile:path 和相对资源名对应 rawfile/path。

地址为空、协议或打包资源路径无效、data: 地址未使用 base64 编码、HTTP 响应码不在 2xx 范围内,或图片解码失败时,Promise 会以 ERR_IMAGE_LOADER 拒绝。

ImageLoaderInterface.loadImageForDisplayFromURL(url, listener)

参数为 url: string 和 listener: ImageLoaderResultListener。返回 void,加载方式与 Promise 形式相同;成功或失败结果分别通过 onSuccess、onFailure 回调。

ImageLoaderInterface.loadImageForManipulationFromURL(url)

参数 url 的类型为 string。返回 Promise<image.PixelMap>,加载供编辑的图片。支持的地址形式和方向处理与展示加载相同,图片保持原始尺寸,不做降采样;每次调用返回独立图片,远程图片每次都会重新请求,不使用缓存。

加载失败时,Promise 会以 ERR_IMAGE_LOADER 拒绝。

ImageLoaderInterface.loadImageForManipulationFromURL(url, listener)

参数为 url: string 和 listener: ImageLoaderResultListener。返回 void,加载方式与 Promise 形式相同;成功或失败结果分别通过 onSuccess、onFailure 回调。

Types

ImageLoaderInterface

提供上述图片加载方法。方法成功时返回可编辑的 image.PixelMap;图片不再使用时,调用方须调用 release() 释放。

ImageLoaderResultListener

供调用方实现的图片加载结果监听器。加载成功时调用 onSuccess,失败时调用 onFailure。

| 成员 | 类型 | 说明 | | ----------- | --------------------------------- | ------------------------------------------------- | | onSuccess | (pixel: image.PixelMap) => void | 图片加载成功后调用;调用方负责释放收到的 PixelMap | | onFailure | (cause: Error) => void | 图片加载失败时调用;错误码为 ERR_IMAGE_LOADER |

Error codes

ERR_IMAGE_LOADER

地址、资源、文件访问、data: 内容、HTTP 状态或 100 MiB 响应上限导致加载失败,以及图片解码失败时,Promise 会以此错误码拒绝,listener 重载会通过 onFailure 收到对应错误。

Permissions

ohos.permission.INTERNET

用于加载 HTTP(S) 图片,由本包的 HarmonyOS 模块声明。

Author

expo-harmony © Baoshuo, Released under the MIT License. Authored and maintained by Baoshuo with help from contributors.

Personal Website · Blog · GitHub @renbaoshuo · Twitter @renbaoshuo