Skip to content

Commit ded00eb

Browse files
committed
Added md5 checksum for each file upload
1 parent c3c41ec commit ded00eb

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

lib/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const Busboy = require('busboy');
44
const fs = require('fs-extra');
55
const streamifier = require('streamifier');
6+
const md5 = require('md5');
67

78
const ACCEPTABLE_MIME = /^(?:multipart\/.+)$/i;
89
const UNACCEPTABLE_METHODS = [
@@ -134,6 +135,7 @@ function processMultipart(options, req, res, next) {
134135
data: buf,
135136
encoding: encoding,
136137
mimetype: mime,
138+
md5: md5(buf),
137139
mv: function(path, callback) {
138140
// Callback is passed in, use the callback API
139141
if (callback) {

package-lock.json

+33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"dependencies": {
1313
"busboy": "^0.2.14",
1414
"fs-extra": "^4.0.1",
15+
"md5": "^2.2.1",
1516
"streamifier": "^0.1.1"
1617
},
1718
"engines": {

0 commit comments

Comments
 (0)