@arkts/sdk-downloader
Version:
Download and extract the ArkTS SDK.
64 lines (46 loc) โข 1.59 kB
Markdown
Simple function to download the ArkTS SDK, streaming, simple, easy to use, and support resume download, fast โก๏ธ
- โฉ๏ธ 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 โจ
- ๐ Support listen events when download, tar extract and zip extract
- ใ๏ธ Check the SHA256 of the downloaded `tar.gz` file
- [x] Windows
- [x] macOS
- [x] Linux
The unit test is run on Windows, macOS and Linux, you can see the test results in github actions:
> Current Test Status: [](https://github.com/Groupguanfang/arkts-sdk-downloader/actions/workflows/ci.yml)
```bash
pnpm add @arkts/sdk-downloader
```
```ts
import { createDownloader } from '@arkts/sdk-downloader'
const downloader = await createDownloader({
url: {
os: SdkOS.MacOS,
version: SdkVersion.API15,
arch: SdkArch.ARM,
},
cacheDir: 'target/.cache',
targetDir: 'target',
resumeDownload: true,
})
await downloader.startDownload(/** Override request options */)
await downloader.checkSha256()
await downloader.extractTar()
await downloader.extractZip()
await downloader.clean()
```
- [Naily Zero](https://github.com/groupguanfang)
- QQ: 1203970284
- Email: zero@naily.cc
- WeChat: gcz-zero
MIT