Skip to content

Provide access to file system times with nanoseconds resolution #8276

Description

@haraldrudell

Node.js should provide nanosecond time values in the fs.stat() response structure similar to how process.hrtime() does it.

If there is a module or trick to provide ns I would be happy to use that

Generally on Linux, human readable stat provides the nanoseconds, and epoch time provides the UTC second-level value. The combination is complete. Since Node.js uses ECMAScript Date objects, there is only millisecond resolution.

  • ext4 and Android has nanosecond time resolution since long time
  • Most Linux utilities still drop sub-seconds and Linux cannot display birth date easily
  • Some Android won't give you UTC allowing you to create lots of bugs calculating it

Here's Linux human readable

stat 0 --format %z
2016-06-14 00:50:44.920739523 -0700

uname --all && node --version
Linux c89 4.4.0-34-generic #53-Ubuntu SMP Wed Jul 27 16:06:39 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
v6.4.0

I have some utilities moving large data around that uses recursive md5 and metadata before-after to verify integrity

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues requesting new Node.js features.fsIssues and PRs related to file-system APIs and the fs module.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions