SXCU.js
Simple NodeJS API wrapper for sxcu.net.
Table of contents
About
sxcu.js is a simple NodeJS API wrapper for sxcu.net API.
Installation
Run npm i sxcu.js
in your project folder. That's it lmao.
Features
-
Covers all the endpoints of SXCU API.
-
Object oriented.
-
That's it!
Example Usage
Here are a few examples to help you understand the wrapper.
Uploading an image
const SXCUjs = require('sxcu.js'); // require the module.
const image = new SXCUjs.Image('https://sxcujs.is-ne.at/upload', 'Your very secret upload token'); // Construct the image.
image.attachFile('your image.png'); // Attach the image.
image.upload() // Upload the image.
.then(uploadedImg => {
console.log(`Upload URL: ${uploadedImg.getUrl()}`); // https://sxcujs.is-ne.at/qbu8Cp
})
.catch(console.error) // Print the error if thrown any while uploading the image.
Creating a paste
const SXCUjs = require('sxcu.js'); // require the module.
let text = `Phoenix852 is a noob.`; // Yeah I am a noob.
SXCUjs.createPaste(text)
.then((paste) => {
console.log(paste.getUrl()); // https://cancer-co.de/rOSaX
})
.catch(console.error) // Print the error if there are any while creating the paste.
Shorten a link
const SXCUjs = require('sxcu.js'); // require the module.
let link = "https://linktr.ee/phoenix852"; // Yeah a shameless self promotion :P
SXCUjs.shortenLink(link) // Shorten the link.
.then(shortenedLink => {
console.log(shortenedLink.getUrl()); // https://questionable.link/JJK1EPc
})
.catch(console.error) // Print the error if there are any while shortening the link.
Links
Useful links you might want to check out.
Contribution
Before creating an issue, please make sure to read the docs once. If you still want to create an issue, you are welcome over here.