Browser/environment utilities: URL helpers, SSR detection, and media URL builders.
npm install @build-from-bits/browser-utilsIN_SERVER—truewhenwindowis undefined (SSR/Node).getProtocol()—window.location.protocolornullon the server.getHostname()— host + port (example.com:8080) ornullon the server.getHostlink()—https://example.com:8080.getCurrentUrl()— full current URL ornullon the server.getUrlParameter(name)— query param value, or''when missing.isNoWindow()—truewhenwindowdoes not exist.getMediaUrl(baseUrl, key, options)— transformed media URL (h,w,f,q).getOriginalMediaUrl(baseUrl, key, extra)— untransformed media URL with optional extra params.
import { getHostlink, getUrlParameter, getMediaUrl } from '@build-from-bits/browser-utils';
const host = getHostlink();
const token = getUrlParameter('token');
const img = getMediaUrl('https://cdn.example.com/api/file/get', 'key-1', { w: 400, q: 80 });npm run build
npm run pack:check
npm run publish:npm
npm run publish:githubLicensed under the Apache License 2.0.
Copyright 2026 Build From Bits Pvt Ltd.