joi-filesize-extensions
Joi extensions for file size.
Lead Maintainer: Tom Yam
File sizes are parsed with patrickkettner/filesize-parser. All issues regarding parsing should be opened there.
Usage
Usage is a two steps process. First, a schema is constructed using the provided types and constraints:
const BaseJoi = ;const Extension = ;const Joi = BaseJoi; // By default all units (KB and KiB) are base 10Joivalue // 1000Joivalue // 1000 // Units can also be base 2Joivalue // 1024Joivalue // 1024 // Or size 10 explicitlyJoivalue // 1000Joivalue // 1000 // If value cannot be parsed it's an errorJoierrormessage // "value" must be a valid file size'
API
See the API Reference.
Based on hapijs/joi-date-extensions