14 lines
353 B
TypeScript
14 lines
353 B
TypeScript
export function isWebFileLike(value: FormDataEntryValue | null | undefined): value is File {
|
|
if (!value || typeof value !== 'object') {
|
|
return false
|
|
}
|
|
|
|
const candidate = value as Partial<File>
|
|
|
|
return (
|
|
typeof candidate.arrayBuffer === 'function' &&
|
|
typeof candidate.name === 'string' &&
|
|
typeof candidate.size === 'number'
|
|
)
|
|
}
|