You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's probably a documentation issue if anything. If you pass a positive, finite, numeric value for a date/time argument to utimes() (or any other fs API that has date/time parameters), it's assuming the value is a UNIX timestamp in seconds. Date.UTC() returns a UNIX timestamp in milliseconds.
Libuv currently rounds down the timestamp to microseconds for consistency across platforms. That's something that could be reconsidered but that should be discussed over at libuv/libuv.
Birthtime is reported on the fs.Stat object when your kernel is new enough and the file system supports the notion of birth time. You can't modify it, of course.
Different file systems on a given system are not portable either. I suggest a best-effort approach where nanoseconds and birth dates are supported whenever possible. People who really want it right can read written data back and throw exception if they are different. ie. owner not supported, time resolution 2 seconds
Another thing I have struggled with is illegal Unicode filenames, which legacy file systems are happy to store. For apis that deal with filenames, all filename arguments must have an option of Buffer format, for the case that the filename cannot be represented in an ECMAScript utf-16 string. The two problem areas are illegal utf-8 byte sequences on-disk and non-NFC normalized characters
Activity
mscdex commentedon Nov 2, 2019
It's probably a documentation issue if anything. If you pass a positive, finite, numeric value for a date/time argument to
utimes()(or any otherfsAPI that has date/time parameters), it's assuming the value is a UNIX timestamp in seconds.Date.UTC()returns a UNIX timestamp in milliseconds.bnoordhuis commentedon Nov 2, 2019
Not portable across platforms.
Libuv currently rounds down the timestamp to microseconds for consistency across platforms. That's something that could be reconsidered but that should be discussed over at libuv/libuv.
Birthtime is reported on the
fs.Statobject when your kernel is new enough and the file system supports the notion of birth time. You can't modify it, of course.haraldrudell commentedon Nov 2, 2019
Different file systems on a given system are not portable either. I suggest a best-effort approach where nanoseconds and birth dates are supported whenever possible. People who really want it right can read written data back and throw exception if they are different. ie. owner not supported, time resolution 2 seconds
Another thing I have struggled with is illegal Unicode filenames, which legacy file systems are happy to store. For apis that deal with filenames, all filename arguments must have an option of Buffer format, for the case that the filename cannot be represented in an ECMAScript utf-16 string. The two problem areas are illegal utf-8 byte sequences on-disk and non-NFC normalized characters
Anyhow, those bug reports make me look a fool
bnoordhuis commentedon Nov 3, 2019
FWIW, discussion about file path encodings goes back to 2010. It's 2019 now and it still hasn't been resolved. :-)