Child pages
  • JSFile
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 21 Next »

Unknown macro: {div}

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'

Unknown macro: {div}


Unknown macro: {table}

{column:width=80px|padding=0px}{column}{column}{column}

Unknown macro: {tr}
Unknown macro: {th}

Method Summary

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

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

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

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

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

createNewFile()
Creates the file on disk if needed.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

deleteFile()
Deletes the file from the disk if possible.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

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

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

JSFile

Unknown macro: {td}

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

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

String

Unknown macro: {td}

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

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

byte[]

Unknown macro: {td}

getBytes()
Gets the contents (bytes) for the file data.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

String

Unknown macro: {td}

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

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

String

Unknown macro: {td}

getName()
Returns the name of the file.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

String

Unknown macro: {td}

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

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

JSFile

Unknown macro: {td}

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

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

String

Unknown macro: {td}

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

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

isAbsolute()
Returns true if the path is absolute.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

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

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

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

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

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

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Date

Unknown macro: {td}

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

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

String[]

Unknown macro: {td}

list()
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.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

JSFile[]

Unknown macro: {td}

listFiles()
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.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

mkdir()
Creates a directory on disk if possible.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

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

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

renameTo(destination)
Renames the file to a different name.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

setBytes(bytes)
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

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

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

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

setLastModified(date)
Sets the date/time of the last modification on the file.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Boolean

Unknown macro: {td}

setReadOnly()
Sets the readonly attribute of the file/directory.

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}

Number

Unknown macro: {td}

size()
Returns the size in bytes of the file.


Unknown macro: {table}

{column:width=100%|padding=0px}{column}

Unknown macro: {tr}
Unknown macro: {th}

Method Details

Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
canRead
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

canRead

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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.');
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
canWrite
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

canWrite

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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.');
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
createNewFile
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

createNewFile

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var f = plugins.file.convertToJSFile('story.txt');
if (!f.exists())
	f.createNewFile();
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
deleteFile
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

deleteFile

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var f = plugins.file.convertToJSFile('story.txt');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/story.txt');
if (f && f.exists())
	f.deleteFile();
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
exists
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

exists

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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.');
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
getAbsoluteFile
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

JSFile

Unknown macro: {span}

getAbsoluteFile

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

JSFile

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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');
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
getAbsolutePath
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

String

Unknown macro: {span}

getAbsolutePath

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

String

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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.');
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
getBytes
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

byte[]

Unknown macro: {span}

getBytes

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

Gets the contents (bytes) for the file data.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

byte[]

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var theFile = plugins.file.showFileOpenDialog();
application.output('The file size in bytes: ' + theFile.getBytes());
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
getContentType
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

String

Unknown macro: {span}

getContentType

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

String

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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.');
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
getName
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

String

Unknown macro: {span}

getName

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

String

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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.');
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
getParent
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

String

Unknown macro: {span}

getParent

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

String

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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');
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
getParentFile
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

JSFile

Unknown macro: {span}

getParentFile

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

JSFile

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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');
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
getPath
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

String

Unknown macro: {span}

getPath

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

String

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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.');
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
isAbsolute
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

isAbsolute

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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.');
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
isDirectory
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

isDirectory

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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.');
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
isFile
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

isFile

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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.');
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
isHidden
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

isHidden

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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.');
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
lastModified
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Date

Unknown macro: {span}

lastModified

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Date

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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.');
}
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
list
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

String[]

Unknown macro: {span}

list

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

String[]

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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());
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
listFiles
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

JSFile[]

Unknown macro: {span}

listFiles

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

JSFile[]

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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());
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
mkdir
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

mkdir

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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.
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
mkdirs
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

mkdirs

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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.

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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.
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
renameTo
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

renameTo

Unknown macro: {span}

(destination)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{Object} destination

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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');
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
setBytes
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

setBytes

Unknown macro: {span}

(bytes)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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

Unknown macro: {tr}
Unknown macro: {td}

Since

Unknown macro: {div}

5.2.5

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{byte[]} bytes – the data

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean – true if the operation worked

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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);
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
setBytes
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

setBytes

Unknown macro: {span}

(bytes, createFile)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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

Unknown macro: {tr}
Unknown macro: {td}

Since

Unknown macro: {div}

5.2.5

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{byte[]} bytes – the data
{Boolean} createFile – true to create a file if it doesn't exist

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean – true if the operation worked

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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);
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
setLastModified
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

setLastModified

Unknown macro: {span}

(date)

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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

Unknown macro: {tr}
Unknown macro: {td}

Parameters

Unknown macro: {div}

{Object} date

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var f = plugins.file.convertToJSFile('story.txt');
f.createNewFile();
// Make the file look old.
f.setLastModified(new Date(1999, 5, 21));
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
setReadOnly
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Boolean

Unknown macro: {span}

setReadOnly

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Boolean

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
var f = plugins.file.convertToJSFile('invoice.txt');
plugins.file.writeTXTFile(f, 'important data that should not be changed');
f.setReadOnly();
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {tbody}
Unknown macro: {tr}
Unknown macro: {td}
size
Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {span}

Number

Unknown macro: {span}

size

Unknown macro: {span}

()

Unknown macro: {tr}
Unknown macro: {td}
Unknown macro: {div}

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

Unknown macro: {tr}
Unknown macro: {td}

Returns

Unknown macro: {div}

Number

Unknown macro: {tr}
Unknown macro: {td}

Sample

Unknown macro: {div}
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.');
}
Unknown macro: {tr}
Unknown macro: {td}
  • No labels