Streams: Difference between revisions

From MemCP
Jump to navigation Jump to search
No edit summary
(Refresh MemCP documentation: accuracy, operational guidance, performance profile and maintained API reference)
 
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)
* '''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.


← Back to [[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; <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.


<span id="streamstring"></span>
<span id="streamstring"></span>
Line 27: Line 27:
=== Returns ===
=== Returns ===


<code>stream</code>
* '''value''' (<code>stream</code>)


== gzip ==
== gzip ==
Line 43: Line 43:
=== Returns ===
=== Returns ===


<code>stream</code>
* '''value''' (<code>stream</code>)


== xz ==
== xz ==
Line 59: Line 59:
=== Returns ===
=== Returns ===


<code>stream</code>
* '''value''' (<code>stream</code>)


== zcat ==
== zcat ==
Line 75: Line 75:
=== Returns ===
=== Returns ===


<code>stream</code>
* '''value''' (<code>stream</code>)


== xzcat ==
== xzcat ==
Line 91: Line 91:
=== Returns ===
=== Returns ===


<code>stream</code>
* '''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)