Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions lib/internal/streams/iter/pull.js
Original file line number Diff line number Diff line change
Expand Up @@ -794,11 +794,6 @@ function pull(source, ...args) {
function pipeToSync(source, ...args) {
const { transforms, writer, options } = parsePipeToArgs(args, 'writeSync');

// Handle transform-writer
if (isTransformObject(writer)) {
ArrayPrototypePush(transforms, writer);
}

// Normalize source and create pipeline
const normalized = fromSync(source);
const pipeline = transforms.length > 0 ?
Expand Down Expand Up @@ -852,11 +847,6 @@ async function pipeTo(source, ...args) {
validateAbortSignal(options.signal, 'options.signal');
}

// Handle transform-writer
if (isTransformObject(writer)) {
ArrayPrototypePush(transforms, writer);
}

const signal = options?.signal;

// Check for abort
Expand Down
27 changes: 27 additions & 0 deletions test/parallel/test-stream-iter-pipeto.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,31 @@ async function testPipeToSyncWithTransforms() {
assert.strictEqual(chunks.join(''), 'HELLO');
}

async function testPipeToWriterTransformMethodIgnored() {
const chunks = [];
const writer = {
transform: common.mustNotCall(),
write(chunk) { chunks.push(new TextDecoder().decode(chunk)); },
};

await pipeTo(from('hello'), writer);
assert.strictEqual(chunks.join(''), 'hello');
}

async function testPipeToSyncWriterTransformMethodIgnored() {
const chunks = [];
const writer = {
transform: common.mustNotCall(),
writeSync(chunk) {
chunks.push(new TextDecoder().decode(chunk));
return true;
},
};

pipeToSync(fromSync('hello'), writer);
assert.strictEqual(chunks.join(''), 'hello');
}

// PipeTo with writev writer
async function testPipeToWithWritevWriter() {
const allChunks = [];
Expand Down Expand Up @@ -301,6 +326,8 @@ Promise.all([
testPipeToWithSignal(),
testPipeToWithTransforms(),
testPipeToSyncWithTransforms(),
testPipeToWriterTransformMethodIgnored(),
testPipeToSyncWriterTransformMethodIgnored(),
testPipeToWithWritevWriter(),
testPipeToSyncFallback(),
testPipeToPreventFail(),
Expand Down
Loading