fix(fs): Fixed copy and copySync functions to ensure they always overwrite files.
This commit is contained in:
parent
04a25221a5
commit
2d1ac0bd50
@ -1,5 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-01-29 - 11.1.8 - fix(fs)
|
||||||
|
Fixed copy and copySync functions to ensure they always overwrite files.
|
||||||
|
|
||||||
|
- Fixed bug in copy function where files were not being overwritten when they already existed at the destination.
|
||||||
|
- Fixed bug in copySync function to ensure files are overwritten to match the async function's behavior.
|
||||||
|
|
||||||
## 2025-01-29 - 11.1.7 - fix(fs)
|
## 2025-01-29 - 11.1.7 - fix(fs)
|
||||||
Refactor copy and copySync functions to simplify return type
|
Refactor copy and copySync functions to simplify return type
|
||||||
|
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartfile',
|
name: '@push.rocks/smartfile',
|
||||||
version: '11.1.7',
|
version: '11.1.8',
|
||||||
description: 'Provides comprehensive tools for efficient file management in Node.js using TypeScript, including handling streams, virtual directories, and various file operations.'
|
description: 'Provides comprehensive tools for efficient file management in Node.js using TypeScript, including handling streams, virtual directories, and various file operations.'
|
||||||
}
|
}
|
||||||
|
4
ts/fs.ts
4
ts/fs.ts
@ -75,14 +75,14 @@ export const isFile = (pathArg): boolean => {
|
|||||||
* copies a file or directory from A to B on the local disk
|
* copies a file or directory from A to B on the local disk
|
||||||
*/
|
*/
|
||||||
export const copy = async (fromArg: string, toArg: string): Promise<void> => {
|
export const copy = async (fromArg: string, toArg: string): Promise<void> => {
|
||||||
return await plugins.fsExtra.copy(fromArg, toArg, {});
|
return await plugins.fsExtra.copy(fromArg, toArg, {overwrite: true});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* copies a file or directory SYNCHRONOUSLY from A to B on the local disk
|
* copies a file or directory SYNCHRONOUSLY from A to B on the local disk
|
||||||
*/
|
*/
|
||||||
export const copySync = (fromArg: string, toArg: string): void => {
|
export const copySync = (fromArg: string, toArg: string): void => {
|
||||||
return plugins.fsExtra.copySync(fromArg, toArg);
|
return plugins.fsExtra.copySync(fromArg, toArg, {overwrite: true});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user