Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@cuberqaq/network-side

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cuberqaq/network-side

Polyfill of network.download API for ZeppOS 2.0 app-side

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
33
26.92%
Maintainers
1
Weekly downloads
 
Created
Source

network-side

Polyfill of network.download API for ZeppOS 1.0/2.0/2.1 app-side.

This project include @cuberqaq/fs-side module. It use settings storage api to storage data, not a true file system, so don't save many big files. Welcome to send issues and PR to make this project better!

Corrently not support segmented download, timeout, onProgress event. Some of the functions have not been tested yet,

Using whatwg-fetch(polyfill of fetch) as fetch api, which uses XMLHttpRequest to access the network.

Based to @cuberqaq/fs-side module to storage files, you should also access the files by it. see CuberQAQ/zepp-fs-side: Simple Lib for ZeppOS 1.0/2.0/2.1 app-side to build a vitual file system.

1. Install

Use Command npm i @cuberqaq/network-side --save to install network-side in your ZeppOS Miniapp project.

2. Import & Use

The network-side module export a download object, not global one.

In your app-side JavaScript source file, use this to import network-side:

import { network } from "@cuberqaq/network-side";

Then you can use the methods in the same way you do with ZeppOS 3.0 network.download. API Document see Zepp OS Developers Documentation For example:

const downloadTask = network.downloader.downloadFile({
  url: "https://docs.zepp.com/img/logo.png",
  filePath: "data://test.png",
});

downloadTask.onSuccess = (event) => {
  console.log(event.filePath); // data://test.png
  console.log(event.tempFilePath); // undefined
  console.log(event.statusCode); // 200
};

Keywords

zepp

FAQs

Package last updated on 18 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts