no message

This commit is contained in:
kuaifan 2025-02-24 00:01:47 +08:00
parent 3f56c64086
commit 80bbe6711c
2 changed files with 280 additions and 275 deletions

View File

@ -157,13 +157,17 @@ class TextExtractor
/**
* 获取文件内容
* @param $filePath
* @param float|int $maxSize 最大文件大小单位字节默认300KB
* @return string
*/
public static function getFileContent($filePath)
public static function getFileContent($filePath, float|int $maxSize = 300 * 1024)
{
if (!file_exists($filePath) || !is_file($filePath)) {
return "(Failed to read contents of {$filePath})";
}
if (filesize($filePath) > $maxSize) {
return "(File size exceeds " . Base::readableBytes($maxSize) . ", unable to display content)";
}
$te = new self();
try {
$isBinary = $te->isBinaryFile($filePath);

549
composer.lock generated

File diff suppressed because it is too large Load Diff