files.com 1.2.180 → 1.2.182
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 +8 -117
- package/_VERSION +1 -1
- package/lib/Files.js +1 -1
- package/package.json +1 -1
- package/src/Files.js +1 -1
package/README.md
CHANGED
|
@@ -546,126 +546,17 @@ Error
|
|
|
546
546
|
| `SiteConfiguration_TrialLockedError`| `SiteConfigurationError` |
|
|
547
547
|
| `SiteConfiguration_UserRequestsEnabledRequiredError`| `SiteConfigurationError` |
|
|
548
548
|
|
|
549
|
-
##
|
|
549
|
+
## Case Sensitivity
|
|
550
550
|
|
|
551
|
-
|
|
551
|
+
The Files.com API compares files and paths in a case-insensitive manner.
|
|
552
|
+
For related documentation see [Case Sensitivity Documentation](https://www.files.com/docs/files-and-folders/file-system-semantics/case-sensitivity).
|
|
552
553
|
|
|
553
|
-
|
|
554
|
+
The `pathNormalizer.same` function in the Files.com SDK is designed to help you determine if two paths on
|
|
555
|
+
your native file system would be considered the same on Files.com. This is particularly important
|
|
556
|
+
when handling errors related to duplicate file names and when developing tools for folder
|
|
557
|
+
synchronization.
|
|
554
558
|
|
|
555
|
-
```javascript
|
|
556
|
-
import File from 'files.com/lib/models/File.js';
|
|
557
|
-
import { isBrowser } from 'files.com/lib/utils.js';
|
|
558
|
-
|
|
559
|
-
// uploading raw file data
|
|
560
|
-
await File.uploadData(destinationFileName, data);
|
|
561
|
-
|
|
562
|
-
// upload readable stream
|
|
563
|
-
await File.uploadStream(destinationFileName, readableStream)
|
|
564
|
-
|
|
565
|
-
// uploading a file on disk (not available in browser)
|
|
566
|
-
if (!isBrowser()) {
|
|
567
|
-
await File.uploadFile(destinationFileName, sourceFilePath);
|
|
568
|
-
}
|
|
569
|
-
```
|
|
570
|
-
|
|
571
|
-
#### Create a Folder
|
|
572
|
-
|
|
573
|
-
```javascript
|
|
574
|
-
import Folder from 'files.com/lib/models/Folder.js';
|
|
575
|
-
|
|
576
|
-
await Folder.create('path/to/folder/to/be/created', {
|
|
577
|
-
mkdir_parents: true,
|
|
578
|
-
});
|
|
579
|
-
```
|
|
580
|
-
|
|
581
|
-
### Download
|
|
582
|
-
|
|
583
|
-
#### Get a Downloadable File Object by Path
|
|
584
|
-
|
|
585
|
-
```javascript
|
|
586
|
-
import File from 'files.com/lib/models/File.js';
|
|
587
|
-
|
|
588
|
-
const foundFile = await File.find(remoteFilePath);
|
|
589
|
-
const downloadableFile = await foundFile.download();
|
|
590
|
-
```
|
|
591
|
-
|
|
592
|
-
#### Download a File (not available in browser)
|
|
593
|
-
|
|
594
|
-
```javascript
|
|
595
|
-
import { isBrowser } from 'files.com/lib/utils.js';
|
|
596
|
-
|
|
597
|
-
if (!isBrowser()) {
|
|
598
|
-
// download to a file on disk
|
|
599
|
-
await downloadableFile.downloadToFile(localFilePath);
|
|
600
|
-
|
|
601
|
-
// download to a writable stream
|
|
602
|
-
await downloadableFile.downloadToStream(stream);
|
|
603
|
-
|
|
604
|
-
// download in memory and return as a UTF-8 string
|
|
605
|
-
const textContent = await downloadableFile.downloadToString();
|
|
606
|
-
}
|
|
607
|
-
```
|
|
608
|
-
|
|
609
|
-
### List
|
|
610
|
-
|
|
611
|
-
#### List Folder Contents
|
|
612
|
-
|
|
613
|
-
```javascript
|
|
614
|
-
import Folder from 'files.com/lib/models/Folder.js';
|
|
615
|
-
|
|
616
|
-
const items = await Folder.listFor('remote/path/to/folder/');
|
|
617
|
-
for (const item of items) {
|
|
618
|
-
console.log(item.path);
|
|
619
|
-
}
|
|
620
|
-
```
|
|
621
|
-
|
|
622
|
-
### Copy
|
|
623
|
-
|
|
624
|
-
The copy method works for both files and folders.
|
|
625
|
-
|
|
626
|
-
```javascript
|
|
627
|
-
import File from 'files.com/lib/models/File.js';
|
|
628
|
-
|
|
629
|
-
const file = new File({ path: 'source/path' });
|
|
630
|
-
await file.copy({ destination: 'destination/path' });
|
|
631
|
-
```
|
|
632
|
-
|
|
633
|
-
### Move
|
|
634
|
-
|
|
635
|
-
The move method works for both files and folders.
|
|
636
|
-
|
|
637
|
-
```javascript
|
|
638
|
-
import File from 'files.com/lib/models/File.js';
|
|
639
|
-
|
|
640
|
-
const file = new File({ path: 'source/path' });
|
|
641
|
-
await file.move({ destination: 'destination/path' });
|
|
642
|
-
```
|
|
643
|
-
|
|
644
|
-
### Delete
|
|
645
|
-
|
|
646
|
-
The delete method works for both files and folders.
|
|
647
|
-
|
|
648
|
-
```javascript
|
|
649
|
-
import File from 'files.com/lib/models/File.js';
|
|
650
|
-
|
|
651
|
-
const file = new File({ path: 'path/to/file/or/folder' });
|
|
652
|
-
await file.delete();
|
|
653
|
-
```
|
|
654
|
-
|
|
655
|
-
In case the folder is not empty, you can use the `recursive` argument:
|
|
656
|
-
|
|
657
|
-
```javascript
|
|
658
|
-
import File from 'files.com/lib/models/File.js';
|
|
659
|
-
|
|
660
|
-
const folder = new File({ path: 'path/to/folder' });
|
|
661
|
-
await folder.delete({ recursive: true });
|
|
662
|
-
```
|
|
663
|
-
|
|
664
|
-
### Comparing Case-Insensitive Files and Paths
|
|
665
|
-
|
|
666
|
-
For related documentation see [Case Sensitivity Documentation](https://www.files.com/docs/files-and-folders/file-system-semantics/case-sensitivity).
|
|
667
|
-
|
|
668
|
-
```javascript
|
|
559
|
+
```javascript title="Compare Case-Insensitive Files and Paths"
|
|
669
560
|
import { pathNormalizer } from 'files.com/lib/utils.js';
|
|
670
561
|
|
|
671
562
|
if (pathNormalizer.same('Fïłèńämê.Txt', 'filename.txt')) {
|
package/_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.2.
|
|
1
|
+
1.2.182
|
package/lib/Files.js
CHANGED
|
@@ -11,7 +11,7 @@ var endpointPrefix = '/api/rest/v1';
|
|
|
11
11
|
var apiKey;
|
|
12
12
|
var baseUrl = 'https://app.files.com';
|
|
13
13
|
var sessionId = null;
|
|
14
|
-
var version = '1.2.
|
|
14
|
+
var version = '1.2.182';
|
|
15
15
|
var userAgent = "Files.com JavaScript SDK v".concat(version);
|
|
16
16
|
var logLevel = _Logger.LogLevel.INFO;
|
|
17
17
|
var debugRequest = false;
|
package/package.json
CHANGED
package/src/Files.js
CHANGED