Package Exports
- sakti-parser-fa
- sakti-parser-fa/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sakti-parser-fa) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
sakti-parser-fa
A TypeScript library for parsing unstructured Excel worksheets into cleaned and structured CSV files.
Installation
npm install sakti-parser-faFeatures
- Parse Excel files (.xlsx) using ExcelJS
- Convert Excel data to JSON or CSV format
- Configurable output formatting options
- TypeScript support with full type definitions
- Zero security vulnerabilities
Quick Start
import { SaktiParser } from 'sakti-parser-fa';
// Create parser instance
const parser = new SaktiParser({
outputFormat: 'csv',
csvOptions: {
header: true,
delimiter: ','
}
});
// Parse Excel file
const result = await parser.parseAndFormat('path/to/file.xlsx');
console.log(result.content); // CSV stringAPI Reference
SaktiParser
Constructor Options
interface ParserOptions {
outputFormat?: 'json' | 'csv';
csvOptions?: {
delimiter?: string;
header?: boolean;
quoted?: boolean;
};
jsonOptions?: {
flat?: boolean; // defaults to true
};
}Methods
parse(filePath: string): Promise<ParseResult>- Parse Excel file and return structured dataparseAndFormat(filePath: string): Promise<OutputResult>- Parse and format in one step
Output Formats
JSON Output
{
"metadata": {
"worksheetName": "Sheet1",
"rowCount": 100,
"columnCount": 5,
"source": "file.xlsx"
},
"data": [
{ "A": "value1", "B": "value2" },
// ... more rows
]
}CSV Output
A,B,C
value1,value2,value3
value4,value5,value6Requirements
- Node.js >= 18.0.0
License
MIT