1.1.10 • Published 5 months ago
img-capicua v1.1.10
img-capicua
this package is used to upload, get and delete images from the service
to use this package, you must create an account here
installation
npm i img-capicua
usage
we import the CapicuaImager package and we set the API_TOKEN that we can get from here
upload image
import { CapicuaImager } from 'img-capicua';
const uploadImage = async () => {
const capicua = new CapicuaImager('your-api-token');
const uri = ... // local uri of the image
const options = {
uri,
compress: true,
webp: false
}
const uploaded = await capicua.uploadImage(options);
console.log(uploaded.id);
}
information about image
import { CapicuaImager } from 'img-capicua';
const imageInfo = async () => {
const capicua = new CapicuaImager('your-api-token');
const id = '...' // id of image
const info = await capicua.getImageInfo(id);
console.log(info.id);
}
delete image
import { CapicuaImager } from 'img-capicua';
const deleteImage = async () => {
const capicua = new CapicuaImager('your-api-token');
const id = '...' // id of image
const deleted = await capicua.deleteImage(id);
console.log(deleted.deleted);
}
get image
to get the image, make a get request to "https://img.capicua.org.es/api/file/{id}"