7
$\begingroup$

I only need to know whether a specific call returns 200 but:

URLFetch[
    "http://exampledata.wolfram.com/10mb.dat"
  , "StatusCode"
] // AbsoluteTiming
{15.141, 200}

So it clearly downloads whole 10MB. Similar curl command returns almost instantaneously:

 curl -I http://exampledata.wolfram.com/10mb.dat

so it is clearly possible. How to do this so it will work on every V10+ installation?

$\endgroup$

1 Answer 1

8
$\begingroup$
URLFetch["http://exampledata.wolfram.com/10mb.dat", "StatusCode", 
  Method -> "HEAD"] // AbsoluteTiming

{0.383878, 200}

$\endgroup$
1
  • $\begingroup$ +1 for good dig.Though the color is red,it's seem also serve for URLRead.And I'm in 11.1. $\endgroup$
    – yode
    Apr 20, 2017 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.