From 50505cc6f862d210757b76f9a9d1eb067c7b1b9d Mon Sep 17 00:00:00 2001 From: cherenkov Date: Mon, 12 Oct 2026 10:16:23 +0900 Subject: [PATCH] Ensure sequentialRead option is honoured --- src/common.cc | 2 +- test/unit/io.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/common.cc b/src/common.cc index b8978772b..8de7d1232 100644 --- a/src/common.cc +++ b/src/common.cc @@ -198,7 +198,7 @@ namespace sharp { } descriptor->limitInputPixels = static_cast(AttrAsInt64(input, "limitInputPixels")); descriptor->limitInputChannels = static_cast(AttrAsInt64(input, "limitInputChannels")); - if (HasAttr(input, "access")) { + if (HasAttr(input, "sequentialRead")) { descriptor->access = AttrAsBool(input, "sequentialRead") ? VIPS_ACCESS_SEQUENTIAL : VIPS_ACCESS_RANDOM; } // Remove safety features and allow unlimited input diff --git a/test/unit/io.js b/test/unit/io.js index ad5fd55c1..53f91b8ea 100644 --- a/test/unit/io.js +++ b/test/unit/io.js @@ -494,6 +494,17 @@ suite('Input/output', () => { t.assert.strictEqual(info.height, 240); }); + test('Sequential read option controls access method', async (t) => { + t.plan(2); + for (const sequentialRead of [true, false]) { + const outputV = fixtures.path(`output.sequential-read-${sequentialRead}.v`); + await sharp(fixtures.inputJpg, { sequentialRead }).toFile(outputV); + const contents = await fs.readFile(outputV, 'latin1'); + t.assert.strictEqual(contents.includes('vips-sequential'), sequentialRead); + await fs.rm(outputV); + } + }); + test('Support output to jpg format', async (t) => { t.plan(5); const { data, info } = await sharp(fixtures.inputPng)