[Project_owners] Get timestamp of a remote file?

Eric H. Jung grimholtz at yahoo.com
Fri Jan 6 08:46:52 EST 2006

You might consider something more accurate like comparing MD5/SHA-1
hashes of the two files (local and remote) instead of timestamps
because clocks can be changed on each system and/or be out-of-synch. Of
course, if you use MD5/SHA-1 hash, you must download the whole remote
file to calculate that value (or, alternatively, upload the hash as a
small separate file whenever the full calendar is uploaded. You then
only need to download a small file to access the calendar's hash).

--- Dan Lee <daniel.eric.lee at gmail.com> wrote:

> Does anyone know of a way to get the timestamp for a remote file?
> For our project ReminderFox we have code to download/upload a
> calendar
> file via FTP or WebDAV.  We would like to do this automatically and
> be
> smart about it -- that is, only have to download the remote calendar
> file if it actually differs from the file on the local system. I
> thought
> the best way would be to check the timestamp of the remote file, but
> I
> am not sure how this can be done.
> For downloading the file, I was utilizing code of this sort:
> var ioService  =
> Components.classes["@
> ;
> this.streamLoader=Components.classes["@
> ;
> this._channel = ioService.newChannelFromURI( aURI );
> if(aURI.scheme=="http" || aURI.scheme=="https")
>  this._channel.loadFlags |=
> Components.interfaces.nsIRequest.LOAD_BYPASS_CACHE;
>  this.streamLoader.init(this._channel, this , null);
> Since it's just dealing with streams, I am not sure if there's any
> way
> to get the timestamp of the file that the stream was created from. 
> Has
> anyone done anything similar or having any ideas of how I could do
> this?
> Thanks.
> > _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners

Yahoo! DSL – Something to write home about. 
Just $16.99/mo. or less. 

More information about the Project_owners mailing list