{"id":20163828,"url":"https://github.com/systemlight/ffeach","last_synced_at":"2026-06-08T17:31:41.836Z","repository":{"id":65525184,"uuid":"353605222","full_name":"SystemLight/ffeach","owner":"SystemLight","description":":hocho: Large file cutting and slicing tools.【大文件分块切割工具】","archived":false,"fork":false,"pushed_at":"2022-07-03T11:24:11.000Z","size":161,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-14T10:56:10.946Z","etag":null,"topics":["filesplit","website"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SystemLight.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}},"created_at":"2021-04-01T06:57:34.000Z","updated_at":"2022-07-03T11:25:06.000Z","dependencies_parsed_at":"2023-01-27T08:01:30.890Z","dependency_job_id":null,"html_url":"https://github.com/SystemLight/ffeach","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SystemLight%2Fffeach","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SystemLight%2Fffeach/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SystemLight%2Fffeach/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SystemLight%2Fffeach/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SystemLight","download_url":"https://codeload.github.com/SystemLight/ffeach/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241600492,"owners_count":19988715,"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","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":["filesplit","website"],"created_at":"2024-11-14T00:31:59.839Z","updated_at":"2026-06-08T17:31:41.829Z","avatar_url":"https://github.com/SystemLight.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ffeach\n\n[![NPM version](https://img.shields.io/npm/v/ffeach.svg)](https://www.npmjs.com/package/ffeach)\n\n\u003e 大文件切片实用工具\n\n### 依赖项\n\n- spark-md5\n\n### 安装\n\n```\nnpm i ffeach\n```\n\n### 接口说明\n\n- ffeach.ffeach() 创建FileForeach对象工厂函数\n  参数： file(必填) File对象\n  参数： chunkSize(选填) 单个文件块大小，单位bytes\n\n- new ffeach.FileForeach() 文件分块函数，主要用于文件提取分割后的数据块\n  参数： file(必填) File对象\n  参数： chunkSize(选填) 单个文件块大小，单位bytes\n\n- FileForeach#isOutRange() 判断文件是否超出可提取的大小\n- FileForeach#nextLoad() 获取下一个文件块，返回Blob对象\n- FileForeach#forEach() 遍历File对象切割的文件块\n  参数： callback(必填) 回调函数，接收一个blob对象为文件数据块\n\n注意：当数据块被遍历完毕后，将无法再产出文件块，FileForeach不保存任何数据块，为了节省空间\n如果需要二次遍历，需要重新创建FileForeach对象\n\n- ffeach.hashFile() 对文件进行hash运算，该方法异步执行\n  参数： file(必填) File对象\n  参数： callback(选填) 接收运算完的hash结果值函数\n  参数： chunkSize(选填) 单个文件块大小，单位bytes\n\n### 使用举例\n\n```html\n\u003cinput type=\"file\" id=\"file\"\u003e\n\u003cscript src=\"https://unpkg.com/spark-md5@3.0.2/spark-md5.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"main.bundle.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  document.getElementById('file').addEventListener('change', function (e) {\n    ffeach.hashFile(this.files[0], (result) =\u003e {\n      console.log(result)\n    })\n\n    ffeach.ffeach(this.files[0], 1024).forEach((chunkIndex, blob) =\u003e {\n      console.log(blob)\n    })\n  })\n\u003c/script\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsystemlight%2Fffeach","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsystemlight%2Fffeach","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsystemlight%2Fffeach/lists"}