<commit_before>module ag.grid {

    var LINE_SEPARATOR = '\r\n';

    export interface CsvExportParams {
        skipHeader?: boolean;
        skipFooters?: boolean;
        skipGroups?: boolean;
        fileName?: string;
        customHeader?: string;
        customFooter?: string;
    }

    export class CsvCreator {

        constructor(
            private rowController: InMemoryRowController,
            private columnController: ColumnController,
            private grid: Grid,
            private valueService: ValueService) {
        }

        public exportDataAsCsv(params?: CsvExportParams): void {
            var csvString = this.getDataAsCsv(params);
            var fileNamePresent = params && params.fileName && params.fileName.length !== 0;
            var fileName = fileNamePresent ? params.fileName : 'export.csv';
            // Internet Explorer
            if (window.navigator.msSaveOrOpenBlob) {
                var fileData = [csvString];
                var blobObject = new Blob(fileData);
                window.navigator.msSaveOrOpenBlob(blobObject, fileName);
            } else {
                // Chrome
                var url = "data:text/plain;charset=utf-8," + encodeURIComponent(csvString);
                var downloadLink = document.createElement("a");
                downloadLink.href = url;
                (<any>downloadLink).download = fileName;

                document.body.appendChild(downloadLink);
                downloadLink.click();
                document.body.removeChild(downloadLink);
            }
        }

        public getDataAsCsv(params?: CsvExportParams): string {
            if (!this.grid.isUsingInMemoryModel()) {
                console.log('ag-Grid: getDataAsCsv not available when doing virtual pagination');
                return '';
            }

            var result = '';

            var skipGroups = params && params.skipGroups;
            var skipHeader = params && params.skipHeader;
            var skipFooters = params && params.skipFooters;<commit_msg>fix(csvExport): large data export need createObjectURL<commit_after>module ag.grid {

    var LINE_SEPARATOR = '\r\n';

    export interface CsvExportParams {
        skipHeader?: boolean;
        skipFooters?: boolean;
        skipGroups?: boolean;
        fileName?: string;
        customHeader?: string;
        customFooter?: string;
    }

    export class CsvCreator {

        constructor(
            private rowController: InMemoryRowController,
            private columnController: ColumnController,
            private grid: Grid,
            private valueService: ValueService) {
        }

        public exportDataAsCsv(params?: CsvExportParams): void {
            var csvString = this.getDataAsCsv(params);
            var fileNamePresent = params && params.fileName && params.fileName.length !== 0;
            var fileName = fileNamePresent ? params.fileName : 'export.csv';
            var blobObject = new Blob([csvString], {
                type: "text/csv;charset=utf-8;"
            });
            // Internet Explorer
            if (window.navigator.msSaveOrOpenBlob) {
                window.navigator.msSaveOrOpenBlob(blobObject, fileName);
            } else {
                // Chrome
                var downloadLink = document.createElement("a");
                downloadLink.href = window.URL.createObjectURL(blobObject);
                (<any>downloadLink).download = fileName;

                document.body.appendChild(downloadLink);
                downloadLink.click();
                document.body.removeChild(downloadLink);
            }
        }

        public getDataAsCsv(params?: CsvExportParams): string {
            if (!this.grid.isUsingInMemoryModel()) {
                console.log('ag-Grid: getDataAsCsv not available when doing virtual pagination');
                return '';
            }

            var result = '';

            var skipGroups = params && params.skipGroups;
            var skipHeader = params && params.skipHeader;
            var skipFooters = params && params.skipFooters;
{'fraction_non_alphanumeric': 0.09327812956648807, 'fraction_numerical': 0.000974184120798831, 'mean_word_length': 1.8963328631875882, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7208520', 'n_tokens_mistral': 1020, 'n_tokens_neox': 986, 'n_words': 223}