@xuda.io/drive_module 1.1.1235 → 1.1.1237
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.mjs +11 -4
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import url from 'url';
|
|
|
11
11
|
import { convertPDF } from 'pdf2image';
|
|
12
12
|
import mammoth from 'mammoth';
|
|
13
13
|
import xlsx from 'node-xlsx';
|
|
14
|
-
import
|
|
14
|
+
import { imageSize } from 'image-size';
|
|
15
15
|
import { getPackageManifest } from 'query-registry';
|
|
16
16
|
|
|
17
17
|
// AWS SDK v3 Imports
|
|
@@ -1477,9 +1477,16 @@ const upload_file_to_spaces = async (tempPath, ref, drive_type, file_name) => {
|
|
|
1477
1477
|
|
|
1478
1478
|
const fileContent = fs.createReadStream(tempPath);
|
|
1479
1479
|
|
|
1480
|
+
// const uploadParams = {
|
|
1481
|
+
// Bucket: `${process.env.XUDA_HOSTNAME}/${drive_type}`,
|
|
1482
|
+
// Key: path.join(ref, _utils.UUID() + '_' + file_name),
|
|
1483
|
+
// Body: fileContent,
|
|
1484
|
+
// ACL: 'public-read',
|
|
1485
|
+
// };
|
|
1486
|
+
|
|
1480
1487
|
const uploadParams = {
|
|
1481
|
-
Bucket:
|
|
1482
|
-
Key: path.join(ref, _utils.UUID() + '_' + file_name),
|
|
1488
|
+
Bucket: _conf.storage_bucket[process.env.XUDA_HOSTNAME].name,
|
|
1489
|
+
Key: path.join(process.env.XUDA_HOSTNAME, drive_type, ref, _utils.UUID() + '_' + file_name),
|
|
1483
1490
|
Body: fileContent,
|
|
1484
1491
|
ACL: 'public-read',
|
|
1485
1492
|
};
|
|
@@ -1605,7 +1612,7 @@ const get_file_info = async (file_path) => {
|
|
|
1605
1612
|
let doc = {};
|
|
1606
1613
|
doc.exif_ret = await fs_module.get_exif(file_path);
|
|
1607
1614
|
try {
|
|
1608
|
-
const dimensions =
|
|
1615
|
+
const dimensions = imageSize(file_path);
|
|
1609
1616
|
doc.dimensions = `${dimensions.width}x${dimensions.height}`;
|
|
1610
1617
|
} catch (error) {}
|
|
1611
1618
|
return doc;
|