Methods
(async) autoHash(argv) → {Promise.<Object.<string, string>>}
1. load auto-hash config(config file or parameter)
2. generate hash value of each file
2.1 (optional) rename file or create a copy of it
2.2 assign hashes to an object
3. (optional) output hashes to file
4. return hashes
Parameters:
Name | Type | Description |
---|---|---|
argv |
AutoHashConfig | AutoHash configuration |
Returns:
- hashes
- Type
- Promise.<Object.<string, string>>
Type Definitions
AutoHashConfig
configuration
Type:
AutoHashConfigWithFile
configuration of AutoHash
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
c |
string | config file path |
config |
string | config file path |
AutoHashConfigWithObject
configuration of AutoHash
Type:
- Object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
files |
Array.<Object> | file list to be hashed | |
files[].file |
string | file path | |
files[].name |
string |
<optional> |
key to use in hash object |
output |
Object |
<optional> |
output file path of hashes |
len |
number |
<optional> |
length of MD5 to be used |
rename |
boolean |
<optional> |
rename original file to originalFilename.hash.ext |
copy |
boolean |
<optional> |
create a copy of original file in originalFilename.hash.ext |