plugins.file.writeFile warning

Hi all,

in some global method I have the following :

/**

  • @properties={typeid:24,uuid:“356B5A2A-2FED-4A76-99CB-7D5316BAC33D”}
  • @param {String} $pdfName
  • @param {Array} $pdf
    */
    function gen_pdf($pdfName, $pdf) {

var $fileName = plugins.file.createTempFile($pdfName, ‘.pdf’);

plugins.file.writeFile($fileName,$pdf);
application.executeProgram(‘rundll32’, ‘url.dll,FileProtocolHandler’, $fileName);
}

but on the line plugins.file.writeFile($fileName,$pdf); there is this warning,
The function writeFile(Object,Array,[?]) is not applicable for the arguments (JSFile,Array)

what’s wrong with the method above, when I run this method the expected pdf is generated, I’m using Servoy 6.0.3

Regards,

Peter

writeFile doesn’t use the file suffix parameter like createTempFile does. Should be a string (not an array) specifying the mime type.

David,

Move the sample that comes with plugins.file.writeFile it gives the same warning.

Regards,
Peter

i will update the sample code by doing this:

/** @type {Array}*/
var bytes = new Array();

thats also what you need to do, its a array of bytes that it want to have, not just an array…

jcompagner:
i will update the sample code by doing this:

/** @type {Array}*/
var bytes = new Array();

Hmm, I overlooked that in the documentation, thanks for the reply.

Peter