-
Notifications
You must be signed in to change notification settings - Fork 95
Open
Description
export async function saveImage(url) {
try {
const imgPath = "./temp.png";
const { data } = await axios.get(url, { responseType: "arraybuffer" });
fs.writeFileSync(imgPath, Buffer.from(data, "utf-8"));
return imgPath;
} catch (error) {
console.error(error);
return null;
}
}
Nếu gửi nhiều hình bằng mảng ImagePaths thì tất cả hình sẽ bị overwrite thành 1 file temp.png nha bác. Kết quả sẽ là các hình giống nhau.
Metadata
Metadata
Assignees
Labels
No labels