Recreate file after delete it

My question might be silly, but, i was trying to recreate file after delete it with ops-delete node. I'am not sure is there a priority between nodes?? Because each time i deploy flow, it append new lines to the existing file then delete it.

That sounds like the file-ops node is passing on the message before the file delete completes. I suggest you raise an issue against the node to get it fixed.

its likely the file deletion is asynchronous & the node is returning a msg before its complete.

I'm not certain if that was the authors intention (might want to ask in github) but for now, you could probably hack it by adding a delay before writing.

You could possibly also use a file watcher to watch for file deletion then trigger the write operation?

edit...
I thought there was a file watcher node - seems not - my bad.

there is a file watcher .

aha knew i'd seen one in the past - well spotted.

I searched watcher - found nothing DOH - I should know better

1 Like

There is also the built in watch node - but hey....
Also the file node can be set to overwrite a file if needed so maybe no need to delete in the first place...

1 Like

ah crap there is also the built in "watch" node.

I put it down to long Easter weekend :slight_smile:

1 Like

Very good point.

You can probably tell i do very little with files

No, overwriting does not work with my case, because i'am adding lines to file inside a loop function. i split the msg.payload then send it to file.

yes - fair enough.
But as Nick pointed out you should raise an issue on the fs-ops node project so it can be fixed.

1 Like

ok i'll do that.