
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
gulp-file-checksum
Advanced tools
Install pakcage with NPM and add it to your development dependencies
npm install --save-dev gulp-file-checksum
The following generages a file dist/package_checksum.txt in the format defined by the template.
const fileChecksum = require('gulp-file-checksum');
const template = `
MD5 : {md5}
SHA1 : {sha1}
CRC32 : {crc32}
size : {size} Bytes
Datetime: {dateime}
`
gulp.task('checksum',() => {
return gulp.src('dist/package.zip', {
buffer: false // for large files
})
.pipe(fileChecksum({
template: template,
output: '{filename}_checksum.txt'
}))
.pipe(gulp.dest('dist'))
})
The contents of the checksum file will look like this:
MD5 : 2f90ce3426541817e0dfd01cae086b60
SHA1 : d817d144dd1397efc52b9ce1dfc9e5713e7265e6
CRC32 : dfc51702
size : 7051797 Bytes
Datetime: 2018-07-28 21:48:34
template - string
A template allow users to customize the output format and use placeholder syntax({}) to define the output content at the specified location.
The built-in placeholders are as follow:
md5,sha1,sha256,sha512 etc. - All hash algorithms are provided by crypto
crc1,crc8,crc24,crc32 etc. - All crc algorithms are provided by crc
size - File size in bytes
datetime - {datetime:YYYY-MM-DD HH:mm:ss A}, The time format please refer to the documentation of momentjs
run - Run unix shell commands defined in shellCommand option via shelljs and get the results:
fileChecksum({
template: `{run:git-revision}`,
shellCommands: {
'git-revision': `
git rev-parse --short HEAD
`
}
})
prefix & suffix - string [optional]
Defines the prefix and suffix of the placeholder in your template.
Default: { and }
output - string
The name of output file. Support these placeholders: {basename}, {extname}, {filename};
plugins - class
Sometimes you need to add a custom placeholder in your template, this option allows you to do that like the following example:
// {time:yyyy-MM-dd}
class FormatedTimePlugin {
static get names() {
return ['time'];
}
constructor(file, gulpOptions, placeholder) {
const firstColonIndex = placeholder.indexOf(':');
if(firstColonIndex > -1) {
this.format = placeholder.substring(firstColonIndex);
} else {
this.format = "YYYY-MM-DDTHH:mm:ss.SSS"; // default format
}
}
preprocess (template) {
//
}
receiveChunk (chunk) {
// ignore
}
finish(){
return {
time: someTimeLibray(new Date(), this.format);
};
}
}
// gulpfile.js
fileChecksum({
template: `
Date: {time:YYYY-MM-DD}
`.trim(),
plugins: [FormatedTimePlugin]
})
FAQs
A gulp plugin for generating checksum file.
The npm package gulp-file-checksum receives a total of 508 weekly downloads. As such, gulp-file-checksum popularity was classified as not popular.
We found that gulp-file-checksum demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.