Name of the model file
Model data as ArrayBuffer
True if size is within expected range
const response = await fetch('/models/u2net.onnx');
const modelData = await response.arrayBuffer();
const sizeValid = validateModelSize('u2net.onnx', modelData);
if (!sizeValid) {
console.error('Model file size is unexpected - may be corrupted');
return;
}
console.log('Model size validation passed');
Validate model data against known size constraints.
Checks if the model file size is within expected ranges. This helps detect corrupted downloads or incorrect model files. Returns true if no size constraints are configured for the model.