1

Is there a good way to use watchFile on a file which is located on other webserver without downloading it? If not, then how can I check the file size changes of a remote file without downloading it?

CatWithGlasses
  • 1,493
  • 2
  • 18
  • 21

1 Answers1

4

Yes, you can do an HTTP HEAD request. A HEAD request is a GET that requests the HTTP Header only and not the body. Having the header, you could read the Content-Length or the Date attribute. (However Content-Length isn't always set correctly.)

Here is how to do HEAD requests with node.js: Getting HTTP headers with node.js

Community
  • 1
  • 1
Philip
  • 3,470
  • 7
  • 29
  • 42