Skip to content

Promises or raw string support#95

Merged
iuccio merged 2 commits intomasterfrom
add-async-mode
Nov 1, 2025
Merged

Promises or raw string support#95
iuccio merged 2 commits intomasterfrom
add-async-mode

Conversation

@iuccio
Copy link
Copy Markdown
Owner

@iuccio iuccio commented Oct 31, 2025

🚀 Promise-based Async API for csvToJson

Overview

Add Promise-based async API to support modern JavaScript patterns while maintaining full backward compatibility with the existing sync API.

Key Features

  • ✨ Promise-based async methods (getJsonFromCsvAsync, generateJsonFileFromCsvAsync)
  • 🔄 Full compatibility with existing sync API
  • 📈 Improved memory handling for large files
  • 🎯 TypeScript support with updated type definitions

Implementation Details

New Files

  • src/csvToJsonAsync.js - Core async implementation
  • MIGRATION.md - Migration guide
  • test/async.spec.js - Async API tests

Updates

  • README.md: Added async documentation & examples
  • index.js: Added async API exports
  • index.d.ts: Added TypeScript definitions
  • src/util/fileUtils.js: Added async operations

Usage Examples

// Async/Await
const json = await csvToJson
  .formatValueByType()
  .getJsonFromCsvAsync('input.csv');

// Promise Chain
csvToJson
  .fieldDelimiter(',')
  .getJsonFromCsvAsync('input.csv')
  .then(json => console.log(json))
  .catch(err => console.error(err));

And here's a refined version of the release notes:

# 🎉 New Release: Async Support

## ✨ Highlights
- Promise-based async API for modern JavaScript applications
- Improved memory handling for large files
- Full backward compatibility maintained
- Comprehensive documentation and migration guide

## 📦 Added
- `getJsonFromCsvAsync()` - Promise-based CSV parsing
- `generateJsonFileFromCsvAsync()` - Async file generation
- Migration guide with best practices
- TypeScript definitions for async API
- Performance optimization examples

## 🔧 Enhanced
- Documentation structure and examples
- Large file processing capabilities
- Error handling and recovery patterns
- TypeScript support

## 📝 Notes
- Zero breaking changes
- Existing sync API remains unchanged
- Gradual migration path available

- Move sync/async documentation into dedicated sections
- Add comprehensive examples for chaining pattern
- Create separate migration guide
- Improve documentation structure and readability
- Add more detailed async API examples
@iuccio iuccio changed the title docs: improve documentation organization and examples Promises or raw string support Oct 31, 2025
@iuccio iuccio force-pushed the add-async-mode branch 2 times, most recently from 6f80411 to 5543ca3 Compare October 31, 2025 20:45
@iuccio iuccio merged commit b84d522 into master Nov 1, 2025
18 checks passed
@iuccio iuccio deleted the add-async-mode branch November 1, 2025 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant