Socket
Socket
Sign inDemoInstall

ugurly

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ugurly

Wrapper for ugurly URL shortener.


Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Ugurly

Introduction

The Ugurly package is a JavaScript library for shortening URLs using the Ugurly service.

Installation

You can install the Ugurly package via npm:

npm install ugurly

Usage

const ugurly = require("ugurly");

// Replace "YOUR_API_KEY" with your actual API key
const apiKey = "YOUR_API_KEY";
const client = new ugurly(apiKey);

(async () => {
  try {
    const { shortUrl } = await client.createShortURL("https://example.com");
    console.log("Shortened URL:", shortUrl);
  } catch (error) {
    console.error("Error:", error.message);
  }
})();

API Reference

new ugurly(apiKey)

Creates a new instance of the Ugurly client with the specified API key.

  • apiKey: The API key provided by Ugurly.

createShortURL(longUrl)

Shortens the given long URL and returns the shortened URL.

  • longUrl: The long URL to shorten.

Returns a Promise that resolves to an object containing the shortened URL:

{
  shortUrl: "https://ugurly.vercel.app/r/jshhsjs"
}

Error Handling

If an error occurs during URL shortening, the Promise will be rejected with an Error object containing the error message.

Contributing

Contributions are welcome! Please feel free to open issues or submit pull requests.

License

This package is licensed under the MIT License.

Keywords

FAQs

Package last updated on 26 Apr 2024

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