Skip to main content
jonnyr84832999
Participant
December 10, 2018
Question

Write file with Base64 encoding

  • December 10, 2018
  • 3 replies
  • 1511 views

I'm trying to write a Base64 string to a png file as part of a CEP extension.

I can do this with:

var filename = "/path/to/file.png";

var data = /*base64 string*/;

window.cep.fs.writeFile(filename, data, window.cep.encoding.Base64);

but ideally I'd do it inside my JSX file. Is this possible or do I need to stick with the above in my .JS file?

Thanks

This topic has been closed for replies.

3 replies

Known Participant
January 23, 2019

my solution was to write the file from the panel and pass the path to the jsx

Tom Ruark
Inspiring
January 22, 2019

var f = new File("/path/to/file.png");

if (f.open('w')) {

f.write(data);

f.close();

}

More information available in the JavaScript Tools Guide pdf (part of ESTK install). There is f.encoding but I don't see any mention of Base64 as an option.

Known Participant
January 16, 2019

bump