https://github.com/ohosvscode/image-manager
💿 OpenHarmony/HarmonyOS qemu image manager. 鸿蒙模拟器镜像列表获取/镜像下载部署器 ⬇️ 通过编程式TypeScript API下载、管理和部署模拟器镜像 ❤️ 支持 Windows / MacOS 🍎
https://github.com/ohosvscode/image-manager
Last synced: 5 months ago
JSON representation
💿 OpenHarmony/HarmonyOS qemu image manager. 鸿蒙模拟器镜像列表获取/镜像下载部署器 ⬇️ 通过编程式TypeScript API下载、管理和部署模拟器镜像 ❤️ 支持 Windows / MacOS 🍎
- Host: GitHub
- URL: https://github.com/ohosvscode/image-manager
- Owner: ohosvscode
- License: mit
- Created: 2026-02-05T00:04:22.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2026-02-25T16:21:21.000Z (5 months ago)
- Last Synced: 2026-02-25T20:14:58.001Z (5 months ago)
- Language: TypeScript
- Homepage:
- Size: 178 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# @arkts/image-manager
OpenHarmony/HarmonyOS qemu image manager.
## Usage
```ts
import { createImageManager, RequestUrlError } from '@arkts/image-manager'
async function main() {
const imageManager = createImageManager({ /** options */ })
// Get all local and remote images
const images = await imageManager.getImages()
console.log(images)
// We choice the first image to deploy
const image = images[0]
// Download the image
const downloader = await image.createDownloader()
if (downloader instanceof RequestUrlError)
return console.error(downloader)
// Listen to the download and extract progress
downloader.on('download-progress', progress => console.warn(progress))
downloader.on('extract-progress', progress => console.warn(progress))
// Start download
await downloader.startDownload()
// When the download is complete, we can check the checksum
const checksum = await downloader.checkChecksum()
console.warn(`Checksum: ${checksum}`)
if (!checksum)
return console.error('Checksum is not valid')
// Start extract the image
await downloader.extract()
// Clean the download cache
await downloader.clean()
// Start to deploy the image
// We must find the product config item if you don't want to customize the deployed image options,
// like `screenWidth`, `screenHeight`, `screenDiagonal`, `screenDensity`, etc.
const productConfig = await image.getProductConfig()
const mateBookFold = productConfig.find(item => item.name === 'MateBook Fold')
if (!mateBookFold)
throw new Error('MateBook Fold not found')
// Create the deployer
const device = image.createDevice('MateBook Fold', createDeployedImageConfig(image))
.setCpuNumber(4)
.setMemoryRamSize(4096)
.setDataDiskSize(6144)
// We can get the final deployed image options,
// it will be written to the `imageBasePath/lists.json` file when deployed.
const list = await device.buildList()
console.warn(list)
// We can get the `config.ini` object,
// it will be written to the `deployedPath/MateBook Fold/config.ini` file when deployed.
const config = await device.buildIni()
console.warn(config)
// You also can get the `config.ini` string version:
const iniString = await device.toIniString()
console.warn(iniString)
// Deploy the device
await device.deploy()
console.warn('Image deployed successfully')
// Start the emulator
await image.start(device)
await new Promise(resolve => setTimeout(resolve, 1000 * 60))
// Stop the emulator
image.stop(device)
}
```