Is there any way to get blob object from byte array client side without actual downloading file

Client side where I want to pass blob object =>

request.get('/api/get/video/blob/'+d1+'/'+d2+'/'+d3) .end((err, res) => { if (err) { console.log("err="+err) } else { console.log("data="+res) if(res) { var uploadVideo = new UploadVideo(); uploadVideo.uploadFile(access_token,res// need actual blob object to pass @ res); but what I get is byte array see following code 

Server side=>

server.route({ method: 'GET', path: '/api/get/video/blob/{d}/{s}/{x}', handler: function handler(request, reply) { const {d,s,x} = request.params; const key = d+'/'+s+'/'+x; var bucket = 're.render-previews'; var params = { Bucket: bucket, Key: key }; s3.getObject(params, function(err, data) { console.log("coming back"); if (err) { console.log("err=>"); console.log(err); // reject(err) } else { console.log("data=>"); console.log(data); reply(data); // where I get byteArray } }); } }); 
3

2 Answers

this line of code worked for me var blob = new Blob([new Uint8Array(BYTEARRAY)], { type: 'video/mp4' });

This works for me.

var blob = new Blob([new Uint8Array(BYTEARRAY).buffer], { type: 'video/mp4' });

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy