@xuda.io/account_module 1.2.249 → 1.2.251
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 +8 -5
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1546,12 +1546,12 @@ export const get_user_name = async function (uid) {
|
|
|
1546
1546
|
}
|
|
1547
1547
|
};
|
|
1548
1548
|
|
|
1549
|
-
const removeBg = async function (
|
|
1549
|
+
const removeBg = async function (url, outputPath) {
|
|
1550
1550
|
try {
|
|
1551
1551
|
let imageBuffer;
|
|
1552
|
-
if (inputPath) {
|
|
1553
|
-
|
|
1554
|
-
}
|
|
1552
|
+
// if (inputPath) {
|
|
1553
|
+
// imageBuffer = fs.readFileSync(inputPath);
|
|
1554
|
+
// }
|
|
1555
1555
|
|
|
1556
1556
|
if (url) {
|
|
1557
1557
|
const res = await fetch(imgObj.url);
|
|
@@ -1565,7 +1565,10 @@ const removeBg = async function (inputPath, url, outputPath) {
|
|
|
1565
1565
|
|
|
1566
1566
|
// Convert to buffer and save
|
|
1567
1567
|
const outputBuffer = Buffer.from(await blob.arrayBuffer());
|
|
1568
|
-
|
|
1568
|
+
|
|
1569
|
+
const drive_ret = await drive_module.upload_drive_file_user({ uid, path: '/Profile Images' }, job_id, headers, file_obj);
|
|
1570
|
+
|
|
1571
|
+
// fs.writeFileSync(outputPath, outputBuffer);
|
|
1569
1572
|
|
|
1570
1573
|
console.log(`Background removed! Saved to ${outputPath}`);
|
|
1571
1574
|
} catch (error) {
|