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 🙏

© 2026 – Pkg Stats / Ryan Hefner

awesome-downloader

v1.0.2

Published

下载组件

Downloads

12

Readme

download

下载组件

API

download(filename:String, data:String) 直接下载数据

filename

必填,下载文件名

data

必填,想要下载的数据

downloadCSV(url:String, options:Object)

options.perPage:Number

每次请求的数量,默认100

options.filename:String

下载的文件名,默认download.csv

options.query:Object

请求的额外参数,默认 {}

options.columns:Array

csv输出列描述,格式如:

  [
    dataIndex: '', //必填,列key
    title:'',//列名, 默认dataIndex
    render:(value, row)=>{//数据转换函数,
      return value;
    } 
  ]

options.responseTransformer:Function=(response)=>{}

接口响应转换函数

return: {data:Array, total:Number} 函数应当返回的结果,data未本次请求转换的结果数组,total是需要下载的总条数

params: response 服务端响应体

options.queryTransformer:Fucntion=(query)=>{}

对query参数进行转换

return {}

params query 请求参数, 包括 offset和limit

options.onUpdate:Function=({data:Array, total:Number})=>{}

data: 所有已经从服务端拉回来的数据

total: 需要下载的总条数

csvStringify(data:Array, columns:Array):String

将数据转化成 csv格式

  import csvStringify from 'awesome-downloader/src/csv'

requestController(url:String, {limit: Number}, onUpdate: Function, responseTransformer: Function):void

请求调度器

  import requestController from 'awesome-downloader/src/request'

Example

  import {downloadCSV} from 'awesome-downloader'
  downloadCSV(
    '/download', //required
    {
    perPage:100, //default is 100
    filename:'test.csv', // default is download.csv
    query:{ //default is empty object
      start_time:0,
      end_time: Date.now()
    },
    columns: [
      {
        dataIndex:'title',
        title:'Title',
        render(value){
          return value;
        }
      }
    ],
    responseTransfomer(response){
      return {
        data: response.data.list, 
        total: response.data.total
      }
    },
    onUpdata({data, total}){}
  })