   a.download = "selected_dataset.jsonl";
        } else {
            // Default to JSON format
            fileContent = JSON.stringify(tempfileobj, null, 2);
            a.download = "selected_dataset.json";
        }

        file = new Blob([fileContent], { type: fileType });

        if (tempfileurl) {
            window.URL.revokeObjectURL(tempfileurl);
        }

        tempfileurl = window.URL.createObjectURL(file);
        a.href = tempfileurl;
        a.target = '_blank';

     