Skip to content

please add an option to File.writeAsBytes to avoid overwriting.Β #59587

@stephane-archer

Description

@stephane-archer
var outputFile = File("a.jpg");
if (!outputFile.exist()) {
    // another program creates a.jpg
    await outputFile.writeAsBytes(jpegData); // boom overwrite!!!
}

please add an option to File.writeAsBytes to avoid overwriting.

maybe something like await outputFile.writeAsBytes(jpegData, exclusive: true);

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.closed-as-intendedClosed as the reported issue is expected behaviorlibrary-iotype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions