README.md

@cutticat/safe-cp

Safe file copy for Node.js: copy a file and skip when the target already exists (unless --force).

Useful for quick-start scripts (.env.example.env) and other bootstrap flows.

Installation

pnpm add @cutticat/safe-cp

CLI

safe-cp <source> <target>
safe-cp .env.example .env
safe-cp .env.example .env --force

Via pnpm in a project that lists the package as a dependency:

pnpm exec safe-cp .env.example .env

API

import { safeCopyFile } from "@cutticat/safe-cp"

const result = await safeCopyFile({
  source: ".env.example",
  target: ".env",
  cwd: process.cwd(),
  force: false,
})

if (result.status === "copied") {
  console.log(`Copied to ${result.target}`)
}

Documentation

Requirements

  • Node.js >= 22.0.0
  • pnpm >= 10.17.0
Описание
Small CLI utility for copying files without overwriting them
Конвейеры
1 успешных
0 с ошибкой
Разработчики