const file = document.querySelector("input").files[0];
fetch("upload?fileName=react.pdf", {
method: "POST",
body: file,
});
{
"fileId": "22d9437d2f95b52dd4ffc9e6611d043a",
"fileSize": 12863501,
"url": "file/22d9437d2f95b52dd4ffc9e6611d043a",
"longURL": "file/22d9437d2f95b52dd4ffc9e6611d043a/react.pdf",
"downloadURL": "file/22d9437d2f95b52dd4ffc9e6611d043a?download=1",
"longDownloadURL": "file/22d9437d2f95b52dd4ffc9e6611d043a/react.pdf?download=1",
"parts": [
"https://cdn.discordapp.com/attachments/989459557900251186/1001690979327279205/react.pdf-chunk-1",
"https://cdn.discordapp.com/attachments/989459557900251186/1001690975644692491/react.pdf-chunk-2"
]
}
Discord allows users to send attachments with a size limit of 8MB per file. This project uses nodejs streaming and buffering to chunk uploaded files into small pieces.
Special thanks to: DDrive (The original idea and code)