touch method

Future<void> touch(
  1. String path, {
  2. int? mtimeSecs,
  3. int? mtimeNsecs,
})

Sets the modification time on the node at path (files touch).

When mtimeSecs is null the current time is used. mtimeNsecs supplies the optional nanosecond fraction.

Implementation

Future<void> touch(String path, {int? mtimeSecs, int? mtimeNsecs}) async {
  final secs =
      mtimeSecs ?? DateTime.now().toUtc().millisecondsSinceEpoch ~/ 1000;
  await _mutationLock.synchronized(() async {
    await _setMetadata(path, mtimeSecs: secs, mtimeNsecs: mtimeNsecs);
  });
}