2

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

3
  • 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/dndfiles Commented 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 that Commented 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? Commented Jul 4, 2015 at 5:48

1 Answer 1

2

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().

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

2 Comments

thank you for our response,please can you attached me sample of JavaScript and C++ code that more illustrate the idea
@AbdoSalah see the Javascript Integration wiki page for example code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.