New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hizliresim

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hizliresim

HızlıResim Unofficial API

  • 1.0.0
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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:

// app.js
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); // t1iz2nq
	console.log(url); // https://www.hizliresim.com/t1iz2nq
	console.log(imageUrl); // https://i.hizliresim.com/t1iz2nq.png
});

Using with promise

// Async/Await
const Foo = async function () {
	const { code, url, imageUrl } = await Client.upload("./rickroll.png", "Rickroll");
	console.log(code); // t1iz2nq
	console.log(url); // https://www.hizliresim.com/t1iz2nq
	console.log(imageUrl); // https://i.hizliresim.com/t1iz2nq.png
};

// Promise
Client.upload("./rickroll.png", "Rickroll").then(function ({ code, url, imageUrl }) {
	console.log(code); // t1iz2nq
	console.log(url); // https://www.hizliresim.com/t1iz2nq
	console.log(imageUrl); // https://i.hizliresim.com/t1iz2nq.png
});

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); // rickroll.png
});

Using with promise

// Async/Await
const Bar = async function () {
	const fileName = await Client.getImage("t1iz2nq", "rickroll");
	console.log(fileName); // rickroll.png
};

// Promise
Client.getImage("t1iz2nq", "rickroll").then(function (fileName) {
	console.log(fileName); // rickroll.png
});

Options

You can set options for saving image.

const { Options } = require("hizliresim");

Client.getImage("t1iz2nq", "rickroll").then(
	function (fileName) {
		console.log(fileName); // rickroll.png
	},
	[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

// Async/Await
const Bar = async function () {
	const { csrf, cookie } = await Client.getCsrfToken();
	console.log(csrf); // csrf token
	console.log(cookie); // csrf cookie
};

// Promise
Client.getCsrfToken().then(function ({ csrf, cookie }) {
	console.log(csrf); // csrf token
	console.log(cookie); // csrf cookie
});

HızlıResim unofficial API By GamerboyTR Licensed Under MIT

Copyright © 2022 GamerboyTR Copyright © 2022 HızlıResim.com

Keywords

FAQs

Package last updated on 11 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc