@srcful/warden-land-image-urls
v1.2.0
Published
This package provides deterministic URL selection based on a provided ID, utilizing cryptographic hash functions to ensure consistent outcomes. This package is useful for applications requiring consistent URL redirection or resource selection based on uni
Downloads
423
Readme
Warden Land Image URLs
This package provides deterministic URL selection based on a provided ID, utilizing cryptographic hash functions to ensure consistent outcomes. This package is useful for applications requiring consistent URL redirection or resource selection based on unique identifiers.
Features
- Deterministic URL Retrieval: Ensures that the same ID always results in the same URL from a predefined set.
- Dual URL Sets: Supports two distinct sets of URLs for 'enriched' and 'primal' contexts.
Installation
Install the package using npm:
npm install @srcful/warden-land-image-urls
Usage
The package provides two main functions:
getEnrichedLandURL(h3index)
: Returns a URL from the enriched set based on the provided H3-index ID.getPrimalLandURL(h3index)
: Returns a URL from the plaid set based on the provided H3-index ID.
Example
Here's how you can use the functions in a Node.js script:
import { getEnrichedLandURL, getPrimalLandURL } from '@srcful/warden-land-image-urls';
const id = '871f2d6b1ffffff';
console.log('Primal URL full: ' + getPrimalLandURL(id).imageUrlFullSize);
console.log('Enriched URL small: ' + getEnrichedLandURL(id)imageUrlSmallSize);
This script will output a URL from each set corresponding to the provided ID.