Child pages
  • JSFile

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING.
THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.
Enter additional information related to this 'class' inside the {div} macro with 'id=description'
Divcache
styleindexdisplay:none

...

iddescription

...

padding0px
width80px

...

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary

...

Table Cell (td)
Boolean

...

Table Cell (td)
Boolean

...

true
refresh100d
showRefreshtrue
iddoc
titleRefresh page
showDatetrue
retryEnable

servoy sReturnTypes2100%height: 30px;2Supported ClientssWordListSmartClientsWordListWebClientsWordListNGClient

servoy sSummary12%30%58%height: 30px;3Methods SummaryReturns true if the file exists and is readable (has access to it) - works on remote files too.

...

Returns true if the file exists and can be modified - works on remote files too.

...

Table Cell (td)
Boolean

...

Table Cell (td)
Boolean

...

Creates the file on disk if needed.

...

...

Table Cell (td)
Boolean

...

Deletes the file from the disk if possible.

...

Returns true if the file/directory exists on the filesystem - works on remote files too.

...

Table Cell (td)
JSFile

...

...

Table Cell (td)
String

...

Returns a JSFile instance that corresponds to the absolute form of this pathname - works on remote files too.

...

Returns a String representation of the absolute form of this pathname - works on remote files too.

...

Table Cell (td)
byte[]

...

...

Table Cell (td)
String

...

Gets the contents (bytes) for the file data.

...

Returns the contenttype of this file, like for example 'application/pdf' - works on remote files too.

...

Table Cell (td)
String

...

...

Table Cell (td)
String

...

Returns the name of the file.

...

Returns the String representation of the path of the parent of this file - works on remote files too.

...

Table Cell (td)
JSFile

...

Table Cell (td)
String

...

Returns a JSFile instance that corresponds to the parent of this file - works on remote files too.

...

Returns a String holding the path to the file - works on remote files too.

...

Table Cell (td)
Boolean

...

...

Table Cell (td)
Boolean

...

Returns true if the path is absolute.

...

Returns true if the file is a directory - works on remote files too.

...

Table Cell (td)
Boolean

...

Returns true if the file is a file and not a regular file - works on remote files too.

...

Table Cell (td)
Boolean

...

Table Cell (td)
Date

...

Returns true if the file is hidden (a file system attribute) - works on remote files too.

...

Returns the time/date of the last modification on the file - works on remote files too.

...

Table Cell (td)
String[]

...

...

Returns an array of strings naming the files and directories located inside the file, if the file is a directory - works on remote files too.

...

Table Cell (td)
JSFile[]
Table Cell (td)
Boolean

...

Returns an array of JSFiles naming the files and directories located inside the file, if the file is a directory - works on remote files too.

...

Creates a directory on disk if possible.

...

Table Cell (td)
Boolean

...

Table Cell (td)
Boolean

...

Creates a directory on disk, together with all its parent directories, if possible.

...

Renames the file to a different name.

...

Table Cell (td)
Boolean

...

Set the content of the file (local or remote) to the bytes provided<br/>

...

Table Cell (td)
Boolean

...

Will not create a new file if one doesn't exist

...

...

Table Cell (td)
Boolean

...

Set the content of the file (local or remote) to the bytes provided

...

Table Cell (td)
Boolean

...

Sets the date/time of the last modification on the file.

...

Table Cell (td)
Number

...

Sets the readonly attribute of the file/directory.

...

...

Returns the size in bytes of the file.

...

function

...

servoy sDetail

...

padding0px
width100%

...

2100%height:30px

...

Table Head (th)
colspan1
Method Details

...

idcanRead
Table Row (tr)
idname
Table Cell (td)
canRead
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
canRead
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true if the file exists and is readable (has access to it) - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

classlastDetailRow

...

idcanWrite
Table Row (tr)
idname
Table Cell (td)
canWrite
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
canWrite
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true if the file exists and can be modified - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

classlastDetailRow

...

idcreateNewFile
Table Row (tr)
idname
Table Cell (td)
createNewFile
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
createNewFile
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Creates the file on disk if needed. Returns true if the file (name) did not already exists and had to be created - for remote, use the streamFilesToServer to stream a file.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('story.txt');
if (!f.exists())
	f.createNewFile();

...

classlastDetailRow

...

iddeleteFile
Table Row (tr)
idname
Table Cell (td)
deleteFile
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
deleteFile
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Deletes the file from the disk if possible. Returns true if the file could be deleted. If the file is a directory, then it must be empty in order to be deleted - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('story.txt');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/story.txt');
if (f && f.exists())
	f.deleteFile();

...

classlastDetailRow

...

idexists
Table Row (tr)
idname
Table Cell (td)
exists
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
exists
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true if the file/directory exists on the filesystem - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

classlastDetailRow

...

idgetAbsoluteFile
Table Row (tr)
idname
Table Cell (td)
getAbsoluteFile
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSFile
Span
stylefont-weight: bold;
getAbsoluteFile
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns a JSFile instance that corresponds to the absolute form of this pathname - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
JSFile
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('story.txt');
// or for a remote file:
// var f = plugins.file.convertToRemoteJSFile('/story.txt');
application.output('parent folder: ' + f.getAbsoluteFile().getParent());
application.output('parent folder has ' + f.getAbsoluteFile().getParentFile().listFiles().length + ' entries');

...

classlastDetailRow

...

idgetAbsolutePath
Table Row (tr)
idname
Table Cell (td)
getAbsolutePath
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getAbsolutePath
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns a String representation of the absolute form of this pathname - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

classlastDetailRow

...

idgetBytes
Table Row (tr)
idname
Table Cell (td)
getBytes
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
byte[]
Span
stylefont-weight: bold;
getBytes
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Gets the contents (bytes) for the file data.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
byte[]
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var theFile = plugins.file.showFileOpenDialog();
application.output('The file size in bytes: ' + theFile.getBytes());

...

classlastDetailRow

...

idgetContentType
Table Row (tr)
idname
Table Cell (td)
getContentType
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getContentType
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the contenttype of this file, like for example 'application/pdf' - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

classlastDetailRow

...

idgetName
Table Row (tr)
idname
Table Cell (td)
getName
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getName
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the name of the file. The name consists in the last part of the file path - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

classlastDetailRow

...

idgetParent
Table Row (tr)
idname
Table Cell (td)
getParent
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getParent
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the String representation of the path of the parent of this file - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('story.txt');
// or for a remote file:
// var f = plugins.file.convertToRemoteJSFile('/story.txt');
application.output('parent folder: ' + f.getAbsoluteFile().getParent());
application.output('parent folder has ' + f.getAbsoluteFile().getParentFile().listFiles().length + ' entries');

...

classlastDetailRow

...

idgetParentFile
Table Row (tr)
idname
Table Cell (td)
getParentFile
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSFile
Span
stylefont-weight: bold;
getParentFile
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns a JSFile instance that corresponds to the parent of this file - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
JSFile
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('story.txt');
// or for a remote file:
// var f = plugins.file.convertToRemoteJSFile('/story.txt');
application.output('parent folder: ' + f.getAbsoluteFile().getParent());
application.output('parent folder has ' + f.getAbsoluteFile().getParentFile().listFiles().length + ' entries');

...

classlastDetailRow

...

idgetPath
Table Row (tr)
idname
Table Cell (td)
getPath
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getPath
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns a String holding the path to the file - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

classlastDetailRow

...

idisAbsolute
Table Row (tr)
idname
Table Cell (td)
isAbsolute
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
isAbsolute
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true if the path is absolute. The path is absolute if it starts with '/' on Unix/Linux/MacOS or has a driver letter on Windows - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

classlastDetailRow

...

idisDirectory
Table Row (tr)
idname
Table Cell (td)
isDirectory
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
isDirectory
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true if the file is a directory - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

classlastDetailRow

...

idisFile
Table Row (tr)
idname
Table Cell (td)
isFile
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
isFile
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true if the file is a file and not a regular file - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

classlastDetailRow

...

idisHidden
Table Row (tr)
idname
Table Cell (td)
isHidden
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
isHidden
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true if the file is hidden (a file system attribute) - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

classlastDetailRow

...

idlastModified
Table Row (tr)
idname
Table Cell (td)
lastModified
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Date
Span
stylefont-weight: bold;
lastModified
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the time/date of the last modification on the file - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Date
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

classlastDetailRow

...

idlist
Table Row (tr)
idname
Table Cell (td)
list
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String[]
Span
stylefont-weight: bold;
list
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns an array of strings naming the files and directories located inside the file, if the file is a directory - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String[]
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var d = plugins.file.convertToJSFile('plugins');
// or for a remote file:
// var d = plugins.convertToRemoteJSFile('/plugins');
var names = d.list();
application.output('Names:');
for (var i=0; i<names.length; i++)
	application.output(names[i]);
var files = d.listFiles();
application.output('Absolute paths:');
for (var i=0; i<files.length; i++)
	application.output(files[i].getAbsolutePath());

...

classlastDetailRow

...

idlistFiles
Table Row (tr)
idname
Table Cell (td)
listFiles
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSFile[]
Span
stylefont-weight: bold;
listFiles
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns an array of JSFiles naming the files and directories located inside the file, if the file is a directory - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
JSFile[]
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var d = plugins.file.convertToJSFile('plugins');
// or for a remote file:
// var d = plugins.convertToRemoteJSFile('/plugins');
var names = d.list();
application.output('Names:');
for (var i=0; i<names.length; i++)
	application.output(names[i]);
var files = d.listFiles();
application.output('Absolute paths:');
for (var i=0; i<files.length; i++)
	application.output(files[i].getAbsolutePath());

...

classlastDetailRow

...

idmkdir
Table Row (tr)
idname
Table Cell (td)
mkdir
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
mkdir
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Creates a directory on disk if possible. Returns true if a new directory was created - for remote, use the streamFilesToServer to create the directory instead.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('one/two/three/four');
f.mkdirs(); // Create all four levels of folders in one step.
var g = plugins.file.convertToJSFile('one/two/three/four/five');
g.mkdir(); // This will work because all parent folders are already created.

...

classlastDetailRow

...

idmkdirs
Table Row (tr)
idname
Table Cell (td)
mkdirs
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
mkdirs
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Creates a directory on disk, together with all its parent directories, if possible. Returns true if the hierarchy of directories is created - for remote, use the streamFilesToServer to create the directories instead.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('one/two/three/four');
f.mkdirs(); // Create all four levels of folders in one step.
var g = plugins.file.convertToJSFile('one/two/three/four/five');
g.mkdir(); // This will work because all parent folders are already created.

...

classlastDetailRow

...

idrenameTo-Object
Table Row (tr)
idname
Table Cell (td)
renameTo
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
renameTo
Span
(destination)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Renames the file to a different name. Returns true if the file could be renamed - works on remote files too.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{Object} destination
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('story.txt');
f.renameTo('otherstory.txt');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/story.txt');
// f.renameTo('/otherstory.txt');

...

classlastDetailRow

...

idsetBytes-byteArray
Table Row (tr)
idname
Table Cell (td)
setBytes
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
setBytes
Span
(bytes)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Set the content of the file (local or remote) to the bytes provided<br/>
Will not create a new file if one doesn't exist
Table Row (tr)
idsnc
Table Cell (td)
Since
Div
classsIndent
5.2.5
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{byte[]} bytes - the data
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean - true if the operation worked
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var file = plugins.file.convertToJSFile('/pathTo/file.jpg');
// or for a remote file:
// var file = plugins.file.convertToRemoteJSFile('/remotePathTo/file.jpg');
var success = file.setBytes(blobDataProvider, true);

...

classlastDetailRow

...

idsetBytes-byteArray_Boolean
Table Row (tr)
idname
Table Cell (td)
setBytes
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
setBytes
Span
(bytes, createFile)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Set the content of the file (local or remote) to the bytes provided
Table Row (tr)
idsnc
Table Cell (td)
Since
Div
classsIndent
5.2.5
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{byte[]} bytes - the data
{Boolean} createFile - true to create a file if it doesn't exist
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean - true if the operation worked
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var file = plugins.file.convertToJSFile('/pathTo/file.jpg');
// or for a remote file:
// var file = plugins.file.convertToRemoteJSFile('/remotePathTo/file.jpg');
var success = file.setBytes(blobDataProvider, true);

...

classlastDetailRow

...

idsetLastModified-Object
Table Row (tr)
idname
Table Cell (td)
setLastModified
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
setLastModified
Span
(date)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Sets the date/time of the last modification on the file.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{Object} date
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('story.txt');
f.createNewFile();
// Make the file look old.
f.setLastModified(new Date(1999, 5, 21));

...

classlastDetailRow

...

idsetReadOnly
Table Row (tr)
idname
Table Cell (td)
setReadOnly
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
setReadOnly
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Sets the readonly attribute of the file/directory. Returns true on success.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('invoice.txt');
plugins.file.writeTXTFile(f, 'important data that should not be changed');
f.setReadOnly();

...

classlastDetailRow

...

idsize
Table Row (tr)
idname
Table Cell (td)
size
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
size
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the size in bytes of the file. Returns 0 if the file does not exist on disk - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

classlastDetailRow

...

2Methods DetailscanReadname

canRead()

dessIndent
Returns true if the file exists and is readable (has access to it) - works on remote files too.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
canWritename

canWrite()

dessIndent
Returns true if the file exists and can be modified - works on remote files too.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
createNewFilename

createNewFile()

dessIndent
Creates the file on disk if needed. Returns true if the file (name) did not already exists and had to be created - for remote, use the streamFilesToServer to stream a file.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
deleteFilename

deleteFile()

dessIndent
Deletes the file from the disk if possible. Returns true if the file could be deleted. If the file is a directory, then it must be empty in order to be deleted - works on remote files too.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
existsname

exists()

dessIndent
Returns true if the file/directory exists on the filesystem - works on remote files too.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getAbsoluteFilename

getAbsoluteFile()

dessIndent
Returns a JSFile instance that corresponds to the absolute form of this pathname - works on remote files too.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getAbsolutePathname

getAbsolutePath()

dessIndent
Returns a String representation of the absolute form of this pathname - works on remote files too.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getBytesname

getBytes()

dessIndent
Gets the contents (bytes) for the file data.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getContentTypename

getContentType()

dessIndent
Returns the contenttype of this file, like for example 'application/pdf' - works on remote files too.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getNamename

getName()

dessIndent
Returns the name of the file. The name consists in the last part of the file path - works on remote files too.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getParentname

getParent()

dessIndent
Returns the String representation of the path of the parent of this file - works on remote files too.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getParentFilename

getParentFile()

dessIndent
Returns a JSFile instance that corresponds to the parent of this file - works on remote files too.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getPathname

getPath()

dessIndent
Returns a String holding the path to the file - works on remote files too.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
isAbsolutename

isAbsolute()

dessIndent
Returns true if the path is absolute. The path is absolute if it starts with '/' on Unix/Linux/MacOS or has a driver letter on Windows - works on remote files too.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
isDirectoryname

isDirectory()

dessIndent
Returns true if the file is a directory - works on remote files too.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
isFilename

isFile()

dessIndent
Returns true if the file is a file and not a regular file - works on remote files too.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
isHiddenname

isHidden()

dessIndent
Returns true if the file is hidden (a file system attribute) - works on remote files too.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
lastModifiedname

lastModified()

dessIndent
Returns the time/date of the last modification on the file - works on remote files too.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
listname

list()

dessIndent
Returns an array of strings naming the files and directories located inside the file, if the file is a directory - works on remote files too.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
listFilesname

listFiles()

dessIndent
Returns an array of JSFiles naming the files and directories located inside the file, if the file is a directory - works on remote files too.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
mkdirname

mkdir()

dessIndent
Creates a directory on disk if possible. Returns true if a new directory was created - for remote, use the streamFilesToServer to create the directory instead.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
mkdirsname

mkdirs()

dessIndent
Creates a directory on disk, together with all its parent directories, if possible. Returns true if the hierarchy of directories is created - for remote, use the streamFilesToServer to create the directories instead.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
renameToname

renameTo(destination)

dessIndent
Renames the file to a different name. Returns true if the file could be renamed - works on remote files too.
prs

Parameters

sIndentdestination ;
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
setBytesname

setBytes(bytes)

dessIndent
Set the content of the file (local or remote) to the bytes provided
Will not create a new file if one doesn't exist
prs

Parameters

sIndentbytesthe data
ret

Returns

sIndent true if the operation worked
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
setBytesname

setBytes(bytes, createFile)

dessIndent
Set the content of the file (local or remote) to the bytes provided
prs

Parameters

sIndentbytesthe datacreateFiletrue to create a file if it doesn't exist
ret

Returns

sIndent true if the operation worked
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
setLastModifiedname

setLastModified(date)

dessIndent
Sets the date/time of the last modification on the file.
prs

Parameters

sIndentdate ;
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
setReadOnlyname

setReadOnly()

dessIndent
Sets the readonly attribute of the file/directory. Returns true on success.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
sizename

size()

dessIndent
Returns the size in bytes of the file. Returns 0 if the file does not exist on disk - works on remote files too.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow