I'm making desktop application by CEF3 and I'm building function that take file path and read it into buffer and this work fine to me but I don't know how JavaScript take the value of the file that I read EX : C++ code : string fileContent = readFile(URL); I need to send fileContent to JavaScript variable
-
I don't understand the question. What is connection to C++? If you want to read files with JavaScript then there is an API for this. Please check this out html5rocks.com/en/tutorials/file/dndfilesDavid J– David J2015-07-04 05:14:56 +00:00Commented Jul 4, 2015 at 5:14
-
thank you for your response ,I need to load large files more than 200 MB so when I load,I need to make operation in data that extracted from the file in the same time of loading it so using C++ give me more power to do thatAbdo Salah– Abdo Salah2015-07-04 05:32:38 +00:00Commented Jul 4, 2015 at 5:32
-
As far as I know: At least for Windows platform there is a way to use COM objects to extend the abilities of JavaScript. This would apply if you try to read files from a browser under windows. What exactly you want to do? It has to run server or client site?David J– David J2015-07-04 05:48:53 +00:00Commented Jul 4, 2015 at 5:48
Add a comment
|
1 Answer
Normally you should use javascript bindings to communicate between c++<>js, see the Javascript Integration wiki page. However since this is huge amount of data, for performance reasons it is best to send it via request, see this topic:
If the amount of binary data is large perform a request (via XMLHttpRequest, for example) that is then handled using a custom scheme handler or CefRequestHandler::GetResourceHandler().
2 Comments
Abdo Salah
thank you for our response,please can you attached me sample of JavaScript and C++ code that more illustrate the idea
Czarek Tomczak
@AbdoSalah see the Javascript Integration wiki page for example code