Table Row (tr) |
---|
| Table Head (th) |
---|
| Method Details |
|
Table Body (tbody) |
---|
id | appendToTXTFile |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
appendToTXTFile |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| appendToTXTFile |
Span |
---|
| (file/fileName, text, [encoding]) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Appends data into a text file. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters file/fileName text [encoding] |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
// append some text to a text file:
var ok = plugins.file.appendToTXTFile('myTextFile.txt', '\nMy fantastic new line of text\n');
|
|
|
|
|
Table Body (tbody) |
---|
id | convertToJSFile |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
convertToJSFile |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| JSFile |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| convertToJSFile |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns a JSFile instance corresponding to an alternative representation of a file (for example a string). |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters file |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var f = plugins.file.convertToJSFile("story.txt");
if (f.canRead())
application.output("File can be read.");
|
|
|
|
|
Table Body (tbody) |
---|
id | convertToRemoteJSFile |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
convertToRemoteJSFile |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| JSFile |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| convertToRemoteJSFile |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns the JSFile object of a server file, given its path (relative the default server location) |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters serverPath |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var f = plugins.file.convertToRemoteJSFile('/story.txt');
if (f && f.canRead())
application.output('File can be read.');
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| copyFile |
Span |
---|
| (sourceFile, destinationFile) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Copies the sourcefile to the destination file. Returns true if the copy succeeds, false if any error occurs. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters sourceFile destinationFile |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
// Copy based on file names.
if (!plugins.file.copyFile("story.txt", "story.txt.copy"))
application.output("Copy failed.");
// Copy based on JSFile instances.
var f = plugins.file.createFile("story.txt");
var fcopy = plugins.file.createFile("story.txt.copy2");
if (!plugins.file.copyFile(f, fcopy))
application.output("Copy failed.");
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
copyFolder |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| copyFolder |
Span |
---|
| (sourceFolder, destinationFolder) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Copies the sourcefolder to the destination folder, recursively. Returns true if the copy succeeds, false if any error occurs. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters sourceFolder destinationFolder |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
// Copy folder based on names.
if (!plugins.file.copyFolder("stories", "stories_copy"))
application.output("Folder copy failed.");
// Copy folder based on JSFile instances.
var d = plugins.file.createFile("stories");
var dcopy = plugins.file.createFile("stories_copy_2");
if (!plugins.file.copyFolder(d, dcopy))
application.output("Folder copy failed.");
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
createFile |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| JSFile |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| createFile |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Creates a JSFile instance. Does not create the file on disk. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters targetFile |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
// Create the JSFile instance based on the file name.
var f = plugins.file.createFile("newfile.txt");
// Create the file on disk.
if (!f.createNewFile())
application.output("The file could not be created.");
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
createFolder |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| createFolder |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Creates a folder on disk. Returns true if the folder is successfully created, false if any error occurs. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters targetFolder |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var d = plugins.file.convertToJSFile("newfolder");
if (!plugins.file.createFolder(d))
application.output("Folder could not be created.");
|
|
|
|
|
Table Body (tbody) |
---|
id | createTempFile |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
createTempFile |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| JSFile |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| createTempFile |
Span |
---|
| (filePrefix, fileSuffix) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Creates a temporary file on disk. A prefix and an extension are specified and they will be part of the file name. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters filePrefix fileSuffix |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var tempFile = plugins.file.createTempFile('myfile','.txt');
application.output('Temporary file created as: ' + tempFile.getAbsolutePath());
plugins.file.writeTXTFile(tempFile, 'abcdefg');
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
deleteFile |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| deleteFile |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Removes a file from disk. Returns true on success, false otherwise. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters targetFile |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
if (plugins.file.deleteFile('story.txt'))
application.output('File deleted.');
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
deleteFolder |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| deleteFolder |
Span |
---|
| (targetFolder, showWarning) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Deletes a folder from disk recursively. Returns true on success, false otherwise. If the second parameter is set to true, then a warning will be issued to the user before actually removing the folder. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters targetFolder showWarning |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
if (plugins.file.deleteFolder('stories', true))
application.output('Folder deleted.');
|
|
|
|
|
Table Body (tbody) |
---|
id | getDesktopFolder |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getDesktopFolder |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| JSFile |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getDesktopFolder |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns a JSFile instance that corresponds to the Desktop folder of the currently logged in user. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var d = plugins.file.getDesktopFolder();
application.output('desktop folder is: ' + d.getAbsolutePath());
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getDiskList |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| JSFile[] |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getDiskList |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns an Array of JSFile instances correponding to the file system root folders. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns JSFile[] |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var roots = plugins.file.getDiskList();
for (var i = 0; i < roots.length; i++)
application.output(roots[i].getAbsolutePath());
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getFileSize |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Number |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getFileSize |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns the size of the specified file. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters targetFile |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var f = plugins.file.convertToJSFile('story.txt');
application.output('file size: ' + plugins.file.getFileSize(f));
|
|
|
|
|
Table Body (tbody) |
---|
id | getFolderContents |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getFolderContents |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| JSFile[] |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getFolderContents |
Span |
---|
| (targetFolder, [fileFilter], [fileOption(1=files,2=dirs)], [visibleOption(1=visible,2=nonvisible)], [lockedOption(1=locked,2=nonlocked)]) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns an array of JSFile instances corresponding to content of the specified folder. The content can be filtered by optional name filter(s), by type, by visibility and by lock status. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters targetFolder [fileFilter] [fileOption(1=files,2=dirs)] [visibleOption(1=visible,2=nonvisible)] [lockedOption(1=locked,2=nonlocked)] |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns JSFile[] |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var files = plugins.file.getFolderContents('stories', '.txt');
for (var i=0; i<files.length; i++)
application.output(files[i].getAbsolutePath());
|
|
|
|
|
Table Body (tbody) |
---|
id | getHomeDirectory |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getHomeDirectory |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| JSFile |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getHomeDirectory |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns a JSFile instance corresponding to the home folder of the logged in used. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var d = plugins.file.getHomeDirectory();
application.output('home folder: ' + d.getAbsolutePath());
|
|
|
|
|
Table Body (tbody) |
---|
id | getModificationDate |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getModificationDate |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Date |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getModificationDate |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns the modification date of a file. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters targetFile |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Date |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var f = plugins.file.convertToJSFile('story.txt');
application.output('last changed: ' + plugins.file.getModificationDate(f));
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getRemoteList |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| JSFile[] |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getRemoteList |
Span |
---|
| (serverFolder/serverFolderPath, [filesOnly]) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Retrieves a list of files existing in a folder on the server side (in the path provided, relative to the default server location) |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters serverFolder/serverFolderPath [filesOnly] |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns JSFile[] |
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| moveFile |
Span |
---|
| (sourceFile, destinationFile) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Moves the file from the source to the destination place. Returns true on success, false otherwise. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters sourceFile destinationFile |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
// Move file based on names.
if (!plugins.file.moveFile('story.txt','story.txt.new'))
application.output('File move failed.');
// Move file based on JSFile instances.
var f = plugins.file.convertToJSFile('story.txt.new');
var fmoved = plugins.file.convertToJSFile('story.txt');
if (!plugins.file.moveFile(f, fmoved))
application.output('File move back failed.');
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| byte[] |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| readFile |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Reads all or part of the content from a binary file. If a file name is not specified, then a file selection dialog pops up for selecting a file. (Web Enabled) |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters [file] [size] |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns byte[] |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
// Read all content from the file.
var bytes = plugins.file.readFile('big.jpg');
application.output('file size: ' + bytes.length);
// Read only the first 1KB from the file.
var bytesPartial = plugins.file.readFile('big.jpg', 1024);
application.output('partial file size: ' + bytesPartial.length);
// Read all content from a file selected from the file open dialog.
var bytesUnknownFile = plugins.file.readFile();
application.output('unknown file size: ' + bytesUnknownFile.length);
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
readTXTFile |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| String |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| readTXTFile |
Span |
---|
| ([file], [charsetname]) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Read all content from a text file. If a file name is not specified, then a file selection dialog pops up for selecting a file. The encoding can be also specified. (Web Enabled) |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters [file] [charsetname] |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
// Read content from a known text file.
var txt = plugins.file.readTXTFile('story.txt');
application.output(txt);
// Read content from a text file selected from the file open dialog.
var txtUnknown = plugins.file.readTXTFile();
application.output(txtUnknown);
|
|
|
|
|
Table Body (tbody) |
---|
id | showDirectorySelectDialog |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
showDirectorySelectDialog |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| JSFile |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| showDirectorySelectDialog |
Span |
---|
| ([directory suggestion], [dialog title text]) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Shows a directory selector dialog. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters [directory suggestion] [dialog title text] |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var dir = plugins.file.showDirectorySelectDialog();
application.output("you've selected folder: " + dir.getAbsolutePath());
|
|
|
|
|
Table Body (tbody) |
---|
id | showFileOpenDialog |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
showFileOpenDialog |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Object |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| showFileOpenDialog |
Span |
---|
| ([selectionMode(0=both,1=Files,2=Dirs)], [startDirectory(null=default/previous)], [multiselect(true/false)], [filterarray], [callbackmethod], [dialog title text]) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Shows a file open dialog. Filters can be applied on what type of files can be selected. (Web Enabled) |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters [selectionMode(0=both,1=Files,2=Dirs)] [startDirectory(null=default/previous)] [multiselect(true/false)] [filterarray] [callbackmethod] [dialog title text] |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
// This selects only files ('1'), previous dir must be used ('null'), no multiselect ('false') and
// the filter "JPG and GIF" should be used: ('new Array("JPG and GIF","jpg","gif")').
var file = plugins.file.showFileOpenDialog(1, null, false, new Array("JPG and GIF","jpg","gif"));
application.output("you've selected file: " + file.getAbsolutePath());
//for the web you have to give a callback function that has a JSFile array as its first argument (also works in smart), other options can be set but are not used in the webclient (yet)
var file = plugins.file.showFileOpenDialog(myCallbackMethod)
|
|
|
|
|
Table Body (tbody) |
---|
id | showFileSaveDialog |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
showFileSaveDialog |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| JSFile |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| showFileSaveDialog |
Span |
---|
| ([fileName/dir suggestion], [dialog title text]) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Shows a file save dialog. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters [fileName/dir suggestion] [dialog title text] |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var file = plugins.file.showFileSaveDialog();
application.output("you've selected file: " + file.getAbsolutePath());
|
|
|
|
|
Table Body (tbody) |
---|
id | streamFilesFromServer |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
streamFilesFromServer |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| void |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| streamFilesFromServer |
Span |
---|
| (file/fileName|fileArray/fileNameArray, serverFile/serverFileName|serverFileArray/serverFileNameArray, [callbackFunction]) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Streams a file or an array of files from the server in a background task to a file (or files) on the client. If provided, calls back a Servoy function when done |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters file/fileName|fileArray/fileNameArray serverFile/serverFileName|serverFileArray/serverFileNameArray [callbackFunction] |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns void |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
// transfer the first file of the default server folder to a chosen file on the client
var dir = plugins.file.getDesktopFolder();
var file = plugins.file.showFileSaveDialog(dir,'Save file to');
if (file) {
var list = plugins.file.getRemoteList('/', true);
if (list && list.length > 0) {
plugins.file.streamFilesFromServer(file, list[0], callbackFunction);
}
}
|
|
|
|
|
Table Body (tbody) |
---|
id | streamFilesToServer |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
streamFilesToServer |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| void |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| streamFilesToServer |
Span |
---|
| (file/fileName|fileArray/fileNameArray, [serverFile/serverFileName|serverFileArray/serverFileNameArray], [callbackFunction]) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Streams a file or an array of files to the server in a background task - with optional relative path(s)/(new) name(s). If provided, calls back a Servoy function when done |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters file/fileName|fileArray/fileNameArray [serverFile/serverFileName|serverFileArray/serverFileNameArray] [callbackFunction] |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns void |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
// send one file:
var file = plugins.file.showFileOpenDialog( 1, null, false, null, null, 'Choose a file to transfer' );
if (file) {
plugins.file.streamFilesToServer( file, callbackFunction );
}
// send an array of files:
var folder = plugins.file.showDirectorySelectDialog();
if (folder) {
var files = plugins.file.getFolderContents(folder);
if (files) {
plugins.file.streamFilesToServer( files, callbackFunction );
}
}
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| writeFile |
Span |
---|
| (file, binary_data, [mimeType]) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Writes data into a binary file. (Web Enabled) |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters file binary_data [mimeType] |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var bytes = new Array();
for (var i=0; i<1024; i++)
bytes[i] = i % 100;
var f = plugins.file.convertToJSFile('bin.dat');
if (!plugins.file.writeFile(f, bytes))
application.output('Failed to write the file.');
// mimeType variable can be left null, and is used for webclient only. Specify one of any valid mime types as referenced here: http://www.w3schools.com/media/media_mimeref.asp'
var mimeType = 'application/vnd.ms-excel'
if (!plugins.file.writeFile(f, bytes, mimeType))
application.output('Failed to write the file.');
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
writeTXTFile |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| writeTXTFile |
Span |
---|
| (file, text_data, [charsetname], [mimeType]) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Writes data into a text file. (Web Enabled) |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters file text_data [charsetname] [mimeType] |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var fileNameSuggestion = 'myspecialexport.tab'
var textData = 'load of data...'
var success = plugins.file.writeTXTFile(fileNameSuggestion, textData);
if (!success) application.output('Could not write file.');
// For file-encoding parameter options (default OS encoding is used), http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html
// mimeType variable can be left null, and is used for webclient only. Specify one of any valid mime types as referenced here: http://www.w3schools.com/media/media_mimeref.asp'
|
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
writeXMLFile |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| writeXMLFile |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Writes data into an XML file. The file is saved with the encoding specified by the XML itself. (Web Enabled) |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters file xml_data |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var fileName = 'form.xml'
var xml = controller.printXML()
var success = plugins.file.writeXMLFile(fileName, xml);
if (!success) application.output('Could not write file.');
|
|
|
|
|
|