logo
down
shadow

How to determine final uncompressed size of a zip in batch or vbscript?


How to determine final uncompressed size of a zip in batch or vbscript?

By : Vincent.Chen
Date : November 18 2020, 11:13 AM
Hope that helps Hi I'm building my own antivirus in batch and want to add a zip bomb or decompression bomb detecting feature, how would I determine final uncompressed size of a zip in batch or vbscript? in advance , Save this as .bat:
code :
 @if (@x)==(@y) @end /***** jscript comment ******
     @echo off

     cscript //E:JScript //nologo "%~f0"  %*
     exit /b 0

 @if (@x)==(@y) @end ******  end comment *********/


 var wshShell = WScript.CreateObject("WScript.Shell");
var args=WScript.Arguments;
var zipFile=args.Item(0);

    getSize = function(path){
        var ShellObj=new ActiveXObject("Shell.Application");
        var targetObject = new Object;
        var targetObject=ShellObj.NameSpace(path);

        if (typeof size === 'undefined'){
            var size=0;
        }
        if (targetObject != null ){

            for (var i=0; i<targetObject.Items().Count;i++){
                //WScript.Echo("Checking: "+targetObject.Items().Item(i));
                if(!targetObject.Items().Item(i).IsFolder){
                    size=size+targetObject.Items().Item(i).Size;
                } else if (targetObject.Items().Item(i).Count!=0){
                    size=size+getSize(targetObject.Items().Item(i).Path);
                }
            }
        } else {
            return 0;
        }
        return size;
    }



WScript.Echo(getSize(zipFile));
call zipjs.bat getSize -source C:\\zipFile.zip


Share : facebook icon twitter icon
iPhone App Store - how to determine the final size of the app when uploading

iPhone App Store - how to determine the final size of the app when uploading


By : Naveen
Date : March 29 2020, 07:55 AM
this will help Roger's response doesn't take into account the additional DRM that Apple adds to your applications. This will generally add at least 1 MB to the final size, and this does affect whether or not it can be downloaded over 3G.
Determine final size of element wrapper before jQuery effect (e.g. slideDown)

Determine final size of element wrapper before jQuery effect (e.g. slideDown)


By : user3634410
Date : March 29 2020, 07:55 AM
like below fixes the issue Solved the problem with the Anthony Jack's help. To get the final size of the wrapper before the animation is fired, the height of all elements contained within the wrapper need to be summed like so:
code :
var calcHgt=0;
$("#wrapper *").each(function() {
   calcHgt+=$(this).height();
});
Determine final size of ImageView shared element after animation

Determine final size of ImageView shared element after animation


By : farm4data
Date : March 29 2020, 07:55 AM
seems to work fine Here's the case: if you change in the second activity the resource from @drawable/first_element to @drawable/first_element_thumb, you'll no long experience that behavior. The downside is, that you'll see a glitch each time the transition is starting, that's because the drawable is being changed from high resolution to a low resolution right before transition starts.
Here's with 300ms animation time:
Determine compressed/uncompressed buffer size for Z-lib in C

Determine compressed/uncompressed buffer size for Z-lib in C


By : Robert Ash
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , If you want to compress in a single deflate() call (which is not necessary by the way), zlib provides the function deflateBound() for exactly this purpose.
There is no useful bound in the other direction. By not useful, I mean that the bound on the size of the decompressed output is over a thousand times the size of the compressed input.
How to determine the number of bytes necessary to store an uncompressed grayscale image of size 8000 × 3400 pixels?

How to determine the number of bytes necessary to store an uncompressed grayscale image of size 8000 × 3400 pixels?


By : Abedoss
Date : September 24 2020, 09:00 PM
Hope this helps
"I am trying to figure out how to calculate it when prompted to do so on an exam."
code :
8000 * 3400 = 27200000 bytes.
(8000 * 3400) / 8 = 3400000 bytes.
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org