@robinpath/stream 0.1.0
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.
- package/README.md +96 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/stream.d.ts +178 -0
- package/dist/stream.d.ts.map +1 -0
- package/dist/stream.js +208 -0
- package/dist/stream.js.map +1 -0
- package/package.json +13 -0
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# @robinpath/stream
|
|
2
|
+
|
|
3
|
+
> Stream processing for large files: read, write, transform, filter, split, concat, hash without loading into memory
|
|
4
|
+
|
|
5
|
+
   
|
|
6
|
+
|
|
7
|
+
## Why use this module?
|
|
8
|
+
|
|
9
|
+
The `stream` module lets you:
|
|
10
|
+
|
|
11
|
+
- Read entire file content
|
|
12
|
+
- Write data to file
|
|
13
|
+
- Stream-copy a file
|
|
14
|
+
- Read file line by line into array
|
|
15
|
+
- Transform file line by line
|
|
16
|
+
|
|
17
|
+
All functions are callable directly from RobinPath scripts with a simple, consistent API.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @robinpath/stream
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
No credentials needed — start using it right away:
|
|
28
|
+
|
|
29
|
+
```robinpath
|
|
30
|
+
stream.writeFile "./out.txt" "hello"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Available Functions
|
|
34
|
+
|
|
35
|
+
| Function | Description |
|
|
36
|
+
|----------|-------------|
|
|
37
|
+
| `stream.readFile` | Read entire file content |
|
|
38
|
+
| `stream.writeFile` | Write data to file |
|
|
39
|
+
| `stream.copyFile` | Stream-copy a file |
|
|
40
|
+
| `stream.lines` | Read file line by line into array |
|
|
41
|
+
| `stream.transform` | Transform file line by line |
|
|
42
|
+
| `stream.filter` | Filter file lines by regex pattern |
|
|
43
|
+
| `stream.concat` | Concatenate multiple files |
|
|
44
|
+
| `stream.split` | Split file into chunks |
|
|
45
|
+
| `stream.count` | Count lines in file |
|
|
46
|
+
| `stream.head` | Read first N lines |
|
|
47
|
+
| `stream.tail` | Read last N lines |
|
|
48
|
+
| `stream.pipe` | Download URL to file via stream |
|
|
49
|
+
| `stream.hash` | Stream-hash a file |
|
|
50
|
+
|
|
51
|
+
## Examples
|
|
52
|
+
|
|
53
|
+
### Write data to file
|
|
54
|
+
|
|
55
|
+
```robinpath
|
|
56
|
+
stream.writeFile "./out.txt" "hello"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Stream-copy a file
|
|
60
|
+
|
|
61
|
+
```robinpath
|
|
62
|
+
stream.copyFile "./a.txt" "./b.txt"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Read file line by line into array
|
|
66
|
+
|
|
67
|
+
```robinpath
|
|
68
|
+
stream.lines "./data.csv"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Integration with RobinPath
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { RobinPath } from "@wiredwp/robinpath";
|
|
75
|
+
import Module from "@robinpath/stream";
|
|
76
|
+
|
|
77
|
+
const rp = new RobinPath();
|
|
78
|
+
rp.registerModule(Module.name, Module.functions);
|
|
79
|
+
rp.registerModuleMeta(Module.name, Module.functionMetadata);
|
|
80
|
+
|
|
81
|
+
const result = await rp.executeScript(`
|
|
82
|
+
stream.writeFile "./out.txt" "hello"
|
|
83
|
+
`);
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Full API Reference
|
|
87
|
+
|
|
88
|
+
See [MODULE.md](./MODULE.md) for complete documentation including all parameters, return types, error handling, and advanced examples.
|
|
89
|
+
|
|
90
|
+
## Related Modules
|
|
91
|
+
|
|
92
|
+
- [`@robinpath/json`](../json) — JSON module for complementary functionality
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ModuleAdapter } from "@wiredwp/robinpath";
|
|
2
|
+
declare const StreamModule: ModuleAdapter;
|
|
3
|
+
export default StreamModule;
|
|
4
|
+
export { StreamModule };
|
|
5
|
+
export { StreamFunctions, StreamFunctionMetadata, StreamModuleMetadata } from "./stream.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,QAAA,MAAM,YAAY,EAAE,aAA2K,CAAC;AAChM,eAAe,YAAY,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StreamFunctions, StreamFunctionMetadata, StreamModuleMetadata } from "./stream.js";
|
|
2
|
+
const StreamModule = { name: "stream", functions: StreamFunctions, functionMetadata: StreamFunctionMetadata, moduleMetadata: StreamModuleMetadata, global: false };
|
|
3
|
+
export default StreamModule;
|
|
4
|
+
export { StreamModule };
|
|
5
|
+
export { StreamFunctions, StreamFunctionMetadata, StreamModuleMetadata } from "./stream.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC5F,MAAM,YAAY,GAAkB,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,sBAA6B,EAAE,cAAc,EAAE,oBAA2B,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAChM,eAAe,YAAY,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/stream.d.ts
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import type { BuiltinHandler } from "@wiredwp/robinpath";
|
|
2
|
+
export declare const StreamFunctions: Record<string, BuiltinHandler>;
|
|
3
|
+
export declare const StreamFunctionMetadata: {
|
|
4
|
+
readFile: {
|
|
5
|
+
description: string;
|
|
6
|
+
parameters: {
|
|
7
|
+
name: string;
|
|
8
|
+
dataType: string;
|
|
9
|
+
description: string;
|
|
10
|
+
formInputType: string;
|
|
11
|
+
required: boolean;
|
|
12
|
+
}[];
|
|
13
|
+
returnType: string;
|
|
14
|
+
returnDescription: string;
|
|
15
|
+
example: string;
|
|
16
|
+
};
|
|
17
|
+
writeFile: {
|
|
18
|
+
description: string;
|
|
19
|
+
parameters: {
|
|
20
|
+
name: string;
|
|
21
|
+
dataType: string;
|
|
22
|
+
description: string;
|
|
23
|
+
formInputType: string;
|
|
24
|
+
required: boolean;
|
|
25
|
+
}[];
|
|
26
|
+
returnType: string;
|
|
27
|
+
returnDescription: string;
|
|
28
|
+
example: string;
|
|
29
|
+
};
|
|
30
|
+
copyFile: {
|
|
31
|
+
description: string;
|
|
32
|
+
parameters: {
|
|
33
|
+
name: string;
|
|
34
|
+
dataType: string;
|
|
35
|
+
description: string;
|
|
36
|
+
formInputType: string;
|
|
37
|
+
required: boolean;
|
|
38
|
+
}[];
|
|
39
|
+
returnType: string;
|
|
40
|
+
returnDescription: string;
|
|
41
|
+
example: string;
|
|
42
|
+
};
|
|
43
|
+
lines: {
|
|
44
|
+
description: string;
|
|
45
|
+
parameters: {
|
|
46
|
+
name: string;
|
|
47
|
+
dataType: string;
|
|
48
|
+
description: string;
|
|
49
|
+
formInputType: string;
|
|
50
|
+
required: boolean;
|
|
51
|
+
}[];
|
|
52
|
+
returnType: string;
|
|
53
|
+
returnDescription: string;
|
|
54
|
+
example: string;
|
|
55
|
+
};
|
|
56
|
+
transform: {
|
|
57
|
+
description: string;
|
|
58
|
+
parameters: {
|
|
59
|
+
name: string;
|
|
60
|
+
dataType: string;
|
|
61
|
+
description: string;
|
|
62
|
+
formInputType: string;
|
|
63
|
+
required: boolean;
|
|
64
|
+
}[];
|
|
65
|
+
returnType: string;
|
|
66
|
+
returnDescription: string;
|
|
67
|
+
example: string;
|
|
68
|
+
};
|
|
69
|
+
filter: {
|
|
70
|
+
description: string;
|
|
71
|
+
parameters: {
|
|
72
|
+
name: string;
|
|
73
|
+
dataType: string;
|
|
74
|
+
description: string;
|
|
75
|
+
formInputType: string;
|
|
76
|
+
required: boolean;
|
|
77
|
+
}[];
|
|
78
|
+
returnType: string;
|
|
79
|
+
returnDescription: string;
|
|
80
|
+
example: string;
|
|
81
|
+
};
|
|
82
|
+
concat: {
|
|
83
|
+
description: string;
|
|
84
|
+
parameters: {
|
|
85
|
+
name: string;
|
|
86
|
+
dataType: string;
|
|
87
|
+
description: string;
|
|
88
|
+
formInputType: string;
|
|
89
|
+
required: boolean;
|
|
90
|
+
}[];
|
|
91
|
+
returnType: string;
|
|
92
|
+
returnDescription: string;
|
|
93
|
+
example: string;
|
|
94
|
+
};
|
|
95
|
+
split: {
|
|
96
|
+
description: string;
|
|
97
|
+
parameters: {
|
|
98
|
+
name: string;
|
|
99
|
+
dataType: string;
|
|
100
|
+
description: string;
|
|
101
|
+
formInputType: string;
|
|
102
|
+
required: boolean;
|
|
103
|
+
}[];
|
|
104
|
+
returnType: string;
|
|
105
|
+
returnDescription: string;
|
|
106
|
+
example: string;
|
|
107
|
+
};
|
|
108
|
+
count: {
|
|
109
|
+
description: string;
|
|
110
|
+
parameters: {
|
|
111
|
+
name: string;
|
|
112
|
+
dataType: string;
|
|
113
|
+
description: string;
|
|
114
|
+
formInputType: string;
|
|
115
|
+
required: boolean;
|
|
116
|
+
}[];
|
|
117
|
+
returnType: string;
|
|
118
|
+
returnDescription: string;
|
|
119
|
+
example: string;
|
|
120
|
+
};
|
|
121
|
+
head: {
|
|
122
|
+
description: string;
|
|
123
|
+
parameters: {
|
|
124
|
+
name: string;
|
|
125
|
+
dataType: string;
|
|
126
|
+
description: string;
|
|
127
|
+
formInputType: string;
|
|
128
|
+
required: boolean;
|
|
129
|
+
}[];
|
|
130
|
+
returnType: string;
|
|
131
|
+
returnDescription: string;
|
|
132
|
+
example: string;
|
|
133
|
+
};
|
|
134
|
+
tail: {
|
|
135
|
+
description: string;
|
|
136
|
+
parameters: {
|
|
137
|
+
name: string;
|
|
138
|
+
dataType: string;
|
|
139
|
+
description: string;
|
|
140
|
+
formInputType: string;
|
|
141
|
+
required: boolean;
|
|
142
|
+
}[];
|
|
143
|
+
returnType: string;
|
|
144
|
+
returnDescription: string;
|
|
145
|
+
example: string;
|
|
146
|
+
};
|
|
147
|
+
pipe: {
|
|
148
|
+
description: string;
|
|
149
|
+
parameters: {
|
|
150
|
+
name: string;
|
|
151
|
+
dataType: string;
|
|
152
|
+
description: string;
|
|
153
|
+
formInputType: string;
|
|
154
|
+
required: boolean;
|
|
155
|
+
}[];
|
|
156
|
+
returnType: string;
|
|
157
|
+
returnDescription: string;
|
|
158
|
+
example: string;
|
|
159
|
+
};
|
|
160
|
+
hash: {
|
|
161
|
+
description: string;
|
|
162
|
+
parameters: {
|
|
163
|
+
name: string;
|
|
164
|
+
dataType: string;
|
|
165
|
+
description: string;
|
|
166
|
+
formInputType: string;
|
|
167
|
+
required: boolean;
|
|
168
|
+
}[];
|
|
169
|
+
returnType: string;
|
|
170
|
+
returnDescription: string;
|
|
171
|
+
example: string;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
export declare const StreamModuleMetadata: {
|
|
175
|
+
description: string;
|
|
176
|
+
methods: string[];
|
|
177
|
+
};
|
|
178
|
+
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAA2C,MAAM,oBAAoB,CAAC;AAsMlG,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAE1D,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAclC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;CAGhC,CAAC"}
|
package/dist/stream.js
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { createReadStream, createWriteStream, readFileSync, writeFileSync, statSync } from "node:fs";
|
|
2
|
+
import { pipeline as pipelineAsync } from "node:stream/promises";
|
|
3
|
+
import { Transform } from "node:stream";
|
|
4
|
+
import { createHash } from "node:crypto";
|
|
5
|
+
import { createInterface } from "node:readline";
|
|
6
|
+
import { join, dirname } from "node:path";
|
|
7
|
+
import { mkdirSync } from "node:fs";
|
|
8
|
+
const readFile = (args) => {
|
|
9
|
+
const filePath = String(args[0] ?? "");
|
|
10
|
+
const opts = (typeof args[1] === "object" && args[1] !== null ? args[1] : {});
|
|
11
|
+
const encoding = String(opts.encoding ?? "utf-8");
|
|
12
|
+
return readFileSync(filePath, { encoding });
|
|
13
|
+
};
|
|
14
|
+
const writeFile = (args) => {
|
|
15
|
+
const filePath = String(args[0] ?? "");
|
|
16
|
+
const data = String(args[1] ?? "");
|
|
17
|
+
const opts = (typeof args[1] === "object" && args[1] !== null ? args[1] : {});
|
|
18
|
+
const encoding = String(opts.encoding ?? "utf-8");
|
|
19
|
+
writeFileSync(filePath, typeof args[1] === "string" ? args[1] : data, { encoding });
|
|
20
|
+
return { path: filePath, size: statSync(filePath).size };
|
|
21
|
+
};
|
|
22
|
+
const copyFile = async (args) => {
|
|
23
|
+
const src = String(args[0] ?? "");
|
|
24
|
+
const dest = String(args[1] ?? "");
|
|
25
|
+
await pipelineAsync(createReadStream(src), createWriteStream(dest));
|
|
26
|
+
return { src, dest, size: statSync(dest).size };
|
|
27
|
+
};
|
|
28
|
+
const lines = async (args) => {
|
|
29
|
+
const filePath = String(args[0] ?? "");
|
|
30
|
+
const result = [];
|
|
31
|
+
const rl = createInterface({ input: createReadStream(filePath, { encoding: "utf-8" }), crlfDelay: Infinity });
|
|
32
|
+
for await (const line of rl)
|
|
33
|
+
result.push(line);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
const transform = async (args) => {
|
|
37
|
+
const inputPath = String(args[0] ?? "");
|
|
38
|
+
const outputPath = String(args[1] ?? "");
|
|
39
|
+
const transformType = String(args[2] ?? "trim");
|
|
40
|
+
const transformArgs = (typeof args[3] === "object" && args[3] !== null ? args[3] : {});
|
|
41
|
+
let lineCount = 0;
|
|
42
|
+
const transformer = new Transform({
|
|
43
|
+
transform(chunk, _encoding, callback) {
|
|
44
|
+
const text = chunk.toString();
|
|
45
|
+
const outputLines = text.split("\n").map((line) => {
|
|
46
|
+
lineCount++;
|
|
47
|
+
switch (transformType) {
|
|
48
|
+
case "uppercase": return line.toUpperCase();
|
|
49
|
+
case "lowercase": return line.toLowerCase();
|
|
50
|
+
case "trim": return line.trim();
|
|
51
|
+
case "prefix": return `${transformArgs.prefix ?? ""}${line}`;
|
|
52
|
+
case "suffix": return `${line}${transformArgs.suffix ?? ""}`;
|
|
53
|
+
case "replace": return line.replaceAll(String(transformArgs.search ?? ""), String(transformArgs.replace ?? ""));
|
|
54
|
+
default: return line;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
callback(null, outputLines.join("\n"));
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
await pipelineAsync(createReadStream(inputPath, { encoding: "utf-8" }), transformer, createWriteStream(outputPath));
|
|
61
|
+
return { inputPath, outputPath, linesProcessed: lineCount };
|
|
62
|
+
};
|
|
63
|
+
const filter = async (args) => {
|
|
64
|
+
const inputPath = String(args[0] ?? "");
|
|
65
|
+
const outputPath = String(args[1] ?? "");
|
|
66
|
+
const pattern = new RegExp(String(args[2] ?? ""));
|
|
67
|
+
let matched = 0;
|
|
68
|
+
let total = 0;
|
|
69
|
+
const filterer = new Transform({
|
|
70
|
+
transform(chunk, _encoding, callback) {
|
|
71
|
+
const lines = chunk.toString().split("\n");
|
|
72
|
+
const kept = [];
|
|
73
|
+
for (const line of lines) {
|
|
74
|
+
total++;
|
|
75
|
+
if (pattern.test(line)) {
|
|
76
|
+
kept.push(line);
|
|
77
|
+
matched++;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
callback(null, kept.join("\n"));
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
await pipelineAsync(createReadStream(inputPath, { encoding: "utf-8" }), filterer, createWriteStream(outputPath));
|
|
84
|
+
return { inputPath, outputPath, totalLines: total, matchedLines: matched };
|
|
85
|
+
};
|
|
86
|
+
const concat = async (args) => {
|
|
87
|
+
const inputPaths = (args[0] ?? []);
|
|
88
|
+
const outputPath = String(args[1] ?? "");
|
|
89
|
+
const out = createWriteStream(outputPath);
|
|
90
|
+
for (const p of inputPaths) {
|
|
91
|
+
await pipelineAsync(createReadStream(String(p)), out, { end: false });
|
|
92
|
+
}
|
|
93
|
+
out.end();
|
|
94
|
+
return { outputPath, filesConcatenated: inputPaths.length, size: statSync(outputPath).size };
|
|
95
|
+
};
|
|
96
|
+
const split = async (args) => {
|
|
97
|
+
const inputPath = String(args[0] ?? "");
|
|
98
|
+
const outputDir = String(args[1] ?? ".");
|
|
99
|
+
const linesPerChunk = Number(args[2] ?? 1000);
|
|
100
|
+
const outputFiles = [];
|
|
101
|
+
let chunkIndex = 0;
|
|
102
|
+
let lineCount = 0;
|
|
103
|
+
let currentOut = null;
|
|
104
|
+
const rl = createInterface({ input: createReadStream(inputPath, { encoding: "utf-8" }), crlfDelay: Infinity });
|
|
105
|
+
for await (const line of rl) {
|
|
106
|
+
if (lineCount % linesPerChunk === 0) {
|
|
107
|
+
if (currentOut)
|
|
108
|
+
currentOut.end();
|
|
109
|
+
const chunkPath = join(outputDir, `chunk_${String(chunkIndex).padStart(4, "0")}.txt`);
|
|
110
|
+
try {
|
|
111
|
+
mkdirSync(dirname(chunkPath), { recursive: true });
|
|
112
|
+
}
|
|
113
|
+
catch { }
|
|
114
|
+
currentOut = createWriteStream(chunkPath);
|
|
115
|
+
outputFiles.push(chunkPath);
|
|
116
|
+
chunkIndex++;
|
|
117
|
+
}
|
|
118
|
+
currentOut.write(line + "\n");
|
|
119
|
+
lineCount++;
|
|
120
|
+
}
|
|
121
|
+
if (currentOut)
|
|
122
|
+
currentOut.end();
|
|
123
|
+
return { outputFiles, totalLines: lineCount, chunks: chunkIndex };
|
|
124
|
+
};
|
|
125
|
+
const count = async (args) => {
|
|
126
|
+
const filePath = String(args[0] ?? "");
|
|
127
|
+
let lineCount = 0;
|
|
128
|
+
const rl = createInterface({ input: createReadStream(filePath, { encoding: "utf-8" }), crlfDelay: Infinity });
|
|
129
|
+
for await (const _ of rl)
|
|
130
|
+
lineCount++;
|
|
131
|
+
return lineCount;
|
|
132
|
+
};
|
|
133
|
+
const head = async (args) => {
|
|
134
|
+
const filePath = String(args[0] ?? "");
|
|
135
|
+
const n = Number(args[1] ?? 10);
|
|
136
|
+
const result = [];
|
|
137
|
+
const rl = createInterface({ input: createReadStream(filePath, { encoding: "utf-8" }), crlfDelay: Infinity });
|
|
138
|
+
for await (const line of rl) {
|
|
139
|
+
result.push(line);
|
|
140
|
+
if (result.length >= n)
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
rl.close();
|
|
144
|
+
return result.join("\n");
|
|
145
|
+
};
|
|
146
|
+
const tail = async (args) => {
|
|
147
|
+
const filePath = String(args[0] ?? "");
|
|
148
|
+
const n = Number(args[1] ?? 10);
|
|
149
|
+
const buffer = [];
|
|
150
|
+
const rl = createInterface({ input: createReadStream(filePath, { encoding: "utf-8" }), crlfDelay: Infinity });
|
|
151
|
+
for await (const line of rl) {
|
|
152
|
+
buffer.push(line);
|
|
153
|
+
if (buffer.length > n)
|
|
154
|
+
buffer.shift();
|
|
155
|
+
}
|
|
156
|
+
return buffer.join("\n");
|
|
157
|
+
};
|
|
158
|
+
const pipe = async (args) => {
|
|
159
|
+
const url = String(args[0] ?? "");
|
|
160
|
+
const outputPath = String(args[1] ?? "");
|
|
161
|
+
const opts = (typeof args[2] === "object" && args[2] !== null ? args[2] : {});
|
|
162
|
+
const headers = {};
|
|
163
|
+
if (typeof opts.headers === "object" && opts.headers !== null) {
|
|
164
|
+
for (const [k, v] of Object.entries(opts.headers))
|
|
165
|
+
headers[k] = String(v);
|
|
166
|
+
}
|
|
167
|
+
const response = await fetch(url, { headers });
|
|
168
|
+
if (!response.ok)
|
|
169
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
170
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
171
|
+
writeFileSync(outputPath, Buffer.from(arrayBuffer));
|
|
172
|
+
const size = statSync(outputPath).size;
|
|
173
|
+
return { path: outputPath, size };
|
|
174
|
+
};
|
|
175
|
+
const hash = async (args) => {
|
|
176
|
+
const filePath = String(args[0] ?? "");
|
|
177
|
+
const algorithm = String(args[1] ?? "sha256");
|
|
178
|
+
return new Promise((resolve, reject) => {
|
|
179
|
+
const h = createHash(algorithm);
|
|
180
|
+
const stream = createReadStream(filePath);
|
|
181
|
+
stream.on("data", (chunk) => h.update(chunk));
|
|
182
|
+
stream.on("end", () => resolve(h.digest("hex")));
|
|
183
|
+
stream.on("error", reject);
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
export const StreamFunctions = {
|
|
187
|
+
readFile, writeFile, copyFile, lines, transform, filter, concat, split, count, head, tail, pipe, hash,
|
|
188
|
+
};
|
|
189
|
+
export const StreamFunctionMetadata = {
|
|
190
|
+
readFile: { description: "Read entire file content", parameters: [{ name: "filePath", dataType: "string", description: "File path", formInputType: "text", required: true }, { name: "options", dataType: "object", description: "{encoding}", formInputType: "text", required: false }], returnType: "string", returnDescription: "File content", example: 'stream.readFile "./data.txt"' },
|
|
191
|
+
writeFile: { description: "Write data to file", parameters: [{ name: "filePath", dataType: "string", description: "File path", formInputType: "text", required: true }, { name: "data", dataType: "string", description: "Content to write", formInputType: "text", required: true }], returnType: "object", returnDescription: "{path, size}", example: 'stream.writeFile "./out.txt" "hello"' },
|
|
192
|
+
copyFile: { description: "Stream-copy a file", parameters: [{ name: "src", dataType: "string", description: "Source path", formInputType: "text", required: true }, { name: "dest", dataType: "string", description: "Destination path", formInputType: "text", required: true }], returnType: "object", returnDescription: "{src, dest, size}", example: 'stream.copyFile "./a.txt" "./b.txt"' },
|
|
193
|
+
lines: { description: "Read file line by line into array", parameters: [{ name: "filePath", dataType: "string", description: "File path", formInputType: "text", required: true }], returnType: "array", returnDescription: "Array of lines", example: 'stream.lines "./data.csv"' },
|
|
194
|
+
transform: { description: "Transform file line by line", parameters: [{ name: "inputPath", dataType: "string", description: "Input file", formInputType: "text", required: true }, { name: "outputPath", dataType: "string", description: "Output file", formInputType: "text", required: true }, { name: "type", dataType: "string", description: "uppercase|lowercase|trim|prefix|suffix|replace", formInputType: "text", required: true }, { name: "args", dataType: "object", description: "{prefix, suffix, search, replace}", formInputType: "text", required: false }], returnType: "object", returnDescription: "{inputPath, outputPath, linesProcessed}", example: 'stream.transform "./in.txt" "./out.txt" "uppercase"' },
|
|
195
|
+
filter: { description: "Filter file lines by regex pattern", parameters: [{ name: "inputPath", dataType: "string", description: "Input file", formInputType: "text", required: true }, { name: "outputPath", dataType: "string", description: "Output file", formInputType: "text", required: true }, { name: "pattern", dataType: "string", description: "Regex pattern", formInputType: "text", required: true }], returnType: "object", returnDescription: "{totalLines, matchedLines}", example: 'stream.filter "./log.txt" "./errors.txt" "ERROR"' },
|
|
196
|
+
concat: { description: "Concatenate multiple files", parameters: [{ name: "inputPaths", dataType: "array", description: "Array of file paths", formInputType: "text", required: true }, { name: "outputPath", dataType: "string", description: "Output file", formInputType: "text", required: true }], returnType: "object", returnDescription: "{outputPath, filesConcatenated, size}", example: 'stream.concat ["a.txt", "b.txt"] "merged.txt"' },
|
|
197
|
+
split: { description: "Split file into chunks", parameters: [{ name: "inputPath", dataType: "string", description: "Input file", formInputType: "text", required: true }, { name: "outputDir", dataType: "string", description: "Output directory", formInputType: "text", required: true }, { name: "linesPerChunk", dataType: "number", description: "Lines per chunk", formInputType: "text", required: false }], returnType: "object", returnDescription: "{outputFiles, totalLines, chunks}", example: 'stream.split "./big.csv" "./chunks" 1000' },
|
|
198
|
+
count: { description: "Count lines in file", parameters: [{ name: "filePath", dataType: "string", description: "File path", formInputType: "text", required: true }], returnType: "number", returnDescription: "Line count", example: 'stream.count "./data.txt"' },
|
|
199
|
+
head: { description: "Read first N lines", parameters: [{ name: "filePath", dataType: "string", description: "File path", formInputType: "text", required: true }, { name: "n", dataType: "number", description: "Number of lines (default 10)", formInputType: "text", required: false }], returnType: "string", returnDescription: "First N lines", example: 'stream.head "./data.txt" 20' },
|
|
200
|
+
tail: { description: "Read last N lines", parameters: [{ name: "filePath", dataType: "string", description: "File path", formInputType: "text", required: true }, { name: "n", dataType: "number", description: "Number of lines (default 10)", formInputType: "text", required: false }], returnType: "string", returnDescription: "Last N lines", example: 'stream.tail "./log.txt" 50' },
|
|
201
|
+
pipe: { description: "Download URL to file via stream", parameters: [{ name: "url", dataType: "string", description: "URL to download", formInputType: "text", required: true }, { name: "outputPath", dataType: "string", description: "Output file path", formInputType: "text", required: true }, { name: "options", dataType: "object", description: "{headers}", formInputType: "text", required: false }], returnType: "object", returnDescription: "{path, size}", example: 'stream.pipe "https://example.com/file.zip" "./file.zip"' },
|
|
202
|
+
hash: { description: "Stream-hash a file", parameters: [{ name: "filePath", dataType: "string", description: "File path", formInputType: "text", required: true }, { name: "algorithm", dataType: "string", description: "Hash algorithm (default sha256)", formInputType: "text", required: false }], returnType: "string", returnDescription: "Hex hash string", example: 'stream.hash "./data.bin" "sha256"' },
|
|
203
|
+
};
|
|
204
|
+
export const StreamModuleMetadata = {
|
|
205
|
+
description: "Stream processing for large files: read, write, transform, filter, split, concat, hash without loading into memory",
|
|
206
|
+
methods: ["readFile", "writeFile", "copyFile", "lines", "transform", "filter", "concat", "split", "count", "head", "tail", "pipe", "hash"],
|
|
207
|
+
};
|
|
208
|
+
//# sourceMappingURL=stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACrG,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAY,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,QAAQ,GAAmB,CAAC,IAAI,EAAE,EAAE;IACxC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACvC,MAAM,IAAI,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CA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F,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,WAAW,EAAE,oHAAoH;IACjI,OAAO,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;CAC3I,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@robinpath/stream",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"publishConfig": { "access": "public" },
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": { ".": { "import": "./dist/index.js", "types": "./dist/index.d.ts" } },
|
|
9
|
+
"files": ["dist"],
|
|
10
|
+
"scripts": { "build": "tsc", "test": "node --import tsx --test tests/*.test.ts" },
|
|
11
|
+
"peerDependencies": { "@wiredwp/robinpath": ">=0.20.0" },
|
|
12
|
+
"devDependencies": { "@wiredwp/robinpath": "^0.30.1", "tsx": "^4.19.0", "typescript": "^5.6.0" }
|
|
13
|
+
}
|