![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
The Ugurly package is a JavaScript library for shortening URLs using the Ugurly service.
You can install the Ugurly package via npm:
npm install ugurly
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);
}
})();
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"
}
If an error occurs during URL shortening, the Promise will be rejected with an Error object containing the error message.
Contributions are welcome! Please feel free to open issues or submit pull requests.
This package is licensed under the MIT License.
FAQs
Wrapper for ugurly URL shortener.
We found that ugurly demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.