diff --git a/changelog.md b/changelog.md index f56d3f5..6b26aed 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2025-01-29 - 11.1.7 - fix(fs) +Refactor copy and copySync functions to simplify return type + +- Changed the return type of fs.copy and fs.copySync from boolean to void. +- Removed unnecessary promise handling in fs.copy. + ## 2025-01-29 - 11.1.6 - fix(fs) Fix issues with fs file copy functions. diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index d985ead..74adba5 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartfile', - version: '11.1.6', + version: '11.1.7', description: 'Provides comprehensive tools for efficient file management in Node.js using TypeScript, including handling streams, virtual directories, and various file operations.' } diff --git a/ts/fs.ts b/ts/fs.ts index 085f9e7..8463269 100644 --- a/ts/fs.ts +++ b/ts/fs.ts @@ -74,23 +74,15 @@ export const isFile = (pathArg): boolean => { /** * copies a file or directory from A to B on the local disk */ -export const copy = async (fromArg: string, toArg: string): Promise => { - const done = plugins.smartpromise.defer(); - plugins.fsExtra.copy(fromArg, toArg, {}, (err) => { - if (err) { - throw new Error(`Could not copy from ${fromArg} to ${toArg}: ${err}`); - } - done.resolve(true); - }); - return done.promise; +export const copy = async (fromArg: string, toArg: string): Promise => { + return await plugins.fsExtra.copy(fromArg, toArg, {}); }; /** * copies a file or directory SYNCHRONOUSLY from A to B on the local disk */ -export const copySync = (fromArg: string, toArg: string): boolean => { - plugins.fsExtra.copySync(fromArg, toArg); - return true; +export const copySync = (fromArg: string, toArg: string): void => { + return plugins.fsExtra.copySync(fromArg, toArg); }; /**