npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

export-kit

v0.1.2

Published

export-kit

Readme

export-kit

Simple, schema-driven data export library for TypeScript.

export-kit helps you transform JavaScript objects into structured text formats such as CSV and fixed-length records, then write them efficiently to files. It is designed for batch jobs, scheduled exports, banking files, legacy integrations, reporting, and ETL pipelines.

Unlike full ETL frameworks, export-kit focuses on one responsibility:

Convert objects into export formats with minimal code.


Features

  • CSV export
  • Fixed-length record export
  • Schema-driven formatting
  • Custom field formatting
  • File writing utilities
  • Streaming support
  • Async file reader
  • Date and time helpers
  • Zero runtime dependencies
  • Fully written in TypeScript

Why export-kit?

Many Node.js libraries can write files.

Many libraries can generate CSV.

Few libraries provide a reusable export framework.

export-kit separates how data is formatted from how data is written, making export logic reusable across applications.

 Business Object
        │
        ▼
 Export Formatter
        │
        ▼
  Formatted Text
        │
        ▼
   File Writer
        │
        ▼
     Output

This separation allows the same business object to be exported into different formats without changing business logic.


Supported Export Formats

CSV

   User
     │
     ▼
CSVFormatter
     │
     ▼
 CSV Text

Supports:

  • Configurable separators
  • Automatic escaping
  • ISO date formatting
  • Custom field formatting

Fixed-Length Records

       User
         │
         ▼
FixedLengthFormatter
         │
         ▼
 Fixed-Length Text

Supports:

  • Configurable field widths
  • Automatic padding
  • Custom formatting
  • Banking and legacy system exports

Architecture

                    Attributes
                         │
         ┌───────────────┴───────────────┐
         │                               │
         ▼                               ▼
  CSVFormatter                FixedLengthFormatter
         │                               │
         └───────────────┬───────────────┘
                         │
                  Formatted String
                         │
                 Stream File Writer 
                         │
                         ▼
                    Output File

The formatter is responsible only for converting objects into text.

The writer is responsible only for writing text.

This separation keeps export logic independent from file I/O.


Schema-Driven Formatting

Instead of manually building CSV strings, define a schema describing how each field should be exported.

const attributes = {
  id: {},
  name: {},
  birthday: {},
  salary: {
    getString: value => `$${value}`
  }
}

The formatter automatically converts each object according to the schema.

Benefits include:

  • Reusable export definitions
  • Centralized formatting rules
  • Consistent exports
  • Easier maintenance

Custom Field Formatting

Each attribute may define its own formatter.

Database Value

      1000
        │
        ▼
   getString()
        │
        ▼
     "$1000"

This makes it easy to customize:

  • Currency
  • Dates
  • Enums
  • Booleans
  • Identifiers

without changing export logic.


CSV Escaping

CSV fields are automatically escaped when necessary.

Supports values containing:

  • Separators
  • Quotation marks
  • Carriage returns
  • Newlines

This ensures generated CSV files remain compatible with standard spreadsheet applications.


File Writing

export-kit provides lightweight file writing utilities suitable for batch processing.

Formatter
    │
    ▼
FileWriter
    │
    ▼
  Disk

For logging scenarios, LogWriter provides buffered writing with configurable line endings.


Streaming Support

Large exports can be written incrementally instead of generating the entire file in memory.

  Object
     │
     ▼
 Formatter
     │
     ▼
Write Stream
     │
     ▼
    File

This approach is suitable for exporting millions of records while keeping memory usage low.


Utility Functions

The library also includes small helpers commonly used in export jobs:

  • Date formatting
  • Time formatting
  • Filename date extraction
  • Date arithmetic
  • Directory creation
  • Async line reader

These utilities support typical batch-processing workflows without introducing additional dependencies.


Typical Use Cases

  • Scheduled data exports
  • CSV report generation
  • Banking files
  • Payroll exports
  • Legacy system integration
  • ETL pipelines
  • Data migration
  • Batch processing
  • Regulatory reporting
  • Enterprise data exchange

Design Principles

export-kit is built around a few simple principles:

  • Single responsibility
  • Schema-driven formatting
  • Small, composable APIs
  • Reusable export definitions
  • Minimal dependencies
  • Type-safe interfaces
  • Production-ready performance

When to Use export-kit

Choose export-kit when you need to:

  • Export business objects to CSV
  • Generate fixed-length files
  • Centralize export rules
  • Build reusable export pipelines
  • Process large datasets efficiently

If you need a lightweight, focused library for object-to-file export, export-kit provides the essential building blocks without requiring a full ETL framework.

License

MIT