I want to set the last modified date of a file to the current date in order to avoid Parcel caching (unfortunately I didn't find a better way).
So I wrote that:
const fs = require('fs');
const file = 'test.txt';
// save the content of the file
const content = fs.readFileSync(file);
// modify the file
fs.appendFileSync(file, ' ');
// restore the file content
fs.writeFileSync(file, content);
It works but meh...
It's really ugly and it's very slow and memory consuming for big files.