Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add overwrite option #73

Closed
wants to merge 6 commits into from
Closed

Conversation

WilsonCWong
Copy link
Contributor

I added an option that would allow downloaded files to overwrite files of the same name in the save directory. It is off by default. I had a use case for it where I wanted to have the program update itself from a remote server and I needed to overwrite existing files to do that. I think it would be nice to have the option to enable it.

@joshuapinter
Copy link
Contributor

Wow, what timing. I was literally looking for this.

@sindresorhus Any idea when this might get merged into master, or should I use @WilsonCWong's master branch for now?

Thanks guys!

@joshuapinter
Copy link
Contributor

FYI, tested this out in our project and it works great. Initially creates another file with the typical "(1)" suffix and then when the download completes, overwrites the existing file:

overwrite files

@sindresorhus sindresorhus changed the title Added option to allow for overwriting files of the same name Add overwrite option Nov 16, 2019
@@ -92,7 +99,7 @@ declare const electronDl: {
*/
(options?: electronDl.Options): void;

/**
/**
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't do unrelated changes.


@default false
*/
readonly allowOverwrite?: boolean;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
readonly allowOverwrite?: boolean;
readonly overwrite?: boolean;


/**
Allows downloaded files to overwrite files with the same name in the directory they are saved to.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also describe what happens by default, that it adds a number to the filename.

@sindresorhus
Copy link
Owner

You need to add it to the readme too.

@sindresorhus
Copy link
Owner

Ping

@sindresorhus
Copy link
Owner

#106

@PetersonLian
Copy link

I wonder what release version supports this feature

@joshuapinter
Copy link
Contributor

@PetersonLian It doesn't appear to be in the master branch yet. This PR got closed without merging and #106 is still open. Looks like if you want to use it, you'll need to use @WilsonCWong's fork in your package.json: https://github.com/WilsonCWong/electron-dl

@PetersonLian
Copy link

@joshuapinter Thanks

@mquevill mquevill mentioned this pull request Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants