Snapshot the file selection before starting a batch
Accept a file selection into its own array before starting image-batch work. The input exposes a FileList; the array gives later work a list belonging to the accepted batch.
function takeSelection(input) {
const files = Array.from(input.files ?? []);
if (files.length === 0) return [];
return files;
}
This copies references into an array. It does not duplicate the bytes, validate the images or preserve files in permanent storage.
Pass that array to the job you start. Decide separately whether a later selection replaces the active job or creates another one. Reading the current input again at each processing step can make that policy unclear.
Keep output records paired with the accepted list. If the user selects more files while work is running, label them as another selection rather than silently mixing them into the earlier batch.
I work on Morphio, an image conversion project. This is a proposed way to define batch ownership. It does not describe the project's current implementation.
About the author
- I build Morphio, an online toolkit for working with image formats, including HEIC conversion. I share practical notes on image processing and web tools.
Comments
Join the discussionNo comments yet. Be the first to comment.