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

kopeer

v1.0.1

Published

Copy files and folders without fuss

Downloads

35

Readme

Kopeer

npm version build status Build status dependencies status

Lean library to copy files and folders recursively, asynchronously.

Install

npm install kopeer

kopeer(source, destination [, options] [, callback])

Infer the type of op by looking at the source file or folder and perform kopeer.directory(..) if source is folder and kopeer.file(..) if source is a file.

kopeer('/files', '/backup', function(err) { /* ... */ });

For available options, check kopeer.file and kopeer.directory below. The options are passed along as they are. Just note that If a callback is not provided, a promise is returned instead.


kopeer.file(source, destination [, options] [, callback])

Copy a file from source to destination, creating intermediate directories as required.

kopeer.file('/files/foo', '/backup/bar', function(err) { /* ... */ });

Usage

  • source (String)

    • The path to the file to copy.
  • destination (String)

    • The path to the file to write to.

      Note: Any intermediate directories leading up to destination will be created automatically.

      New: As of version 0.2.0, destination can denote a directory. In this case, the destination is resolved to destination/{source-filename}. See the example for more information.

  • options (Object) [default: undefined]

    • options.dereference (Bool) [default: false]

      • If given and true, resolve any symlinked files and folders and copy the actual contents. Otherwise, write the linked file as the target file.
    • options.limit (Int) [default: 512]

      • The limit of concurrently opened files. A higher limit is faster but risks EMFILE errors, while a lower limit is slower but safer.

        Only applies if options.dereference === true and the location pointed to by source turns out to be directory. Note that the directory pointed to will also be fully dereferenced.

  • callback (Function) [default: undefined]

    • Invoke the given node-style callback with any errors and no result:

      function(err) { /*...*/ }

kopeer.directory(source, destination [, options] [, callback])

Copy a folder recursively from source to destination, creating intermediate directories as required.

kopeer.directory('/files', '/backup', function(err) { /* ... */ });

Usage

  • source (String)

    • The path to the directory to copy
  • destination (String)

    • The path to the directory to copy to.

      Note: Any intermediate directories leading up to destination will be created automatically.

  • options (Object) [default: undefined]

    • options.filter (Function: Filepath -> Bool) [default: noop]

      • Given the target path, decide whether to include this file.
    • options.ignore (String|Array<String>) [default: []] since v1.0.0

      • Given a list of patterns to ignore, create a minimatch filter from each and apply to each path.
    • options.dereference (Bool) [default: false]

      • If true, copy symlinked files and folders into the target file tree.
    • options.rename (Function: Filepath -> Filepath) [default: noop]

      • Given the target path, return a new target path.
    • options.limit (Int) [default: 512]

      • The limit of concurrently opened files.

        A higher limit is faster but risks EMFILE errors, while a lower limit is slower but safer.

  • callback (Function) [default: undefined]

    • Invoke the given node-style callback with any errors and no result:

      function(err) { /*...*/ }

Contributing

Business as usual. Get started by running the test suite:

npm install
npm test

Then fix bug / add feature and submit a pull request.