Open stephane-archer opened 12 hours ago
Summary: User requests File.writeAsBytes
option to prevent overwriting existing files, avoiding data loss in concurrent scenarios. Proposed solution: exclusive
flag.
What behavior do you expect in case the file already exists? Throw exception?
@julemand101 yes
Have you looked at https://api.dart.dev/dart-io/File/create.html which allows you to specify exclusive: true
to ensure new file is created, get PathExistsException
if file already exists?
please add an option to
File.writeAsBytes
to avoid overwriting.maybe something like
await outputFile.writeAsBytes(jpegData, exclusive: true);