Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fast-csv/format

Package Overview
Dependencies
Maintainers
4
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fast-csv/format

fast-csv formatting module

  • 5.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.8M
decreased by-14.58%
Maintainers
4
Weekly downloads
 
Created

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

Keywords

FAQs

Package last updated on 22 Oct 2024

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

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc