raszi / node-tmp

Temporary file and directory creator for node.js
MIT License
736 stars 92 forks source link

File created using tmp.fileSync() cannot be deleted on Windows #202

Closed yoavain-sundaysky closed 4 years ago

yoavain-sundaysky commented 4 years ago

Operating System

NodeJS Version

Tmp Version

0.1.0

Expected Behavior

the following code should delete temp file:

import * as tmp from "tmp";

let tempFile = tmp.fileSync();
fs.unlinkSync(filename);

Experienced Behavior

File stays even after node exits.

Note:

  1. When creating file using fs.writeFileSync(), i'm able to delete it.
  2. Tried with fs-extra remove() and the result is the same
  3. When creating temp directory using tmp.dirSync() it is possible to delete it using fs-extra remove()
silkentrance commented 4 years ago

This might be related to #198 and #199.

silkentrance commented 4 years ago

Fixed with #198.