npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

rc-downloader

v0.2.8

Published

The seed project for React library.

Downloads

25

Readme

Downloader

本组件集成3种下载方式。

  • 第一种:通过url下载文件
  • 第二种:通过form表单下载文件
  • 第三种:文件断点下载

安装

使用npm:

$ npm i rc-downloader

How to Use

  • 第一种 url下载

Import:

import Downloader from 'rc-downloader' // 主文件
Downloader.downloadByUrl(url) // url为下载的文件路径
  • 第二种 form表单形式下载

Import:

import Downloader from 'rc-downloader' // 主文件
const { RemoteDownload } = Downloader // 表单下载组件

Js in your script:

//开始下载设置参数
this.setState({
    downloadUrl: '',
    gotoDownload: true,
    downloadParams
})

// 下载结束后要把gotoDownload设置为false
afterDownload = () => {
    this.setState({
        gotoDownload: false
    })
}

Render in your component:

<RemoteDownload
    url={downloadUrl}                       // 下载路径
    method="get"                            // 下载方式
    gotoDownload={gotoDownload}             // 是否开始下载
    afterDownload={this.afterDownload}      // 下载后回调
    paramData={downloadParams}              // 下载文件需要的参数
/>
  • 第三种 使用下载器断点下载

后台需要配合接口

Import:

import Downloader from 'rc-downloader' // 主文件

在app.js中初始化组件


Downloader.initDownloader()

添加任务

const fileObj = {
    url: '',                // 服务器端下载url 必填
    fileId: '',             // 服务器的文件id 必填
    total: 0,               // 文件总大小 必填
    id: '',                 // 任务id 非必填
    fileName: '',           // 文件名称 非必填
    date: '',               // 创建日期 非必填
    type: '',               // 文件类型 非必填
    resultUrl: '',          // 下载成功后回调 非必填
    resultParams: '',       // 下载成功后回调函数参数 非必填
}

// 调用下载组件
Downloader.addTask(fileObj)

// 显示下载组件
Downloader.show()

// 隐藏下载组件
Downloader.hide()

Keywords

react, downloader