tao-test/app/taoClientDiagnostic/views/js/tools/bandwidth/data
2022-08-29 20:14:13 +02:00
..
.htaccess Code, before instalation. 2022-08-29 20:14:13 +02:00
bin1MB.data Code, before instalation. 2022-08-29 20:14:13 +02:00
bin10KB.data Code, before instalation. 2022-08-29 20:14:13 +02:00
bin100KB.data Code, before instalation. 2022-08-29 20:14:13 +02:00
readme.md Code, before instalation. 2022-08-29 20:14:13 +02:00

Due to their size we should consider to generate the .data files during install/update. Code could be something like this:

function generate_file($fileName, $size)
{
    if ($fp = fopen($fileName, 'w+')) {
        $fileSize = 0;
        do {
            $chunk = rtrim(base64_encode(md5(microtime())), '=');
            $len = strlen($chunk);
            $fileSize += $len;

            if ($fileSize > $size) {
                $len -= $size - $fileSize;
                $fileSize = $size;
            }

            if ($len > 0) {
                fwrite($fp, $chunk, $len);
            }

        } while( $fileSize < $size );
        fclose($fp);
    }
}