react-native-blob-util 0.13.17 → 0.13.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -651,7 +651,7 @@ In `v0.5.0` we've added `writeStream` and `readStream`, which allows your app r
651
651
 
652
652
  When calling `readStream` method, you have to `open` the stream, and start to read data. When the file is large, consider using an appropriate `bufferSize` and `interval` to reduce the native event dispatching overhead (see [Performance Tips](#user-content-performance-tips))
653
653
 
654
- > The file stream event has a default throttle(10ms) and buffer size which preventing it cause too much overhead to main thread, yo can also [tweak these values](#user-content-performance-tips).
654
+ > The file stream event has a default throttle(10ms) and buffer size which preventing it cause too much overhead to main thread, you can also [tweak these values](#user-content-performance-tips).
655
655
 
656
656
  ```js
657
657
  let data = ''
@@ -57,7 +57,7 @@ class ReactNativeBlobUtilFS {
57
57
 
58
58
  if (!f.exists()) {
59
59
  if (dir != null && !dir.exists()) {
60
- if (!dir.mkdirs()) {
60
+ if (!dir.mkdirs() && !dir.exists()) {
61
61
  promise.reject("EUNSPECIFIED", "Failed to create parent directory of '" + path + "'");
62
62
  return;
63
63
  }
@@ -129,7 +129,7 @@ class ReactNativeBlobUtilFS {
129
129
 
130
130
  if (!f.exists()) {
131
131
  if (dir != null && !dir.exists()) {
132
- if (!dir.mkdirs()) {
132
+ if (!dir.mkdirs() && !dir.exists()) {
133
133
  promise.reject("ENOTDIR", "Failed to create parent directory of '" + path + "'");
134
134
  return;
135
135
  }
@@ -445,7 +445,7 @@ class ReactNativeBlobUtilFS {
445
445
 
446
446
  if (!dest.exists()) {
447
447
  if (dir != null && !dir.exists()) {
448
- if (!dir.mkdirs()) {
448
+ if (!dir.mkdirs() && !dir.exists()) {
449
449
  callback.invoke("ENOTDIR", "Failed to create parent directory of '" + path + "'");
450
450
  return;
451
451
  }
@@ -1185,9 +1185,6 @@ class ReactNativeBlobUtilFS {
1185
1185
  return null;
1186
1186
  if (!path.matches("\\w+\\:.*"))
1187
1187
  return path;
1188
- if (path.startsWith("file://")) {
1189
- return path.replace("file://", "");
1190
- }
1191
1188
 
1192
1189
  Uri uri = Uri.parse(path);
1193
1190
  if (path.startsWith(ReactNativeBlobUtilConst.FILE_PREFIX_BUNDLE_ASSET)) {
package/index.d.ts CHANGED
@@ -392,9 +392,23 @@ export interface FS {
392
392
 
393
393
  slice(src: string, dest: string, start: number, end: number): Promise<void>;
394
394
  asset(path: string): string;
395
- df(): Promise<{ free: number, total: number }>;
395
+ df(): Promise<RNFetchBlobDf>;
396
396
  }
397
397
 
398
+ export interface RNFetchBlobDfIOS {
399
+ free?: number;
400
+ total?: number;
401
+ }
402
+
403
+ export interface RNFetchBlobDfAndroid {
404
+ external_free?: string;
405
+ external_total?: string;
406
+ internal_free?: string;
407
+ internal_total?: string;
408
+ }
409
+
410
+ export type RNFetchBlobDf = RNFetchBlobDfIOS & RNFetchBlobDfAndroid;
411
+
398
412
  export interface Dirs {
399
413
  DocumentDir: string;
400
414
  CacheDir: string;
@@ -115,6 +115,7 @@
115
115
  if([body hasPrefix:FILE_PREFIX]) {
116
116
  __block NSString * orgPath = [body substringFromIndex:[FILE_PREFIX length]];
117
117
  orgPath = [ReactNativeBlobUtilFS getPathOfAsset:orgPath];
118
+ orgPath = [[NSURL URLWithString:orgPath] path];
118
119
  if([orgPath hasPrefix:AL_PREFIX])
119
120
  {
120
121
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-blob-util",
3
- "version": "0.13.17",
3
+ "version": "0.13.18",
4
4
  "description": "A module provides upload, download, and files access API. Supports file stream read/write for process large files.",
5
5
  "main": "index.js",
6
6
  "scripts": {