{"id":16654162,"url":"https://github.com/letmefly666/multifiles","last_synced_at":"2025-09-01T05:35:33.745Z","repository":{"id":210006815,"uuid":"725153240","full_name":"LetMeFly666/MultiFiles","owner":"LetMeFly666","description":"机械磁盘上的大量小文件读/复制操作？太慢了怎么办？","archived":false,"fork":false,"pushed_at":"2023-12-03T08:43:40.000Z","size":56,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-19T04:46:40.417Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LetMeFly666.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-29T14:49:05.000Z","updated_at":"2023-11-30T07:53:17.000Z","dependencies_parsed_at":"2024-11-18T08:44:33.231Z","dependency_job_id":null,"html_url":"https://github.com/LetMeFly666/MultiFiles","commit_stats":null,"previous_names":["letmefly666/multifiles"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/LetMeFly666/MultiFiles","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LetMeFly666%2FMultiFiles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LetMeFly666%2FMultiFiles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LetMeFly666%2FMultiFiles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LetMeFly666%2FMultiFiles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LetMeFly666","download_url":"https://codeload.github.com/LetMeFly666/MultiFiles/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LetMeFly666%2FMultiFiles/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273077227,"owners_count":25041358,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T09:48:55.253Z","updated_at":"2025-09-01T05:35:33.702Z","avatar_url":"https://github.com/LetMeFly666.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\n * @Author: LetMeFly\n * @Date: 2023-11-29 22:49:31\n * @LastEditors: LetMeFly\n * @LastEditTime: 2023-12-03 16:42:51\n--\u003e\n# MultiFiles\n\n机械磁盘上的大量小文件读/复制操作？太慢了怎么办？\n\n**合并小文件：** 如果你在开发一款产品，这个产品中有大量的只读小文件（例如node项目），那么你可以调用MultiFiles库，将你认为的小文件全部打包到一起。这样，文件传输/解压安装的效率会大幅度提升。\n\n**读取小文件：** 在需要读取文件时，调用MultiFiles库，避免了多次大量的IO操作。\n\n## 使用方法\n\nVisualStudio项目解决方案在```MultiFiles/MultiFiles.sln```。启动后将```MultiFiles_MergerByCPP```设置为启动项目，编译运行即可（第一次编译运行可能会失败，因为要先生成.dll和.lib文件，失败了就再编译一次就能成功了）。\n\n**合并小文件：** 调用```MultiFiles.dll```的```MultiFilesMerger```类的```merge```方法。\n\n参数：\n\n+ vector\u003cstring\u003e\u0026 toGenFiles：一个要合并的小文件的 文件名数组\n+ string toGenFileName（可选）：合并后的文件名\n+ string infoFileName（可选）：合并信息的文件名\n\n返回：\n\n+ None\n\n**读取小文件：** 调用```MultiFiles.dll```的```MultiFilesReader```类的```read```方法。\n\n类```MultiFilesReader```构造函数的参数：\n\n+ string mergedFileName（可选）：合并后的文件名\n+ string infoFileName（可选）：合并信息的文件名\n\n方法```read```的参数：\n\n+ string toReadFileName：要读取的文件的文件名\n\n方法```read```的返回值：\n\n+ string：该文件的内容（当无此文件时返回空字符串）\n\n## TODO\n\n后续计划：\n\n- [ ] 自动选取小文件（当前必须手动选择一些小文件并把参数传递给MultiFiles，若MulitFiles能实现自动分析应用构成并自动选取小文件就更好了）\n- [ ] 目录的支持（支持传递一个目录，若传递参数包括目录，则自动打包该目录下的所有文件）\n- [ ] 多平台的支持（比如Linux？）\n- [ ] 写文件的支持（当前仅支持只读小文件，暂不支持写文件）\n- [ ] 文件读写失败的判断（读写文件可能失败）\n- [ ] 统一文件读取接口的支持，或者说对C++自带读文件操作的兼容（使用MultiFiles.reader应该像使用ifstream一样才好）\n- [ ] 当读取文件没有在“合并文件”中时，应当自动从磁盘中读取（这样就无需判断，全部使用MultiFiles来读 被合并的小文件 和 未被合并的大文件 了）\n- [ ] 手动释放内存中的文件（当前是把小文件读到了内存中，若后续不需要这些数据可选择手动释放）\n- [ ] 使用其他编程语言实现对该类的调用（当前使用Python调用失败了，是由于自己对动态链接库相关知识的不熟悉。也许Py调用DLL文件时不支持C++中的string类型而必须用原始C语言中的char *类型？）\n- [ ] 压缩infoFiles（infoFiles中全是可显示ASCII字符，且由于小文件文件名的相似性(可能处于相同子目录)，该文件若压缩一下则可以进一步节省空间，但响应的会消耗一定的额外时间）\n- [x] 不支持大于4G的文件，这是因为使用了32位有符号整数（emm，这已经不是小文件了好吧）\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fletmefly666%2Fmultifiles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fletmefly666%2Fmultifiles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fletmefly666%2Fmultifiles/lists"}