0.1.13 โข Published 4 months ago
@arkts/sdk-downloader v0.1.13
@arkts/sdk-downloader
Simple function to download the ArkTS SDK, streaming, simple, easy to use, and support resume download, fast โก๏ธ
Features ๐
- โฉ๏ธ Resume download โ
- โฌ Download Progress, tar extract progress and zip extract progress tracking โ
- ๐งต HTTP/HTTPS support โ
- ๐ Support cancel download โ
- ๐งน Clean the cache directory after the download is complete โจ
Install ๐ฆ
pnpm add @arkts/sdk-downloaderUsage ๐
import { download, SdkArch, SdkOS, SdkVersion } from '@arkts/sdk-downloader'
download({
url: {
os: SdkOS.MacOS,
version: SdkVersion.API15,
arch: SdkArch.ARM,
},
// Store the resume download file in the cache directory
cacheDir: 'target/.cache',
// The sdk target directory
targetDir: 'target',
// Whether to resume the download
resumeDownload: true,
// The progress callback
onProgress: (e) => {
console.warn(`Downloading: ${e.percentage}% ${e.network}${e.unit}`)
},
onTarExtracted: (entry) => {
console.warn(`Extracting TAR file: ${entry.path}`)
},
onZipExtracted: (entry, total, current) => {
console.warn(`Extracting ZIP file: ${entry.path} ${current}/${total}`)
},
})Author ๐ค
- Naily Zero
- QQ: 1203970284
- Email: zero@naily.cc
- WeChat: gcz-zero
License ๐
MIT