How to: Create JSfile from a method variable?

Having problems figuring out how to do this:

Take a string created in a method:

var thisstring = "This is my file\r\n";

Then, putting this into a JSfile object as a text file:

var file = plugins.file.convertStringToJSFile(thisstring.toString())

But I can’t get the string to be seen as a file.

Purpose:

Generate a text file WITHIN a method (without writing to a disk and then re-reading it into a JSfile) to be used in a file upload using the http plugin.
Reason: due to varied environment, writing to user filesystem will not be failproof.

var thisstring = "This is my file\r\n";
var mv_file = plugins.file.convertStringToJSFile(thisstring.toString())
L_TmpFile = mv_file
L_AddParam  = L_Poster.addFile('data','file.name',L_TmpFile);

This doesn’t work (assume the convertStringToJSFile will only take a file path, not an ACTUAL string).

So, anyway to take a string variable and CREATE a file object from it that JSfile can use? (without writing files to disk).

NCM
FSCI[/code]

this

thisstring.toString()

is not necessary.
JavaScript is auto typecasting.

From the docs (concerning convertStringToJSFile):

Returns a JSFile object for the given String, Parameters Object - the fully qualified path name…

.
In other words you are on the wrong track!

This will work: ```
plugins.file.writeTXTFile( file, text_data, [charsetname])