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

com.rn0x.downloader

v1.3.1

Published

Background file downloader with progress, resume, and cancel (Cordova)

Readme

com.rn0x.downloader

Background file downloader with progress, resume, and cancel support for Android.

Features

  • Background downloads — survives app kill using WorkManager
  • Progress callbacks — real-time progress events with loaded/total/percent
  • Resume — auto-resumes from where it stopped (HTTP Range header)
  • Cancel — cancel individual or all downloads
  • Notifications — system notification shows download progress
  • State persistence — download state saved to SharedPreferences
  • FileProvider — secure file sharing on Android 7+

Installation

cordova plugin add com.rn0x.downloader

Or add to package.json:

"com.rn0x.downloader": "file:cordova-plugins/com.rn0x.downloader"

API

cordova.plugins.Downloader.download(opts)

Download a file with progress tracking.

var Downloader = cordova.plugins.Downloader

Downloader.download({
  url: 'https://archive.org/download/altaqwaa/quran-cards.pdf',
  fileName: 'quran-cards.pdf',
  dir: 'downloads',  // subdirectory inside app files
  headers: {
    'Authorization': 'Bearer token'
  },
  onProgress: function (p) {
    console.log(p.percent + '% — ' + p.loaded + ' / ' + p.total)
  }
})
.then(function (result) {
  console.log('Downloaded to:', result.path)
})
.catch(function (err) {
  console.error(err.code, err.message)
})

Returns: Promise<{ success, path, id, bytesDownloaded, totalBytes }>

cordova.plugins.Downloader.cancel(id)

Cancel an active download.

Downloader.cancel('dl_1').then(function () {
  console.log('Cancelled')
})

cordova.plugins.Downloader.cancelAll()

Cancel all active downloads.

Downloader.cancelAll()

cordova.plugins.Downloader.list()

List all tracked downloads.

Downloader.list().then(function (downloads) {
  downloads.forEach(function (dl) {
    console.log(dl.id, dl.state, dl.bytesDownloaded)
  })
})

cordova.plugins.Downloader.getContentUri(path)

Get a content:// URI for a local file (for sharing or opening).

Downloader.getContentUri('/data/.../file.pdf').then(function (result) {
  console.log(result.uri) // content://com.rn0x.altaqwaa.downloader.fileprovider/...
})

Download States

| State | Description | |-------|-------------| | pending | Queued, waiting to start | | running | Download in progress | | paused | Paused (app killed or network lost) | | done | Download complete | | cancelled | User cancelled | | error | Failed |

Error Codes

| Code | Description | |------|-------------| | timeout | Connection timed out | | no-network | No internet connection | | http-error | Server returned error (check httpStatus) | | io-error | File write error | | cancelled | Download was cancelled | | invalid-args | Missing required arguments |

How Resume Works

  1. Download starts, partial file saved to disk
  2. App is killed or network lost
  3. On next download() call with same id:
    • Plugin checks if partial file exists
    • Sends Range: bytes=<offset>- header
    • Server responds with 206 Partial Content
    • Download continues from where it stopped

Requirements

  • Android 5.0+ (API 21)
  • androidx.work:work-runtime:2.9.1 (included in plugin.xml)

License

MIT