expand-short-url
v1.0.7
Published
This library is designed to expand short URLs for Node.JS
Readme
Expand Short URLs
This library is designed to expand short URLs. This does not have any external dependencies and is lightweight.
Installation
npm install expand-short-urlsUsage
import { expand } from 'expand-short-url';
const shortURL = 'https://bit.ly/3xYz1a2';
const expandedURL = await expand(shortURL);
console.log(expandedURL);Options
You can pass options to the expand function to customize its behavior. Also, you can pass any options supported by http.request or https.request module.
timeout: The maximum time to wait for the expansion to complete (default: 5000 ms).maxRedirects: The maximum number of redirects to follow (default: 3).
Example
import { expand } from 'expand-short-url';
const shortURL = 'https://bit.ly/3xYz1a2';
const expandedURL = await expand(shortURL, { timeout: 10000, maxRedirects: 5 });
console.log(expandedURL);Output
'https://example.com/'If you like my work, please consider giving it a star on GitHub or Sponsor my work by following sponsoring me link.
