Function isLt1M

Checks if the given file size is less than 1 MB.

This function helps enforce stricter size limits, useful for scenarios where smaller file sizes are required.

const fileSize = 0.8 * 1024 * 1024; // 0.8 MB in bytes
console.log(isLt1M(fileSize)); // true

const largeFileSize = 1.2 * 1024 * 1024; // 1.2 MB in bytes
console.log(isLt1M(largeFileSize)); // false
  • Parameters

    • size: number

      The size of the file in bytes.

    Returns boolean

    true if the file size is less than 1 MB, otherwise false.