Skip to content

Commit 10b9b50

Browse files
committed
examples: use updated res.download in example
1 parent 03dc367 commit 10b9b50

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

examples/downloads/index.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
var express = require('../../');
88
var path = require('path');
9-
var resolvePath = require('resolve-path')
109

1110
var app = module.exports = express();
1211

@@ -25,9 +24,7 @@ app.get('/', function(req, res){
2524
// /files/* is accessed via req.params[0]
2625
// but here we name it :file
2726
app.get('/files/:file(*)', function(req, res, next){
28-
var filePath = resolvePath(FILES_DIR, req.params.file)
29-
30-
res.download(filePath, function (err) {
27+
res.download(req.params.file, { root: FILES_DIR }, function (err) {
3128
if (!err) return; // file sent
3229
if (err.status !== 404) return next(err); // non-404 error
3330
// file for download not found

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
"multiparty": "4.2.3",
7676
"nyc": "15.1.0",
7777
"pbkdf2-password": "1.2.1",
78-
"resolve-path": "1.4.0",
7978
"supertest": "6.2.2",
8079
"vhost": "~3.0.2"
8180
},

0 commit comments

Comments
 (0)