PeekStream

(Engine-Level Function)

Description: Returns a string of bytes from a stream without removing them from the stream.
Returns: See description
Usage: Script only.
Function Groups: Stream and Socket
Related to: GetStreamLength | PipeStream | SRead | StreamEnd
Format: PeekStream(Stream, N)
Parameters:  
Stream
Required. Any expression returning a pipe stream.
N
Required. Any numeric expression giving the number of bytes to get from the pipe.
Comments: Execution of this function doesn't affect the stream position pointer.
The second parameter may specify up to 2,147,483,647 characters. Beyond that, Invalid will be returned.

Example:

If ! Valid(data);
[
  data = PeekStream(strm, 10);
]

This stores the last 10 bytes from strm in data. The stream is unaffected.