1- # merge-streams
1+ # @ bitofsky/ merge-streams
22
33** When Databricks gives you 90+ presigned URLs, merge them into one.**
44
@@ -61,7 +61,7 @@ Now my MCP client gets one URL. Done.
6161## Installation
6262
6363``` bash
64- npm install merge-streams
64+ npm install @bitofsky/ merge-streams
6565```
6666
6767Requires Node.js 18+ (uses native ` fetch() ` and ` Readable.fromWeb() ` )
@@ -87,7 +87,7 @@ npm test -- test/databricks.spec.ts
8787### URL-based (for Databricks External Links)
8888
8989``` ts
90- import { mergeStreamsFromUrls } from ' merge-streams'
90+ import { mergeStreamsFromUrls } from ' @bitofsky/ merge-streams'
9191
9292await mergeStreamsFromUrls (' CSV' , urls , outputStream )
9393await mergeStreamsFromUrls (' JSON_ARRAY' , urls , outputStream )
@@ -109,19 +109,39 @@ controller.abort()
109109
110110## Format Details
111111
112- | Format | Databricks name | Behavior |
113- | --------| ---------------- | ---------- |
114- | CSV | ` CSV ` | Writes header once, skips duplicate headers from subsequent chunks |
115- | JSON_ARRAY | ` JSON_ARRAY ` | Wraps in ` [] ` , strips brackets from chunks, inserts commas |
116- | ARROW_STREAM | ` ARROW_STREAM ` | Re-encodes RecordBatches into single IPC stream (not byte-concat) |
112+ | Format | Behavior |
113+ | --------| ----------|
114+ | ` CSV ` | Writes header once, skips duplicate headers from subsequent chunks |
115+ | ` JSON_ARRAY ` | Wraps in ` [] ` , strips brackets from chunks, inserts commas |
116+ | ` ARROW_STREAM ` | Re-encodes RecordBatches into single IPC stream (not byte-concat) |
117117
118118---
119119
120120## Types
121121
122122``` ts
123- type InputSource = Readable | (() => Readable ) | (() => Promise <Readable >)
123+ import { Readable , Writable } from ' node:stream'
124+
124125type MergeFormat = ' ARROW_STREAM' | ' CSV' | ' JSON_ARRAY'
126+ type InputSource = Readable | (() => Readable ) | (() => Promise <Readable >)
127+
128+ interface MergeStreamsOptions {
129+ signal? : AbortSignal
130+ }
131+
132+ function mergeStreams(
133+ format : MergeFormat ,
134+ inputs : InputSource [],
135+ output : Writable ,
136+ options ? : MergeStreamsOptions
137+ ): Promise <void >
138+
139+ function mergeStreamsFromUrls(
140+ format : MergeFormat ,
141+ urls : string [],
142+ output : Writable ,
143+ options ? : MergeStreamsOptions
144+ ): Promise <void >
125145```
126146
127147-- -
0 commit comments