npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

universal-app-opener

v0.2.1

Published

A zero-dependency library to generate deep links from HTTP URLs

Readme

Universal App Opener

A zero-dependency JavaScript library that converts standard HTTP URLs (YouTube, LinkedIn) into Native Mobile Deep Links (Custom Schemes & Android Intents).

Installation

npm install universal-app-opener
pnpm add universal-app-opener
yarn add universal-app-opener

Usage

One-Click Open (Recommended)

The simplest way to open a link - automatically detects platform and opens the appropriate app or web URL:

import { openLink } from 'universal-app-opener';

openLink('https://www.youtube.com/watch?v=dQw4w9WgXcQ');

With options:

import { openLink } from 'universal-app-opener';

openLink('https://www.linkedin.com/in/iamsaban/', {
  fallbackToWeb: true, // Fallback to web if app not installed (default: true)
  fallbackDelay: 2500, // Delay before fallback in ms (default: 2500)
  openInNewTab: false, // Open web URL in new tab (default: false)
});

Advanced Usage

If you need more control, you can use the lower-level APIs:

import { generateDeepLink, detectOS } from 'universal-app-opener';

const result = generateDeepLink('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
const os = detectOS();

if (os === 'ios' && result.ios) {
  window.location.href = result.ios;
} else if (os === 'android' && result.android) {
  window.location.href = result.android;
} else {
  window.open(result.webUrl, '_blank');
}

CommonJS Usage

const { openLink, generateDeepLink } = require('universal-app-opener');

openLink('https://www.youtube.com/watch?v=dQw4w9WgXcQ');

API Reference

openLink(url: string, options?: OpenLinkOptions): void

Opens a URL in the appropriate app or browser. Automatically detects platform and handles deep linking.

Parameters:

  • url (string): The web URL to open (YouTube or LinkedIn)
  • options (optional): Configuration object
    • fallbackToWeb (boolean): Fallback to web URL if app not installed (default: true)
    • fallbackDelay (number): Delay in milliseconds before fallback (default: 2500)
    • openInNewTab (boolean): Open web URL in new tab (default: false)

Example:

openLink('https://www.youtube.com/watch?v=dQw4w9WgXcQ');

generateDeepLink(url: string): DeepLinkResult

Converts a web URL into platform-specific deep links. Returns the deep link data without opening it.

Parameters:

  • url (string): The web URL to convert (YouTube or LinkedIn)

Returns:

interface DeepLinkResult {
  webUrl: string; // Original web URL
  ios: string | null; // iOS deep link (custom scheme)
  android: string | null; // Android deep link (intent URL)
  platform: 'youtube' | 'linkedin' | 'unknown';
}

Supported Platforms:

  • YouTube: youtube.com/watch?v=* and youtu.be/*
  • LinkedIn: linkedin.com/in/*

detectOS(): 'ios' | 'android' | 'desktop'

Detects the current operating system based on user agent.

Returns:

  • 'ios' - iPhone, iPad, or iPod
  • 'android' - Android devices
  • 'desktop' - Desktop browsers or unknown

Examples

YouTube Video

const result = generateDeepLink('https://www.youtube.com/watch?v=BdgwH614LM0');
// result.ios: 'vnd.youtube://watch?v=BdgwH614LM0'
// result.android: 'intent://watch?v=BdgwH614LM0#Intent;scheme=vnd.youtube;package=com.google.android.youtube;end'

LinkedIn Profile

const result = generateDeepLink('https://www.linkedin.com/in/iamsaban/');
// result.ios: 'linkedin://in/iamsaban'
// result.android: 'intent://in/iamsaban#Intent;scheme=linkedin;package=com.linkedin.android;end'

Unknown URL

const result = generateDeepLink('https://example.com');
// result.ios: null
// result.android: null
// result.platform: 'unknown'

Demo

Try it out: Live Demo

License

MIT