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

rn-background-upload

v0.1.0

Published

A robust React Native background upload library for iOS and Android

Readme

rn-background-upload

A robust, high-performance background upload library for React Native (iOS and Android). Built with the New Architecture (Turbo Modules) for maximum efficiency and future-proof compatibility.

Features

  • Background Uploads: Continue uploading files even when the app is backgrounded or killed.
  • New Architecture Support: Fully compatible with Turbo Modules and Fabric.
  • Multipart & Raw Uploads: Supports both standard multipart/form-data and raw binary uploads.
  • Progress Notifications: Built-in support for interactive notifications on Android.
  • Progress Tracking: Real-time progress updates via event emitters.
  • Cancellation: Easily cancel active uploads.
  • Large File Support: Designed to handle large video and image files efficiently.

Installation

npm install rn-background-upload
# or
yarn add rn-background-upload

iOS

Run pod install:

npx pod-install

Android

No additional setup is required.

Usage

1. Simple Upload

import { startUpload } from 'rn-background-upload';

const options = {
  url: 'https://myserver.com/upload',
  path: 'path/to/file.mp4',
  method: 'POST',
  type: 'multipart',
  field: 'file',
  headers: {
    'Authorization': 'Bearer ...',
  },
  notification: {
    enabled: true
  }
};

const uploadId = await startUpload(options);
console.log('Upload started with ID:', uploadId);

2. Listening for Events

We use an event subscription model compatible with React Native's new architecture.

import { useEffect } from 'react';
import { onProgress, onCompleted, onError, onCancelled } from 'rn-background-upload';

useEffect(() => {
  const progressSub = onProgress((event) => {
    if (event.id === myUploadId) {
      console.log(`Progress: ${event.progress}%`);
    }
  });

  const completeSub = onCompleted((event) => {
    console.log('Upload finished with code:', event.responseCode);
  });

  return () => {
    progressSub.remove();
    completeSub.remove();
    // ... clean up other subscriptions
  };
}, [myUploadId]);

3. API Reference

startUpload(options)

Starts a background upload. Returns a Promise<string> with the upload ID.

Options:

  • url (string, required): The endpoint to upload to.
  • path (string, required): The absolute path to the file.
  • method (string): HTTP method (POST or PUT, default: POST).
  • type (string): Upload type (multipart or raw, default: raw).
  • field (string): Field name for multipart uploads (required if type is multipart).
  • headers (object): Custom HTTP headers.
  • parameters (object): Form data parameters (multipart only).
  • notification (object): Android notification config (enabled: boolean).

cancelUpload(uploadId)

Cancels an active upload by ID. Returns Promise<boolean>.

getFileInfo(path)

Gets metadata for a file at a given path.

onProgress(callback), onCompleted(callback), onError(callback), onCancelled(callback)

Subscription methods for upload events.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library