FileTools[Compressed]
Open
open a compressed file for reading or writing
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
Open(filename, options)
filename
-
string, or string in string
options
(optional) argument(s) of the form option=value where option is one of mode, append, format, or gzipopts
mode : READ or WRITE
append : true or false (default); whether to append to an existing file
format : zip or gzip ; specify compression format
gzipopts : additional compression options to pass to zlib see FileTools[Compressed].
The Open command opens a file to be read or written in gzip or zip format. It returns an integer file descriptor that can be passed to most of the commands in the subpackage FileTools[Compressed].
If filename is the name of an existing file, the file is opened for reading unless the append option is passed or the option mode is set to WRITE. If mode=WRITE is given, filename will be overwritten unless the option append is also given.
If filename is not an existing file, then it will be opened for writing.
The format will be implicitly determined by the filename -- if the suffix is ".zip", ".ZIP" or if filename is of the form "subfile" in "zipfile", then the system will assume the file is in zip format. Otherwise it will be opened as if it were in gzip format. The format=gzip or format=zip option can be used to force the recognition of a specified format.
file≔FileToolsTemporaryFilename⁡FileToolsJoinPath⁡FileToolsTemporaryDirectory⁡,GZtest-
file≔/tmp/mpldoc3/GZtest-yYoYxV9R
fd≔FileToolsCompressedOpen⁡file
fd≔25364016
FileToolsCompressedClose⁡fd
0
FileToolsCompressedOpen⁡file
25364016
Error, (in FileTools:-Compressed:-Open) file /tmp/mpldoc3/GZtest-yYoYxV9R is already open
FileToolsCompressedClose⁡file
The FileTools[Compressed][Open] command was introduced in Maple 16.
For more information on Maple 16 changes, see Updates in Maple 16.
The format option was introduced in Maple 18.
For more information on Maple 18 changes, see Updates in Maple 18.
See Also
FileTools[Compressed][Close]
FileTools[Compressed][Read]
FileTools[Compressed][Write]
FileTools[Remove]
Download Help Document