T
T
timofy2017-09-22 12:09:28
JavaScript
timofy, 2017-09-22 12:09:28

How to accept data from Node.js thread?

The server stores pictures that need to be transferred to the client and displayed on the client (in the browser).
On the server, this is the code that processes the request from the client:

app.get("/file", function (request, response) {

    var file = new fs.ReadStream(`${request.query.filePath}`);
    file.pipe(response);
});

On the client, response.data receives data in the following form:
JFIFIExifMM*&b1&2iVFWindows Photo Editor 10.0.10011.16384Windows Photo Editor 10.0.10011.163842017:06:30 18:11:4500000	2017:06:15 22:10:182017:06:15 22:10:18(7U``C		

 $.' ",#(7),01444'9=82<.342C			

2!!22222222222222222222222222222222222222222222222222!	
}!1AQa"q2#BR$3br	
%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz	
w!1AQaq"2B	#3Rbr
$4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz?⮿^<,_B[8:clڤ@'8 P˥Ӏ^yK,20ɻ29s9K;'N%t=9jWTZ.km=
oe]zQԓWD
M6&a-2yWS	IJ\ϡK[X,oDc+{$`T}kGj78)3dAVj<{{u_M{?xf刍lE_3uy\*s^]X+K0=rg쪿֖P7#w#AxNrzo
K%إs6 #iz5(ӹ,E"wpOjcOLd S"ei5	;{o!)=_xM:6?rN9ZnW^O}BWW8Np	ߙ\7Xq8IbA%֧,V4qQ9s-J](6&>`rحhcFTFjyufF{kX_7n==~FUn" ]4Wf3I#ިEe-9z[('HLQ4m#ל
jٻ_roF2#'9GP1durE8$-G%s'1ë'Pt=S/VTļ-ZY.ro\`{wCZ"ԡR2hZx1QÊDB՜[pC{
uOeQ¶®N6asqSO	y<4KM:{mn\JKp_zm]v 1NeF$_6I[[J8F;p;]Lzy^ޗy7>`1[URqRW[~`b=+[kY,k^y-YMA%ed&0r2IΞ=GY+Y<4Ȭ%T}W{;$yQ6ܶ5/#^=zW,ıyl(?I([email protected];vӭszo$;p~bA8횼?μ+٧cLCEo$C60EUP1ǯOnݫ9IsEB
O-~e3;[9#4e\G9\ƽQ9Ʃ^J)/TsT_Q-ȤW7 MJC`s!m*|K>%9cdEٶI!,V{Dݝ0iS{6ۻW}&dk5+*!Q7sR;X\O!NSDE\C,wpw12cnvIF)Ojӹ}-ȍX?P>v;\vUI?G=쑲HʭDH

As I understand it, the picture came in a line.
The question is: how to process this image and display it on the page in the browser?

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
A
Abcdefgk, 2017-09-22
@timofy

Cool!
I think you need to write the following script on the page:

var elem = document.createElement('img');
elem.src = '/...'; //путь до нужного файла

and paste this elem in the right place.
The src attribute is the GET request

V
Vladimir Skibin, 2017-09-22
@megafax

<img src="/file?filePath=...">
So ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question