skpm / fs

Drop-in replacement for the fs NodeJS package
MIT License
27 stars 11 forks source link

renameSync should automatically overwrite files #7

Closed jeremyblalock closed 5 years ago

jeremyblalock commented 6 years ago

Problem

Node's implementation of renameSync automatically overwrites files, but in this implementation we throw an error if there is already a file at the destination path.

Possible Solution

Rather than using moveItemAtPath we can instead use replaceItemAtURL to achieve this desired behavior.

Stop Gap

Currently, I'm having to use existsSync -> renameSync to avoid the error. This adds an extra call to the file system would be nice to avoid if possible.

mathieudutour commented 6 years ago

Ah yes good call! Do you want to send a PR?

mathieudutour commented 5 years ago

fixed in 0.2.3