file2md5
file2md5 is a browser-side implementation of file conversion to md5 format based on SparkMD5, which supports typescript friendly.
Features
-
Supports Typescript
-
Promise API
-
All browsers supported
Installation
Npm
npm install file2md5 --save
Yarn
yarn add file2md5
Usage
Html:
Javascript:
; ;; ; el.addEventListener 'change', onChange, false;
You can call the abort method to terminate before the end of the file conversion to the md5 value.
; abort;
Params
Name | Required | Description | Type | Default value |
---|---|---|---|---|
file | true | The file is used to convert md5 format. | File | - |
options | false | Optional configuration items. | IOptions | {} |
Options
Name | Required | Description | Type | Default value |
---|---|---|---|---|
chunkSize | false | The conversion is performed in chunks, so you can customize the size of each chunk. | number | 2 * 1024 * 1024 |
raw | false | If raw is true, the result as a binary string will be returned instead. | boolean | false |
onProgress | false | Callback function for monitoring progress. | (progress: number) => unknown | - |
Browser compatibility
- IE10+
- Chrome latest 2 versions
- Firefox latest 2 versions
- Microsoft Edge latest 2 versions
- Safari latest 2 versions
License
file2md5 is licensed under a MIT License