gulpjs / better-stats

A replacement for node's fs.Stats with more utility
MIT License
5 stars 6 forks source link

Custom inspect method #1

Open phated opened 8 years ago

phated commented 8 years ago

I am thinking this should have a custom inspect method similar to Vinyl (https://github.com/gulpjs/vinyl/blob/master/index.js#L123-L142) but I'm not sure what information should be there.

@contra @sindresorhus @piranna

phated commented 8 years ago

Current output of console.log on node 0.10 - notice the [Getter/Setter]

{ dev: 16777220,
  nlink: 1,
  uid: 501,
  gid: 20,
  rdev: 0,
  blksize: 4096,
  ino: 42716293,
  size: 798,
  blocks: 8,
  mode: [Getter/Setter],
  atime: Tue Dec 08 2015 15:10:10 GMT-0700 (MST),
  mtime: Tue Dec 08 2015 13:36:58 GMT-0700 (MST),
  ctime: Tue Dec 08 2015 13:36:58 GMT-0700 (MST),
  birthtime: Tue Dec 08 2015 15:10:10 GMT-0700 (MST) }
piranna commented 8 years ago

I would throw in as much info as possible, also info not available in some platforms if it's available.

sindresorhus commented 8 years ago

Not sure of the intent of .inpect(). If it's for humans, I would make all the keys more human readable. E.g. mtime => Modified. Also as you mentioned, make mode value visible.

piranna commented 5 years ago

Custom inspect methods are being deprecated in Node.js, this can be closed as won't fix.

phated commented 5 years ago

@piranna they deprecated it in favor of a method attached at some Symbol. I think this needs to stay open.