Spaces:
Running
on
Zero
Running
on
Zero
Update file_utils.py
Browse files- file_utils.py +5 -2
file_utils.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import os
|
2 |
from magika import Magika
|
|
|
3 |
|
4 |
def validate_file_types(directory):
|
5 |
m = Magika()
|
@@ -20,12 +21,14 @@ def validate_file_types(directory):
|
|
20 |
|
21 |
def get_file_summary(file_path, file_type):
|
22 |
size = os.path.getsize(file_path)
|
|
|
|
|
23 |
return {
|
24 |
"name": os.path.relpath(file_path),
|
25 |
"type": file_type,
|
26 |
"size": size,
|
27 |
-
"creation_date":
|
28 |
-
"modification_date":
|
29 |
}
|
30 |
|
31 |
def read_file_content(file_path, max_size=32*1024):
|
|
|
1 |
import os
|
2 |
from magika import Magika
|
3 |
+
import time
|
4 |
|
5 |
def validate_file_types(directory):
|
6 |
m = Magika()
|
|
|
21 |
|
22 |
def get_file_summary(file_path, file_type):
|
23 |
size = os.path.getsize(file_path)
|
24 |
+
creation_date = time.ctime(os.path.getctime(file_path))
|
25 |
+
modification_date = time.ctime(os.path.getmtime(file_path))
|
26 |
return {
|
27 |
"name": os.path.relpath(file_path),
|
28 |
"type": file_type,
|
29 |
"size": size,
|
30 |
+
"creation_date": creation_date,
|
31 |
+
"modification_date": modification_date
|
32 |
}
|
33 |
|
34 |
def read_file_content(file_path, max_size=32*1024):
|