Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
d238662bea | |||
8efb2b1093 | |||
4926f57d83 | |||
86552f2b1b | |||
353a8ecde6 | |||
3e03b81a43 | |||
5e4ec5b837 | |||
62796f7151 | |||
2c1d9f05ce | |||
34cbf28972 | |||
1b6e38c040 | |||
b135e6023a | |||
91d01f3689 | |||
e8e067ea77 | |||
2cb490cd2a | |||
98397bb85e |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@push.rocks/smartstream",
|
"name": "@push.rocks/smartstream",
|
||||||
"version": "3.0.3",
|
"version": "3.0.11",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "simplifies access to node streams",
|
"description": "simplifies access to node streams",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
@ -25,8 +25,9 @@
|
|||||||
"@git.zone/tsbuild": "^2.1.66",
|
"@git.zone/tsbuild": "^2.1.66",
|
||||||
"@git.zone/tsrun": "^1.2.44",
|
"@git.zone/tsrun": "^1.2.44",
|
||||||
"@git.zone/tstest": "^1.0.77",
|
"@git.zone/tstest": "^1.0.77",
|
||||||
"@push.rocks/smartfile": "^10.0.33",
|
"@push.rocks/smartfile": "^10.0.37",
|
||||||
"@push.rocks/tapbundle": "^5.0.15"
|
"@push.rocks/tapbundle": "^5.0.15",
|
||||||
|
"@types/node": "^20.8.10"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@push.rocks/smartpromise": "^4.0.3",
|
"@push.rocks/smartpromise": "^4.0.3",
|
||||||
|
145
pnpm-lock.yaml
generated
145
pnpm-lock.yaml
generated
@ -23,11 +23,14 @@ devDependencies:
|
|||||||
specifier: ^1.0.77
|
specifier: ^1.0.77
|
||||||
version: 1.0.81(@types/node@20.8.10)(sinon@17.0.1)
|
version: 1.0.81(@types/node@20.8.10)(sinon@17.0.1)
|
||||||
'@push.rocks/smartfile':
|
'@push.rocks/smartfile':
|
||||||
specifier: ^10.0.33
|
specifier: ^10.0.37
|
||||||
version: 10.0.33
|
version: 10.0.37
|
||||||
'@push.rocks/tapbundle':
|
'@push.rocks/tapbundle':
|
||||||
specifier: ^5.0.15
|
specifier: ^5.0.15
|
||||||
version: 5.0.15(sinon@17.0.1)
|
version: 5.0.15(sinon@17.0.1)
|
||||||
|
'@types/node':
|
||||||
|
specifier: ^20.8.10
|
||||||
|
version: 20.8.10
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
|
|
||||||
@ -57,7 +60,7 @@ packages:
|
|||||||
'@push.rocks/smartdelay': 3.0.5
|
'@push.rocks/smartdelay': 3.0.5
|
||||||
'@push.rocks/smartenv': 5.0.10
|
'@push.rocks/smartenv': 5.0.10
|
||||||
'@push.rocks/smartfeed': 1.0.11
|
'@push.rocks/smartfeed': 1.0.11
|
||||||
'@push.rocks/smartfile': 10.0.33
|
'@push.rocks/smartfile': 10.0.37
|
||||||
'@push.rocks/smartlog': 3.0.3
|
'@push.rocks/smartlog': 3.0.3
|
||||||
'@push.rocks/smartlog-destination-devtools': 1.0.10
|
'@push.rocks/smartlog-destination-devtools': 1.0.10
|
||||||
'@push.rocks/smartmanifest': 2.0.2
|
'@push.rocks/smartmanifest': 2.0.2
|
||||||
@ -65,7 +68,7 @@ packages:
|
|||||||
'@push.rocks/smartopen': 2.0.0
|
'@push.rocks/smartopen': 2.0.0
|
||||||
'@push.rocks/smartpath': 5.0.11
|
'@push.rocks/smartpath': 5.0.11
|
||||||
'@push.rocks/smartpromise': 4.0.3
|
'@push.rocks/smartpromise': 4.0.3
|
||||||
'@push.rocks/smartrequest': 2.0.18
|
'@push.rocks/smartrequest': 2.0.20
|
||||||
'@push.rocks/smartrx': 3.0.7
|
'@push.rocks/smartrx': 3.0.7
|
||||||
'@push.rocks/smartsitemap': 2.0.3
|
'@push.rocks/smartsitemap': 2.0.3
|
||||||
'@push.rocks/smarttime': 4.0.6
|
'@push.rocks/smarttime': 4.0.6
|
||||||
@ -76,7 +79,7 @@ packages:
|
|||||||
cors: 2.8.5
|
cors: 2.8.5
|
||||||
express: 4.18.2
|
express: 4.18.2
|
||||||
express-force-ssl: 0.3.2
|
express-force-ssl: 0.3.2
|
||||||
lit: 3.0.1
|
lit: 3.0.2
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- bufferutil
|
- bufferutil
|
||||||
- supports-color
|
- supports-color
|
||||||
@ -342,7 +345,7 @@ packages:
|
|||||||
'@push.rocks/early': 4.0.4
|
'@push.rocks/early': 4.0.4
|
||||||
'@push.rocks/smartcli': 4.0.8
|
'@push.rocks/smartcli': 4.0.8
|
||||||
'@push.rocks/smartdelay': 3.0.5
|
'@push.rocks/smartdelay': 3.0.5
|
||||||
'@push.rocks/smartfile': 10.0.33
|
'@push.rocks/smartfile': 10.0.37
|
||||||
'@push.rocks/smartlog': 3.0.3
|
'@push.rocks/smartlog': 3.0.3
|
||||||
'@push.rocks/smartpath': 5.0.11
|
'@push.rocks/smartpath': 5.0.11
|
||||||
'@push.rocks/smartpromise': 4.0.3
|
'@push.rocks/smartpromise': 4.0.3
|
||||||
@ -356,7 +359,7 @@ packages:
|
|||||||
'@push.rocks/early': 4.0.4
|
'@push.rocks/early': 4.0.4
|
||||||
'@push.rocks/smartcli': 4.0.8
|
'@push.rocks/smartcli': 4.0.8
|
||||||
'@push.rocks/smartdelay': 3.0.5
|
'@push.rocks/smartdelay': 3.0.5
|
||||||
'@push.rocks/smartfile': 10.0.33
|
'@push.rocks/smartfile': 10.0.37
|
||||||
'@push.rocks/smartlog': 3.0.3
|
'@push.rocks/smartlog': 3.0.3
|
||||||
'@push.rocks/smartlog-destination-local': 9.0.1
|
'@push.rocks/smartlog-destination-local': 9.0.1
|
||||||
'@push.rocks/smartpath': 5.0.11
|
'@push.rocks/smartpath': 5.0.11
|
||||||
@ -374,7 +377,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-8miFVBle9Mnjx+uPGI/P+EuWcIOXWjBAkdjN5IYbdp5Ytt4xQODCLh4JSnC9h56UeU1nUxCAxZeJs2e9TXrivA==}
|
resolution: {integrity: sha512-8miFVBle9Mnjx+uPGI/P+EuWcIOXWjBAkdjN5IYbdp5Ytt4xQODCLh4JSnC9h56UeU1nUxCAxZeJs2e9TXrivA==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
dependencies:
|
dependencies:
|
||||||
'@push.rocks/smartfile': 10.0.33
|
'@push.rocks/smartfile': 10.0.37
|
||||||
'@push.rocks/smartshell': 3.0.3
|
'@push.rocks/smartshell': 3.0.3
|
||||||
ts-node: 10.9.1(@types/node@20.8.10)(typescript@5.1.6)
|
ts-node: 10.9.1(@types/node@20.8.10)(typescript@5.1.6)
|
||||||
typescript: 5.1.6
|
typescript: 5.1.6
|
||||||
@ -394,7 +397,7 @@ packages:
|
|||||||
'@push.rocks/consolecolor': 2.0.1
|
'@push.rocks/consolecolor': 2.0.1
|
||||||
'@push.rocks/smartbrowser': 2.0.6
|
'@push.rocks/smartbrowser': 2.0.6
|
||||||
'@push.rocks/smartdelay': 3.0.5
|
'@push.rocks/smartdelay': 3.0.5
|
||||||
'@push.rocks/smartfile': 10.0.33
|
'@push.rocks/smartfile': 10.0.37
|
||||||
'@push.rocks/smartlog': 3.0.3
|
'@push.rocks/smartlog': 3.0.3
|
||||||
'@push.rocks/smartpromise': 4.0.3
|
'@push.rocks/smartpromise': 4.0.3
|
||||||
'@push.rocks/smartshell': 3.0.3
|
'@push.rocks/smartshell': 3.0.3
|
||||||
@ -658,8 +661,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-MeOl/200UOvSO4Pgq/DVFiBVZpL9gjOBQM+4XYNjSxda8c6VBvchHAntaFLQUlO8U1ckNaP9i+nMO4O4/0ymyw==}
|
resolution: {integrity: sha512-MeOl/200UOvSO4Pgq/DVFiBVZpL9gjOBQM+4XYNjSxda8c6VBvchHAntaFLQUlO8U1ckNaP9i+nMO4O4/0ymyw==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@push.rocks/smartfile@10.0.33:
|
/@push.rocks/smartfile@10.0.37:
|
||||||
resolution: {integrity: sha512-mCvTWP32MCFtFcZVuGzvazyxQSrPhlaLkWTydz8IZ32/V41vvxieXDiPwoF64lcIYO37EZEXElYdBBjqCJ8MuA==}
|
resolution: {integrity: sha512-RlWq5Q4ObvFh7Jv00Mkjx3gQDFedR6qo1ZT8OutjmQ3d+wLeLxi+LbcMHzWWO2NjPQP59T65TWpxF9iqZcS5wQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@push.rocks/lik': 6.0.5
|
'@push.rocks/lik': 6.0.5
|
||||||
'@push.rocks/smartdelay': 3.0.5
|
'@push.rocks/smartdelay': 3.0.5
|
||||||
@ -669,8 +672,8 @@ packages:
|
|||||||
'@push.rocks/smartmime': 1.0.6
|
'@push.rocks/smartmime': 1.0.6
|
||||||
'@push.rocks/smartpath': 5.0.11
|
'@push.rocks/smartpath': 5.0.11
|
||||||
'@push.rocks/smartpromise': 4.0.3
|
'@push.rocks/smartpromise': 4.0.3
|
||||||
'@push.rocks/smartrequest': 2.0.18
|
'@push.rocks/smartrequest': 2.0.20
|
||||||
'@push.rocks/smartstream': 2.0.4
|
'@push.rocks/smartstream': 2.0.8
|
||||||
'@types/fs-extra': 11.0.3
|
'@types/fs-extra': 11.0.3
|
||||||
'@types/glob': 8.1.0
|
'@types/glob': 8.1.0
|
||||||
'@types/js-yaml': 4.0.8
|
'@types/js-yaml': 4.0.8
|
||||||
@ -776,7 +779,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-W5tR1rlgrs7MoXEEGgnuJOAGLFxXTHDCgHpdhrtlt5M3t/ELZvaJoyMNRwrt3BbWEAb86dr4QwWSt380Q3MhfQ==}
|
resolution: {integrity: sha512-W5tR1rlgrs7MoXEEGgnuJOAGLFxXTHDCgHpdhrtlt5M3t/ELZvaJoyMNRwrt3BbWEAb86dr4QwWSt380Q3MhfQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@push.rocks/smartdelay': 3.0.5
|
'@push.rocks/smartdelay': 3.0.5
|
||||||
'@push.rocks/smartfile': 10.0.33
|
'@push.rocks/smartfile': 10.0.37
|
||||||
'@push.rocks/smartnetwork': 3.0.2
|
'@push.rocks/smartnetwork': 3.0.2
|
||||||
'@push.rocks/smartpath': 5.0.11
|
'@push.rocks/smartpath': 5.0.11
|
||||||
'@push.rocks/smartpromise': 4.0.3
|
'@push.rocks/smartpromise': 4.0.3
|
||||||
@ -811,8 +814,8 @@ packages:
|
|||||||
- utf-8-validate
|
- utf-8-validate
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@push.rocks/smartrequest@2.0.18:
|
/@push.rocks/smartrequest@2.0.20:
|
||||||
resolution: {integrity: sha512-MsTou9rRHhlhBC83dUGoi6quYKrWD9urI23Bcgk2GjvkiOpaddpSib6x1cQfidoOVpwP7LaVDMD+tFnW4CpWRA==}
|
resolution: {integrity: sha512-7Y22kOS9CGJLjayjpRbkoDxd5kqmnG9WDY1WWR3/kqo63WFhdgHueatmJjT/v1QqvKSG88gL36kG4f7YG/0xTA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@push.rocks/smartpromise': 4.0.3
|
'@push.rocks/smartpromise': 4.0.3
|
||||||
'@push.rocks/smarturl': 3.0.7
|
'@push.rocks/smarturl': 3.0.7
|
||||||
@ -883,8 +886,8 @@ packages:
|
|||||||
- supports-color
|
- supports-color
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@push.rocks/smartstream@2.0.4:
|
/@push.rocks/smartstream@2.0.8:
|
||||||
resolution: {integrity: sha512-rbQf4+sLle9ga6RidRv0WXb/TuLFcMordRQBbqPq01n/mpBHoEiqIThWzVuImPVRVuSK/LKbM/QX4Ey26FFerg==}
|
resolution: {integrity: sha512-GlF/9cCkvBHwKa3DK4DO5wjfSgqkj6gAS4TrY9uD5NMHu9RQv4WiNrElTYj7iCEpnZgUnLO3tzw1JA3NRIMnnA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@push.rocks/smartpromise': 4.0.3
|
'@push.rocks/smartpromise': 4.0.3
|
||||||
'@push.rocks/smartrx': 3.0.7
|
'@push.rocks/smartrx': 3.0.7
|
||||||
@ -1449,7 +1452,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-IO+MJPVhoqz+28h1qLAcBEH2+xHMK6MTyHJc7MTnnYb6wsoLR29POVGJ7LycmVXIqyy/4/2ShP5sUwTXuOwb/w==}
|
resolution: {integrity: sha512-IO+MJPVhoqz+28h1qLAcBEH2+xHMK6MTyHJc7MTnnYb6wsoLR29POVGJ7LycmVXIqyy/4/2ShP5sUwTXuOwb/w==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/minimatch': 5.1.2
|
'@types/minimatch': 5.1.2
|
||||||
'@types/node': 20.4.1
|
'@types/node': 20.8.10
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@types/html-minifier@4.0.4:
|
/@types/html-minifier@4.0.4:
|
||||||
@ -1549,10 +1552,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==}
|
resolution: {integrity: sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@types/node@20.4.1:
|
|
||||||
resolution: {integrity: sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg==}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@types/node@20.8.10:
|
/@types/node@20.8.10:
|
||||||
resolution: {integrity: sha512-TlgT8JntpcbmKUFzjhsyhGfP2fsiz1Mv56im6enJ905xG1DAYesxJaeSbGqQmAw8OWPdhyJGhGSQGKRNJ45u9w==}
|
resolution: {integrity: sha512-TlgT8JntpcbmKUFzjhsyhGfP2fsiz1Mv56im6enJ905xG1DAYesxJaeSbGqQmAw8OWPdhyJGhGSQGKRNJ45u9w==}
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -1760,8 +1759,8 @@ packages:
|
|||||||
- utf-8-validate
|
- utf-8-validate
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@xmldom/xmldom@0.8.8:
|
/@xmldom/xmldom@0.8.10:
|
||||||
resolution: {integrity: sha512-0LNz4EY8B/8xXY86wMrQ4tz6zEHZv9ehFMJPm8u2gq5lQ71cfRKdaKyxfJAx5aUoyzx0qzgURblTisPGgz3d+Q==}
|
resolution: {integrity: sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==}
|
||||||
engines: {node: '>=10.0.0'}
|
engines: {node: '>=10.0.0'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
@ -2097,13 +2096,6 @@ packages:
|
|||||||
responselike: 3.0.0
|
responselike: 3.0.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/call-bind@1.0.2:
|
|
||||||
resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==}
|
|
||||||
dependencies:
|
|
||||||
function-bind: 1.1.1
|
|
||||||
get-intrinsic: 1.2.1
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/call-bind@1.0.5:
|
/call-bind@1.0.5:
|
||||||
resolution: {integrity: sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==}
|
resolution: {integrity: sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -2471,14 +2463,6 @@ packages:
|
|||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/define-properties@1.2.0:
|
|
||||||
resolution: {integrity: sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==}
|
|
||||||
engines: {node: '>= 0.4'}
|
|
||||||
dependencies:
|
|
||||||
has-property-descriptors: 1.0.0
|
|
||||||
object-keys: 1.1.1
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/define-properties@1.2.1:
|
/define-properties@1.2.1:
|
||||||
resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==}
|
resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==}
|
||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
@ -2959,7 +2943,7 @@ packages:
|
|||||||
engines: {node: '>=14'}
|
engines: {node: '>=14'}
|
||||||
dependencies:
|
dependencies:
|
||||||
cross-spawn: 7.0.3
|
cross-spawn: 7.0.3
|
||||||
signal-exit: 4.0.2
|
signal-exit: 4.1.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/form-data-encoder@2.1.4:
|
/form-data-encoder@2.1.4:
|
||||||
@ -3003,7 +2987,7 @@ packages:
|
|||||||
dependencies:
|
dependencies:
|
||||||
graceful-fs: 4.2.11
|
graceful-fs: 4.2.11
|
||||||
jsonfile: 6.1.0
|
jsonfile: 6.1.0
|
||||||
universalify: 2.0.0
|
universalify: 2.0.1
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/fs.realpath@1.0.0:
|
/fs.realpath@1.0.0:
|
||||||
@ -3018,10 +3002,6 @@ packages:
|
|||||||
dev: true
|
dev: true
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/function-bind@1.1.1:
|
|
||||||
resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/function-bind@1.1.2:
|
/function-bind@1.1.2:
|
||||||
resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}
|
resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}
|
||||||
dev: true
|
dev: true
|
||||||
@ -3049,15 +3029,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==}
|
resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/get-intrinsic@1.2.1:
|
|
||||||
resolution: {integrity: sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==}
|
|
||||||
dependencies:
|
|
||||||
function-bind: 1.1.1
|
|
||||||
has: 1.0.3
|
|
||||||
has-proto: 1.0.1
|
|
||||||
has-symbols: 1.0.3
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/get-intrinsic@1.2.2:
|
/get-intrinsic@1.2.2:
|
||||||
resolution: {integrity: sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==}
|
resolution: {integrity: sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -3193,12 +3164,6 @@ packages:
|
|||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/has-property-descriptors@1.0.0:
|
|
||||||
resolution: {integrity: sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==}
|
|
||||||
dependencies:
|
|
||||||
get-intrinsic: 1.2.1
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/has-property-descriptors@1.0.1:
|
/has-property-descriptors@1.0.1:
|
||||||
resolution: {integrity: sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==}
|
resolution: {integrity: sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==}
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -3222,13 +3187,6 @@ packages:
|
|||||||
has-symbols: 1.0.3
|
has-symbols: 1.0.3
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/has@1.0.3:
|
|
||||||
resolution: {integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==}
|
|
||||||
engines: {node: '>= 0.4.0'}
|
|
||||||
dependencies:
|
|
||||||
function-bind: 1.1.1
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/hasown@2.0.0:
|
/hasown@2.0.0:
|
||||||
resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==}
|
resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==}
|
||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
@ -3487,8 +3445,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==}
|
resolution: {integrity: sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==}
|
||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
dependencies:
|
dependencies:
|
||||||
call-bind: 1.0.2
|
call-bind: 1.0.5
|
||||||
define-properties: 1.2.0
|
define-properties: 1.2.1
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/is-negative-zero@2.0.2:
|
/is-negative-zero@2.0.2:
|
||||||
@ -3675,7 +3633,7 @@ packages:
|
|||||||
/jsonfile@6.1.0:
|
/jsonfile@6.1.0:
|
||||||
resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==}
|
resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
universalify: 2.0.0
|
universalify: 2.0.1
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
graceful-fs: 4.2.11
|
graceful-fs: 4.2.11
|
||||||
dev: true
|
dev: true
|
||||||
@ -3783,25 +3741,25 @@ packages:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@lit-labs/ssr-dom-shim': 1.1.2
|
'@lit-labs/ssr-dom-shim': 1.1.2
|
||||||
'@lit/reactive-element': 2.0.1
|
'@lit/reactive-element': 2.0.1
|
||||||
lit-html: 3.0.1
|
lit-html: 3.0.2
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/lit-html@1.4.1:
|
/lit-html@1.4.1:
|
||||||
resolution: {integrity: sha512-B9btcSgPYb1q4oSOb/PrOT6Z/H+r6xuNzfH4lFli/AWhYwdtrgQkQWBbIc6mdnf6E2IL3gDXdkkqNktpU0OZQA==}
|
resolution: {integrity: sha512-B9btcSgPYb1q4oSOb/PrOT6Z/H+r6xuNzfH4lFli/AWhYwdtrgQkQWBbIc6mdnf6E2IL3gDXdkkqNktpU0OZQA==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/lit-html@3.0.1:
|
/lit-html@3.0.2:
|
||||||
resolution: {integrity: sha512-1nmGaNNQg9rBvE1yJ6oS3ZNbLs3FXtlG4+jgGkix8O740qVEwwiFVTgDGIIH8N5TcQ8V9tBk5T+sxqBgffcjJg==}
|
resolution: {integrity: sha512-Q1A5lHza3bnmxoWJn6yS6vQZQdExl4fghk8W1G+jnAEdoFNYo5oeBBb/Ol7zSEdKd3TR7+r0zsJQyuWEVguiyQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/trusted-types': 2.0.5
|
'@types/trusted-types': 2.0.5
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/lit@3.0.1:
|
/lit@3.0.2:
|
||||||
resolution: {integrity: sha512-CYFv7/gwrs6bfPm299O9LD/HB4dgHvsEf/yqUOI//fi469i2OrT4xaptUcmhr05DNQEgsBFecFH8EJnN5So8oQ==}
|
resolution: {integrity: sha512-ZoVUPGgXOQocP4OvxehEOBmC4rWB4cRYDPaz7aFmH8DFytsCi/NeACbr4C6vNPGDEC07BrhUos7uVNayDKLQ2Q==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@lit/reactive-element': 2.0.1
|
'@lit/reactive-element': 2.0.1
|
||||||
lit-element: 4.0.1
|
lit-element: 4.0.1
|
||||||
lit-html: 3.0.1
|
lit-html: 3.0.2
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/locate-path@3.0.0:
|
/locate-path@3.0.0:
|
||||||
@ -3922,8 +3880,8 @@ packages:
|
|||||||
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
|
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/lru-cache@10.0.0:
|
/lru-cache@10.0.1:
|
||||||
resolution: {integrity: sha512-svTf/fzsKHffP42sujkO/Rjs37BCIsQVRCeNYIm9WN8rgT7ffoUnRtZCqU+6BqcSBdv8gwJeTz8knJpgACeQMw==}
|
resolution: {integrity: sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==}
|
||||||
engines: {node: 14 || >=16.14}
|
engines: {node: 14 || >=16.14}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
@ -4064,11 +4022,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==}
|
resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/minipass@7.0.2:
|
|
||||||
resolution: {integrity: sha512-eL79dXrE1q9dBbDCLg7xfn/vl7MS4F1gvJAgjJrQli/jbQWdUttuVawphqpffoIYfRdq78LHx6GP4bU/EQ2ATA==}
|
|
||||||
engines: {node: '>=16 || 14 >=14.17'}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/minipass@7.0.4:
|
/minipass@7.0.4:
|
||||||
resolution: {integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==}
|
resolution: {integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==}
|
||||||
engines: {node: '>=16 || 14 >=14.17'}
|
engines: {node: '>=16 || 14 >=14.17'}
|
||||||
@ -4220,10 +4173,6 @@ packages:
|
|||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/object-inspect@1.12.3:
|
|
||||||
resolution: {integrity: sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/object-inspect@1.13.1:
|
/object-inspect@1.13.1:
|
||||||
resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==}
|
resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==}
|
||||||
dev: true
|
dev: true
|
||||||
@ -4398,8 +4347,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==}
|
resolution: {integrity: sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==}
|
||||||
engines: {node: '>=16 || 14 >=14.17'}
|
engines: {node: '>=16 || 14 >=14.17'}
|
||||||
dependencies:
|
dependencies:
|
||||||
lru-cache: 10.0.0
|
lru-cache: 10.0.1
|
||||||
minipass: 7.0.2
|
minipass: 7.0.4
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/path-to-regexp@0.1.7:
|
/path-to-regexp@0.1.7:
|
||||||
@ -4432,7 +4381,7 @@ packages:
|
|||||||
engines: {node: '>=14.18.0', npm: '>=6.14.15'}
|
engines: {node: '>=14.18.0', npm: '>=6.14.15'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
dependencies:
|
dependencies:
|
||||||
'@xmldom/xmldom': 0.8.8
|
'@xmldom/xmldom': 0.8.10
|
||||||
dev: true
|
dev: true
|
||||||
bundledDependencies:
|
bundledDependencies:
|
||||||
- '@xmldom/xmldom'
|
- '@xmldom/xmldom'
|
||||||
@ -4870,17 +4819,17 @@ packages:
|
|||||||
/side-channel@1.0.4:
|
/side-channel@1.0.4:
|
||||||
resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==}
|
resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==}
|
||||||
dependencies:
|
dependencies:
|
||||||
call-bind: 1.0.2
|
call-bind: 1.0.5
|
||||||
get-intrinsic: 1.2.1
|
get-intrinsic: 1.2.2
|
||||||
object-inspect: 1.12.3
|
object-inspect: 1.13.1
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/signal-exit@3.0.7:
|
/signal-exit@3.0.7:
|
||||||
resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==}
|
resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/signal-exit@4.0.2:
|
/signal-exit@4.1.0:
|
||||||
resolution: {integrity: sha512-MY2/qGx4enyjprQnFaZsHib3Yadh3IXyV2C321GY0pjGfVBu4un0uDJkwgdxqO+Rdx8JMT8IfJIRwbYVz3Ob3Q==}
|
resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==}
|
||||||
engines: {node: '>=14'}
|
engines: {node: '>=14'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
@ -5402,8 +5351,8 @@ packages:
|
|||||||
tiny-inflate: 1.0.3
|
tiny-inflate: 1.0.3
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/universalify@2.0.0:
|
/universalify@2.0.1:
|
||||||
resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==}
|
resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==}
|
||||||
engines: {node: '>= 10.0.0'}
|
engines: {node: '>= 10.0.0'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ tap.test('should handle a read stream', async (tools) => {
|
|||||||
streamTools.push('wow =========== \n');
|
streamTools.push('wow =========== \n');
|
||||||
return Buffer.from(result);
|
return Buffer.from(result);
|
||||||
},
|
},
|
||||||
streamEndFunction: async (tools) => {
|
finalFunction: async (tools) => {
|
||||||
return Buffer.from('this is the end');
|
return Buffer.from('this is the end');
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
@ -24,7 +24,7 @@ tap.test('should handle a read stream', async (tools) => {
|
|||||||
writeAndTransformFunction: async (chunkStringArg) => {
|
writeAndTransformFunction: async (chunkStringArg) => {
|
||||||
console.log(chunkStringArg.toString());
|
console.log(chunkStringArg.toString());
|
||||||
},
|
},
|
||||||
streamEndFunction: async (tools) => {
|
finalFunction: async (tools) => {
|
||||||
tools.push(null);
|
tools.push(null);
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartstream',
|
name: '@push.rocks/smartstream',
|
||||||
version: '3.0.3',
|
version: '3.0.11',
|
||||||
description: 'simplifies access to node streams'
|
description: 'simplifies access to node streams'
|
||||||
}
|
}
|
||||||
|
@ -2,3 +2,5 @@ export * from './smartstream.classes.passthrough.js';
|
|||||||
export * from './smartstream.classes.smartduplex.js';
|
export * from './smartstream.classes.smartduplex.js';
|
||||||
export * from './smartstream.classes.streamwrapper.js';
|
export * from './smartstream.classes.streamwrapper.js';
|
||||||
export * from './smartstream.classes.streamintake.js';
|
export * from './smartstream.classes.streamintake.js';
|
||||||
|
|
||||||
|
export * from './smartstream.functions.js'
|
||||||
|
@ -13,7 +13,9 @@ export class PassThrough extends plugins.stream.Duplex {
|
|||||||
if (this.push(chunk, encoding)) {
|
if (this.push(chunk, encoding)) {
|
||||||
callback();
|
callback();
|
||||||
} else {
|
} else {
|
||||||
this.once('drain', callback);
|
this.once('drain', () => {
|
||||||
|
callback();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,7 +17,7 @@ export interface IStreamEndFunction<rT> {
|
|||||||
export interface SmartStreamOptions<TInput, TOutput> extends DuplexOptions {
|
export interface SmartStreamOptions<TInput, TOutput> extends DuplexOptions {
|
||||||
readFunction?: () => Promise<void>;
|
readFunction?: () => Promise<void>;
|
||||||
writeAndTransformFunction?: IWriteAndTransformFunction<TInput, TOutput>;
|
writeAndTransformFunction?: IWriteAndTransformFunction<TInput, TOutput>;
|
||||||
streamEndFunction?: IStreamEndFunction<TOutput>;
|
finalFunction?: IStreamEndFunction<TOutput>;
|
||||||
// Add other custom options if necessary
|
// Add other custom options if necessary
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,15 +109,15 @@ export class SmartDuplex<TInput = any, TOutput = any> extends Duplex {
|
|||||||
|
|
||||||
// INSTANCE
|
// INSTANCE
|
||||||
private readFunction?: () => Promise<void>;
|
private readFunction?: () => Promise<void>;
|
||||||
private writeAndTransformFunction?: IWriteAndTransformFunction<TInput, TOutput>;
|
private writeFunction?: IWriteAndTransformFunction<TInput, TOutput>;
|
||||||
private streamEndFunction?: IStreamEndFunction<TOutput>;
|
private finalFunction?: IStreamEndFunction<TOutput>;
|
||||||
private observableSubscription?: plugins.smartrx.rxjs.Subscription;
|
private observableSubscription?: plugins.smartrx.rxjs.Subscription;
|
||||||
|
|
||||||
constructor(optionsArg?: SmartStreamOptions<TInput, TOutput>) {
|
constructor(optionsArg?: SmartStreamOptions<TInput, TOutput>) {
|
||||||
super(optionsArg);
|
super(optionsArg);
|
||||||
this.readFunction = optionsArg?.readFunction;
|
this.readFunction = optionsArg?.readFunction;
|
||||||
this.writeAndTransformFunction = optionsArg?.writeAndTransformFunction;
|
this.writeFunction = optionsArg?.writeAndTransformFunction;
|
||||||
this.streamEndFunction = optionsArg?.streamEndFunction;
|
this.finalFunction = optionsArg?.finalFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async _read(size: number): Promise<void> {
|
public async _read(size: number): Promise<void> {
|
||||||
@ -128,7 +128,7 @@ export class SmartDuplex<TInput = any, TOutput = any> extends Duplex {
|
|||||||
|
|
||||||
// Ensure the _write method types the chunk as TInput and encodes TOutput
|
// Ensure the _write method types the chunk as TInput and encodes TOutput
|
||||||
public async _write(chunk: TInput, encoding: string, callback: (error?: Error | null) => void) {
|
public async _write(chunk: TInput, encoding: string, callback: (error?: Error | null) => void) {
|
||||||
if (!this.writeAndTransformFunction) {
|
if (!this.writeFunction) {
|
||||||
return callback(new Error('No stream function provided'));
|
return callback(new Error('No stream function provided'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ export class SmartDuplex<TInput = any, TOutput = any> extends Duplex {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const modifiedChunk = await this.writeAndTransformFunction(chunk, tools);
|
const modifiedChunk = await this.writeFunction(chunk, tools);
|
||||||
if (modifiedChunk) {
|
if (modifiedChunk) {
|
||||||
if (!this.push(modifiedChunk)) {
|
if (!this.push(modifiedChunk)) {
|
||||||
// Handle backpressure if necessary
|
// Handle backpressure if necessary
|
||||||
@ -154,24 +154,24 @@ export class SmartDuplex<TInput = any, TOutput = any> extends Duplex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async _final(callback: (error?: Error | null) => void) {
|
public async _final(callback: (error?: Error | null) => void) {
|
||||||
if (this.streamEndFunction) {
|
if (this.finalFunction) {
|
||||||
const tools: IStreamTools = {
|
const tools: IStreamTools = {
|
||||||
truncate: () => callback(),
|
truncate: () => callback(),
|
||||||
push: (pipeObject) => this.push(pipeObject),
|
push: (pipeObject) => this.push(pipeObject),
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const finalChunk = await this.streamEndFunction(tools);
|
const finalChunk = await this.finalFunction(tools);
|
||||||
if (finalChunk) {
|
if (finalChunk) {
|
||||||
this.push(finalChunk);
|
this.push(finalChunk);
|
||||||
}
|
}
|
||||||
callback();
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
callback(err);
|
callback(err);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.push(null),
|
// nothing here
|
||||||
|
}
|
||||||
|
this.push(null);
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
26
ts/smartstream.functions.ts
Normal file
26
ts/smartstream.functions.ts
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import { Transform, type TransformCallback, type TransformOptions } from 'stream';
|
||||||
|
|
||||||
|
export interface AsyncTransformFunction<TInput, TOutput> {
|
||||||
|
(chunkArg: TInput): Promise<TOutput>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createTransformFunction<TInput, TOutput>(
|
||||||
|
asyncFunction: AsyncTransformFunction<TInput, TOutput>,
|
||||||
|
options?: TransformOptions
|
||||||
|
): Transform {
|
||||||
|
const transformStream = new Transform({
|
||||||
|
...options,
|
||||||
|
objectMode: true, // Ensure we operate in object mode
|
||||||
|
async transform(chunk: TInput, encoding: string, callback: TransformCallback) {
|
||||||
|
try {
|
||||||
|
const transformed = await asyncFunction(chunk);
|
||||||
|
this.push(transformed);
|
||||||
|
callback();
|
||||||
|
} catch (error) {
|
||||||
|
callback(error instanceof Error ? error : new Error(String(error)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return transformStream;
|
||||||
|
}
|
Reference in New Issue
Block a user