Forked from jpmirandas/gist:a2b4f4951c7e8027ecb4
Last active
August 29, 2015 14:22
-
-
Save mstred/f7a5f13255f4655ed4e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$filePath = @$argv[1]; | |
$outputExt = @$argv[2]; | |
if (!isset($filePath)) { | |
echo "Base64 content file hasn't been actually provided"; | |
exit; | |
} | |
// read content from file and decode it as base64 | |
$file = file_get_contents($filePath, FILE_TEXT); | |
$content = base64_decode($file); | |
// write output file with same name, assume .html as default extension | |
$result = file_put_contents(isset($outputExt) ? $filePath . $outputExt : "$filePath.html", $content, FILE_TEXT); | |
if (!$result) { | |
exit("There was an error in current operation"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment