c# - How to detect if a JS is packed already -


hey guys.. writing windows application in c# minifies css files , packs js files batch job. 1 hurdle application is, if user selects javascript file has been packed? end increasing file size, defeating purpose entirely!

is opening file , looking string eval(function(p,a,c,k,e,d) enough? guess no, there other js packing methods out there. me out!

one might suggest compare size of pre , post packed js , return/use smaller of two.

update based on question in comment gpx on sep 30 @ 1:02

the following simple way tell. there may different, or more accurate, ways of determining this, should going in right direction:

var unpackedjs = file.readalltext(...) var unpackedsize = jscontent.length; var packedjs = ... // packaging routine file.writealltext(pathtofile, unpackedsize < packedjs.length ? unpackedjs : packedjs) 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -