Version: v0.7.1 - Beta.  We welcome contributors & feedback.

File.touch

File.touch($path, $date = now, $flags = {}) -> false

Description

Update the modifyDate and accessDate of a file.

If the file does not exist, it will be created with no content.

The $path is relative to the data/files directory.

The $date must be a Date object.

File.touch('file.txt')  // now

File.touch('file.txt', Date.create('5 minutes ago'))

Options

Option Value Description
stat access, modify, both The timestamp stat to update. (Default: 'both')
File.touch('file.txt', Date.now(), { stat: 'access' })

See Also