Streams: Difference between revisions

From MemCP
Jump to navigation Jump to search
(Created page with "= Streams = The '''Streams''' module provides stream processing and compression functionality for the SCM programming language. This module includes: * '''Stream creation''': Functions to create streams from string content (streamString) * '''Compression''': Stream compression using gzip and xz algorithms * '''Decompression''': Stream decompression using zcat (gzip) and xzcat (xz) functions These functions enable efficient handling of data streams, file compression, a...")
 
(Refresh MemCP documentation: accuracy, operational guidance, performance profile and maintained API reference)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<!-- Copyright (C) 2026 Carl-Philip Haensch -->
<!-- SPDX-License-Identifier: GPL-3.0-or-later -->
<span id="streams"></span>
= Streams =
= Streams =


The '''Streams''' module provides stream processing and compression functionality for the SCM programming language. This module includes:
<!-- Generated from MemCP c42e19eba on 2026-08-27; do not edit manually. -->
<div class="mw-message-box mw-message-box-notice">Generated from MemCP commit <code>c42e19eba</code> on 27 August 2026. See [[Full SCM API documentation]].</div>


* '''Stream creation''': Functions to create streams from string content (streamString)
The '''Streams''' module processes data incrementally instead of requiring one complete in-memory string. It includes string-backed streams plus gzip/xz compression and decompression adapters.
* '''Compression''': Stream compression using gzip and xz algorithms
* '''Decompression''': Stream decompression using zcat (gzip) and xzcat (xz) functions


These functions enable efficient handling of data streams, file compression, and decompression operations in SCM programs, particularly useful for processing large datasets and file I/O operations.
Compression functions produce compressed output; <code>zcat</code> and <code>xzcat</code> decode compressed input. Choose the direction explicitly when composing import and export pipelines, and close externally owned resources according to the caller's IO contract.
 
← Back to [[Full SCM API documentation]]


<span id="streamstring"></span>
== streamString ==
== streamString ==


Line 17: Line 19:
'''Allowed number of parameters:''' 1–1
'''Allowed number of parameters:''' 1–1


'''Parameters:'''
<span id="parameters"></span>
=== Parameters ===
 
* '''content''' (<code>string</code>): content to put into the stream
* '''content''' (<code>string</code>): content to put into the stream


'''Returns:''' <code>stream</code>
<span id="returns"></span>
=== Returns ===
 
* '''value''' (<code>stream</code>)


== gzip ==
== gzip ==
Line 28: Line 35:
'''Allowed number of parameters:''' 1–1
'''Allowed number of parameters:''' 1–1


'''Parameters:'''
<span id="parameters-1"></span>
=== Parameters ===
 
* '''stream''' (<code>stream</code>): input stream
* '''stream''' (<code>stream</code>): input stream


'''Returns:''' <code>stream</code>
<span id="returns-1"></span>
=== Returns ===
 
* '''value''' (<code>stream</code>)


== xz ==
== xz ==
Line 39: Line 51:
'''Allowed number of parameters:''' 1–1
'''Allowed number of parameters:''' 1–1


'''Parameters:'''
<span id="parameters-2"></span>
=== Parameters ===
 
* '''stream''' (<code>stream</code>): input stream
* '''stream''' (<code>stream</code>): input stream


'''Returns:''' <code>stream</code>
<span id="returns-2"></span>
=== Returns ===
 
* '''value''' (<code>stream</code>)


== zcat ==
== zcat ==
Line 50: Line 67:
'''Allowed number of parameters:''' 1–1
'''Allowed number of parameters:''' 1–1


'''Parameters:'''
<span id="parameters-3"></span>
=== Parameters ===
 
* '''stream''' (<code>stream</code>): input stream
* '''stream''' (<code>stream</code>): input stream


'''Returns:''' <code>stream</code>
<span id="returns-3"></span>
=== Returns ===
 
* '''value''' (<code>stream</code>)


== xzcat ==
== xzcat ==
Line 61: Line 83:
'''Allowed number of parameters:''' 1–1
'''Allowed number of parameters:''' 1–1


'''Parameters:'''
<span id="parameters-4"></span>
=== Parameters ===
 
* '''stream''' (<code>stream</code>): input stream
* '''stream''' (<code>stream</code>): input stream


'''Returns:''' <code>stream</code>
<span id="returns-4"></span>
=== Returns ===
 
* '''value''' (<code>stream</code>)

Latest revision as of 11:59, 28 August 2026


Streams

Generated from MemCP commit c42e19eba on 27 August 2026. See Full SCM API documentation.

The Streams module processes data incrementally instead of requiring one complete in-memory string. It includes string-backed streams plus gzip/xz compression and decompression adapters.

Compression functions produce compressed output; zcat and xzcat decode compressed input. Choose the direction explicitly when composing import and export pipelines, and close externally owned resources according to the caller's IO contract.

streamString

creates a stream that contains a string

Allowed number of parameters: 1–1

Parameters

  • content (string): content to put into the stream

Returns

  • value (stream)

gzip

compresses a stream with gzip. Create streams with (stream filename)

Allowed number of parameters: 1–1

Parameters

  • stream (stream): input stream

Returns

  • value (stream)

xz

compresses a stream with xz. Create streams with (stream filename)

Allowed number of parameters: 1–1

Parameters

  • stream (stream): input stream

Returns

  • value (stream)

zcat

turns a compressed gzip stream into a stream of uncompressed data. Create streams with (stream filename)

Allowed number of parameters: 1–1

Parameters

  • stream (stream): input stream

Returns

  • value (stream)

xzcat

turns a compressed xz stream into a stream of uncompressed data. Create streams with (stream filename)

Allowed number of parameters: 1–1

Parameters

  • stream (stream): input stream

Returns

  • value (stream)