From 5d8a8908339502480a79503c41302a05988c3fa2 Mon Sep 17 00:00:00 2001 From: kitolog Date: Tue, 31 May 2016 16:02:57 +0300 Subject: [PATCH] Updated readme and package.json --- README.md | 10 +++++++--- package.json | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 51beeb8..20bed48 100644 --- a/README.md +++ b/README.md @@ -250,7 +250,7 @@ Create a directory at `filepath`. Automatically creates parents and does not thr IOS only: If `excludeFromBackup` is true, then `NSURLIsExcludedFromBackupKey` attribute will be set. Apple will *reject* apps for storing offline cache data that does not have this attribute. -### `promise downloadFile(url, filepath [, beginCallback, progressCallback])` +### `promise downloadFile(url, filepath [, beginCallback, progressCallback, progressDivider])` Download file from `url` to `filepath`. Will overwrite any previously existing file. @@ -264,9 +264,13 @@ If `beginCallback` is provided, it will be invoked once upon download starting w If `progressCallback` is provided, it will be invoked continuously and passed a single argument with the following properties: `contentLength` (`Number`) - The total size in bytes of the download resource -`bytesWritten` (`Number`) - The number of bytes written to the file so far +`bytesWritten` (`Number`) - The number of bytes written to the file so far -Percentage can be computed easily by dividing `bytesWritten` by `contentLength`. +If `progressDivider`(`Number`) is provided, it will return progress events that divided by progressDivider + +For example, if `progressDivider` = 10, you will receive only ten callbacks for this values of progress: 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 +Use it for performance issues. +If `progressDivider` = 1, you will receive all `progressCallback` calls, default value is 1. ### `void stopDownload(jobId)` diff --git a/package.json b/package.json index 6065be9..5e5c4c4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-fs", - "version": "1.3.0", + "version": "1.3.1", "description": "Native filesystem access for react-native", "main": "FS.common.js", "scripts": {