files.com 1.0.161 → 1.0.162
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/_VERSION +1 -1
- package/lib/models/File.js +1 -1
- package/package.json +1 -1
- package/src/models/File.js +1 -1
- package/test/src/index.js +8 -4
package/README.md
CHANGED
@@ -136,7 +136,7 @@ You can set the following global properties using static methods on the `Files`
|
|
136
136
|
#### Getting a file record by path
|
137
137
|
|
138
138
|
import File from 'files.com/lib/models/File'
|
139
|
-
const foundFile = await File.
|
139
|
+
const foundFile = await File.findDownload(remoteFilePath)
|
140
140
|
|
141
141
|
#### Download a file (not available in browser)
|
142
142
|
|
package/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.162
|
package/lib/models/File.js
CHANGED
@@ -1166,7 +1166,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
1166
1166
|
return _ref21.apply(this, arguments);
|
1167
1167
|
};
|
1168
1168
|
}());
|
1169
|
-
(0, _defineProperty2.default)(File, "
|
1169
|
+
(0, _defineProperty2.default)(File, "findDownload", /*#__PURE__*/function () {
|
1170
1170
|
var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(path) {
|
1171
1171
|
var response;
|
1172
1172
|
return _regenerator.default.wrap(function _callee20$(_context20) {
|
package/package.json
CHANGED
package/src/models/File.js
CHANGED
@@ -178,7 +178,7 @@ class File {
|
|
178
178
|
return saveUrlToFile(this.download_uri, destinationPath)
|
179
179
|
}
|
180
180
|
|
181
|
-
static
|
181
|
+
static findDownload = async path => {
|
182
182
|
const response = await Api.sendRequest(`/files/${encodeURIComponent(path)}`, 'GET')
|
183
183
|
return new File(response.data)
|
184
184
|
}
|
package/test/src/index.js
CHANGED
@@ -40,12 +40,16 @@ const testSuite = async () => {
|
|
40
40
|
const nonce = new Date().getTime()
|
41
41
|
|
42
42
|
const testFolderListAutoPagination = async () => {
|
43
|
-
Files.
|
43
|
+
Files.configureNetwork({
|
44
|
+
autoPaginate: false,
|
45
|
+
})
|
44
46
|
const firstPageItems = await Folder.listFor('/', { per_page: 1 })
|
45
|
-
assert(firstPageItems.length === 1)
|
46
47
|
|
47
|
-
|
48
|
+
assert(firstPageItems.length === 1)
|
48
49
|
|
50
|
+
Files.configureNetwork({
|
51
|
+
autoPaginate: true,
|
52
|
+
})
|
49
53
|
// note: this test will fail if the root folder has <= 1 file or folder
|
50
54
|
const allPageItems = await Folder.listFor('/', { per_page: 1 })
|
51
55
|
|
@@ -66,7 +70,7 @@ const testSuite = async () => {
|
|
66
70
|
assert(!!file.path)
|
67
71
|
assert(file.display_name === displayName)
|
68
72
|
|
69
|
-
const foundFile = await File.
|
73
|
+
const foundFile = await File.findDownload(destinationPath)
|
70
74
|
|
71
75
|
assert(foundFile.path === destinationPath)
|
72
76
|
assert(foundFile.display_name === displayName)
|