@oniryk/xlsx
Version:
A lightweight, efficient TypeScript library for generating single-sheet Excel XLSX files with support for large datasets
63 lines (62 loc) • 2.08 kB
TypeScript
import SharedStrings from './shared-strings.js';
import Sheet from './sheet.js';
/**
* Manages the creation of Excel XLSX packages
* Handles the assembly of various XML components into a final ZIP archive
* following the Office Open XML SpreadsheetML format
*/
export declare class Package {
/** ZIP archive instance for creating the final XLSX file */
private zip;
/** SharedStrings instance for managing text content */
private sharedStrings;
/** Sheet instance containing the worksheet data */
private sheet;
/** List of temporary files that need cleanup */
private disposable;
/**
* Creates a new Package instance
* @param sheet - Sheet instance containing worksheet data
* @param sharedStrings - SharedStrings instance for text content management
*/
constructor(sheet: Sheet, sharedStrings: SharedStrings);
/**
* Adds string content to the ZIP archive
* @param path - Path within the ZIP archive
* @param content - String content to add
* @private
*/
private add;
/**
* Adds a local file to the ZIP archive
* Tracks the file for later cleanup
* @param file - Target path within the ZIP archive
* @param localpath - Local filesystem path of the file to add
* @private
*/
private addFile;
/**
* Adds required Excel template files to the ZIP archive
* Includes relationships, workbook, styles, and content type definitions
* @private
*/
private addMockFiles;
/**
* Builds the final XLSX package
* Assembles all components, generates required XML files,
* and creates the ZIP archive
* @returns Promise that resolves to the XLSX file as a Buffer
*/
build(): Promise<Buffer>;
/**
* @deprecated Use build() instead
* Legacy method for package creation
* @returns Promise that resolves to the XLSX file as a Buffer
*/
pack(): Promise<Buffer>;
/**
* Cleans up temporary files created during package assembly
* @private
*/
private dispose;
}