Socket
Socket
Sign inDemoInstall

@fast-csv/format

Package Overview
Dependencies
5
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @fast-csv/format

fast-csv formatting module


Version published
Weekly downloads
1.8M
increased by1.83%
Maintainers
2
Install size
113 kB
Created
Weekly downloads
 

Package description

What is @fast-csv/format?

The @fast-csv/format package is a powerful, fast, and flexible library for formatting CSV data in Node.js. It allows users to easily convert arrays or streams of objects into CSV format, supporting complex features like custom headers, transforming data, and more.

What are @fast-csv/format's main functionalities?

Formatting an array of objects to CSV

This feature allows you to easily convert an array of objects into a CSV string. The example demonstrates how to use the `writeToString` method to convert an array of objects into a CSV format string, including headers.

const { writeToString } = require('@fast-csv/format');
const rows = [
  { id: 'A1', name: 'John Doe' },
  { id: 'A2', name: 'Jane Doe' }
];
writeToString(rows, { headers: true })
  .then(csvString => console.log(csvString));

Streaming data to CSV

This feature demonstrates how to stream data to a CSV file. It uses the `format` function to create a stream that formats objects into CSV format and pipes the output to a file. This is useful for handling large datasets or real-time data processing.

const { createWriteStream } = require('fs');
const { format } = require('@fast-csv/format');
const stream = format({ headers: true });
stream.pipe(createWriteStream('path/to/file.csv'));
stream.write({ id: 'A1', name: 'John Doe' });
stream.write({ id: 'A2', name: 'Jane Doe' });
stream.end();

Other packages similar to @fast-csv/format

Changelog

Source

5.0.0 (2024-01-13)

BREAKING CHANGES

  • deps!: Dropped support for Node.js versions 10, 12, 14 and 15 #833

Bug Fixes

  • Added missing single quote in error message (#656) (b9dceab)
  • deps: Fix up @types node package incorrectly involved in dependencies, closes #774 (#838) (83315a6)
  • deps: update dependency @types/yargs to v16.0.1 (024ec2c)
  • deps: update dependency classnames to v2.4.0 (#642) (3ce8ad8)
  • deps: update dependency classnames to v2.5.0 (#847) (8a38bd2)
  • deps: update dependency classnames to v2.5.1 (#849) (4187b08)
  • deps: update dependency globby to v11.0.2 (57953cc)
  • deps: update dependency globby to v11.0.3 (e310319)
  • deps: update dependency globby to v11.1.0 (#678) (0ea420d)
  • deps: update dependency jest-diff to v29 (#672) (b962de0)
  • deps: update dependency yargs to v16.2.0 (d9420d8)
  • deps: update dependency yargs to v17 (#673) (0d33b48)
  • deps: update docusaurus monorepo to v2.4.3 (#531) (ed71ed4)
  • deps: update docusaurus monorepo to v3 (#844) (7fdb903)
  • deps: update docusaurus monorepo to v3.1.0 (#855) (4f67398)
  • deps: update react monorepo to v18 (#845) (a447d06)

Readme

Source

fast-csv Logo

npm version Build Status Coverage Status Known Vulnerabilities

@fast-csv/format

fast-csv package to format CSVs.

Installation

Install Guide

Usage

To get started with @fast-csv/format check out the docs

Keywords

FAQs

Last updated on 13 Jan 2024

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc