0.0.13 • Published 7 years ago
react-native-install-app v0.0.13
Usage (iOS)
First you need to install react-native-install-app:
npm install react-native-install-app --save
Adding automatically with react-native link
At the command line, in your project folder, type:
react-native link react-native-install-app
Done! No need to worry about manually adding the library to your project.
Examples
Basic
// require the module
import {
installApp,
installAppFromStore
} from 'react-native-install-app';
// get a list of files and directories in the main bundle
// android
installApp().then((result) => {
console.log('GOT RESULT', result);
// stat the first file
}).catch((err) => {
console.log(err.message, err.code);
});
// ios
installAppFromStore()
installApp(options: DownloadFileOptions): { jobId: number, promise: Promise<DownloadResult> }
type DownloadFileOptions = {
fromUrl: string; // URL to download file from
toFile: string; // Local filesystem path to save the file to
headers?: Headers; // An object of headers to be passed to the server
progressDivider?: number;
begin?: (res: DownloadBeginCallbackResult) => void;
progress?: (res: DownloadProgressCallbackResult) => void;
resumable?: () => void; // only supported on iOS yet
connectionTimeout?: number // only supported on Android yet
readTimeout?: number // supported on Android and iOS
};
type DownloadResult = {
jobId: number; // The download job ID, required if one wishes to cancel the download. See `stopDownload`.
statusCode: number; // The HTTP status code
bytesWritten: number; // The number of bytes written to the file
};