3

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
    on client side !== in node.js Commented Jul 15, 2016 at 15:16
  • sorry I wanted to say client side / node js (using npm) Commented Jul 15, 2016 at 15:23
  • in web development client side is the stuff that runs in the browser. programmers.stackexchange.com/questions/171203/… . so i guess you are meaning server side. Can you show us some code? Commented Jul 15, 2016 at 15:26

2 Answers 2

4

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

Sign up to request clarification or add additional context in comments.

1 Comment

But how to import Blob? import statement I cant use . require is not working either
1

This works for me.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.