hola-server 0.6.3 → 0.6.4
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/core/file.js +8 -1
- package/package.json +1 -1
package/core/file.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
|
+
const fs_promises = require('fs').promises;
|
|
3
|
+
|
|
2
4
|
const unzipper = require('unzipper');
|
|
3
5
|
|
|
4
6
|
const file_extension = file_name => file_name ? file_name.split('.').pop() : "";
|
|
@@ -28,4 +30,9 @@ const is_file_exist = (path) => {
|
|
|
28
30
|
return true;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
const get_file_size = async (path) => {
|
|
34
|
+
const stats = await fs_promises.stat(path);
|
|
35
|
+
return stats.size;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
module.exports = { file_extension, file_prefix, read_from_zip_by_extension, read_from_zip_by_prefix, is_file_exist, get_file_size }
|