Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var assert = require('assert-plus');
- var request = require('request');
- function postParseVideo(req, res, next) {
- assert.string(req.body.videoSourceUrl, 'videoSourceUrl');
- var stream = request.get({uri: req.body.videoSorceUrl});
- stream.on('response', function(parseResponse) {
- fnThatTakesAReadableStream(parseResponse, function(err, data) {
- if (err) {
- console.log(err);
- next(err);
- } else {
- res.send(201, null, {Location: data.location});
- next();
- }
- });
- });
- stream.on('error', function(err) {
- console.log(err);
- next(err);
- });
- };
- return self.emit('error', new Error('options.uri is a required argument'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement