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 🙏

© 2024 – Pkg Stats / Ryan Hefner

rreadlink

v0.2.1

Published

Unix CLI that prints a symlink's complete chain of targets using absolute paths.

Downloads

13

Readme

npm version license

Contents

rreadlink — introduction

rreadlink is a multi-platform Unix CLI that prints a symlink's complete chain of targets using absolute paths; it can also determine the canonical path of non-symlinks.

The primary purpose of rreadlink (recursive readlink) is to follow a given symlink to its ultimate target, printing all intermediate symlinks along the way.
All paths are printed as absolute paths, with the ultimate target printed in canonical form.

This is hepful on Linux platforms, for instance, where some utilities are installed as symlinks that point to other symlinks before resolving to the ultimate target, making it difficult to understand what is ultimately invoked;
e.g., on some Linux distros /usr/bin/nawk links to /etc/alternatives/nawk, which in turn links to the actual target, /usr/bin/gawk.
Note that the native GNU readlink utility can either only give you the next target (not the ultimate one), or, with -f or -e or -m, only the ultimate target (not intermediate ones).

Loosely speaking, rreadlink provides the functionality of GNU readlink -e while also including intermediate targets. rreadlink has the added advantage of being multi-platform (see Installation below).

Alternatively, given a non-symlink, rreadlink prints the argument's canonical path (i.e., any directory components that are symlinks are resolved to their ultimate targets).

Find examples below, concise usage information further below, or read the manual.

See also: The typex utility provides information about executables in the path (among other things) and has rreadlink's behavior built in to show what file is ultimately invoked.

Examples

# Print the symlink chain for executable /usr/bin/nawk (e.g., on Ubuntu):
$ rreadlink /usr/bin/nawk
/usr/bin/nawk@ -> /etc/alternatives/nawk@ -> /usr/bin/gawk

# Ditto, but printing one path per line, without the symlink sigil (@):
# (This format is the default when not outputting to a terminal.)
$ rreadlink -1 /usr/bin/nawk
/usr/bin/nawk
/etc/alternatives/nawk
/usr/bin/gawk

# Canonicalize the path of a non-symlink:
# (Assume that /var links to /private/var and that log is a regular file.)
$ rreadlink /var/log
/private/var/log

Installation

Supported platforms

Unix-like platforms with POSIX-compatible utilities and Bash, such as Linux and OS X.

Installation from the npm registry

Note: Even if you don't use Node.js, its package manager, npm, works across platforms and is easy to install; try curl -L http://git.io/n-install | bash

With Node.js or io.js installed, install the package as follows:

[sudo] npm install rreadlink -g

Note:

  • Whether you need sudo depends on how you installed Node.js / io.js and whether you've changed permissions later; if you get an EACCES error, try again with sudo.
  • The -g ensures global installation and is needed to put rreadlink in your system's $PATH.

Manual installation

  • Download the CLI as rreadlink.
  • Make it executable with chmod +x rreadlink.
  • Move it or symlink it to a folder in your $PATH, such as /usr/local/bin (OSX) or /usr/bin (Linux).

Usage

Find concise usage information below; for complete documentation, read the manual online or, once installed, run rreadlink nws (rreadlink --man if installed manually).

$ rreadlink --help


Recursively resolves symlinks by printing the chain of targets using absolute  
paths or prints the canonical path of a symlink's ultimate target or of a  
non-symlink.

    rreadlink [-s|-1] symLink
    rreadlink -e symLink

    -s     single-line output format using ' -> ' between paths and
           @ to mark symlinks (default when printing to terminal)
    -1     one-line-per-path output format, without the @ marker (default
           when NOT printing to a terminal)
    -e     print only the symlink's ultimate target, in canonical form

Standard options: --help, --man, --version, --home

License

Copyright (c) 2015 Michael Klement [email protected] (http://same2u.net), released under the MIT license.

Acknowledgements

This project gratefully depends on the following open-source components, according to the terms of their respective licenses.

npm dependencies below have optional suffixes denoting the type of dependency; the absence of a suffix denotes a required run-time dependency: (D) denotes a development-time-only dependency, (O) an optional dependency, and (P) a peer dependency.

npm dependencies

Changelog

Versioning complies with semantic versioning (semver).

  • v0.2.1 (2015-10-21):

    • [dev] Improved robustness of interal rreadlinkchain() function.
  • v0.2.0 (2015-09-18):

    • [potentially breaking change] rreadlink now also accepts options placed after operands on the command line (except after --).
    • [doc] rreadlink now has a man page (if manually installed, use rreadlink --man); rreadlink -h now just prints concise usage information.
    • [doc] README.md cleaned up and extended.
    • [dev] Removed post-install command that verifies presence of Bash, because npm prints the command during installation, which can be confusing.
  • v0.1.6 (2015-09-15):

    • [dev] Makefile improvements; various other behind-the-scenes tweaks.
  • v0.1.5 (2015-06-26):

    • [doc] Read-me: npm badge changed to shields.io; license badge added; typo fixed.
    • [dev] To-do added; Makefile updated.
  • v0.1.4 (2015-05-30):

  • v0.1.3 (2015-02-11):

    • Doc: Read-me improvements.
  • v0.1.2 (2015-02-11):

    • Doc: Read-me and CLI help improvements.
  • v0.1.1 (2015-02-11):

    • Dev: Tests improved.
  • v0.1.0 (2015-02-11):

    • Initial release.