-
-
Save johnsaigle/36dd877d6224d3bfa91899878a31b656 to your computer and use it in GitHub Desktop.
Extract source code & directories from the javascript .map files
This file contains hidden or 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 | |
| /** | |
| * Created by PhpStorm. | |
| * User: edwinsturt | |
| * Date: 2020-06-24 | |
| * Time: 00:45 | |
| */ | |
| $file = 'main.ff0058ad.js.map'; | |
| if(file_exists($file)) { | |
| $json = json_decode(file_get_contents($file)); | |
| $directories = []; | |
| foreach ($json->sources as $index => $source) { | |
| $dir = dirname($source); | |
| if (!is_dir($dir)) { | |
| mkdir($dir, 0755, true); | |
| } | |
| $data = explode('/', $source); | |
| $file = end($data); | |
| file_put_contents($dir . "/" . $file, $json->sourcesContent[$index]); | |
| $files[] = $dir . "/" . $file; | |
| } | |
| echo "<pre>All Source codes has been extracted from map file "; | |
| print_r($files); | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment