| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 24b7831 commit 557bf99
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -946,11 +946,6 @@ function pull(source, ...args) { | |||
| 946 | 946 | function pipeToSync(source, ...args) { | |
| 947 | 947 | const { transforms, writer, options } = parsePipeToArgs(args, 'writeSync'); | |
| 948 | 948 | ||
| 949 | - // Handle transform-writer | ||
| 950 | - if (isTransformObject(writer)) { | ||
| 951 | - ArrayPrototypePush(transforms, writer); | ||
| 952 | - } | ||
| 953 | - | ||
| 954 | 949 | // Normalize source and create pipeline | |
| 955 | 950 | const normalized = fromSync(source); | |
| 956 | 951 | const pipeline = transforms.length > 0 ? | |
@@ -1017,11 +1012,6 @@ async function pipeTo(source, ...args) { | |||
| 1017 | 1012 | validateAbortSignal(options.signal, 'options.signal'); | |
| 1018 | 1013 | } | |
| 1019 | 1014 | ||
| 1020 | - // Handle transform-writer | ||
| 1021 | - if (isTransformObject(writer)) { | ||
| 1022 | - ArrayPrototypePush(transforms, writer); | ||
| 1023 | - } | ||
| 1024 | - | ||
| 1025 | 1015 | const signal = options?.signal; | |
| 1026 | 1016 | ||
| 1027 | 1017 | // Check for abort | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -141,6 +141,31 @@ async function testPipeToSyncWithTransforms() { | |||
| 141 | 141 | assert.strictEqual(chunks.join(''), 'HELLO'); | |
| 142 | 142 | } | |
| 143 | 143 | ||
| 144 | + async function testPipeToWriterTransformMethodIgnored() { | ||
| 145 | + const chunks = []; | ||
| 146 | + const writer = { | ||
| 147 | + transform: common.mustNotCall(), | ||
| 148 | + write(chunk) { chunks.push(new TextDecoder().decode(chunk)); }, | ||
| 149 | + }; | ||
| 150 | + | ||
| 151 | + await pipeTo(from('hello'), writer); | ||
| 152 | + assert.strictEqual(chunks.join(''), 'hello'); | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + async function testPipeToSyncWriterTransformMethodIgnored() { | ||
| 156 | + const chunks = []; | ||
| 157 | + const writer = { | ||
| 158 | + transform: common.mustNotCall(), | ||
| 159 | + writeSync(chunk) { | ||
| 160 | + chunks.push(new TextDecoder().decode(chunk)); | ||
| 161 | + return true; | ||
| 162 | + }, | ||
| 163 | + }; | ||
| 164 | + | ||
| 165 | + pipeToSync(fromSync('hello'), writer); | ||
| 166 | + assert.strictEqual(chunks.join(''), 'hello'); | ||
| 167 | + } | ||
| 168 | + | ||
| 144 | 169 | // PipeTo with writev writer | |
| 145 | 170 | async function testPipeToWithWritevWriter() { | |
| 146 | 171 | const allChunks = []; | |
@@ -301,6 +326,8 @@ Promise.all([ | |||
| 301 | 326 | testPipeToWithSignal(), | |
| 302 | 327 | testPipeToWithTransforms(), | |
| 303 | 328 | testPipeToSyncWithTransforms(), | |
| 329 | + testPipeToWriterTransformMethodIgnored(), | ||
| 330 | + testPipeToSyncWriterTransformMethodIgnored(), | ||
| 304 | 331 | testPipeToWithWritevWriter(), | |
| 305 | 332 | testPipeToSyncFallback(), | |
| 306 | 333 | testPipeToPreventFail(), | |
| Back | FazBrowse Home | New Git URL |
0 commit comments