files.com 1.2.178 → 1.2.179
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 +79 -20
- 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
|
@@ -545,28 +545,12 @@ Error
|
|
|
545
545
|
| `SiteConfiguration_TrialLockedError`| `SiteConfigurationError` |
|
|
546
546
|
| `SiteConfiguration_UserRequestsEnabledRequiredError`| `SiteConfigurationError` |
|
|
547
547
|
|
|
548
|
-
##
|
|
549
|
-
|
|
550
|
-
Files.com publishes a Files.com API server, which is useful for testing your use of the Files.com
|
|
551
|
-
SDKs and other direct integrations against the Files.com API in an integration test environment.
|
|
552
|
-
|
|
553
|
-
It is a Ruby app that operates as a minimal server for the purpose of testing basic network
|
|
554
|
-
operations and JSON encoding for your SDK or API client. It does not maintain state and it does not
|
|
555
|
-
deeply inspect your submissions for correctness.
|
|
556
|
-
|
|
557
|
-
Eventually we will add more features intended for integration testing, such as the ability to
|
|
558
|
-
intentionally provoke errors.
|
|
559
|
-
|
|
560
|
-
Download the server as a Docker image via [Docker Hub](https://hub.docker.com/r/filescom/files-mock-server).
|
|
561
|
-
|
|
562
|
-
The Source Code is also available on [GitHub](https://github.com/Files-com/files-mock-server).
|
|
563
|
-
|
|
564
|
-
A README is available on the GitHub link.
|
|
565
|
-
|
|
566
|
-
## File/Folder Operations
|
|
548
|
+
## Examples
|
|
567
549
|
|
|
568
550
|
### Upload
|
|
569
551
|
|
|
552
|
+
#### Upload a File
|
|
553
|
+
|
|
570
554
|
```javascript
|
|
571
555
|
import File from 'files.com/lib/models/File.js';
|
|
572
556
|
import { isBrowser } from 'files.com/lib/utils.js';
|
|
@@ -583,6 +567,16 @@ if (!isBrowser()) {
|
|
|
583
567
|
}
|
|
584
568
|
```
|
|
585
569
|
|
|
570
|
+
#### Create a Folder
|
|
571
|
+
|
|
572
|
+
```javascript
|
|
573
|
+
import Folder from 'files.com/lib/models/Folder.js';
|
|
574
|
+
|
|
575
|
+
await Folder.create('path/to/folder/to/be/created', {
|
|
576
|
+
mkdir_parents: true,
|
|
577
|
+
});
|
|
578
|
+
```
|
|
579
|
+
|
|
586
580
|
### Download
|
|
587
581
|
|
|
588
582
|
#### Get a Downloadable File Object by Path
|
|
@@ -613,10 +607,57 @@ if (!isBrowser()) {
|
|
|
613
607
|
|
|
614
608
|
### List
|
|
615
609
|
|
|
610
|
+
#### List Folder Contents
|
|
611
|
+
|
|
616
612
|
```javascript
|
|
617
613
|
import Folder from 'files.com/lib/models/Folder.js';
|
|
618
614
|
|
|
619
|
-
const
|
|
615
|
+
const items = await Folder.listFor('remote/path/to/folder/');
|
|
616
|
+
for (const item of items) {
|
|
617
|
+
console.log(item.path);
|
|
618
|
+
}
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
### Copy
|
|
622
|
+
|
|
623
|
+
The copy method works for both files and folders.
|
|
624
|
+
|
|
625
|
+
```javascript
|
|
626
|
+
import File from 'files.com/lib/models/File.js';
|
|
627
|
+
|
|
628
|
+
const file = new File({ path: 'source/path' });
|
|
629
|
+
await file.copy({ destination: 'destination/path' });
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
### Move
|
|
633
|
+
|
|
634
|
+
The move method works for both files and folders.
|
|
635
|
+
|
|
636
|
+
```javascript
|
|
637
|
+
import File from 'files.com/lib/models/File.js';
|
|
638
|
+
|
|
639
|
+
const file = new File({ path: 'source/path' });
|
|
640
|
+
await file.move({ destination: 'destination/path' });
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
### Delete
|
|
644
|
+
|
|
645
|
+
The delete method works for both files and folders.
|
|
646
|
+
|
|
647
|
+
```javascript
|
|
648
|
+
import File from 'files.com/lib/models/File.js';
|
|
649
|
+
|
|
650
|
+
const file = new File({ path: 'path/to/file/or/folder' });
|
|
651
|
+
await file.delete();
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
In case the folder is not empty, you can use the `recursive` argument:
|
|
655
|
+
|
|
656
|
+
```javascript
|
|
657
|
+
import File from 'files.com/lib/models/File.js';
|
|
658
|
+
|
|
659
|
+
const folder = new File({ path: 'path/to/folder' });
|
|
660
|
+
await folder.delete({ recursive: true });
|
|
620
661
|
```
|
|
621
662
|
|
|
622
663
|
### Comparing Case-Insensitive Files and Paths
|
|
@@ -630,3 +671,21 @@ if (pathNormalizer.same('Fïłèńämê.Txt', 'filename.txt')) {
|
|
|
630
671
|
// the paths are the same
|
|
631
672
|
}
|
|
632
673
|
```
|
|
674
|
+
|
|
675
|
+
## Mock Server
|
|
676
|
+
|
|
677
|
+
Files.com publishes a Files.com API server, which is useful for testing your use of the Files.com
|
|
678
|
+
SDKs and other direct integrations against the Files.com API in an integration test environment.
|
|
679
|
+
|
|
680
|
+
It is a Ruby app that operates as a minimal server for the purpose of testing basic network
|
|
681
|
+
operations and JSON encoding for your SDK or API client. It does not maintain state and it does not
|
|
682
|
+
deeply inspect your submissions for correctness.
|
|
683
|
+
|
|
684
|
+
Eventually we will add more features intended for integration testing, such as the ability to
|
|
685
|
+
intentionally provoke errors.
|
|
686
|
+
|
|
687
|
+
Download the server as a Docker image via [Docker Hub](https://hub.docker.com/r/filescom/files-mock-server).
|
|
688
|
+
|
|
689
|
+
The Source Code is also available on [GitHub](https://github.com/Files-com/files-mock-server).
|
|
690
|
+
|
|
691
|
+
A README is available on the GitHub link.
|
package/_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.2.
|
|
1
|
+
1.2.179
|
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.179';
|
|
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