
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
csv-builder-downloader
Advanced tools
A no dependancy client side CSV builder and downloader written in TypeScript.
This is will sanitize the values and download a file: csv-download-<timestamp>.csv
const yourData = [[...headers][...row1][...row2]];
new CsvBuilder().addRows(yourData).download();
Pass in configuration and make usage match your data model more closely.
const {
defaultFileHeading,
yesterdayFileHeaders,
yesterdayData,
todayFileHeaders,
todayData,
getFileName,
} from yourReducerOrDataModel;
// Initialize with custom parameters (all optional)
const csvBuilder = new CsvBuilder({
filename: getFileName(), // Generate a filemane
includeTimeStamp: false, // By default adds a timestamp to the end
sanitizeRegex: /[^a-zA-Z0-9:\./_\-@$ ]/g, // Regex override
nonValueIndices: [0,5] // These values wont be sanitized
});
// Add a row or multiple rows
csvBuilder
.addRow(`${defaultFileHeading} Yesterday:`)
.addRow(yesterdayFileHeaders)
.addRows(yesterdayData)
.addNewLine(2);
// Add cell at a time
yesterdayData.forEach((metric) => csvBuilder.addCell(someCalculation(metric)));
// Use a helper function for a typical table
csvBuilder.addSection({
title: `${defaultFileHeading} Today:`,
headers: todayFileHeaders,
rows: todayData
});
// Change the sanitize RegEx mid file creation
csvBuilder.changeRegEx(/[^a-zA-Z:\./_\-@$ ]/g);
// Add cell at a time
todayData.forEach((metric) => csvBuilder.addCell(someCalculation(metric)));
// Finally download
csvBuilder.download();
Option | Default | Type |
---|---|---|
encodingType | data:text/csv;charset=utf-8 | String |
file | '' | String |
fileSuffix | .csv | String |
filename | csv-download | String |
includeTimeStamp | true | Boolean |
nonValueIndices | [] | Array |
sanitizeRegex | /[^a-zA-Z0-9:\./_\-@$ ]/g | RegExp |
sanitizeValues | true | Boolean |
.addCell(val: CELL_TYPE, sanitize: boolean = true)
.addRow(val: CELL_TYPE | ROW_ARRAY_TYPE, sanitize?: boolean)
.addRows(rows: ROW_ARRAY_TYPE[])
.addNewLine(count: number = 1)
.addSection({ title, headers, rows, newLines }: SECTION_TYPE)
.getEncodedFile()
.getFilename()
.changeRegex(passedRegex: RegExp)
.download()
If using the CsvBuilder, you do not need to separately use the CsvDownloader, but it can be used on its own if needed.
Option | Type |
---|---|
encodedFile | String |
filename | String |
.getBlob()
.getBlobUrl(csvData: Blob)
.download()
FAQs
A no dependancy client side CSV builder and downloader written in TypeScript.
The npm package csv-builder-downloader receives a total of 0 weekly downloads. As such, csv-builder-downloader popularity was classified as not popular.
We found that csv-builder-downloader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.