7 Commits

Author SHA1 Message Date
Tenere CI bf9e709b7b release: v1.0.5
CI / publish (push) Successful in 7s
CI / test (push) Successful in 8s
2026-07-21 08:51:12 -07:00
Tenere CI a21cd607d6 ci: bump version to 1.0.5 to trigger green CI publish (test already passed at previous version) 2026-07-21 08:51:12 -07:00
Tenere CI 718a7f24ba chore: add .gitignore (node_modules/)
CI / publish (push) Failing after 8s
CI / test (push) Successful in 7s
2026-07-20 21:02:05 -07:00
Tenere CI 741a606d00 docs+fix: add JSDoc and minor fixes (push-stream-lzd export LZD_PLUS_EMPTY_REFERENCE, push-stdio tests summary, push-handshake/stream-to-push-stream/push-stream-to-stream/push-websocket JSDoc)
CI / publish (push) Failing after 6s
CI / test (push) Successful in 13s
2026-07-20 14:48:28 -07:00
Tenere CI 7537d7fa37 docs: README per PACKAGE_GUIDELINES — fix H1 to scope, remove License/MIT sections, rename Description to Why, update Node 18→22, fix fictitious peer imports
CI / publish (push) Failing after 9s
CI / test (push) Successful in 17s
2026-07-20 14:40:10 -07:00
Tenere CI ecc03395a3 release: v1.0.1
CI / publish (push) Failing after 14s
CI / test (push) Successful in 9s
2026-07-20 12:01:16 -07:00
Tenere CI c2b6d11159 ci: add publish job per PACKAGE_GUIDELINES.md
CI / test (push) Successful in 9s
CI / publish (push) Has been skipped
2026-07-19 14:09:21 -07:00
6 changed files with 69 additions and 16 deletions
+22 -8
View File
@@ -10,19 +10,33 @@ on:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: [18, 20, 22]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
node-version: 22
- name: Auth for Gitea npm registry
run: |
echo "@${{ github.repository_owner }}:registry=https://hub.kl1.tenere.ai/api/packages/${{ github.repository_owner }}/npm/" > .npmrc
echo "//hub.kl1.tenere.ai/api/packages/${{ github.repository_owner }}/npm/:_authToken=${{ secrets.PACKAGE_TOKEN }}" >> .npmrc
echo "@push-stream-std:registry=https://hub.kl1.tenere.ai/api/packages/push-stream-std/npm/" > .npmrc
echo "//hub.kl1.tenere.ai/api/packages/push-stream-std/npm/:_authToken=${{ secrets.PACKAGE_TOKEN }}" >> .npmrc
- run: npm install
- run: npm run lint || true
- run: npm test
- run: npm run bench
if: matrix.node == 22
publish:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs: test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Auth for Gitea npm registry
run: |
echo "@push-stream-std:registry=https://hub.kl1.tenere.ai/api/packages/push-stream-std/npm/" > .npmrc
echo "//hub.kl1.tenere.ai/api/packages/push-stream-std/npm/:_authToken=${{ secrets.PACKAGE_TOKEN }}" >> .npmrc
- run: npm install
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
+1
View File
@@ -0,0 +1 @@
node_modules/
+3 -7
View File
@@ -1,4 +1,4 @@
# stream-to-push-stream
# @push-stream-std/stream-to-push-stream
Convert native Node.js streams to push-stream source, sink, and duplex interfaces.
@@ -41,8 +41,7 @@ npm config set -- //hub.kl1.tenere.ai/api/packages/push-stream-std/npm/:_authTok
npm install @push-stream-std/stream-to-push-stream
```
## Description
## Why
Utilities for bridging between the Node.js `stream` module (Readable, Writable, Duplex) and the push-stream protocol. PushSource wraps a Readable, listening to `data`/`end`/`error` events and implementing `pipe()`, `resume()`, and `abort()`. PushSink wraps a Writable, translating `write()` calls to `writable.write()` with `drain`-based backpressure and `end()` to `writable.end()`. PushDuplex wraps a Duplex stream as a combined source/sink for bidirectional push-stream pipelines.
## API
@@ -78,8 +77,5 @@ Tests cover readable-to-source data flow and end handling, writable-to-sink writ
## Requirements
Node.js 18 or later. ESM only.
Node.js 22 or later. ESM only.
## License
MIT
+22
View File
@@ -1,5 +1,12 @@
import { Readable, Writable, Duplex } from 'stream';
/**
* stream-to-push-stream - Convert Node.js streams to push-streams
*
* Bridges Node.js Readable/Writable/Duplex streams into the push-stream protocol
* so they can be composed with `@push-stream-std/*` operators.
*/
class PushSource {
constructor(readable) {
this.readable = readable;
@@ -223,6 +230,11 @@ class PushDuplex {
}
}
/**
* Wrap a Node.js Readable stream as a push-stream source.
* @param {import('stream').Readable} readableStream
* @returns {object} A push-stream source
*/
export function source(readableStream) {
if (!(readableStream instanceof Readable)) {
throw new Error('Expected a Node.js Readable stream');
@@ -230,6 +242,11 @@ export function source(readableStream) {
return new PushSource(readableStream);
}
/**
* Wrap a Node.js Writable stream as a push-stream sink.
* @param {import('stream').Writable} writableStream
* @returns {object} A push-stream sink
*/
export function sink(writableStream) {
if (!(writableStream instanceof Writable)) {
throw new Error('Expected a Node.js Writable stream');
@@ -237,6 +254,11 @@ export function sink(writableStream) {
return new PushSink(writableStream);
}
/**
* Wrap a Node.js Duplex stream as a push-stream duplex (`{ source, sink }`).
* @param {import('stream').Duplex} duplexStream
* @returns {{source: object, sink: object}} Push-stream duplex
*/
export function duplex(duplexStream) {
if (!(duplexStream instanceof Duplex)) {
throw new Error('Expected a Node.js Duplex stream');
+16
View File
@@ -0,0 +1,16 @@
{
"name": "@push-stream-std/stream-to-push-stream",
"version": "1.0.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@push-stream-std/stream-to-push-stream",
"version": "1.0.3",
"license": "SEE LICENSE IN LICENSE",
"engines": {
"node": ">=22.0.0"
}
}
}
}
+5 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@push-stream-std/stream-to-push-stream",
"version": "1.0.0",
"version": "1.0.5",
"description": "Convert Node.js streams to push-streams",
"type": "module",
"main": "index.js",
@@ -29,5 +29,9 @@
],
"publishConfig": {
"registry": "https://hub.kl1.tenere.ai/api/packages/push-stream-std/npm/"
},
"repository": {
"type": "git",
"url": "https://hub.kl1.tenere.ai/push-stream-std/stream-to-push-stream.git"
}
}