@xuda.io/account_module 1.2.251 → 1.2.253

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.mjs +9 -3
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1546,7 +1546,8 @@ export const get_user_name = async function (uid) {
1546
1546
  }
1547
1547
  };
1548
1548
 
1549
- const removeBg = async function (url, outputPath) {
1549
+ const removeBg = async function (req, job_id, headers) {
1550
+ const { url, outputPath } = req;
1550
1551
  try {
1551
1552
  let imageBuffer;
1552
1553
  // if (inputPath) {
@@ -1566,10 +1567,15 @@ const removeBg = async function (url, outputPath) {
1566
1567
  // Convert to buffer and save
1567
1568
  const outputBuffer = Buffer.from(await blob.arrayBuffer());
1568
1569
 
1569
- const drive_ret = await drive_module.upload_drive_file_user({ uid, path: '/Profile Images' }, job_id, headers, file_obj);
1570
+ fs.writeFileSync(outputPath, outputBuffer);
1570
1571
 
1571
- // fs.writeFileSync(outputPath, outputBuffer);
1572
+ const file_obj = {
1573
+ originalname: originalname,
1574
+ path: tempPath,
1575
+ mimetype: `image/${ext}`,
1576
+ };
1572
1577
 
1578
+ const drive_ret = await drive_module.upload_drive_file_user({ uid, path: '/Profile Images' }, job_id, headers, file_obj);
1573
1579
  console.log(`Background removed! Saved to ${outputPath}`);
1574
1580
  } catch (error) {
1575
1581
  console.error('Error:', error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.251",
3
+ "version": "1.2.253",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {