Skip to content

Improve default name generation #2

@sindresorhus

Description

@sindresorhus

There could easily be a conflict as your random generation isn't very high resolution.

opts.filename = 'meme-' + randomInt(100, 999) + '.gif';

I would use randomInt(100, 99999) and also check if the image exists before writing and generate a new number if it does. You never want to accidentally overwrite an existing image.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions