# write-csv

> Quickly write json array to a .csv file

Latest version **1.0.0** (published 2015-12-22) · ISC license · 0 weekly downloads

## Install

```sh
npm install write-csv
pnpm add write-csv
yarn add write-csv
bun add write-csv
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-12-22 |
| First published | 2015-12-22 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | David Ernst |
| Maintainers | dsernst |
| Keywords | write, csv, quick, easy |

## Links

- npm: https://www.npmjs.com/package/write-csv
- Repository: https://github.com/dsernst/write-csv
- Homepage: https://github.com/dsernst/write-csv#readme
- Issues: https://github.com/dsernst/write-csv/issues
- npm.io page: https://npm.io/package/write-csv

## Dependencies (1)

- [csv-stringify](https://npm.io/package/csv-stringify.md) 0.0.8

## Alternatives

- [csv-to-markdown-table](https://npm.io/package/csv-to-markdown-table.md) — 47.0K weekly downloads
- [@sapphire/ratelimits](https://npm.io/package/@sapphire/ratelimits.md) — 4.4K weekly downloads
- [js-csvparser](https://npm.io/package/js-csvparser.md) — 2.0K weekly downloads
- [@adadapted/js-sdk](https://npm.io/package/@adadapted/js-sdk.md) — 251 weekly downloads
- [@grapecity/spread-sheets-sparklines](https://npm.io/package/@grapecity/spread-sheets-sparklines.md) — 103 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2015-12-22
- 0.0.1 — 2015-12-22

## README

# write-csv

[![NPM Version](https://img.shields.io/npm/v/write-csv.svg)](https://www.npmjs.com/package/write-csv)
[![Build Status](https://travis-ci.org/dsernst/write-csv.svg?branch=master)](https://travis-ci.org/dsernst/write-csv)
[![Coverage Status](https://coveralls.io/repos/dsernst/write-csv/badge.svg?branch=master&service=github)](https://coveralls.io/github/dsernst/write-csv?branch=master)

### Quickest way to write a json array to a .csv file


## Install

Install with npm:
```
npm i --save write-csv
```

Then require in your file:

```js
var writeCSV = require('write-csv')
```

## Usage

### writeFile(filename, data)

- `filename` String filename or file descriptor
- `data` Array of objects

```js
writeCSV('./results.csv', [
  {a: 'foo', b: 'bar', c: 'baz'},
  {a: 'shoo', b: 'boo', c: 'chaz'},
  {a: 'gaia', b: 'loves', c: 'you'},
])
```

This will synchronously write your data to `results.csv` like this:

```csv
a,b,c
foo,bar,baz
shoo,boo,chaz
gaia,loves,you
```

---
_Source: https://npm.io/package/write-csv · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
