// DIE's signature file
// doc-ref: https://github.com/dsnet/compress/blob/master/doc/bzip2-format.pdf
init("archive","");

function detect(bShowType,bShowVersion,bShowOptions)
{
    if(Binary.getSize()>=9)
    {
        if(Binary.compare("'BZ0'"))
        {
            sName = "BZip1 compressed data (.BZ)"
            bDetected=true;
        }

        else if(Binary.compare("'BZh'") && Binary.compare("314159265359",0x4))
        {
            sName = "BZip2 compressed data (.BZ2)"
            bDetected=true;
        }
        if(bDetected && Binary.isVerbose())
        {
            sOptions="block-size:"+Binary.getString(3,1)+"00 kb";
        }
    }

    return result(bShowType,bShowVersion,bShowOptions);
}
