grunt-md5sum
v2.0.1
Published
Calculates and verifies 128-bit MD5 hashes, as described in RFC 1321 like md5sum program
Downloads
646
Maintainers
Readme
grunt-md5sum
Calculates and verifies 128-bit MD5 hashes, as described in RFC 1321 like MD5sum program
Getting Started
This plugin requires Grunt ~0.4.5
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-md5sum --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-md5sum');
grunt-md5sum task
Run this task with the grunt md5sum
command.
Task targets, files and options may be specified according to the grunt Configuring tasks guide.
Options
exclude_path
Type: Boolean
Exclude an absolute path
path_prefix
Type: Boolean
Append a path prefix
process
Type: Function(/* [ ...{ file, hex } ], [ ...files ] */)
This option as an advanced way to control the file contents that are created.
....
options: {
process: function (content, files) {
return content;
}
}
....
Usage Example
module.exports = function (grunt) {
grunt.config.init({
md5sum: {
build: {
files: [
{
cwd : 'files/',
src : ['**/*.{js,css}'],
dest: 'sum.md5'
}
]
}
}
});
grunt.loadNpmTasks('grunt-md5sum');
grunt.registerTask('default', ['md5sum']);
};
This task supports all the file mapping format Grunt supports. Please read Globbing patterns and Building the files object dynamically for additional details.
Result
File structure
├── path
│ ├── file.js
│ ├── file.css
Output file
d8e8fca2dc0f896fd7cb4cb0031ba248 path/file.js
d8e8fca2dc0f896fd7cb4cb0031ba249 path/file.css
Verify files with md5sum command
➜ md5sum -c sum.md5
path/file.js: OK
path/file.css: OK
Tests
➜ grunt test
Links
MD5sum user manual MD5sum wiki Microbrew MD5sum
Task submitted by Alexander Abashkin