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

copyfiles-ng

v2.4.6

Published

Actively maintained fork of copyfiles with security fixes and modern dependency support

Readme

About this fork

This package is a fork of copyfiles with security and maintenance updates:

  • Why this fork: the original project has been largely inactive for ~5 years and carries known dependency vulnerabilities. The intermediate fork we pulled from was updated about a year ago but has since gone dormant as well.
  • What changed: upgraded vulnerable dependencies (notably glob) and modernized supporting tooling so the API/CLI continue to work on current Node.js versions.
  • Original repository: https://github.com/calvinmetcalf/copyfiles

Install

npm install copyfiles-ng

Command line

  Usage: copyfiles-ng [options] inFile [more files ...] outDirectory

  Options:
    -u, --up       slice a path off the bottom of the paths               [number]
    -a, --all      include files & directories begining with a dot (.)   [boolean]
    -f, --flat     flatten the output                                    [boolean]
    -e, --exclude  pattern or glob to exclude (may be passed multiple times)
    -E, --error    throw error if nothing is copied                      [boolean]
    -V, --verbose  print more information to console                     [boolean]
    -s, --soft     do not overwrite destination files if they exist      [boolean]
    -F, --follow   follow symbolink links                                [boolean]
    -v, --version  Show version number                                   [boolean]
    -h, --help     Show help                                             [boolean]

Copy one or more files (including globs); the last argument is the output directory, which will be created if needed. On Windows, globs must be double quoted. Other shells may use single or double quotes.

copyfiles-ng foo foobar foo/bar/*.js out

This produces an out directory containing foo, foobar, and a nested foo/bar folder with all matches from foo/bar/*.js.

If you want to omit a leading folder from the output path, use --up:

copyfiles-ng something/*.js out

This would place the JS files under out/something. To drop that folder, use:

copyfiles-ng -u 1 something/*.js out

To flatten all outputs into one directory:

copyfiles-ng -f ./foo/*.txt ./foo/bar/*.txt out

This puts a.txt and b.txt directly into out.

If your terminal doesn’t support globstars, quote the pattern:

copyfiles-ng -f ./foo/**/*.txt out

This does not work by default on macOS, but quoting does:

copyfiles-ng -f "./foo/**/*.txt" out

You can also quote globstars within mixed inputs:

copyfiles-ng some.json "./some_folder/*.json" ./dist/ && echo 'JSON files copied.'

To exclude files, pass one or more -e patterns:

copyfiles-ng -e "**/*.test.js" -f ./foo/**/*.js out

Other options include:

  • -a or --all to include dotfiles.
  • -s or --soft to skip overwriting existing files.
  • -F or --follow to follow symbolic links.

copyup

The package also provides a copyup command, identical to copyfiles, but with --up defaulting to 1 (equivalent to running copyfiles -u 1 ...).

Programmatic API

var copyfiles = require('copyfiles-ng');

copyfiles([paths], opt, callback);

paths is an array where the last entry is the destination path. The optional opt argument can be:

  • a number (equivalent to --up),
  • true (equivalent to --flat), or
  • an options object (e.g. up, all, flat, exclude, error, verbose, follow, soft).

Tilde support for home directory

If source or destination paths begin with a tilde (~) on Windows, make sure to include -u or -f in options (or use the copyup command). Otherwise you may see Error: Illegal characters in path.