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 🙏

© 2026 – Pkg Stats / Ryan Hefner

finder-alias

v0.1.0

Published

Resolve and create macOS Finder aliases

Readme

finder-alias

Resolve and create macOS Finder aliases

A Finder alias is a file that points to another file or folder, like a symlink, but it keeps working when the target is moved. Node.js cannot follow aliases, because the file system sees them as regular files.

It uses the CoreFoundation bookmark APIs through node:ffi, so it is fast and has no native dependencies.

Install

npm install finder-alias

Requires Node.js 26.9 or later.

Usage

import {isFinderAlias, resolveFinderAlias, createFinderAlias} from 'finder-alias';

isFinderAlias('/Users/sindresorhus/Desktop/Unicorn alias');
//=> true

resolveFinderAlias('/Users/sindresorhus/Desktop/Unicorn alias');
//=> '/Users/sindresorhus/Documents/Unicorn'

createFinderAlias('/Users/sindresorhus/Documents/Rainbow', '/Users/sindresorhus/Desktop/Rainbow alias');

API

The methods are synchronous. Resolving an alias takes a few milliseconds.

isFinderAlias(path)

Returns a boolean of whether the path is a Finder alias.

Symlinks are not Finder aliases. Returns false if the path does not exist or if the platform is not macOS.

Throws if the path cannot be checked, for example because of missing permission.

resolveFinderAlias(path)

Returns the real path of the target.

It works like fs.realpathSync.native(), but it also resolves the path when it is a Finder alias. It continues until the path is neither, so it handles an alias to a symlink, a symlink to an alias, and an alias to an alias.

Only the last part of the path can be a Finder alias. macOS does not follow aliases in the parent folders of a path.

On other platforms than macOS, it only resolves symlinks.

Throws if the path does not exist, if the target of an alias cannot be found, or if the aliases form a cycle.

createFinderAlias(targetPath, aliasPath)

Create a Finder alias at aliasPath that points to targetPath.

Throws if the target does not exist, if the alias path exists, if the folder of the alias path does not exist, or if the platform is not macOS.

CLI

npm install --global finder-alias
finder-alias --help

  Resolve and create macOS Finder aliases

  Usage
    $ finder-alias <path>
    $ finder-alias --create <target> <alias>
    $ finder-alias --check <path>

  Options
    --create  Create a Finder alias to the target
    --check   Exit with code 0 if the path is a Finder alias, and 2 if not

  Examples
    $ finder-alias 'Unicorn alias'
    /Users/sindresorhus/Documents/Unicorn

    $ finder-alias --create ~/Documents/Unicorn ~/Desktop/'Unicorn alias'

FAQ

Why does it print an experimental warning?

node:ffi is still experimental in Node.js. The package loads it the first time it reads a regular file to find out if it is an alias, or creates an alias, on macOS. The warning shows at that time, once.

Does it mount network volumes?

No. If the target is on a volume that is not mounted, resolving the alias throws.

Is it safe in a folder that another local user can write to?

No. Checking that a path is a regular file and reading the file happen in two steps. Another local user with write access to the folder can swap the file in between, for example with a named pipe, which makes the process wait forever. Use a folder that only you can write to.