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