Validation API

isFile()

Validates that the passed arguments are instanceof File.

  • Accepts any arguments.
  • Returns true if all provided arguments pass the validation, otherwise, returns false.
Example:
isFile(new File(['content'], 'file.txt'));
isFile(new File(['data'], 'file.json', {type: 'application/json'}), new File([], 'file.txt'));
// true

isFile(null);
isFile({});
isFile(new Blob(['content'], {type: 'text/plain'}));
isFile(new File(['data'], 'file.txt'), 'not-a-file');
// false