Use fast-csv in a browser
A practical review of running fast-csv client-side for CSV and TSV conversion: what it changes in your data, what bundling it requires, and when a browser-native parser or plain text is the better fit.
fast-csv is a JavaScript library for parsing and writing delimited text such as CSV and TSV. It is published as two packages, one for parsing and one for formatting. It was designed around Node.js streams rather than browser APIs. That design choice is the deciding factor in whether it is a good fit for client-side work. This review covers what the library does to your data, what you need to make it run in a browser, and when a different approach makes more sense.
Is fast-csv suitable for browser-side CSV and TSV conversion?
It can be, with conditions. Its main benefit is a well-defined, configurable conversion between delimited text and rows or objects. Parsing and formatting share one consistent model, and you can set the delimiter, quote and escape characters, header handling and whitespace trimming. The main tradeoff is its dependence on Node core modules, chiefly streams and buffers. Current bundlers do not supply these automatically. Webpack 5 removed its automatic Node polyfills, and Vite does not provide them by default. Using fast-csv in a browser therefore usually means adding and configuring polyfills, which adds build complexity and code you have to ship.
A bounded recommendation:
• fast-csv is reasonable if you already use it on a Node.js server and want the same parsing rules in the browser.
• It is also reasonable if your build already polyfills Node streams.
• A browser-native CSV parser is usually simpler if you are starting fresh and only need client-side parsing. Papa Parse is a common example, and it is built for browsers, including Web Worker use.
• Plain text is preferable if readers only need to view or copy a small dataset. Plain delimited text, or a simple HTML table, avoids adding a library at all.
Evidence gap: no bundle-size measurements, parsing-speed benchmarks or browser compatibility tests were available for this review. Weigh the build overhead against your own measurements rather than assuming it is small or large.
What the conversion actually changes
Words like "reverse", "mirror" and "font" do not apply here. fast-csv does not restyle characters, substitute Unicode lookalikes or change how text is displayed. It changes structure. Parsing turns a flat string into rows by splitting on delimiters and line breaks, while respecting quoted fields. Formatting does the reverse: it serializes rows back into a string, adding quotes and escapes where a value contains the delimiter, a quote character or a line break. Field contents are stored characters, not visual presentation, so each conversion step can alter what is saved.
Here is an illustrative case that follows standard CSV quoting rules. The input below contains a comma inside a quoted field and a doubled quote used as an escape. A parser configured with headers enabled should produce one row in which name is Lee, A. and note is said "hi". The surrounding quotes are removed, and the doubled quote collapses to a single quote character. The original string and the parsed values differ in their exact characters while carrying the same meaning.
name,note
"Lee, A.","said ""hi"""
| Aspect | Typically preserved | Can change depending on options |
| Field values | Text inside fields, including commas and line breaks within quotes | Leading and trailing whitespace if trimming is enabled |
| Quoting | Meaning of quoted values | Which fields get quoted on output; the original quoting style is not retained |
| Headers | Column names when headers are used | Column names if renamed or discarded; rows with mismatched column counts may be rejected or handled differently |
| Delimiter | Separation between fields | Switching between comma and tab when converting CSV to TSV or back |
| Line endings and encoding markers | Row boundaries | Specific line-ending characters and byte-order marks on output |
Because it is the main search topic, the browser case needs a concrete shape. With a polyfilled build, parsing text already held in memory might look like the snippet below. It uses the string-parsing entry point from the parse package with a tab delimiter for TSV. Check the option names against the documentation for the version you install. This example has not been run as part of this review.
import { parseString } from '@fast-csv/parse';
const rows = [];
parseString(tsvText, { headers: true, delimiter: '\t' })
.on('error', (err) => console.error(err))
.on('data', (row) => rows.push(row))
.on('end', (rowCount) => console.log(`Parsed ${rowCount} rows`));
For the opposite direction, the format package provides a function that writes an array of rows to a string and returns a promise. To offer the result as a download, create a Blob from that string. Large files read from a file input still have to pass through a browser-to-stream bridge, and that is where most polyfill friction tends to appear.
Will the converted data stay readable and usable after copying or sharing?
Delimited output is plain text, so copying it does not lose hidden styling. Usability depends on where the text goes:
• Pasting tab-separated text into a spreadsheet often splits it into columns.
• Comma-separated text pasted the same way may land in a single column unless the application offers an import step.
• Behavior differs between spreadsheet applications and versions. No destination-specific testing was available for this review, so confirm with the tools your readers actually use.
Raw CSV is hard to follow with a screen reader. Delimiters are read aloud or skipped, and there is no announced column context. If people will read the data rather than import it, render the parsed rows as an HTML table with proper header cells. Assistive technology can then convey row and column relationships. No specific screen reader was tested here.
Watch for a security issue when generated files are opened in spreadsheet software. A cell value beginning with characters such as =, +, - or @ may be interpreted as a formula. This is a widely documented risk known as CSV or formula injection. If your exported data includes user-supplied text, decide on an escaping or prefixing policy before release. Confirm whether your installed version of the formatter offers a built-in option for it.
Search and editing are unaffected at the character level, because the output contains ordinary text. Quoting and escaping can, however, make exact-match searches on raw files miss values that contain doubled quotes. Parsing in the browser means the library itself has no reason to send data anywhere. Whether a given page or app transmits, logs or retains the data is a separate question, and you cannot judge it from appearance or marketing. Check the page's actual code and stated policies.