-
Notifications
You must be signed in to change notification settings - Fork 665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot set stats of uploaded file either via setstat or open/write #22
Comments
Yes, this was recently fixed in the readme recently and should be in the latest version on npm. It's not the same attributes as fs.Stats though (see here). |
Okay.. so that means it's the "number of miliseconds since Jan 1 1970"? I tried this following and got file dates all over the map, from 1972 to 2034 .. That is, fs.stat returns a Date object, and Date.getTime() returns the number of milliseconds since the Epoch. Am I understanding this up right?
|
There is no ctime. atime and mtime are UNIX timestamps, so it would be number of seconds since 1/1/1970. So you want |
Ok, I've pushed some changes to allow for Date instances in ATTRS objects. I have also added utimes/futimes methods to make things simpler. |
Can you please try with the latest version now and see if setting atime and mtime work for you now? |
Yes, I just updated and reran my code and it works fine. The tool is here:- https://github.com/robogeek/node-ssh2sync |
I'm writing a tool to synchronize files to a server (node-ssh2sync) and one thing I want is to set the file create/access/modify times to match those on my laptop.
The attributes object isn't documented .. so I'm guessing that the fields required would be the same as returned by fs.stat or sftp.stat.
Hence,
or
Visit my repository to see the exact script ..
The text was updated successfully, but these errors were encountered: