Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Route definition
- { method: 'POST', path: '/upload', handler: upload.upload, config: { auth: { mode: 'required' }, pre: [ { method: projects.getVideo, assign: 'getVideo' } ], payload: { maxBytes: 9999000000, output: 'stream', allow: 'multipart/form-data' }, plugins: {'route-access': { 'role': 'teacher' } } } },
- // Handler function
- var teamID = parseInt(request.payload.teamID);
- var file = request.payload.video;
- var fileName = file.hapi.filename;
- var tmpPath = process.env.PWD + '/tmp/' + fileName;
- file.pipe(fs.createWriteStream(tmpPath)).on('data', function(chunk) {
- console.log(chunk.length);
- }).on('finish', function() {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement