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

rlink

v1.0.1

Published

Clone a directory by recreating the directory structure inside the target directory and linking all of the files to the source files. It's way faster and disk space efficient than copying the whole stuff.

Downloads

1

Readme

Recursive Link

What is this?

This library "clones" a directory by recreating it's structure within a target directory and then linking all the files within these directories to their respective source files.

Why would you use this instead of just copying stuff?

Just imagine you have a pretty large application of which you would like to run multiple instances, but you cannot or don't want to run them from the same directory. Instead of copying all the files to another directory and starting the application from there, this library allows you to link all the files, that never change during runtime anyway. By that you save lots of disk space and (most important) time when creating the clone, while files created by your running instance (e.g. log files) are kept within the cloned directory.

TL;DR, How to?

As a command line tool:

npm install --g rlink

rlink /opt/mySource /opt/myTarget

As a library:

npm install --save rlink
const rlink = require('rlink');
rlink('/var/lib/myrepository', '/tmp/myinstance').then(() => {
    console.log('yay!');
}).catch((err) => {
    console.error('aaah, shoot!');
})

Filtering

You can specify which files and directories you want to add to your target by either passing a function which returns true for every file, that is allowed to be linked and every directory that is allowed to be created or an array of files/directories you want to exclude.

The following example will only copy files that contain .txt in their names.

const rlink = require('rlink'),
    myFilter = (fileOrDirName) => {
        return fileOrDirName.indexOf('.txt') > -1;
    };
rlink('/var/lib/myrepository', '/tmp/myinstance', myFilter);

Pass a blacklist array as an alternative (this example will not link the stuff.txt file within the source directory. However, files named stuff.txt within subdirectories will be linked. Only the files listed in the blacklist array will be ignored.

const rlink = require('rlink'),
    blacklist = ['stuff.txt'];
rlink('/var/lib/myrepository', '/tmp/myinstance', blacklist);

What else?

YES, this document is probably longer than the actual library source code.