Skip to content

fs.stat and fs.statSync may not return identical struct #12419

@DoumanAsh

Description

@DoumanAsh
  • Version: 7.9.0
  • Platform: Windows 10 (64 bit)
  • Subsystem: fs

Simple code example is here: https://gist.github.com/DoumanAsh/a70b49b3e05aa4c4273dd6917cce13e0
Occasionally found that Stats.dev differs for sync and async versions.
I'm not really sure how it is possible considering that both should use the same OS API...
All other fields are identical

Sync stats output:

Stats {
  dev: 3163614271,
  mode: 16822,
  nlink: 1,
  uid: 0,
  gid: 0,
  rdev: 0,
  blksize: undefined,
  ino: 5066549581028165,
  size: 0,
  blocks: undefined,
  atime: 2017-04-15T06:12:53.786Z,
  mtime: 2017-04-15T06:12:53.786Z,
  ctime: 2017-04-15T06:12:53.786Z,
  birthtime: 2017-04-15T06:03:09.505Z }

Async stat output

Stats {
  dev: -1131353025,
  mode: 16822,
  nlink: 1,
  uid: 0,
  gid: 0,
  rdev: 0,
  blksize: undefined,
  ino: 5066549581028165,
  size: 0,
  blocks: undefined,
  atime: 2017-04-15T06:12:53.786Z,
  mtime: 2017-04-15T06:12:53.786Z,
  ctime: 2017-04-15T06:12:53.786Z,
  birthtime: 2017-04-15T06:03:09.505Z }

Metadata

Metadata

Assignees

No one assigned

    Labels

    fsIssues and PRs related to the fs subsystem / file system.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions