Options
All
  • Public
  • Public/Protected
  • All
Menu

A Writer instance is used to write CSV data according to a given configuration.

Hierarchy

Index

Constructors

constructor

Properties

newline

newline: string

Row separator string.

quote

quote: string

Quote/escape character.

quoteAll

quoteAll: boolean

Whether to quote/escape all columns when serializing.

separator

separator: string

Column separator character.

Methods

configure

  • configure(options?: Options): this
  • Apply the given options to this Configurable object.

    Parameters

    • Optional options: Options

      Optional Options object to determine parsing or serialization behavior.

    Returns this

    This instance, for easy chaining.

iterate

  • Construct and return an object implementing an ES6 iterator interface for enumerating lazily serialized CSV data character-by-character.

    Parameters

    • rows: RowsIterable

      An iterable enumerating rows, where the rows are themselves iterables enumerating columns. Columns are serialized to CSV data strings using the String() function.

    Returns WriterRowIterator

    An iterator enumerating the characters of the lazily serialized output.

rows

  • Construct and return an object implementing an ES6 iterator interface for enumerating lazily serialized rows one-by-one.

    Parameters

    • rows: RowsIterable

      An iterable enumerating rows, where the rows are themselves iterables enumerating columns. Columns are serialized to CSV data strings using the String() function.

    Returns WriterRowIterator

    An iterator whose elements are the input rows, serialized as CSV data strings. Note that every output row will end with a row terminator (i.e. a newline), including the final row.

stream

  • Construct and return an object implementing a NodeJS readable stream interface for lazily serializing some input rows.

    Parameters

    • rows: RowsIterable

      An iterable enumerating rows, where the rows are themselves iterables enumerating columns. Columns are serialized to CSV data strings using the String() function.

    Returns WriterNodeStream

    An object implementing the NodeJS readable stream interface, serializing rows as they are requested instead of all at once.

write

  • Eagerly write the input rows as one aggregated CSV data string.

    Parameters

    • rows: RowsIterable

      An iterable enumerating rows, where the rows are themselves iterables enumerating columns. Columns are serialized to CSV data strings using the String() function.

    Returns string

    A string containing the fully serialized CSV data.

writeColumn

  • writeColumn(value: any): string
  • Serialize a single column of CSV data using this Writer's configuration. Columns containing special characters such as row or column separators will be quote-escaped. Depending on the Writer configuration, all columns may be escaped regardless of their content.

    Parameters

    • value: any

    Returns string

    A CSV data string representing the serialized column.

writeRow

  • writeRow(row: Iterable<any>): string
  • Serialize a single row of CSV data using this Writer's configuration.

    Parameters

    • row: Iterable<any>

      An iterable enumerating columns in a row. Columns are serialized to CSV data strings using the String() function.

    Returns string

    A CSV data string representing the serialized row.

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc