From e993f6deb95bb286fbafb39787de76369f64c9e1 Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Tue, 16 Dec 2025 10:10:06 +0000 Subject: [PATCH] v1.3.1 --- changelog.md | 7 ++++++ package.json | 2 +- readme.md | 47 ++++++++++++++++++++++++++++++++++++++++ ts/00_commitinfo_data.ts | 2 +- 4 files changed, 56 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 788df05..b217aea 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,12 @@ # Changelog +## 2025-12-16 - 1.3.1 - fix(docs) +docs(readme): add "Directory Copy & Move" section with examples and options + +- Adds README documentation for recursive directory copy and move with usage examples (basic copy/move, copy with filter, overwrite, preserve timestamps, applyFilter). +- Documents conflict handling modes for copy/move: merge (default), error, and replace. +- Documentation-only change — no code or API changes; recommended patch version bump. + ## 2025-12-16 - 1.3.0 - feat(smartfs.directory) feat(smartfs.directory): add directory copy/move with conflict handling and options diff --git a/package.json b/package.json index 0707c3d..634c94b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@push.rocks/smartfs", - "version": "1.3.0", + "version": "1.3.1", "private": false, "description": "a cross platform extendable fs module", "main": "dist_ts/index.js", diff --git a/readme.md b/readme.md index 1207fc9..1f498a4 100644 --- a/readme.md +++ b/readme.md @@ -135,6 +135,53 @@ await fs.directory('/path/to/dir') const exists = await fs.directory('/path/to/dir').exists(); ``` +### 📁 Directory Copy & Move + +Copy or move entire directory trees with fine-grained control: + +```typescript +// Basic copy - copies all files recursively +await fs.directory('/source').copy('/destination'); + +// Basic move - moves directory to new location +await fs.directory('/old-location').move('/new-location'); + +// Copy with options +await fs.directory('/source') + .filter(/\.ts$/) // Only copy TypeScript files + .overwrite(true) // Overwrite existing files + .preserveTimestamps(true) // Keep original timestamps + .copy('/destination'); + +// Copy all files (ignore filter setting) +await fs.directory('/source') + .filter('*.ts') + .applyFilter(false) // Ignore filter, copy everything + .copy('/destination'); + +// Handle target directory conflicts +await fs.directory('/source') + .onConflict('merge') // Default: merge contents + .copy('/destination'); + +await fs.directory('/source') + .onConflict('error') // Throw if target exists + .copy('/destination'); + +await fs.directory('/source') + .onConflict('replace') // Delete target first, then copy + .copy('/destination'); +``` + +**Configuration Options:** +| Method | Default | Description | +|--------|---------|-------------| +| `filter(pattern)` | none | Filter files by glob, regex, or function | +| `applyFilter(bool)` | `true` | Whether to apply filter during copy/move | +| `overwrite(bool)` | `false` | Overwrite existing files at destination | +| `preserveTimestamps(bool)` | `false` | Preserve original file timestamps | +| `onConflict(mode)` | `'merge'` | `'merge'`, `'error'`, or `'replace'` | + ### 🔐 Tree Hashing (Cache-Busting) Compute a deterministic hash of all files in a directory - perfect for cache invalidation: diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 4e69f83..31b1435 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartfs', - version: '1.3.0', + version: '1.3.1', description: 'a cross platform extendable fs module' }