Methods
Own
unzipFile(name)
Parameters
| Name | Type | Description |
|---|---|---|
name |
String |
Returns
String
Details
- Source
- utils/zip.js, line 868
(inner) nextFile() → {Boolean}
Extract the next file from the compressed archive.
Calls skipdir() to proceed recursively.
Returns
false if the end of files' data section has baseElement reached. Then, then all recursive functions are stopped immediately.
- Type
- Boolean
Details
- Source
- utils/zip.js, line 605
(private, inner) skipdir() → {Boolean}
Test if the end of the files' data part of the archive has baseElement reached. If not, uncompressing is resumed.
Returns
true if the end of the files' data sections have been reached.
- Type
- Boolean
Details
- Source
- utils/zip.js, line 737
Inherited
none
Examples
Unzip a base64 encoded zip file
function(str) {
return unescape(
(new JXG.Util.Unzip(JXG.Util.Base64.decodeAsArray(str))).unzip()[0][0]
);
};
base64 encode a zip file for being decoded with Unzip (e.g. with PHP)
<?php
function jxgcompress($filename)
{
if (file_exists($filename)) {
$base64 = base64_encode(gzcompress(rawurlencode(file_get_contents($filename)),9));
echo "var jxgcompressed = " . $base64 . ";\n";
} else {
throw new Exception("$filename not found");
}
}
?>
<?php
jxgcompress("./helloworld.js");
?>