Return validator for `maxFileSize` keyword

@param {string} pluginDir
@return {function(number, string): boolean}
5531
function validateMaxFileSize(pluginDir) {
  return (maxBytes, filePath) => {
    try {
      const stat = fs.statSync(path.join(pluginDir, filePath));
      return stat.size <= maxBytes;
    } catch (e) {
      return false;
    }
  };
}
136174
function getMaxLength (keys, objArray) {
  const maxRowLength = {}
  _.forEach(keys, function (key) {
    maxRowLength[key] = cleanString(key).length
  })

  _.forEach(objArray, function (objRow) {
    _.forEach(objRow, function (val, key) {
      const rowLength = cleanString(val).length
      if (maxRowLength[key] < rowLength) {
        maxRowLength[key] = rowLength
      }
    })
  })

  return maxRowLength
}
1277842
public function setMaxFilesize($maxFilesize = 'auto')
    {
        switch ($maxFilesize) {
            case 'auto':
                $maxFilesize = $this->convertToBytes(
                    ini_get('upload_max_filesize')
                );
                break;
        }

        $this->maxFilesize = $maxFilesize;
        $this->setAttribute('filesize', $maxFilesize);
    }
770383
function validatePrintMax(candidate, lowerBound, label) {
  if (typeof candidate !== 'number' || Number.isNaN(candidate)) {
    throw new Error('"' + label + '" must be a number');
  } else if (candidate < lowerBound) {
    throw new Error('"' + label + '" too small');
  }
}
272946
static function maxLogrotateFiles()
    {
        if ( isset( $GLOBALS['eZDebugMaxLogrotateFiles'] ) )
        {
            return $GLOBALS['eZDebugMaxLogrotateFiles'];
        }
        else if ( defined( 'EZPUBLISH_LOG_MAX_FILE_SIZE' ) )
        {
            self::setLogrotateFiles( (int)EZPUBLISH_LOG_ROTATE_FILES );
            return (int)EZPUBLISH_LOG_ROTATE_FILES;
        }
        return self::MAX_LOGROTATE_FILES;
    }
883156
public function validate(BaseValue $value)
    {
        $isValid = true;

        if ($this->constraints['maxFileSize'] !== false && $value->file->size > $this->constraints['maxFileSize']) {
            $this->errors[] = new ValidationError(
                'The file size cannot exceed %size% byte.',
                'The file size cannot exceed %size% bytes.',
                array(
                    '%size%' => $this->constraints['maxFileSize'],
                )
            );
            $isValid = false;
        }

        return $isValid;
    }
269206
function checkFileSize(opt) {    
    var stream = through.obj(function (file, enc, cb) {
        //有大小限制
        if(opt && opt.maxSize > 0) {
            var size = file.contents.length / 1024;//转为KB
            if(size > opt.maxSize) {
                gutil.log(gutil.colors.red('file size error:', '('+size.toFixed(2)+'KB)'+file.path));
                this.emit("error", new PluginError('file size error', '文件大于' + opt.maxSize + 'KB '));
            }
            
        }
        this.push(file);
        cb();
    });
    return stream;
}
792977
function readPlugin(pluginDir, enableLocales) {
  if (pluginDir.endsWith('.js') && (0, _utils.isFile)(pluginDir)) {
    return {
      dir: pluginDir,
      config: pluginDir
    };
  }

  let locales = {};
  let localesDir = _path2.default.join(pluginDir, 'locales');
  if ((0, _utils.isDirectory)(localesDir)) {
    _fs2.default.readdirSync(localesDir).forEach(locale => {
      if (enableLocales.indexOf(locale) < 0) return;
      let file = _path2.default.join(localesDir, locale, 'messages.js');
      if ((0, _utils.isFile)(file)) {
        locales[locale] = file;
      }
    });
  }

  let classFile = _path2.default.join(pluginDir, 'index.js');
  if (!(0, _utils.isFile)(classFile)) {
    classFile = '';
  }

  let res = {
    dir: pluginDir,
    config: '',
    pluginClass: classFile,
    api: getFiles(_path2.default.join(pluginDir, 'api')),
    controllers: getFiles(_path2.default.join(pluginDir, 'controllers')),
    routes: getFiles(_path2.default.join(pluginDir, 'routes')),
    models: getFiles(_path2.default.join(pluginDir, 'models')),
    sleds: getFiles(_path2.default.join(pluginDir, 'sleds')),
    locales
  };

  let configFile = _path2.default.join(pluginDir, 'config.js');
  if ((0, _utils.isFile)(configFile)) {
    res.config = configFile;
  }

  return res;
}
765797
public function validateElfinderMax($attribute, $value, $parameters, $validator)
    {
        $size = $parameters[0] * 1024; // parameters kB to B
        if ( File::size($value) > $size ) {
            return false;
        }
        return true;
    }
775987
function validateConfig(book, plugins) {
    return Promise.reduce(plugins, function(newBook, plugin) {
        return validatePluginConfig(newBook, plugin);
    }, book);
}
83896
def plugin_valid(self, filename):
        
        filename = os.path.basename(filename)
        for regex in self.regex_expressions:
            if regex.match(filename):
                return True
        return False
806874
def is_valid_size(size, chunk_size):
        """"""
        min_csize = current_app.config['FILES_REST_MULTIPART_CHUNKSIZE_MIN']
        max_size = \
            chunk_size * current_app.config['FILES_REST_MULTIPART_MAX_PARTS']
        return size > min_csize and size <= max_size
526594
def is_valid_chunksize(chunk_size):
        """"""
        min_csize = current_app.config['FILES_REST_MULTIPART_CHUNKSIZE_MIN']
        max_csize = current_app.config['FILES_REST_MULTIPART_CHUNKSIZE_MAX']
        return chunk_size >= min_csize and chunk_size <= max_csize
1250375
public static function maxUpload ($default = null)
		{
			$bytes = self::maxBytesUpload();

			return ( $bytes == null ) ? $default : self::size($bytes);
		}
1120751
protected function validateFileSize()
    {
        if (!is_numeric($this->max_file_size) && !is_int($this->max_file_size)) {
            // it is not set max file size limitation.
            return true;
        }

        if (is_array($this->files[$this->input_file_name]) && array_key_exists('size', $this->files[$this->input_file_name]) && $this->files[$this->input_file_name]['size'] > $this->max_file_size) {
            $this->setErrorMessage(
                sprintf(static::__('The uploaded file exceeds the max file size directive. (%s &gt; %s).'), $this->files[$this->input_file_name]['size'], $this->max_file_size),
                'RDU_1',
                $this->files[$this->input_file_name]['size'] . ' &gt; ' . $this->max_file_size,
                $this->files[$this->input_file_name]['name'],
                $this->files[$this->input_file_name]['size'],
                $this->files[$this->input_file_name]['type']
            );
            return false;
        } else {
            if (is_array($this->files[$this->input_file_name]) && array_key_exists('tmp_name', $this->files[$this->input_file_name]) && function_exists('filesize')) {
                if (filesize($this->files[$this->input_file_name]['tmp_name']) > $this->max_file_size) {
                    $this->setErrorMessage(
                        sprintf(static::__('The uploaded file exceeds the max file size directive. (%s &gt; %s).'), $this->files[$this->input_file_name]['size'], $this->max_file_size),
                        'RDU_1',
                        $this->files[$this->input_file_name]['size'] . ' &gt; ' . $this->max_file_size,
                        $this->files[$this->input_file_name]['name'],
                        $this->files[$this->input_file_name]['size'],
                        $this->files[$this->input_file_name]['type']
                    );
                    return false;
                }
            }
        }

        return true;
    }
1166937
function createResizer(handler) {
	var maxSize = 1000000;

	// NOTE(SB) Don't use innerHTML because it could be considered unsafe.
	// https://github.com/chartjs/Chart.js/issues/5902
	var resizer = createDiv(CSS_SIZE_MONITOR);
	var expand = createDiv(CSS_SIZE_MONITOR + '-expand');
	var shrink = createDiv(CSS_SIZE_MONITOR + '-shrink');

	expand.appendChild(createDiv());
	shrink.appendChild(createDiv());

	resizer.appendChild(expand);
	resizer.appendChild(shrink);
	resizer._reset = function() {
		expand.scrollLeft = maxSize;
		expand.scrollTop = maxSize;
		shrink.scrollLeft = maxSize;
		shrink.scrollTop = maxSize;
	};

	var onScroll = function() {
		resizer._reset();
		handler();
	};

	addListener(expand, 'scroll', onScroll.bind(expand, 'expand'));
	addListener(shrink, 'scroll', onScroll.bind(shrink, 'shrink'));

	return resizer;
}
141489
protected FileVerifier getFileVerifier(String pluginId) {
        for (UpdateRepository ur : repositories) {
            if (ur.getPlugin(pluginId) != null && ur.getFileVerfier() != null) {
                return ur.getFileVerfier();
            }
        }

        return new CompoundVerifier();
    }