Syntax
| SendBinary sBytes$
| ||||
|---|---|---|---|---|---|
Description
| Writes a raw byte-per-character payload directly to the HTTP response body, without any conversion, without managing the Content-Type header, and without appending any end-of-line characters. SendBinary is intended for streaming binary content such as images, PDF documents, ZIP archives, or any other non-textual payload produced by a CCL script.
Each character of sBytes$ must have a code point in the range 0 through 255, and will be written as exactly one output byte. The caller is fully responsible for setting the correct Content-Type header in advance, for example "image/png", "application/pdf", or "application/octet-stream", using ParentResponse.Header.Add before the first SendBinary call. The caller is also responsible for preparing the byte-per-char string, which is typically produced by loading the raw bytes into a Chilkat BinData object and then calling its GetString("ansi") method to obtain a VB6 BSTR in which every character corresponds to a single source byte.
SendBinary never writes a carriage return or linefeed to the stream, because binary payloads must be delivered byte-exact. For textual responses always use Send, which produces correct UTF-8 output with automatic Content-Type handling. For legacy Windows-1252 textual output use SendAnsi. SendBinary is reserved for true binary content only.
| ||||
See Also
| |||||
Example
| Sub Main |