views:

186

answers:

1

hey guys as u know there are lots of ways to compress a JS file such as Packer YUI and ....

but how can we decompress them

so many times happened to me that i did compress a file and i lost the source file

plz if u know any software or method give me a hint

+2  A: 

You can't. Javascript compression is usually a lossy one, and the information is lost forever.

What you can do, is use a source formatter and a good refactoring tool and -- painfully -- reconstruct the original source. Even if you are not familiar with the code it should be possible; Jeff and a few others reverse engineered the WMD javascript code from a minified version.

Finally, you should consider using a version control system and proper backups to keep your source code safe.

David Schmitt
thanks but is there any software to tidy up the mess , so u r telling i lost my script for ever , i always wonder how can i user version control system , any software any online service ?
Mac Taylor
+1 for mentioning, that JS compression is lossy. Another +1 for the source formatter. And a third +1 for the version control system and backups. Summing it up, taking modulo 2 and finally adding +1 to the answer.
Boldewyn
@Mac Tylor: If you're a Windows user, take a look at TortoiseSVN. Mac comes with Time Machine (more a backup software than a full featured VCS), and for *NIX you have the most remarkably rich choice of dozens of good command line based systems (and git-gui or gitk, if you choose git and need visible feedback).
Boldewyn
Online Services: Either you pay, or you publish your soruce code as open source. In the latter case you have the free choice among e.g.: SourceForge, GitHub, Google Code, Codeplex, ...
Boldewyn
thanks guys , im a windows user and i would give toroise a try
Mac Taylor
@Mac: not lost. Just a helluva work to get it back. It's still less work to rename all vars and redo the comments than to recode (and re-test and re-debug) the whole script.
David Schmitt