Skip to content

URL Shortener 🔗 ​

The URL Shortener uses TinyURL to shorten our URL's to a more readable format.

Usage ​

ts
import { shortenUrl } from '@fingermarkglobal/url.shortener';

const shortenImageUrl = async () => {
  // `request` is an async request that will return the shortened URL or the original URL if shortening fails
  // `controller` can be used if you need to abort the request with `controller.abort()`
  const [request, controller] = shortenUrl(
    'https://cdn.sanity.io/images/wdfk0n2i/production/73334e111a2cfcb4801ada85d8994386903b59fb-5667x3912.jpg',
  );

  const shortUrl = await request();

  return shortUrl;
};