mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 19:35:50 +00:00
no message
This commit is contained in:
parent
3f56c64086
commit
80bbe6711c
@ -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
549
composer.lock
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user