Perform HTTP requests on separate native asynchronous threads and then call back to a promise.
npm install react-native-threaded-downloader
import { performThreadedDownload } from 'react-native-threaded-downloader';
// First argument is the URL and second argument is the timeout in seconds
performThreadedDownload("https://example.com/", 60)
.then((response) => console.log(response))
.catch((e) => console.dir(e));
See the example for details.
When performThreadedDownload
is called:
- On iOS, a task is executed on a dispatch queue of type
DISPATCH_QUEUE_CONCURRENT
. - On Android, a
Runnable
is executed on a thread pool of up to 10 native threads.
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
Made with create-react-native-library