Skip to content

Commit cf1d46f

Browse files
committed
add time count
1 parent cbd154c commit cf1d46f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/handler.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports = function(req, res) {
77
const cmd = req.query.cmd;
88
const url = req.query.url;
99
const file = req.file;
10+
const startTime = Date.now();
1011
if(!cmd) return res.error('cmd');
1112
if(!file && !url) return res.error('file');
1213
const command = cmd.split('/');
@@ -29,6 +30,7 @@ module.exports = function(req, res) {
2930
// })
3031
.videoFilters('boxblur=1:'+ blurV +':cr=0:ar=0')
3132
.on('end', function() {
33+
console.log('end', filepath, Date.now() - startTime);
3234
const stat = fs.statSync(filepath);
3335
const total = stat.size;
3436
res.writeHead(200, { 'Content-Length': total, 'Content-Type': 'video/mp4' });

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ app.use(router);
1313
router.use((req, res, next) => {
1414
if(req.path === '/handler' && req.method === 'POST') {
1515
let length = req.headers['content-length'];
16-
console.log(req.headers);
17-
if(length === 0) next();
16+
console.log(JSON.stringify(req.headers));
17+
if(length == 0) return next();
1818
const filename = Math.random().toString(36).substr(2);
1919
const filepath = path.resolve('/tmp/', filename)
2020
const writerStream = fs.createWriteStream(filepath);

0 commit comments

Comments
 (0)