UNPKG

vue-csv-processor

Version:

Vue 3 component library for CSV file processing with encoding detection and preview

31 lines (30 loc) 1.08 kB
/** * Check for the presence of a BOM (Byte Order Mark) * @param {ArrayBuffer} buffer - The file buffer * @returns {string|null} Detected encoding from BOM or null if no BOM */ export function detectBOM(buffer: ArrayBuffer): string | null; /** * Detect encoding based on content analysis * This is a basic implementation and may not be 100% accurate * @param {ArrayBuffer} buffer - The file buffer * @returns {string} Best-guess encoding */ export function detectEncoding(buffer: ArrayBuffer): string; /** * Read a file with a specific encoding * @param {File|Blob|ArrayBuffer} file - The file or buffer to read * @param {string} encoding - The encoding to use * @returns {Promise<string>} The file content as a string */ export function readWithEncoding(file: File | Blob | ArrayBuffer, encoding?: string): Promise<string>; /** * Utilities for detecting and handling text encodings in CSV files */ /** * Common text encodings supported by the browser */ export const SUPPORTED_ENCODINGS: { value: string; label: string; }[];