Windows Temp file not working electron
See original GitHub issueOperating System
- Linux
- Windows 7
- Windows 10
- MacOS
- other:
NodeJS Version
- 0.x
- 4.x
- 6.x
- 7.x
- other: 8.6
Tmp Version
TBD:Enter tmp version here newest
Expected Behavior
TBD:What have you expected tmp to do? correct temp file.
Experienced Behavior
TBD:What did actually happen?
It generates this file:
let fileName = tmp.tmpNameSync();
undefined\temp\tmp-3476obo4mLnOL8Bp
Then i trying to write to this file:
fs.writeFileSync(fileName, new Buffer(result.data));
no such file or directory, open 'C:\Users\xxx\xx\app-1.0.2\undefined\temp\tmp-3476obo4mLnOL8Bp'
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
In Electron app how do you reference the temp path?
Learning Electron I'd like to do some file processing after a drag and drop. On a Mac the equivalent for tmp is a...
Read more >WDAC How to allow .tmp.node file by Electron app?
Hi all, I'm facing an issue with .tmp.node file that executed by an application called Ledger Live and written by Electron.
Read more >Create a temp directory for your app in Node.js
When working with Node.js, you might need to create a temporary folder for your app. Here's how to do it.
Read more >Options | electron-packager
Functions to be called after your app directory has been copied to a temporary directory. Note: afterCopy will not be called if the...
Read more >How I Fixed: Electron builder rcedit-x64.exe": file does not exist
cannot execute cause=exec: "C:\\Windows\\TEMP\\electron-builder-cache\\winCodeSign\\winCodeSign-2.6.0\\rcedit-x64.exe": file does not exist ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is working now:
tmp.tmpNameSync({ dir: app.getPath('temp') })
This was never fixed, at least not correctly.
It will also break with the changes for #207 and the way that the dir option is being treated, which can no longer be an absolute path outside of the system’s default.
The correct behaviour should be for _getTmpDir() to throw an exception if the os.tmpDir() cannot be resolved as a path using path.resolve().
From the official electron docs https://www.electronjs.org/docs/all
So os.tmpdir() should be set and working around using app.getPath(‘temp’) must not be used.