archive icon indicating copy to clipboard operation
archive copied to clipboard

Resource locked after extracting file to disk in windows

Open pyjserv opened this issue 1 year ago • 4 comments

Hi, I got a problem "Process cannot access the file because it is being used by another process" when I was deleting a zip file after extracting it to disk in windows.

await extractFileToDisk('${path}.zip', '${dirPath}');
File('${path}.zip').deleteSync();

But if I use extractArchiveToDisk() and close inputStream, it works.

final inputStream = InputFileStream('${path}.zip');
final archive = ZipDecoder().decodeBuffer(inputStream);
extractArchiveToDisk(archive, '${dirPath}');
inputStream.close();
File('${path}.zip').deleteSync();

It occurs in my case, and I don't test it in a simple case.

pyjserv avatar Mar 27 '23 05:03 pyjserv