Socket
Book a DemoInstallSign in
Socket

csv-to-markdown-table

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csv-to-markdown-table

JavaScript/Node.js Csv to Markdown Table Converter

1.6.2
latest
Source
npmnpm
Version published
Weekly downloads
73K
1.51%
Maintainers
1
Weekly downloads
 
Created
Source

CSV To Markdown Table

npm version npm Coverage Status GitHub license

Simple JavaScript CSV to Markdown Table Converter

You can see it in action and play with the Live Example.

Requires no external libraries. Works in Node as well as in the browser.

Install

npm install csv-to-markdown-table

Usage

CLI

This package also includes a CLI tool. You can install it globally with:

npm install -g csv-to-markdown-table

Then you can use it like so:

$ csv-to-markdown-table --help
Usage: csv-to-markdown-table [options]
// … help output

$ csv-to-markdown-table --delimiter ',' --headers < example.csv
| cats | dogs | fish | 
|------|------|------| 
| 1    | 2    | 3    | 
| 4    | 5    | 6    |
$ csv-to-markdown-table
Reading from stdin... (press Ctrl+D at the start of a line to finish)
CSV Delimiter: \t (tab) Headers: false
[interactive input]

Browser via CDN (UMD)

<script src="https://unpkg.com/csv-to-markdown-table"></script>
<script>
  console.log(
    csvToMarkdown("header1,header2,header3\nValue1,Value2,Value3", ",", true)
  );
</script>

Node.js with CommonJS (require)

const csvToMarkdown = require("csv-to-markdown-table");

console.log(
  csvToMarkdown("header1,header2,header3\nValue1,Value2,Value3", ",", true)
);

Node.js with ES Modules (import)

import csvToMarkdown from "csv-to-markdown-table";

console.log(
  csvToMarkdown("header1,header2,header3\nValue1,Value2,Value3", ",", true)
);

TypeScript

import csvToMarkdown from "csv-to-markdown-table";

console.log(
  csvToMarkdown("header1,header2,header3\nValue1,Value2,Value3", ",", true)
);

Outputs:

| header1 | header2 | header3 | 
|---------|---------|---------| 
| Value1  | Value2  | Value3  | 

Which displays in markdown as:

header1header2header3
Value1Value2Value3

Distribution Formats

This package is distributed in multiple formats:

  • UMD: Universal Module Definition for browsers and legacy environments (includes csvToMarkdown global variable when loaded in a browser)
    • lib/CsvToMarkdown.js (unminified)
    • lib/CsvToMarkdown.min.js (minified)
  • ESM: ES Modules for modern JavaScript environments
    • lib/CsvToMarkdown.mjs
  • CJS: CommonJS for Node.js
    • lib/CsvToMarkdown.cjs

The package.json is configured with the appropriate fields to ensure the correct format is used in each environment:

  • main: Points to the CommonJS build
  • module: Points to the ESM build
  • browser: Points to the UMD build
  • unpkg: Points to the minified UMD build
  • exports: Provides conditional exports for different environments

Keywords

csv

FAQs

Package last updated on 29 Jul 2025

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.