Data Exporter Service
DataExporterService is the main entry point of the module.
It resolves the correct exporter provider by type and returns the exported result.
Methods
| Method | Description |
|---|---|
exportAsync(args) | Exports data using the provider selected by args.type. |
Export types
| Type | Description |
|---|---|
csv | Exports data as CSV. |
excel | Exports data as an Excel workbook. |
Usage
report.service.ts
import { Injectable } from '@nestjs/common';
import { DataExporterService } from 'nestjs-export-module';
@Injectable()
export class ReportService {
constructor(private readonly dataExporter: DataExporterService) {}
async exportUsersCsv() {
return this.dataExporter.exportAsync({
type: 'csv',
// other args depend on the provider
});
}
}
note
Provider-specific arguments and result details are documented under Providers.