Skip to content
This repository has been archived by the owner on Oct 20, 2021. It is now read-only.

Latest commit

 

History

History
32 lines (25 loc) · 603 Bytes

size.md

File metadata and controls

32 lines (25 loc) · 603 Bytes

Size

Validates sizes.

Valid values:

validator.size('5mb', '20mb').validate('10mb');
validator.size().validate('file path');
validator.size('5mb').validate('file path with greather 5mb');
validator.size('5mb').validate(fs.statSync('file path with greather 5mb'));

Invalid values:

validator.size('5mb', '20mb').validate('30mb');
validator.size('5mb').validate('file path with length less 5mb');
validator.size('5mb').validate(fs.statSync('file path with length less 5mb'));

Sizes are not case-sensitive and the accepted values are:

  • B
  • KB
  • MB
  • GB
  • TB
  • PB
  • EB
  • ZB
  • YB