Skip to content

Commit a884d6b

Browse files
committed
Use built-in toString to convert buffer to hex
1 parent b7ef166 commit a884d6b

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib/incoming_form.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -529,11 +529,8 @@ IncomingForm.prototype._initJSONencoded = function() {
529529
};
530530

531531
IncomingForm.prototype._uploadPath = function(filename) {
532-
var name = 'upload_';
533532
var buf = crypto.randomBytes(16);
534-
for (var i = 0; i < buf.length; ++i) {
535-
name += ('0' + buf[i].toString(16)).slice(-2);
536-
}
533+
var name = 'upload_' + buf.toString('hex');
537534

538535
if (this.keepExtensions) {
539536
var ext = path.extname(filename);

0 commit comments

Comments
 (0)