GoLang Phar::addEmptyDir

request it (246)
GoLang replacement for PHP's Phar::addEmptyDir [edit | history]

Do you know a GoLang replacement for PHP's Phar::addEmptyDir? Write it!

PHP Phar::addEmptyDir

PHP original manual for Phar::addEmptyDir [ show | php.net ]



Phar::addEmptyDirAdd an empty directory to the phar archive


public void Phar::addEmptyDir ( string $dirname )


This method requires the php.ini setting phar.readonly to be set to 0 in order to work for Phar objects. Otherwise, a PharException will be thrown.

With this method, an empty directory is created with path dirname. This method is similar to ZipArchive::addEmptyDir().



The name of the empty directory to create in the phar archive

Return Values

no return value, exception is thrown on failure.


Example #1 A Phar::addEmptyDir() example

try {
$a = new Phar('/path/to/phar.phar');

// demonstrates how this file is stored
$b $a['full/path/to/file']->isDir();
} catch (
Exception $e) {
// handle errors here

See Also