Archived Forum Post

Index of archived forum posts


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?


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

Chilkat.HttpResponse resp = http.QuickGetObj("");
(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...