@push.rocks/smartstream 3.0.14 → 3.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@push.rocks/smartstream',
|
|
6
|
-
version: '3.0.
|
|
6
|
+
version: '3.0.15',
|
|
7
7
|
description: 'simplifies access to node streams'
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx5QkFBeUI7SUFDL0IsT0FBTyxFQUFFLFFBQVE7SUFDakIsV0FBVyxFQUFFLG1DQUFtQztDQUNqRCxDQUFBIn0=
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import {
|
|
2
|
+
import { type TransformOptions } from 'stream';
|
|
3
|
+
import { SmartDuplex } from './smartstream.classes.smartduplex.js';
|
|
3
4
|
export interface AsyncTransformFunction<TInput, TOutput> {
|
|
4
5
|
(chunkArg: TInput): Promise<TOutput>;
|
|
5
6
|
}
|
|
6
|
-
export declare function createTransformFunction<TInput, TOutput>(asyncFunction: AsyncTransformFunction<TInput, TOutput>, options?: TransformOptions):
|
|
7
|
+
export declare function createTransformFunction<TInput, TOutput>(asyncFunction: AsyncTransformFunction<TInput, TOutput>, options?: TransformOptions): SmartDuplex;
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
import { Transform } from 'stream';
|
|
2
|
+
import { SmartDuplex } from './smartstream.classes.smartduplex.js';
|
|
2
3
|
export function createTransformFunction(asyncFunction, options) {
|
|
3
|
-
const
|
|
4
|
+
const smartDuplexStream = new SmartDuplex({
|
|
4
5
|
...options,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const transformed = await asyncFunction(chunk);
|
|
9
|
-
this.push(transformed);
|
|
10
|
-
callback();
|
|
11
|
-
}
|
|
12
|
-
catch (error) {
|
|
13
|
-
callback(error instanceof Error ? error : new Error(String(error)));
|
|
14
|
-
}
|
|
6
|
+
writeFunction: async (chunkArg, toolsArg) => {
|
|
7
|
+
const result = await asyncFunction(chunkArg);
|
|
8
|
+
return result;
|
|
15
9
|
}
|
|
16
10
|
});
|
|
17
|
-
return
|
|
11
|
+
return smartDuplexStream;
|
|
18
12
|
}
|
|
19
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
13
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJlYW0uZnVuY3Rpb25zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzdHJlYW0uZnVuY3Rpb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQWlELE1BQU0sUUFBUSxDQUFDO0FBQ2xGLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxzQ0FBc0MsQ0FBQztBQU1uRSxNQUFNLFVBQVUsdUJBQXVCLENBQ3JDLGFBQXNELEVBQ3RELE9BQTBCO0lBRTFCLE1BQU0saUJBQWlCLEdBQUcsSUFBSSxXQUFXLENBQUM7UUFDeEMsR0FBRyxPQUFPO1FBQ1YsYUFBYSxFQUFFLEtBQUssRUFBRSxRQUFRLEVBQUUsUUFBUSxFQUFFLEVBQUU7WUFDMUMsTUFBTSxNQUFNLEdBQUcsTUFBTSxhQUFhLENBQUMsUUFBUSxDQUFDLENBQUM7WUFDN0MsT0FBTyxNQUFNLENBQUM7UUFDaEIsQ0FBQztLQUNGLENBQUMsQ0FBQTtJQUVGLE9BQU8saUJBQWlCLENBQUM7QUFDM0IsQ0FBQyJ9
|
package/package.json
CHANGED
package/ts/00_commitinfo_data.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Transform, type TransformCallback, type TransformOptions } from 'stream';
|
|
2
|
+
import { SmartDuplex } from './smartstream.classes.smartduplex.js';
|
|
2
3
|
|
|
3
4
|
export interface AsyncTransformFunction<TInput, TOutput> {
|
|
4
5
|
(chunkArg: TInput): Promise<TOutput>;
|
|
@@ -7,20 +8,14 @@ export interface AsyncTransformFunction<TInput, TOutput> {
|
|
|
7
8
|
export function createTransformFunction<TInput, TOutput>(
|
|
8
9
|
asyncFunction: AsyncTransformFunction<TInput, TOutput>,
|
|
9
10
|
options?: TransformOptions
|
|
10
|
-
):
|
|
11
|
-
const
|
|
11
|
+
): SmartDuplex {
|
|
12
|
+
const smartDuplexStream = new SmartDuplex({
|
|
12
13
|
...options,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const transformed = await asyncFunction(chunk);
|
|
17
|
-
this.push(transformed);
|
|
18
|
-
callback();
|
|
19
|
-
} catch (error) {
|
|
20
|
-
callback(error instanceof Error ? error : new Error(String(error)));
|
|
21
|
-
}
|
|
14
|
+
writeFunction: async (chunkArg, toolsArg) => {
|
|
15
|
+
const result = await asyncFunction(chunkArg);
|
|
16
|
+
return result;
|
|
22
17
|
}
|
|
23
|
-
})
|
|
18
|
+
})
|
|
24
19
|
|
|
25
|
-
return
|
|
20
|
+
return smartDuplexStream;
|
|
26
21
|
}
|