Skip to content

Commit

Permalink
Added md5 checksum for each file upload
Browse files Browse the repository at this point in the history
  • Loading branch information
tumulr committed Nov 22, 2017
1 parent c3c41ec commit ded00eb
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const Busboy = require('busboy');
const fs = require('fs-extra');
const streamifier = require('streamifier');
const md5 = require('md5');

const ACCEPTABLE_MIME = /^(?:multipart\/.+)$/i;
const UNACCEPTABLE_METHODS = [
Expand Down Expand Up @@ -134,6 +135,7 @@ function processMultipart(options, req, res, next) {
data: buf,
encoding: encoding,
mimetype: mime,
md5: md5(buf),
mv: function(path, callback) {
// Callback is passed in, use the callback API
if (callback) {
Expand Down
33 changes: 33 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"dependencies": {
"busboy": "^0.2.14",
"fs-extra": "^4.0.1",
"md5": "^2.2.1",
"streamifier": "^0.1.1"
},
"engines": {
Expand Down

0 comments on commit ded00eb

Please sign in to comment.