Skip to content

Bug gửi nhiều hình #12

@TaQuangTien

Description

@TaQuangTien
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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions