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 🙏

© 2024 – Pkg Stats / Ryan Hefner

expo-downloads-manager

v1.0.2

Published

download manager based on expo react native

Downloads

113

Readme

expo-download-manager

GitHub last commit npm version npm downloads weekly

A library that allows you to download files from links and view downloaded files from your app.

You need the following permissions to use this library

  1. CAMERA_ROLL / MEDIA_LIBRARY permissions granted by the user

Demo-Preview

Table of contents

Installation

(Back to top)

Just run

yarn add expo-downloads-manager

Usage

(Back to top)

To see a full-code working example,you can check out this example app expo-download-manager-example.

downloadFileFromUri

import { downloadFileFromUri } from 'expo-downloads-manager';

const callback = (downloadProgress) => {
    const progress =
      downloadProgress.totalBytesWritten /
      downloadProgress.totalBytesExpectedToWrite;
    setDownloadProgress(progress);
  };
...
      <Button title='Download' onPress={async () => {
        const { status, error } = await downloadFileFromUri(
              uri,
              fileName,
              callback
            );
      }}

Arguments:

  • uri: string - the URI of the resource you want to download.
  • filename: string - the filename to save the resource (only the filename, no path information, must be unique).
  • callback?: ({totalBytesWritten: number, totalBytesExpectedToWrite: number}) => void - Optional argument, gets called on every file write to the system with information about how much of the file has been written and how much is left to write.

This function will download a file from the given URI.

Return:

  • status: "downloading" | "finished" | "error" - current status of the download.
  • error: string - reason for the error ( error return only if there is any error occurs ).

openDownloadedFile

import { openDownloadedFile } from 'expo-downloads-manager';

...
      <Button title='Download' onPress={async () => {
       await openDownloadedFile(fileName)
      }}

Arguments:

  • filename: string - the filename used to save the resource to (only the filename, no path information, must be unique).

This function will open the downloaded file.

checkFileIsAvailable

import { checkFileIsAvailable } from 'expo-downloads-manager';

...
 async function checkAvail() {
    const { isAvailable } = await checkFileIsAvailable(fileName);
    if (isAvailable) {
     // type your code.
    }
  }

Arguments:

  • filename: string - the filename used to save the resource to (only the filename, no path information, must be unique).

This function will check this file is already downloaded or not.

Return:

  • isAvailable: Boolean - availability of the file.it returns true file is available else not.

Contribute

Sponsor

(Back to top)

If this saved you development time or you otherwise found it useful, leave a star or follow in GitHub.

You can also buy me a coffee to say thanks:

PayPal

paypal

Adding new features or fixing bugs

(Back to top)

Bug reports are also welcome, please provide a minimum reproducible example along with a bug report