GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — stream: remove transform-writer handling in pipeTo · nodejs/node@557bf99

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/streams/iter
    • pull.js
  • test/parallel
    • test-stream-iter-pipeto.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/streams/iter/pull.js‎

Copy file name to clipboardExpand all lines: lib/internal/streams/iter/pull.js
-10Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -946,11 +946,6 @@ function pull(source, ...args) {
946946
function pipeToSync(source, ...args) {
947947
const { transforms, writer, options } = parsePipeToArgs(args, 'writeSync');
948948

949-
// Handle transform-writer
950-
if (isTransformObject(writer)) {
951-
ArrayPrototypePush(transforms, writer);
952-
}
953-
954949
// Normalize source and create pipeline
955950
const normalized = fromSync(source);
956951
const pipeline = transforms.length > 0 ?
@@ -1017,11 +1012,6 @@ async function pipeTo(source, ...args) {
10171012
validateAbortSignal(options.signal, 'options.signal');
10181013
}
10191014

1020-
// Handle transform-writer
1021-
if (isTransformObject(writer)) {
1022-
ArrayPrototypePush(transforms, writer);
1023-
}
1024-
10251015
const signal = options?.signal;
10261016

10271017
// Check for abort
Collapse file

‎test/parallel/test-stream-iter-pipeto.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-stream-iter-pipeto.js
+27Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,31 @@ async function testPipeToSyncWithTransforms() {
141141
assert.strictEqual(chunks.join(''), 'HELLO');
142142
}
143143

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+
144169
// PipeTo with writev writer
145170
async function testPipeToWithWritevWriter() {
146171
const allChunks = [];
@@ -301,6 +326,8 @@ Promise.all([
301326
testPipeToWithSignal(),
302327
testPipeToWithTransforms(),
303328
testPipeToSyncWithTransforms(),
329+
testPipeToWriterTransformMethodIgnored(),
330+
testPipeToSyncWriterTransformMethodIgnored(),
304331
testPipeToWithWritevWriter(),
305332
testPipeToSyncFallback(),
306333
testPipeToPreventFail(),

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.