Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
f6fb28d32f | |||
2d1ac0bd50 | |||
04a25221a5 | |||
13081b7344 |
12
changelog.md
12
changelog.md
@ -1,5 +1,17 @@
|
||||
# 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)
|
||||
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.
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@push.rocks/smartfile",
|
||||
"private": false,
|
||||
"version": "11.1.6",
|
||||
"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.",
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartfile',
|
||||
version: '11.1.6',
|
||||
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.'
|
||||
}
|
||||
|
16
ts/fs.ts
16
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<boolean> => {
|
||||
const done = plugins.smartpromise.defer<boolean>();
|
||||
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<void> => {
|
||||
return await plugins.fsExtra.copy(fromArg, toArg, {overwrite: true});
|
||||
};
|
||||
|
||||
/**
|
||||
* 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, {overwrite: true});
|
||||
};
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user