31 lines
No EOL
835 B
Markdown
31 lines
No EOL
835 B
Markdown
catbox
|
|
|
|
- https://catbox.moe/tools.php
|
|
- cURL to API
|
|
If you want to make curl requests to the API, here are examples of both.
|
|
`curl -F "reqtype=urlupload" -F "userhash=####" -F "url=https://files.catbox.moe/174bac.jpg" https://catbox.moe/user/api.php`
|
|
|
|
` curl -F "reqtype=fileupload" -F "userhash=####" -F "fileToUpload=@cutie.png" https://catbox.moe/user/api.php `
|
|
|
|
|
|
Converting to axios
|
|
```js
|
|
import axios from 'axios';
|
|
import FormData from 'form-data';
|
|
import * as fs from 'fs';
|
|
|
|
const form = new FormData();
|
|
form.append('reqtype', 'fileupload');
|
|
form.append('userhash', '####');
|
|
form.append('fileToUpload', fs.readFileSync('cutie.png'), 'cutie.png');
|
|
|
|
const response = await axios.post(
|
|
'https://catbox.moe/user/api.php',
|
|
form,
|
|
{
|
|
headers: {
|
|
...form.getHeaders()
|
|
}
|
|
}
|
|
);
|
|
``` |