fquery-gethash
Advanced tools
Comparing version 0.1.4 to 0.2.0
@@ -7,21 +7,21 @@ /*jshint node: true */ | ||
var defaults = { | ||
algorithm: 'sha1', // 'sha1', 'md5', 'sha256', 'sha512' | ||
encoding: 'hex' // 'hex', 'binary', 'base64' | ||
}; | ||
var defaults = { | ||
algorithm: 'sha1', // 'sha1', 'md5', 'sha256', 'sha512' | ||
encoding: 'hex' // 'hex', 'base64' | ||
}; | ||
fQuery.getHash = function (sequence, options) { | ||
fQuery.getHash = function (sequence, options) { | ||
var crypto = require('crypto'), | ||
settings = fQuery._.extend({}, defaults, options), | ||
shasum = crypto.createHash(settings.algorithm); | ||
var crypto = require('crypto'); | ||
var settings = fQuery._.extend({}, defaults, options); | ||
var shasum = crypto.createHash(settings.algorithm); | ||
shasum.update(sequence); | ||
return shasum.digest(settings.encoding); | ||
}; | ||
shasum.update(sequence); | ||
return shasum.digest(settings.encoding); | ||
}; | ||
fQuery.fn.getHash = function (options) { | ||
fQuery.fn.getHash = function (options) { | ||
return fQuery.getHash(this.getContent(), options); | ||
}; | ||
return fQuery.getHash(this.getContent(), options); | ||
}; | ||
}; |
{ | ||
"name": "fquery-gethash", | ||
"displayName": "fQuery.getHash", | ||
"version": "0.1.4", | ||
"description": "fQuery plugin to get the hash of a file's content", | ||
"version": "0.2.0", | ||
"description": "fQuery plugin to get a hash for the content of all selected files", | ||
"homepage": "https://github.com/lrsjng/fquery-gethash", | ||
@@ -16,9 +16,8 @@ "bugs": "https://github.com/lrsjng/fquery-gethash/issues", | ||
"scripts": { | ||
"test": "node_modules/.bin/mocha test.js" | ||
"test": "mocha --recursive test" | ||
}, | ||
"dependencies": { | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"fquery": "~0.12.2", | ||
"mocha": "~1.21.0" | ||
"fquery": "~0.13.3", | ||
"mocha": "~1.21.4" | ||
}, | ||
@@ -25,0 +24,0 @@ "engines": { |
# fQuery.getHash | ||
[![Version](http://img.shields.io/npm/v/fquery-gethash.svg?style=flat)](https://www.npmjs.org/package/fquery-gethash) | ||
[![Downloads](http://img.shields.io/npm/dm/fquery-gethash.svg?style=flat)](https://www.npmjs.org/package/fquery-gethash) | ||
[![License](http://img.shields.io/npm/l/fquery-gethash.svg?style=flat)](https://www.npmjs.org/package/fquery-gethash) | ||
[![Dependencies Status](http://img.shields.io/david/lrsjng/fquery-gethash.svg?style=flat)](https://david-dm.org/lrsjng/fquery-gethash) | ||
[![Build Status](http://img.shields.io/travis/lrsjng/fquery-gethash.svg?style=flat)](https://travis-ci.org/lrsjng/fquery-gethash) | ||
[![license][license-img]][github] [![github][github-img]][github] [![npm][npm-img]][npm] | ||
[![version][npm-v-img]][npm] [![downloads][npm-dm-img]][npm] [![dependencies status][gemnasium-img]][gemnasium] [![build status][travis-img]][travis] | ||
[fQuery](https://github.com/lrsjng/fquery) plugin to get the hash of a file's content. | ||
To report a bug or make a feature request please create [a new issue](https://github.com/lrsjng/fquery-gethash/issues/new). | ||
[fQuery][fquery] plugin to get a hash for the content of all selected files. | ||
References: [GitHub](https://github.com/lrsjng/fquery-gethash), [npm](https://www.npmjs.org/package/fquery-gethash) | ||
## Install | ||
@@ -23,5 +17,12 @@ | ||
fQuery.plugin('fquery-gethash'); | ||
fQuery(selector).getHash(); | ||
fQuery(selector).getHash(options); | ||
with | ||
options = { | ||
algorithm: 'sha1', // 'sha1', 'md5', 'sha256', 'sha512' | ||
encoding: 'hex' // 'hex', 'base64' | ||
} | ||
## License | ||
@@ -49,1 +50,18 @@ The MIT License (MIT) | ||
THE SOFTWARE. | ||
[github]: https://github.com/lrsjng/fquery-gethash | ||
[npm]: https://www.npmjs.org/package/fquery-gethash | ||
[gemnasium]: https://gemnasium.com/lrsjng/fquery-gethash | ||
[travis]: https://travis-ci.org/lrsjng/fquery-gethash | ||
[license-img]: http://img.shields.io/badge/license-MIT-a0a060.svg?style=flat-square | ||
[github-img]: http://img.shields.io/badge/github-lrsjng/fquery--gethash-a0a060.svg?style=flat-square | ||
[npm-img]: http://img.shields.io/badge/npm-fquery--gethash-a0a060.svg?style=flat-square | ||
[npm-v-img]: http://img.shields.io/npm/v/fquery-gethash.svg?style=flat-square | ||
[npm-dm-img]: http://img.shields.io/npm/dm/fquery-gethash.svg?style=flat-square | ||
[gemnasium-img]: http://img.shields.io/gemnasium/lrsjng/fquery-gethash.svg?style=flat-square | ||
[travis-img]: http://img.shields.io/travis/lrsjng/fquery-gethash.svg?style=flat-square | ||
[fquery]: https://github.com/lrsjng/fquery |
Sorry, the diff of this file is not supported yet
7153
7
74
66