techendeavors/fileinfo

输入文件位置,获取类似其mimetype、哈希值、大小、创建和修改日期、符号链接链、权限和所有权等信息。

1.2.0 2018-07-12 19:40 UTC

This package is auto-updated.

Last update: 2024-09-13 11:14:55 UTC


README

包的非常简短的描述

Latest Version on Packagist Total Downloads

输入文件位置,获取类似其mimetype、哈希值、大小、创建和修改日期、符号链接链、权限和所有权等信息。

待办事项

开发流程

在包注册到 packagist.org 之前,您可以在本地使用它。首先,将以下内容添加到您的 .bashrc.bash_profile.zshrc

composer-link() {  
    composer config repositories.local '{"type": "path", "url": "'$1'"}' --file composer.json
}

然后,在 Laravel 安装文件夹中,运行 composer-link ../fileinfo,它将包信息添加到 composer.json 文件的仓库部分。然后运行 composer require techendeavors/fileinfo

您可以在 此处 找到更多信息。

安装

您可以通过 composer 安装此包

composer require techendeavors/fileinfo

使用

有用的文件输出

>>> $test = new FileInfo('/usr/bin/ffmpeg')
=> Techendeavors\FileInfo\FileInfo {#2855}
>>> $test->all()
=> Illuminate\Support\Collection {#2849
     all: [
       "query" => "/usr/bin/ffmpeg",
       "tests" => [
         "directory" => false,
         "executable" => true,
         "file" => true,
         "link" => false,
       ],
       "permissions" => [
         "readable" => true,
         "writable" => false,
         "user" => "root",
         "group" => "root",
         "octal" => "0755",
         "human" => "rwxr-xr-x",
       ],
       "info" => [
         "name" => "ffmpeg",
         "path" => "/usr/bin",
         "type" => "file",
         "mime" => "application/x-sharedlib",
       ],
       "size" => [
         "bytes" => 272528,
         "human" => "266.14KB",
       ],
       "hashes" => [
         "crc32" => "ec9b4c8f",
         "crc32b" => "b5be398b",
         "md5" => "7f7f8d7d5549ec1deabaff3f615f80ce",
         "ripemd256" => "8fc001f0f9395f14ceb652cdef4d4a54caa33dae549a002e95ad45c8365ff4cc",
         "sha1" => "f43e9bb580a156aa3f84ba15d6965ac23d86b5d0",
         "sha256" => "290bb7c6a8bfdd308b2a59c3fd8f3655aec224646a9f348920a81d492db85aef",
         "sha3-256" => "7ef630dda0bc7484f00cd7e9c4268ee3c886212121991c0e94ab49e0c799cdfb",
         "sha3-384" => "cfb8fba5ee465a81c6c0d9ba2171d248fa902ec0a288cfb284f319aa7bbe6e2310e2f33252596d78de5ef8e3af3c78ba",
         "sha3-512" => "3fceb5e875610d283d223e10f914af02a7d367247dd00e87dff33e61afa7364e814a84ce2b831d91042605051e1d2371a3004ba0ca5dbd804dd8cf6cf843eeeb",
         "sha384" => "8e8a8dbb4542f55152cf77ed44d304febdc3182a775e54238c5d85a942d30b226347475a148b36f2e7638fedd5b0dab6",
         "sha512" => "0f3a69a3dada9ac0f12111a9c6c901d29c17fc30510764278a3cb52c1c0b61f57ad33e9197dda5f673452105df9d117b3fb99c7feeb330ffc55dae893325f859",
       ],
       "events" => [
         "modified" => Carbon\Carbon @1523273080 {#2866
           date: 2018-04-09 11:24:40.0 UTC (+00:00),
         },
         "changed" => Carbon\Carbon @1526714923 {#2861
           date: 2018-05-19 07:28:43.0 UTC (+00:00),
         },
         "accessed" => Carbon\Carbon @1531345222 {#2856
           date: 2018-07-11 21:40:22.0 UTC (+00:00),
         },
       ],
     ],
   }

甚至可以与目录一起工作

>>> $test = new FileInfo('/usr/bin')
=> Techendeavors\FileInfo\FileInfo {#2864}
>>> $test->all()
=> Illuminate\Support\Collection {#2861
     all: [
       "query" => "/usr/bin",
       "tests" => [
         "directory" => true,
         "executable" => true,
         "file" => false,
         "link" => false,
       ],
       "permissions" => [
         "readable" => true,
         "writable" => false,
         "user" => "root",
         "group" => "root",
         "octal" => "755",
         "human" => "rwxr-xr-x",
       ],
       "info" => [
         "name" => "bin",
         "path" => "/usr",
         "type" => "dir",
         "mime" => "directory",
       ],
       "size" => [
         "bytes" => 980864346,
         "human" => "935.43MB",
       ],
       "hashes" => null,
       "events" => [
         "modified" => Carbon\Carbon @1531375218 {#2854
           date: 2018-07-12 06:00:18.0 UTC (+00:00),
         },
         "changed" => Carbon\Carbon @1531375218 {#2855
           date: 2018-07-12 06:00:18.0 UTC (+00:00),
         },
         "accessed" => Carbon\Carbon @1531375223 {#2849
           date: 2018-07-12 06:00:23.0 UTC (+00:00),
         },
       ],
     ],
   }
>>> 

测试

尚未实现

变更日志

请参阅 CHANGELOG 了解最近更改的详细信息。

贡献

请参阅 CONTRIBUTING 了解详细信息。

安全

如果您发现任何与安全相关的问题,请使用问题跟踪器

致谢

许可证

MIT许可证(MIT)。更多信息请参见许可证文件