HızlıResim Unofficial API
Coded By GamerboyTR
Licensed Under MIT
Getting started
Install the package with nodejs:
$ npm install hizliresim
Or you can use yarn
$ yarn add hizliresim
Create app.js
$ touch app.js
And add this code:
const hizliresim = require("hizliresim");
const Client = new hizliresim.Client();
Uploading Image
Upload an image to HızlıResim
Syntax
Client.upload("filename":String, "description":String, "password|callback":String|Function?, "retention|callback":Int|Function?, "callback":Function?):<Promise<JSON>>
Using with callback
Client.upload("./rickroll.png", "Rickroll", function ({ code, url, imageUrl }) {
console.log(code);
console.log(url);
console.log(imageUrl);
});
Using with promise
const Foo = async function () {
const { code, url, imageUrl } = await Client.upload("./rickroll.png", "Rickroll");
console.log(code);
console.log(url);
console.log(imageUrl);
};
Client.upload("./rickroll.png", "Rickroll").then(function ({ code, url, imageUrl }) {
console.log(code);
console.log(url);
console.log(imageUrl);
});
Saving Image
Save an image from HızlıResim
Syntax
Client.getImage("code":String, "fileName":String,"callback":Function?, "options":Array?):<Promise<String>>
Notice: If file already exists, it throws HizliResimRequestException
.
Using with callback
Client.getImage("t1iz2nq", "rickroll", function (fileName) {
console.log(fileName);
});
Using with promise
const Bar = async function () {
const fileName = await Client.getImage("t1iz2nq", "rickroll");
console.log(fileName);
};
Client.getImage("t1iz2nq", "rickroll").then(function (fileName) {
console.log(fileName);
});
Options
You can set options for saving image.
const { Options } = require("hizliresim");
Client.getImage("t1iz2nq", "rickroll").then(
function (fileName) {
console.log(fileName);
},
[Options.FLAGS.OVERWRITE]
);
If you want to overwrite the file, you can use Options.FLAGS.OVERWRITE
Get Csrf Token
Get csrf token for other processes
Syntax
Client.getCsrfToken():<Promise<JSON>>
Using with promise
const Bar = async function () {
const { csrf, cookie } = await Client.getCsrfToken();
console.log(csrf);
console.log(cookie);
};
Client.getCsrfToken().then(function ({ csrf, cookie }) {
console.log(csrf);
console.log(cookie);
});
HızlıResim unofficial API By GamerboyTR
Licensed Under MIT
Copyright © 2022 GamerboyTR
Copyright © 2022 HızlıResim.com