Mika Scraper / uploadToCatbox
Function: uploadToCatbox()
uploadToCatbox(
buffer
,filename
):Promise
<string
>
Defined in: src/_other-scraper/uploader.ts:11
Uploads a given image buffer to Catbox for public access.
Parameters
buffer
- Type:
Buffer
The image file buffer containing the binary data of the image to be uploaded.
filename
- Type:
string
The desired name to assign to the file on Catbox, including any necessary file extension (e.g.,.png
,.jpg
).
Returns
- Type:
Promise<string>
A promise that resolves to a public URL pointing to the uploaded image on Catbox.
Example
import { uploadToCatbox } from 'path-to-module';
const imageBuffer: Buffer = /* buffer data */;
const fileName: string = 'image.png';
uploadToCatbox(imageBuffer, fileName)
.then((url) => {
console.log(`Image uploaded successfully: ${url}`);
})
.catch((error) => {
console.error(`Failed to upload image: ${error.message}`);
});
Last updated on