"); lines.push(' '); lines.push(' '); lines.push(" Generated Test Data Report"); lines.push(" "); lines.push(""); lines.push(""); lines.push("

Employee Data Report

"); lines.push("

Generated on: 2026-06-13 | Total records shown below

"); lines.push(" "); lines.push(" "); lines.push(" "); lines.push(" "); lines.push(" "); var idx = 1; var currentLen = lines.join("\n").length; while (currentLen < sizeInBytes - 300 && idx < 999999) { var rec = generateRecord(idx, rand); var badgeClass = rec.isActive ? "active" : (rec.status === "pending" ? "pending" : "inactive"); var row = ' '; currentLen += row.length + 1; if (currentLen > sizeInBytes - 100) break; lines.push(row); idx++; } lines.push(" "); lines.push("
IDNameEmailDepartmentJob TitleSalaryStatusLocation
' + rec.id + '' + rec.firstName + ' ' + rec.lastName + '' + rec.email + '' + rec.department + '' + rec.jobTitle + '$' + rec.salary.toLocaleString() + '' + rec.status + '' + rec.city + ', ' + rec.state + '
"); lines.push("

Report contains " + (idx - 1) + " records.

"); lines.push(""); lines.push(""); return padToSize(new TextEncoder().encode(lines.join("\n")), sizeInBytes); } // --- SQL: valid CREATE TABLE + INSERT statements --- function generateSQL(sizeInBytes) { var rand = rng(42); var lines = []; lines.push("-- Auto-generated SQL test data"); lines.push("-- Generated: 2026-06-13"); lines.push(""); lines.push("CREATE TABLE IF NOT EXISTS employees ("); lines.push(" id INT PRIMARY KEY AUTO_INCREMENT,"); lines.push(" uuid VARCHAR(36) NOT NULL UNIQUE,"); lines.push(" first_name VARCHAR(50) NOT NULL,"); lines.push(" last_name VARCHAR(50) NOT NULL,"); lines.push(" email VARCHAR(100) NOT NULL UNIQUE,"); lines.push(" phone VARCHAR(20),"); lines.push(" age INT,"); lines.push(" job_title VARCHAR(100),"); lines.push(" department VARCHAR(50),"); lines.push(" salary DECIMAL(10,2),"); lines.push(" status VARCHAR(20) DEFAULT 'active',"); lines.push(" city VARCHAR(50),"); lines.push(" state VARCHAR(10),"); lines.push(" ip_address VARCHAR(15),"); lines.push(" join_date DATE,"); lines.push(" is_active BOOLEAN DEFAULT TRUE,"); lines.push(" created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); lines.push(");"); lines.push(""); lines.push("INSERT INTO employees (id, uuid, first_name, last_name, email, phone, age, job_title, department, salary, status, city, state, ip_address, join_date, is_active) VALUES"); var idx = 1; var currentLen = lines.join("\n").length; var valueLines = []; while (currentLen < sizeInBytes - 100 && idx < 999999) { var rec = generateRecord(idx, rand); var val = "(" + rec.id + ", '" + rec.uuid + "', '" + rec.firstName + "', '" + rec.lastName + "', '" + rec.email + "', '" + rec.phone + "', " + rec.age + ", '" + rec.jobTitle + "', '" + rec.department + "', " + rec.salary + ".00, '" + rec.status + "', '" + rec.city + "', '" + rec.state + "', '" + rec.ip + "', '" + rec.joinDate + "', " + (rec.isActive ? "TRUE" : "FALSE") + ")"; currentLen += val.length + 2; if (currentLen > sizeInBytes - 20) break; lines.push(shape); idx++; } lines.push(""); return padToSize(new TextEncoder().encode(lines.join("\n")), sizeInBytes); } // --- Galois Field mathematics for O(log N) CRC-32 combination --- var POLY = 0xedb88320; function multmodp(a, b) { if (a === 0 || b === 0) return 0; var m = 0x80000000; var p = 0; for (;;) { if (a & m) { p ^= b; if ((a & (m - 1)) === 0) break; } m = m >>> 1; b = (b & 1) ? ((b >>> 1) ^ POLY) : (b >>> 1); } return p >>> 0; } var x2n_table = []; (function init_x2n_table() { var p = 0x40000000; x2n_table[0] = p >>> 0; for (var n = 1; n < 32; n++) { p = multmodp(p, p); x2n_table[n] = p >>> 0; } })(); function x2nmodp(n, k) { var p = 0x80000000; while (n > 0) { if (n % 2 !== 0) { p = multmodp(x2n_table[k & 31], p); } n = Math.floor(n / 2); k++; } return p >>> 0; } function crc32_combine(crc1, crc2, len2) { return (multmodp(x2nmodp(len2, 3), crc1) ^ crc2) >>> 0; } function crcOfSpaces(len) { if (len === 0) return 0; if (len === 1) return 0xe96ccf45; // CRC of a single space byte [32] var half = Math.floor(len / 2); var halfCrc = crcOfSpaces(half); var combined = crc32_combine(halfCrc, halfCrc, half); if (len % 2 !== 0) { combined = crc32_combine(combined, 0xe96ccf45, 1); } return combined; } // --- Dynamic zip internal padding --- function padZipInternal(data, targetSize, paddingParts) { var len = data.length; var eocdPos = -1; for (var i = len - 22; i >= 0; i--) { if (data[i] === 0x50 && data[i+1] === 0x4B && data[i+2] === 0x05 && data[i+3] === 0x06) { eocdPos = i; break; } } if (eocdPos === -1) { return [data]; } var view = new DataView(data.buffer, data.byteOffset, data.byteLength); var cdSize = view.getUint32(eocdPos + 12, true); var cdStartOffset = view.getUint32(eocdPos + 16, true); var numRecords = view.getUint16(eocdPos + 8, true); var P = targetSize - data.length - 98; if (P <= 0) { return [data]; } var paddingCrc = crcOfSpaces(P); // Construct LFH of padding.txt var lfh = new Uint8Array(41); var lfhView = new DataView(lfh.buffer); lfh.set([80, 75, 3, 4], 0); lfhView.setUint16(4, 10, true); lfhView.setUint16(6, 0, true); lfhView.setUint16(8, 0, true); lfhView.setUint16(10, 0, true); lfhView.setUint16(12, 0, true); lfhView.setUint32(14, paddingCrc, true); lfhView.setUint32(18, P, true); lfhView.setUint32(22, P, true); lfhView.setUint16(26, 11, true); lfhView.setUint16(28, 0, true); lfh.set(new TextEncoder().encode("padding.txt"), 30); // Construct CDFH of padding.txt var cdfh = new Uint8Array(57); var cdfhView = new DataView(cdfh.buffer); cdfh.set([80, 75, 1, 2], 0); cdfhView.setUint16(4, 20, true); cdfhView.setUint16(6, 10, true); cdfhView.setUint16(8, 0, true); cdfhView.setUint16(10, 0, true); cdfhView.setUint16(12, 0, true); cdfhView.setUint16(14, 0, true); cdfhView.setUint32(16, paddingCrc, true); cdfhView.setUint32(20, P, true); cdfhView.setUint32(24, P, true); cdfhView.setUint16(28, 11, true); cdfhView.setUint16(30, 0, true); cdfhView.setUint16(32, 0, true); cdfhView.setUint16(34, 0, true); cdfhView.setUint16(36, 0, true); cdfhView.setUint32(38, 0, true); cdfhView.setUint32(42, 0, true); cdfh.set(new TextEncoder().encode("padding.txt"), 46); // Copy and shift CDFHs var origCd = new Uint8Array(data.subarray(cdStartOffset, cdStartOffset + cdSize)); var shift = 41 + P; var cdView = new DataView(origCd.buffer, origCd.byteOffset, origCd.byteLength); var offset = 0; while (offset < origCd.length - 4) { if (origCd[offset] === 0x50 && origCd[offset+1] === 0x4B && origCd[offset+2] === 0x01 && origCd[offset+3] === 0x02) { var oldOff = cdView.getUint32(offset + 42, true); cdView.setUint32(offset + 42, oldOff + shift, true); var fnLen = cdView.getUint16(offset + 28, true); var extraLen = cdView.getUint16(offset + 30, true); var commentLen = cdView.getUint16(offset + 32, true); offset += 46 + fnLen + extraLen + commentLen; } else { offset++; } } // Copy and modify EOCD var origEocd = new Uint8Array(data.subarray(eocdPos, eocdPos + 22)); var eocdView = new DataView(origEocd.buffer, origEocd.byteOffset, origEocd.byteLength); var oldRecords = eocdView.getUint16(8, true); eocdView.setUint16(8, oldRecords + 1, true); eocdView.setUint16(10, oldRecords + 1, true); var oldCdSize = eocdView.getUint32(12, true); eocdView.setUint32(12, oldCdSize + 57, true); eocdView.setUint32(16, 41 + P + cdStartOffset, true); return [lfh].concat(paddingParts).concat([data.subarray(0, cdStartOffset), cdfh, origCd, origEocd]); } // --- Dynamic tar.gz generation --- function makeTarHeader(filename, fileSize) { var header = new Uint8Array(512); var encoder = new TextEncoder(); header.set(encoder.encode(filename).subarray(0, 100), 0); header.set(encoder.encode("0000644"), 100); header.set(encoder.encode("0000000"), 108); header.set(encoder.encode("0000000"), 116); var sizeStr = fileSize.toString(8).padStart(11, "0") + ""; header.set(encoder.encode(sizeStr), 124); header.set(encoder.encode("00000000000"), 136); header[156] = 48; // '0' (normal file) header.set(encoder.encode("ustar"), 257); header.set(encoder.encode("00"), 263); for (var i = 0; i < 8; i++) { header[148 + i] = 32; } var sum = 0; for (var i = 0; i < 512; i++) { sum += header[i]; } var chkStr = sum.toString(8).padStart(6, "0") + " "; header.set(encoder.encode(chkStr), 148); return header; } function gzipCompressStored(parts, rawSize, crcVal) { var gzipParts = []; var header = new Uint8Array([0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03]); gzipParts.push(header); var blockBuf = new Uint8Array(65535); var blockLen = 0; function pushBlock(isFinal) { var blockHeader = new Uint8Array(5); blockHeader[0] = isFinal ? 1 : 0; var len = blockLen; blockHeader[1] = len & 0xFF; blockHeader[2] = (len >>> 8) & 0xFF; var nlen = ~len; blockHeader[3] = nlen & 0xFF; blockHeader[4] = (nlen >>> 8) & 0xFF; gzipParts.push(blockHeader); gzipParts.push(blockBuf.slice(0, len)); blockLen = 0; } for (var p = 0; p < parts.length; p++) { var part = parts[p]; var offset = 0; while (offset < part.length) { var copyLen = Math.min(part.length - offset, 65535 - blockLen); blockBuf.set(part.subarray(offset, offset + copyLen), blockLen); blockLen += copyLen; offset += copyLen; if (blockLen === 65535) { pushBlock(false); } } } pushBlock(true); // final block var footer = new Uint8Array(8); var fView = new DataView(footer.buffer); fView.setUint32(0, crcVal, true); fView.setUint32(4, rawSize, true); gzipParts.push(footer); return gzipParts; } function generateTarGz(targetSize, spaceChunk) { var S = targetSize - 18; while (18 + 5 * Math.ceil(S / 65535) + S > targetSize) { S--; } var fileSize = S - 1536; var header = makeTarHeader("dummy_test_data.txt", fileSize); var trailer = new Uint8Array(1024); // zeros var crcHeader = crc32(header); var crcSpaces = crcOfSpaces(fileSize); var crcCombined = crc32_combine(crcHeader, crcSpaces, fileSize); var crcFinal = crc32_combine(crcCombined, 0xefb5af2e, 1024); var paddingParts = []; var remaining = fileSize; while (remaining > 0) { var sliceSize = Math.min(remaining, spaceChunk.length); if (sliceSize === spaceChunk.length) { paddingParts.push(spaceChunk); } else { paddingParts.push(spaceChunk.slice(0, sliceSize)); } remaining -= sliceSize; } var rawParts = [header].concat(paddingParts).concat([trailer]); return gzipCompressStored(rawParts, S, crcFinal); } // ===== Main message handler ===== self.onmessage = function(e) { var id = e.data.id; var targetSizeInBytes = e.data.sizeInBytes; var ext = e.data.ext; if (ext === "tar.gz" && targetSizeInBytes >= 1564) { var spaceChunk = new Uint8Array(1024 * 1024); spaceChunk.fill(32); var gzipParts = generateTarGz(targetSizeInBytes, spaceChunk); self.postMessage({ type: "done", id: id, blob: new Blob(gzipParts, { type: "application/octet-stream" }) }); return; } var MAX_UNIQUE = 5 * 1024 * 1024; var sizeInBytes = Math.min(targetSizeInBytes, MAX_UNIQUE); var data; if (ext === "pdf") { data = generateValidPDF(sizeInBytes); } else if (ext === "zip") { data = generateValidZip(sizeInBytes); } else if (ext === "docx") { data = new Uint8Array(minDocx); } else if (ext === "xlsx") { data = new Uint8Array(minXlsx); } else if (ext === "pptx") { data = new Uint8Array(minPptx); } else if (ext === "tar.gz") { data = new Uint8Array(minTarGz); } else if (ext === "rar") { data = new Uint8Array(minRar); } else if (ext === "7z") { data = new Uint8Array(min7z); } else if (ext === "gif") { data = new Uint8Array(minGif); } else if (ext === "webp") { data = new Uint8Array(minWebp); } else if (ext === "png") { data = new Uint8Array(minPng); } else if (ext === "jpg" || ext === "jpeg") { data = new Uint8Array(minJpg); } else if (ext === "mp3") { data = new Uint8Array(minMp3); } else if (ext === "mp4") { data = new Uint8Array(minMp4); } else if (ext === "mkv") { data = new Uint8Array(minMkv); } else if (ext === "avi") { data = new Uint8Array(minAvi); } else if (ext === "mov") { data = new Uint8Array(minMov); } else if (ext === "wav") { data = generateValidWav(sizeInBytes); } else if (ext === "svg") { data = generateSVG(sizeInBytes); } else if (ext === "json") { data = generateJSON(sizeInBytes); } else if (ext === "csv") { data = generateCSV(sizeInBytes); } else if (ext === "xml") { data = generateXML(sizeInBytes); } else if (ext === "html") { data = generateHTML(sizeInBytes); } else if (ext === "sql") { data = generateSQL(sizeInBytes); } else if (ext === "yaml") { data = generateYAML(sizeInBytes); } else if (ext === "css") { data = generateCSS(sizeInBytes); } else if (ext === "js") { data = generateJS(sizeInBytes); } else if (ext === "py") { data = generatePython(sizeInBytes); } else if (ext === "java") { data = generateJava(sizeInBytes); } else if (ext === "go") { data = generateGo(sizeInBytes); } else if (ext === "cpp") { data = generateCpp(sizeInBytes); } else if (ext === "php") { data = generatePHP(sizeInBytes); } else if (ext === "log") { data = generateLog(sizeInBytes); } else if (ext === "md") { data = generateMarkdown(sizeInBytes); } else if (ext === "txt" || ext === "dat") { data = generateTXT(sizeInBytes); } else if (ext === "rtf" || ext === "odt") { data = generateRTF(sizeInBytes); } else if (ext === "sh" || ext === "bat") { data = generateShell(sizeInBytes, ext); } else if (["ini","cfg","conf","properties"].indexOf(ext) >= 0) { data = generateINI(sizeInBytes); } else { data = new Uint8Array(sizeInBytes); } var blobParts = []; var diff = targetSizeInBytes - data.length; if (diff > 0) { var zipExts = ["zip","docx","xlsx","pptx"]; var isZip = (zipExts.indexOf(ext) >= 0); var padSize = isZip ? (targetSizeInBytes - data.length - 98) : diff; if (padSize > 0) { var spaceChunk = new Uint8Array(1024 * 1024); if (ext === "mp3") { var offset = 0; while (offset < spaceChunk.length) { var copySize = Math.min(minMp3.length, spaceChunk.length - offset); spaceChunk.set(minMp3.subarray(0, copySize), offset); offset += copySize; } } else { spaceChunk.fill(32); } var paddingParts = []; var remaining = padSize; while (remaining > 0) { var sliceSize = Math.min(remaining, spaceChunk.length); if (sliceSize === spaceChunk.length) { paddingParts.push(spaceChunk); } else { paddingParts.push(spaceChunk.slice(0, sliceSize)); } remaining -= sliceSize; } if (isZip) { blobParts = padZipInternal(data, targetSizeInBytes, paddingParts); } else { blobParts = [data].concat(paddingParts); } } else { blobParts = [data]; } } else { blobParts = [data]; } self.postMessage({ type: "done", id: id, blob: new Blob(blobParts, { type: "application/octet-stream" }) }); };
File Generator Parameters
.bin (Binary Data File)
Generation Status
Configure parameters and click "Generate & Download" to create mock files.
Done!

Similar Tools