Uploader.js

by CxzDeveloper
31 Raw
/* Name: Uploader ( Upload to catbox )
Fitur By: CxzDeveloper
Channel: https://whatsapp.com/channel/0029Vap4P0BHbFVCk8IWWN0S
/*

const fs = require('fs')
const axios = require('axios')
const FormData = require('form-data')

async function uptocatbox(imagePath) {
    let form = new FormData();
    form.append("fileToUpload", fs.createReadStream(imagePath));
    form.append("reqtype", "fileupload");

    try {
        let { data } = await axios.post("https://catbox.moe/user/api.php", form, {
            headers: form.getHeaders(),
        });
        return data;
    } catch (error) {
        console.error("Upload gagal:", error);
        return "Gagal upload gambar.";
    }
}

module.exports = uptocatbox