0

I am deleting file when I receive event stopRecording from client that is working as expected -- file is deleted from directory.

My question here is when I look into directory using Windows (WebStorm IDE) file name is still visible there but when I click on file name it got removed from directory.

I am not sure what I should do here because functionality is working it's just matter of filename visibility until you click its there.

What will be behavior on server and how can I resolve this problem ?

logRecording.js

deleteFile:function (filename) { var path = './app/records/templogs'; var file = path + '/'+ filename; console.log('filename in delete', filename); fs.unlink(file); } 

socketIo.js

socket.on('stopRecording',function (filename) { console.log('stop recording data',filename); logsRecording.deleteFile(filename); }); 
2
  • Where do you click in the directory? Your IDE? Windows? Linux? Commented Aug 19, 2016 at 18:32
  • its windows i am using webstorm editor Commented Aug 19, 2016 at 18:32

1 Answer 1

1

Webstorm sometimes needs some time to renew the file system structure/it's files. Don't worry, the file is deleted, it just might take some time to show up.

It's not a problem with your code.

SIDENOTE

You may experience the same with newly created files, sometimes they won't show up until you manually refresh the project structure.

If you are very curious, try the following - but remember it will throw an error every time, so don't use it in production code:

deleteFile:function (filename) { var path = './app/records/templogs'; var file = path + '/'+ filename; console.log('filename in delete', filename); fs.unlink(file); fs.statSync(file); } 
Sign up to request clarification or add additional context in comments.

3 Comments

I have linux server it should be good there ? because user will be creating tons of files i dont want them to sit there after delete.
No worries, if you check it with windows explorer you'll see it works @hussain
@hussain added a checkup for you

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.