UNPKG

@arkts/sdk-downloader

Version:
64 lines (46 loc) โ€ข 1.59 kB
# @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 โœจ - ๐Ÿ‘‚ Support listen events when download, tar extract and zip extract - ใŠ™๏ธ Check the SHA256 of the downloaded `tar.gz` file ## Supported Platforms ๐Ÿ’ป - [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: [![CI](https://github.com/Groupguanfang/arkts-sdk-downloader/actions/workflows/ci.yml/badge.svg)](https://github.com/Groupguanfang/arkts-sdk-downloader/actions/workflows/ci.yml) ## Install ๐Ÿ“ฆ ```bash pnpm add @arkts/sdk-downloader ``` ## Usage ๐Ÿš€ ```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() ``` ## Author ๐Ÿค - [Naily Zero](https://github.com/groupguanfang) - QQ: 1203970284 - Email: zero@naily.cc - WeChat: gcz-zero ## License ๐Ÿ“„ MIT