Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kpy

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kpy

CLI and Node.js API to copy files with globs, promises, typescript and stuff.

  • 1.9.0
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

kpy

CLI and Node.js API to copy files with globs, promises, typescript and stuff.

npm code style: prettier

Features

  • Dead simple (see examples), minimalistic
  • Provides both CLI and API (so you don't need 2 separate packages)
  • Provides Typescript typings (so you don't need 3 separate packages)
  • Relies on proven lower-level libs (globby, cp-file, yargs)
  • Report progress to STDOUT by default (unless --silent is used)

Just run kpy help to see CLI options.

CLI API


kpy <baseDir> <pattern1> <pattern2> ... <outputDir>

# Example, copy all from `test` to `out`:

kpy test out

# Example, copy all `*.txt` file from `test`, except `one.txt` to `out`:

kpy test '**/*.txt' '!**/one.txt' out

Options:

  • --silent - don't output anything
  • --verbose - report progress on every file
  • --dotfiles - include files starting with .
  • --no-overwrite - don't overwrite
  • --flat - flatten the output folders
  • --dry - don't copy (useful for debugging)
  • --move - move files instead of copy
  • help - show available options

Why

cpy has issue with --cwd, --parents. --parents should be default, and cwd is confusing.

cpx is amazing, but doesn't support multiple globs and therefore negation globs (e.g test/* !test/one.txt)

Example 1

Copy all files/dirs while keeping directory structure from test/* to out.

Simple, right?

cpy
cpy ** ../out --cwd test --parent

Possible, but not trivial to figure out ..out, --cwd, etc.

cpx
cpx out test

Works really well here!

Example 2

Copy all files/dirs while keeping directory structure from test/*.txt to out, excluding one.txt.

Simple, right?

cpy
cpy ** !**/one.txt ../out --cwd test --parent

Possible, but not trivial to figure out ..out, --cwd, etc.

cpx

Not possible to exclude :(

del

This package also provides del cli (api similar and inspired by del.

Examples:


# Delete everything under `dist`, including `dist`:
del dist

# Delete everything under `dist`, NOT including `dist` (important to quote globs!):
del 'dist/**'

# Delete all .json files under `dist`:
del 'dist/**/*.json'

# Delete all, but .json files under `dist`:
del dist '!**/*.json'

# Delete folders `a`, `b` and `c`:
del a b c

FAQs

Package last updated on 29 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc