Skip to content

getFileHashFromPath

Requires a Node.js runtime ('qsu/node')

Returns the file in the specified path as a value hashed by a specific algorithm. The default algorithm is md5. This method uses a Promise to return a valid hash value.

Parameters

NameTypeRequiredDefault
filePathstring
File path
algorithmnamed'md5' | 'sha1' | 'sha256' | 'sha512''md5'
OpenSSL algorithm to be used for file hashing

named parameters are passed as named parameters in Dart and keyword arguments in Python.

Returns

Promise::string

Examples

javascript
await getFileHashFromPath('/home/user/text.txt', 'sha1'); // '38851813f75627d581c593f3ccfb7061dd013fbd'
dart
await getFileHashFromPath('/home/user/text.txt', algorithm: 'sha1'); // '38851813f75627d581c593f3ccfb7061dd013fbd'
python
getFileHashFromPath('/home/user/text.txt', 'sha1') # '38851813f75627d581c593f3ccfb7061dd013fbd'

Released under the MIT License