Archived Forum Post

Index of archived forum posts

Question:

HTTP Download a URL to a Byte Array?

Jun 17 '15 at 17:09

Is there a function to download a URL to a byte array instead of directly to disk?


Answer

Yes, to download to an in-memory byte array, call the Http.QuickGetObj method. For example:

Chilkat.HttpResponse resp = http.QuickGetObj("http://www.chilkatsoft.com/download/9.5.0.50/ChilkatDotNet45-9.5.0-x64.zip");
(Please note: The above URL is valid at the time of this posting, but may not be valid in the future.)

The response object has a Body property. It is a binary byte array. For example, in C# it is this:

public byte[] Body {get; }
In the ActiveX it is a Variant containing a byte array. In C++, Java, Python, etc. it is a CkByteData. In Objective-C it is a
@property (nonatomic, readonly, copy) NSData *Body; 
Etc. etc. etc...