@xuda.io/drive_module 1.1.451 → 1.1.453

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.
Files changed (2) hide show
  1. package/index.js +10 -8
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -175,13 +175,10 @@ exports.get_drive_files = async function (req) {
175
175
  const file_path = path.join(_conf[`user_drive_path`], uid, doc._id);
176
176
  if (doc.type === "file") {
177
177
  try {
178
- // const stat = await fs.stat(file_path);
179
- // if (stat.isFile()) {
180
- // files.size += stat.size;
181
- // }
182
178
  files.size += doc.size;
183
179
  files.children.push({
184
180
  name: doc.originalname,
181
+ sizeInBytes: doc.size,
185
182
  size: formatBytes(doc.size),
186
183
  extension: doc?.file_ext?.substr(1),
187
184
  type: doc.type,
@@ -196,10 +193,15 @@ exports.get_drive_files = async function (req) {
196
193
  }
197
194
  if (doc.type === "directory") {
198
195
  try {
196
+ const sizeInBytes = await get_folder_size(
197
+ req.path,
198
+ drive_type,
199
+ null
200
+ );
201
+
199
202
  files.children.push({
200
- size: formatBytes(
201
- await get_folder_size(file_path, drive_type, null)
202
- ),
203
+ sizeInBytes,
204
+ size: formatBytes(sizeInBytes),
203
205
  name: doc.folder_name,
204
206
  path: "/" + doc._id,
205
207
  });
@@ -2190,7 +2192,7 @@ const get_folder_size = async function (dir, drive_type, app_id) {
2190
2192
  selector: {
2191
2193
  docType: `${drive_type}_drive`,
2192
2194
  stat: 3,
2193
- type: "file",
2195
+ // type: "file",
2194
2196
  file_path: dirPath,
2195
2197
  },
2196
2198
  limit: 99999,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/drive_module",
3
- "version": "1.1.451",
3
+ "version": "1.1.453",
4
4
  "description": "Xuda Drive Server Module",
5
5
  "main": "index.js",
6
6
  "dependencies": {