Copy link to clipboard
Copied
Hi,
I'm desperatly trying to load a local JSON file using CEP API.
My current code is like :
file = cep.fs.readFile('path/to/file.json');
console.log(file);
And it gives me an unusable object instead of printing the json.
What am I doing wrong ?
Thanks for helping !
1 Correct answer
I think you're trying to print a file object, instead of the file data it contains. Here's a snippet from the CEP docs:
Adobe CEP APIs | Adobe Developer Connection
var path = “/tmp/”;
var result = window.cep.fs.readFile(path);
if (result.err == 0) {
//success alert(result.data); // displays file content
} else { …// handle failure }
Copy link to clipboard
Copied
You posted in the Premiere Pro forum. What Adobe software are you using?
Copy link to clipboard
Copied
Yes I posted it here because I'm making a CEP (Javascript) extension for Premiere Pro.
Copy link to clipboard
Copied
Moved to Premiere Pro SDK
Copy link to clipboard
Copied
I think you're trying to print a file object, instead of the file data it contains. Here's a snippet from the CEP docs:
Adobe CEP APIs | Adobe Developer Connection
var path = “/tmp/”;
var result = window.cep.fs.readFile(path);
if (result.err == 0) {
//success alert(result.data); // displays file content
} else { …// handle failure }
Copy link to clipboard
Copied
Thanks for answering.
I was doing right for accessing the file then. But :
alert(result.data);
doesn't print the file content. I'm getting an err = 3.
Where can I find docs about error messages ? Every link in the page you've sent me is error404.
Copy link to clipboard
Copied
I figured out, I was trying to acces it by relative path and it was from the JS script, not the Premiere Project. (Okay, stupid mistake)
Then, about the error, I've found the answer in the source code : CEP-Resources/CEPEngine_extensions.js at 5880e20b7cb2dc09e6b226f15a33165a08c0d831 · Adobe-CEP/CEP-Re...
Thank you again !

