Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ namespace sharp {
}
descriptor->limitInputPixels = static_cast<uint64_t>(AttrAsInt64(input, "limitInputPixels"));
descriptor->limitInputChannels = static_cast<uint64_t>(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
Expand Down
11 changes: 11 additions & 0 deletions test/unit/io.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading