You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-16
Original file line number
Diff line number
Diff line change
@@ -319,15 +319,15 @@ The following constants are available on the `RNFS` export:
319
319
- `ExternalDirectoryPath` (`String`) The absolute path to the external files, shared directory (androidonly)
320
320
- `ExternalStorageDirectoryPath` (`String`) The absolute path to the external storage, shared directory (androidonly)
321
321
322
-
IMPORTANT: when using `ExternalStorageDirectoryPath` it's necessary to request permissions (onAndroid) to read and write on the external storage, here an example: [React Native Offical Doc](https://facebook.github.io/react-native/docs/permissionsandroid)
322
+
IMPORTANT: when using `ExternalStorageDirectoryPath` it's necessary to request permissions (onAndroid) to read and write on the external storage, here an example: [React Native Offical Doc](https://facebook.github.io/react-native/docs/permissionsandroid)
Reads the contents of `path`. This must be an absolute path. Use the above path constants to form a usable file path.
327
327
328
328
The returned promise resolves with an array of objects with the following properties:
329
329
330
-
```
330
+
```js
331
331
type ReadDirItem = {
332
332
ctime: date; // The creation date of the file (iOS only)
333
333
mtime: date; // The last modified date of the file
@@ -346,7 +346,7 @@ Reads the contents of `dirpath ` in the Android app's assets folder.
346
346
347
347
The returned promise resolves with an array of objects with the following properties:
348
348
349
-
```
349
+
```js
350
350
type ReadDirItem = {
351
351
name: string; // The name of the item
352
352
path: string; // The absolute path to the item
@@ -369,7 +369,7 @@ Node.js style version of `readDir` that returns only the names. Note the lowerca
369
369
Stats an item at `filepath`. If the `filepath` is linked to a virtual file, for example Android Content URI, the `originalPath` can be used to find the pointed file path.
370
370
The promise resolves with an object with the following properties:
371
371
372
-
```
372
+
```js
373
373
type StatResult = {
374
374
path:// The same as filepath argument
375
375
ctime: date; // The creation date of the file
@@ -510,7 +510,7 @@ Create a directory at `filepath`. Automatically creates parents and does not thr
toFile: string; // Local filesystem path to save the file to
@@ -528,7 +528,7 @@ type DownloadFileOptions = {
528
528
backgroundTimeout?: number // Maximum time (in milliseconds) to download an entire resource (iOS only, useful for timing out background downloads)
529
529
};
530
530
```
531
-
```
531
+
```js
532
532
type DownloadResult= {
533
533
jobId: number; // The download job ID, required if one wishes to cancel the download. See `stopDownload`.
534
534
statusCode: number; // The HTTP status code
@@ -540,7 +540,7 @@ Download file from `options.fromUrl` to `options.toFile`. Will overwrite any pre
540
540
541
541
If `options.begin` is provided, it will be invoked once upon download starting when headers have been received and passed a single argument with the following properties:
542
542
543
-
```
543
+
```js
544
544
type DownloadBeginCallbackResult= {
545
545
jobId: number; // The download job ID, required if one wishes to cancel the download. See `stopDownload`.
546
546
statusCode: number; // The HTTP status code
@@ -551,7 +551,7 @@ type DownloadBeginCallbackResult = {
551
551
552
552
If `options.progress` is provided, it will be invoked continuously and passed a single argument with the following properties:
553
553
554
-
```
554
+
```js
555
555
type DownloadProgressCallbackResult= {
556
556
jobId: number; // The download job ID, required if one wishes to cancel the download. See `stopDownload`.
557
557
contentLength: number; // The total size in bytes of the download resource
@@ -587,7 +587,7 @@ Check if the the download job with this ID is resumable with `resumeDownload()`.
587
587
588
588
Example:
589
589
590
-
```
590
+
```js
591
591
if (awaitRNFS.isResumable(jobId) {
592
592
RNFS.resumeDownload(jobId)
593
593
}
@@ -603,7 +603,7 @@ Read more about background downloads in the [Background Downloads Tutorial (iOS)
603
603
604
604
`options` (`Object`) - An object containing named parameters
605
605
606
-
```
606
+
```js
607
607
type UploadFileOptions = {
608
608
toUrl: string; // URL to upload file to
609
609
binaryStreamOnly?:boolean// Allow for binary data stream for file to be uploaded without extra headers, Default is 'false'
@@ -616,7 +616,7 @@ type UploadFileOptions = {
616
616
};
617
617
618
618
```
619
-
```
619
+
```js
620
620
type UploadResult= {
621
621
jobId: number; // The upload job ID, required if one wishes to cancel the upload. See `stopUpload`.
622
622
statusCode: number; // The HTTP status code
@@ -627,7 +627,7 @@ type UploadResult = {
627
627
628
628
Each file should have the following structure:
629
629
630
-
```
630
+
```js
631
631
type UploadFileItem= {
632
632
name: string; // Name of the file, if not defined then filename is used
633
633
filename: string; // Name of file
@@ -638,15 +638,15 @@ type UploadFileItem = {
638
638
639
639
If `options.begin` is provided, it will be invoked once upon upload has begun:
640
640
641
-
```
641
+
```js
642
642
type UploadBeginCallbackResult= {
643
643
jobId: number; // The upload job ID, required if one wishes to cancel the upload. See `stopUpload`.
644
644
};
645
645
```
646
646
647
647
If `options.progress` is provided, it will be invoked continuously and passed a single object with the following properties:
648
648
649
-
```
649
+
```js
650
650
type UploadProgressCallbackResult= {
651
651
jobId: number; // The upload job ID, required if one wishes to cancel the upload. See `stopUpload`.
652
652
totalBytesExpectedToSend: number; // The total number of bytes that will be sent to the server
@@ -664,7 +664,7 @@ Abort the current upload job with this ID.
664
664
665
665
Returns an object with the following properties:
666
666
667
-
```
667
+
```js
668
668
type FSInfoResult = {
669
669
totalSpace: number; // The total amount of storage space on the device (in bytes).
670
670
freeSpace: number; // The amount of available storage space on the device (in bytes).
@@ -696,7 +696,7 @@ Background downloads in iOS require a bit of a setup.
696
696
697
697
First, in your `AppDelegate.m` file add the following:
0 commit comments