Created
September 9, 2009 20:00
-
-
Save lloyd/184033 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'digest/md5' | |
class FileChecksum | |
bp_version "1.0.10" | |
bp_doc "Allows client side MD5 of user selected files." | |
def md5(bp, args) | |
begin | |
contents = File.open(args[:file].realpath, "rb") { |f| f.read } | |
bp.complete(Digest::MD5.hexdigest(contents)) | |
rescue Exception => err | |
bp.error("Error", err.to_s) | |
end | |
end | |
bp_doc :md5, "Generate an md5 checksum of a file. | |
<file: path> The file for which to calculate a checksum." | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment