NotFoundError: If the mode is "r" and the file does not exist, or the mode is not "r" and the file cannot be created because the path of the file after excluding its file name does not exist

IOError: If the access is denied due to insufficient permissions

UnknownError: In case of any other error

Use mode depending on which operation are intended:

Mode

Description

r

Use this mode for extracting or getting information about the contents of an archive file. file must exist. If the file does not exist, onerror will be invoked (NotFoundError).When an archive file is opened in this mode, add() will not be available. (IOError will be thrown.)

w

Use this mode to create an archive file and add files to the archive file. If file does not exist, it will be created. If file exists and the overwrite option is true, the existing file will be overwritten with empty archive. If file exists and the overwrite option is false, onerror callback will be invoked (InvalidModificationError). When an archive file is opened in this mode, getEntries(), getEntryByName(), and extractAll() are not available. (IOError will be thrown.)

rw

Use this mode for archive zipping/unzipping. If file does not exist, it will be created. If file exists and the overwrite option is true, the existing file will be overwritten with an empty archive. If file exists and the overwrite option is false, the existing contents are preserved.
Both adding and extracting will be available.

a

Use this mode to add new files to an archive file. If file does not exist, it will be created. If file exists, then the previous contents of the archive file are preserved and new files can be added to the archive file.
In this mode, getEntries(), getEntryByName(), and extractAll() are not available. (IOError will be thrown.)

Privilege level:
public

Privilege:
http://tizen.org/privilege/filesystem.write

Parameters:

file:
File to open

mode:
File mode for the opened archive. Determines which operations are available

onsuccess:
Callback method to be invoked when archive is opened successfully

onerror [optional] [nullable]:
Callback method to be invoked when an error occurs

If sourceFile refers to a directory,
the directory and its content will be added to ArchiveFile.

The errorCallback is launched with these error types:

NotFoundError: If the given sourceFile does not exist

IOError: If archiveFile can not be written due the lack of access permission

InvalidModificationError: If the operation results in a name conflict in the archivei.e. two entries in the archive with the same name (including directory names).

UnknownError: In any case of any other error

Name stored for new entries is constructed from sourceFile according to the
stripSourceDirectory and destination options. Names are constructed as follows:

source file

destination

stripSourceDirectory

resulting entry name

documents/subdir/second/justName.ext

(empty)

false

subdir/second/justName.ext

documents/subdir/second/justName.ext

(empty)

true

justName.ext

documents/subdir/justName.ext

"report3"

false

report3/subdir/justName.ext

documents/subdir/justName.ext

"report3"

true

report3/justName.ext

Privilege level:
public

Privilege:
http://tizen.org/privilege/filesystem.write

Parameters:

sourceFile:
File or directory to be added to archive

onsuccess [optional] [nullable]:
Callback method to be invoked when this operation is completed successfully

onerror [optional] [nullable]:
Callback method to be invoked when an error occurs

onprogress [optional] [nullable]:
Callback method to be invoked to notify about operation progress It is called every time a single source file has been completely added.
If the source file is big then the callback can also be called while the file is being processed.

options [optional] [nullable]:
Additional options used to control how the sourceFile will be compressed and stored in the archive

Return value:

long Task ID which can be used to cancel the operation with abort()

Exceptions:

WebAPIException

with error type TypeMismatchError, if parameter is of the wrong type.

with error type InvalidStateError, if ArchiveFile is not open.

with error type InvalidAccessError, if the file mode is "r".

with error type SecurityError, if the application does not have the privilege to call this method.

IOError: If destinationDirectory can not be written to (e.g due to insufficient permissions)

InvalidModificationError: If during extracting it is detected that an existing file would
have to be overwritten and the overwrite argument is false

UnknownError: In any other error case

Privilege level:
public

Privilege:
http://tizen.org/privilege/filesystem.write

Parameters:

destinationDirectory:
Directory where extracted files will be stored Specified as a virtual path or a File object representing a directory.

onsuccess [optional] [nullable]:
Callback method to be invoked when an archive is extracted successfully

onerror [optional] [nullable]:
Callback method to be invoked when an error occurs

onprogress [optional] [nullable]:
Callback method to be invoked while the extracting is in progress The onprogress callback is called at least once. It will be invoked for every extracted file.

overwrite [optional] [nullable]:
Flag indicating whether to overwrite or keep the existing files with the same name in the destinationDirectory location when extracting an archive By default, this attribute is set to false.

Return value:

long Task ID which can be used to cancel the operation with abort()

Exceptions:

WebAPIException

with error type TypeMismatchError, if parameter is of the wrong type.

with error type InvalidStateError, if ArchiveFile is not open.

with error type InvalidAccessError, if the file mode is "w" or "a".

with error type SecurityError, if the application does not have the privilege to call this method.

Call this method when the archive file is not used any more. Once you call this method, the archive file object will not be available and any further operation attempt results in an InvalidStateError.Calling close() on an archive file object which is already closed does not raise any exception.

Exceptions:

WebAPIException

with error type UnknownError, if any other error occurs.

2.6. ArchiveFileEntry

The ArchiveFileEntry interface provides access to ArchiveFile member information and file data.

InvalidModificationError: If the file already exists and overwriting is not allowed

IOError: If destinationDirectory can not be written to

UnknownError: In case of any other error

Privilege level:
public

Privilege:
http://tizen.org/privilege/filesystem.write

Parameters:

destinationDirectory:
Directory where extracted files will be stored Given as a virtual path or a File object representing a directory.

onsuccess [optional] [nullable]:
Callback method to be invoked when an extract operation is completed

onerror [optional] [nullable]:
Callback method to be invoked when an error occurs

onprogress [optional] [nullable]:
Callback method to be invoked while the extracting is in progress The onprogress callback is called at least once. It will be invoked for every extracted file.

stripName [optional] [nullable]:
Flag which determines if directory name part of ArchiveFileEntry should be removed or preserved The default value is false. If it is true, use only base name (part after last slash) as a target path.

overwrite [optional] [nullable]:
Flag which determines if it possible to overwrite files when the decompressed file already exists in this destination location The default value is false.

Return value:

long Task ID which can be used to cancel the operation with abort()

Exceptions:

WebAPIException

with error type TypeMismatchError, if parameter is of the wrong type.

with error type InvalidValuesError, if directory parameter does not represent a directory.

with error type SecurityError, if the application does not have the privilege to call this method.