RAVAGE V2

NEXT-GEN PIXEL HOSTING

DROP YOUR PIXELS HERE

[ CLICK TO BROWSE PHOTO, VIDEO, OR MUSIC ]

Preview
// UPLOAD_SUCCESSFUL
Tunggu selama 30 detik jika file tersebut belum muncul.

API DOCS

API_ENDPOINT.EXE

01. ENDPOINT

METHOD: POST

https://upload.ravagee.tech/api/upload

02. RESPONSES

HTTP 200 OK
JSON
{
  "status": true,
  "message": "File uploaded successfully!",
  "data": {
    "filename": "example.jpg",
    "folder": "images",
    "url": "https://upload.ravagee.tech/upload/main/images/example.jpg",
    "size": 12345,
    "mimetype": "image/jpeg",
    "type": "images"
  }
}
HTTP 400 ERROR
JSON
{
  "status": false,
  "message": "Invalid file format or size too large"
}

03. CODE EXAMPLES

NODE.JS (SERVER SIDE)
const multer = require("multer");
const axios = require("axios");

const upload = multer({
    storage: multer.memoryStorage()
});

module.exports = function (app) {

    app.options("/api/upload", (req, res) => {
        res.sendStatus(200);
    });

    app.post("/api/upload", upload.single("file"), async (req, res) => {
        try {
            if (!req.file) {
                return res.status(400).json({
                    status: false,
                    error: "File tidak ditemukan"
                });
            }

            const GITHUB_TOKEN = process.env.GITHUB_TOKEN;

            if (!GITHUB_TOKEN) {
                return res.status(500).json({
                    status: false,
                    error: "GITHUB_TOKEN tidak ditemukan."
                });
            }

            let folder = "files";

            if (req.file.mimetype.startsWith("image/")) {
                folder = "images";
            } else if (req.file.mimetype.startsWith("audio/")) {
                folder = "music";
            } else if (req.file.mimetype.startsWith("video/")) {
                folder = "videos";
            }

            const filename = `${Date.now()}-${req.file.originalname}`;
            const filepath = `${folder}/${filename}`;

            await axios.put(
                `https://api.github.com/repos/DaffaDevv/upload/contents/${filepath}`,
                {
                    message: `Upload ${filename}`,
                    content: req.file.buffer.toString("base64")
                },
                {
                    headers: {
                        Authorization: `Bearer ${GITHUB_TOKEN}`,
                        Accept: "application/vnd.github+json"
                    }
                }
            );

            return res.json({
                status: true,
                message: "File uploaded successfully!",
                data: {
                    filename: filename,
                    folder: folder,
                    url: `https://upload.ravagee.tech/upload/main/${filepath}`,
                    size: req.file.size,
                    mimetype: req.file.mimetype,
                    type: folder
                }
            });

        } catch (err) {
            console.log(err.response?.data || err.message);

            return res.status(500).json({
                status: false,
                error: err.response?.data || err.message
            });
        }
    });

};
PYTHON (REQUESTS)
import requests

URL = "https://upload.ravagee.tech/api/upload"
payload = {'file': open('photo.jpg', 'rb')}

try:
    response = requests.post(URL, files=payload)
    print(response.json())
except Exception as e:
    print(f"Failed: {e}")

API UPLOAD RAVAGE

Layanan hosting gambar berperforma tinggi dengan infrastruktur yang cepat dan aman. Dirancang untuk pengembang yang membutuhkan solusi penyimpanan aset yang handal dan mudah diintegrasikan.

© Daffa Dev