This package provides functionality to shorten and generate redirect URLs. It is designed to be simple and easy to integrate into any Node.js application.
You can install the package using npm:
npm install rapid-shrink
To generate a shortened URL, you can use the generate function provided by the package:
const { generate } = require('rapid-shrink');
(async () => {
try {
const link = 'https://example.com';
const redirectUrl = await generate(link);
console.log('Redirect URL:', redirectUrl);
} catch (error) {
console.error('Error:', error);
}
})();
You can use Node.js to run a JavaScript file from the command line:
Create a JavaScript file , for example : shorten.js:
const { generate } = require('rapid-shrink');
(async () => {
try {
const link = 'https://example.com';
const redirectUrl = await generate(link);
console.log('Redirect URL:', redirectUrl);
} catch (error) {
console.error('Error:', error);
}
})();
Run the script using Node.js:
node shorten.js