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

copy-recursive

v1.0.2

Published

An utility to recursively copy files and directories with support for custom options and error handling.

Readme

copy-recursive

A flexible and powerful Node.js utility for recursively copying files and directories with advanced configuration options.

Features

  • Recursive file and directory copying
  • Configurable copy depth and height limits
  • Directory flattening option
  • Multiple conflict resolution strategies
  • Support for single source or multiple sources
  • Asynchronous operation with Promises
  • Comprehensive error handling
  • Configurable logging levels with Gulp-style output

Installation

npm install copy-recursive

Usage

import copy from 'copy-recursive';

// Single file/directory copy with logging
const config = [{
    src: 'source/path',
    dest: 'destination/path',
    depth: 2,
    height: 0,
    flatten: false,
    conflictResolution: 'rename',
    logLevel: 'brief'
}];
await copy(config);

// Multiple sources with verbose logging
const multiConfig = [{
    src: ['source1', 'source2', 'source3'],
    dest: 'destination/path',
    flatten: true,
    logLevel: 'verbose'
}];
await copy(multiConfig);

Configuration Options

Each configuration object supports the following options:

| Option | Type | Default | Description | |--------|------|---------|-------------| | src | string\|string[] | required | Source path(s) to copy from | | dest | string | required | Destination path to copy to | | depth | number | 0 | Maximum copy depth (0 for unlimited) | | height | number | 0 | Maximum copy height from root (0 for unlimited) | | flatten | boolean | false | When true, flattens directory structure | | conflictResolution | string | 'overwrite' | How to handle conflicts ('overwrite', 'skip', or 'rename') | | logLevel | string | 'none' | Logging level ('none', 'verbose', or 'brief') |

Conflict Resolution Strategies

  • overwrite: Overwrites existing files at destination
  • skip: Skips copying if file exists at destination
  • rename: Adds a numeric suffix to create a unique filename

Logging Levels

  • none: No logging output
  • verbose: Detailed logging of all operations
  • brief: Concise, Gulp-style logging with symbols
    • File copied
    • File overwritten
    • File skipped
    • File renamed

Example brief logging output:

Starting copy task...
→ src/file1.txt → dest/file1.txt
↺ src/file2.txt → dest/file2.txt
⠿ src/file3.txt
⥅ src/file4.txt → dest/file4_1.txt
Copy task completed

Project Structure

copy-recursive/
├── index.js         # Main module file
├── test-script.js   # Test script by shell
├── test/            # Test by Mocha/Chai
├── docs/            # Generated documentation
├── jsdoc.json       # JSDoc configuration
├── .mocharc.json    # Mocha configuration
├── package.json     # Project configuration
└── README.md        # This file

Documentation

To generate documentation:

npm run docs

Documentation will be generated in the docs directory. Open docs/index.html in your browser to view.

Testing

To run tests:

npm test

Development

  1. Clone the repository
  2. Install dependencies:
npm install
  1. Make your changes
  2. Run tests:
npm test
  1. Generate documentation:
npm run docs

License

MIT

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Support

Please open an issue for support.