{"id":20144147,"url":"https://github.com/quansitech/file-md5-wasm","last_synced_at":"2026-08-12T08:38:28.403Z","repository":{"id":196460738,"uuid":"696054584","full_name":"quansitech/file-md5-wasm","owner":"quansitech","description":"calculate file md5 written by wasm","archived":false,"fork":false,"pushed_at":"2024-04-22T09:58:21.000Z","size":181,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-05T05:40:31.438Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/quansitech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-09-25T01:36:28.000Z","updated_at":"2024-04-22T09:58:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"94f2959f-8ab5-425a-a0fb-3d8d9a798dd2","html_url":"https://github.com/quansitech/file-md5-wasm","commit_stats":null,"previous_names":["quansitech/file-md5-wasm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/quansitech/file-md5-wasm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quansitech%2Ffile-md5-wasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quansitech%2Ffile-md5-wasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quansitech%2Ffile-md5-wasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quansitech%2Ffile-md5-wasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quansitech","download_url":"https://codeload.github.com/quansitech/file-md5-wasm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quansitech%2Ffile-md5-wasm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":36556592,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-08-06T04:43:03.162Z","status":"online","status_checked_at":"2026-08-12T02:00:07.134Z","response_time":57,"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-11-13T22:08:59.095Z","updated_at":"2026-08-12T08:38:28.369Z","avatar_url":"https://github.com/quansitech.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## htmlInput file md5 calculate\n\nCompute the MD5 signature of a file. If the file is larger than 40MB, only the first and last 10MB, as well as the middle 10MB, are read to calculate the MD5. Therefore, even when computing large files, the process will be extremely fast.\n\n### Install\n```shell\nnpm add @quansitech/file-md5-wasm\n```\n\n### Usage\n\nuse in ES6\n```javascript\nimport init, {calc_file_hash} from '@quansitech/file-md5-wasm';\n\nconst upload = async (file: File) =\u003e {\n    await init();\n    const hashId = await calc_file_hash(file);\n    console.log(hashId);\n}\n\n```\n\nPS. init()方法会根据webpack的 output.publicPath自动寻找wasm文件所在的位置，如果发现这个地址不正确，需要调整webpack的output.publicPath配置。\n\nuse in browser\n\nDownload the contents of the 'dist' folder. When loading 'index.js' on the webpage, the 'calc_file_hash' function will be automatically added to 'window' object.\n\n\n```html\n\u003chtml\u003e\n\u003chead\u003e\n  \u003ctitle\u003e文件哈希校验\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n  \u003cinput type=\"file\" id=\"fileInput\" /\u003e\n  \u003cbutton onclick=\"handleFile()\"\u003e上传文件\u003c/button\u003e\n  \u003cdiv id=\"result\"\u003e\u003c/div\u003e\n\n  \u003cscript src=\"./index.js\"\u003e\u003c/script\u003e\n  \u003cscript\u003e\n    function handleFile() {\n        const fileInput = document.getElementById(\"fileInput\");\n        const start = new Date().getTime();\n        window.calc_file_hash(fileInput.files[0]).then(function(res){\n          const end = new Date().getTime();\n          console.log(`文件Md5: ${res}`);\n          console.log(`耗时: ${end - start}ms`);\n        });\n    }\n  \u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n\n#### how to build\n\n```shell\nwasm-pack build --target web --scope quansitech --package file-md5-wasm\n```\n\npublish to npm\n```shell\ncd pkg\nnpm publish\n```\n\nbuild index.js for browser\n```shell\nnpm run build\n```\n\n\n#### Old Version Browsers\n\nOld version browsers have poor compatibility with wasm. You may use the JS code in the JS folder as a substitute, which will also create the `calc_file_hash` function to achieve the same functionality.\n\n```html\n\u003cscript src=\"md5.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"calc_file_hash.js\"\u003e\u003c/script\u003e\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquansitech%2Ffile-md5-wasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquansitech%2Ffile-md5-wasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquansitech%2Ffile-md5-wasm/lists"}