exaroton 1.11.1 → 1.11.3
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 +17 -0
- package/package.json +1 -1
- package/src/Server/File.js +2 -2
- package/src/Server/ServerStatus.js +1 -0
package/README.md
CHANGED
|
@@ -239,6 +239,23 @@ try {
|
|
|
239
239
|
}
|
|
240
240
|
```
|
|
241
241
|
|
|
242
|
+
##### List files in a directory
|
|
243
|
+
```js
|
|
244
|
+
try {
|
|
245
|
+
// get the children of the directory
|
|
246
|
+
let children = await file.getChildren();
|
|
247
|
+
console.log(children);
|
|
248
|
+
|
|
249
|
+
// iterate over the children
|
|
250
|
+
// each child is a file object
|
|
251
|
+
for (let child of children) {
|
|
252
|
+
console.log(child);
|
|
253
|
+
}
|
|
254
|
+
} catch (e) {
|
|
255
|
+
console.error(e.message);
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
242
259
|
##### Get the content of a file / download a file
|
|
243
260
|
```js
|
|
244
261
|
try {
|
package/package.json
CHANGED
package/src/Server/File.js
CHANGED
|
@@ -79,7 +79,7 @@ class File {
|
|
|
79
79
|
* @param {string|null} path
|
|
80
80
|
*/
|
|
81
81
|
constructor(path = null) {
|
|
82
|
-
if (path) {
|
|
82
|
+
if (path !== null) {
|
|
83
83
|
this.setPath(path);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -265,7 +265,7 @@ class File {
|
|
|
265
265
|
* @return {Promise<[File]|null>}
|
|
266
266
|
*/
|
|
267
267
|
async getChildren() {
|
|
268
|
-
if (this.children === null && this.isDirectory) {
|
|
268
|
+
if (this.children === null && (this.isDirectory || this.isDirectory === undefined)) {
|
|
269
269
|
await this.getInfo();
|
|
270
270
|
}
|
|
271
271
|
|