@xuda.io/drive_module 1.1.483 → 1.1.485
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/index.js +7 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -95,14 +95,15 @@ exports.get_drive_files = async function (req) {
|
|
|
95
95
|
const files = {
|
|
96
96
|
path: req.path || "/",
|
|
97
97
|
name: file_doc.data.folder_name || "/",
|
|
98
|
-
size: 0,
|
|
98
|
+
// size: 0,
|
|
99
|
+
sizeInBytes: 0,
|
|
99
100
|
children: [],
|
|
100
101
|
};
|
|
101
102
|
|
|
102
103
|
for await (let doc of ret.docs) {
|
|
103
104
|
if (doc.type === "file") {
|
|
104
105
|
try {
|
|
105
|
-
files.
|
|
106
|
+
files.sizeInBytes += doc.size;
|
|
106
107
|
files.children.push({
|
|
107
108
|
name: doc.originalname,
|
|
108
109
|
sizeInBytes: doc.size,
|
|
@@ -125,7 +126,7 @@ exports.get_drive_files = async function (req) {
|
|
|
125
126
|
drive_type,
|
|
126
127
|
app_id_reference
|
|
127
128
|
);
|
|
128
|
-
files.
|
|
129
|
+
files.sizeInBytes += sizeInBytes;
|
|
129
130
|
files.children.push({
|
|
130
131
|
sizeInBytes,
|
|
131
132
|
size: formatBytes(sizeInBytes),
|
|
@@ -168,7 +169,7 @@ exports.get_drive_files = async function (req) {
|
|
|
168
169
|
const files = {
|
|
169
170
|
path: req.path || "/",
|
|
170
171
|
name: file_doc.data.folder_name || "/",
|
|
171
|
-
|
|
172
|
+
sizeInBytes: 0,
|
|
172
173
|
children: [],
|
|
173
174
|
};
|
|
174
175
|
|
|
@@ -176,7 +177,7 @@ exports.get_drive_files = async function (req) {
|
|
|
176
177
|
const file_path = path.join(_conf[`user_drive_path`], uid, doc._id);
|
|
177
178
|
if (doc.type === "file") {
|
|
178
179
|
try {
|
|
179
|
-
files.
|
|
180
|
+
files.sizeInBytes += doc.size;
|
|
180
181
|
files.children.push({
|
|
181
182
|
name: doc.originalname,
|
|
182
183
|
sizeInBytes: doc.size,
|
|
@@ -199,7 +200,7 @@ exports.get_drive_files = async function (req) {
|
|
|
199
200
|
drive_type,
|
|
200
201
|
null
|
|
201
202
|
);
|
|
202
|
-
files.
|
|
203
|
+
files.sizeInBytes += sizeInBytes;
|
|
203
204
|
files.children.push({
|
|
204
205
|
sizeInBytes,
|
|
205
206
|
size: formatBytes(sizeInBytes),
|