import DbfField from './DbfField'; import DbfHeader from './DbfHeader'; import DbfRecord from './DbfRecord'; import DbfIterator from './DbfIterator'; import OpenerSync from '../base/OpenerSync'; import IQueryFilter from '../shared/IQueryFilter'; import DbfFieldEditCache from './DbfFieldEditCache'; export default class Dbf extends OpenerSync { filePath: string; _fd?: number; _header?: DbfHeader; _flag: string; _fieldEditCache: DbfFieldEditCache; constructor(filePath: string, flag?: string); /** * @override */ _open(): void; fields(detail?: boolean): DbfField[] | string[]; /** * @override */ _close(): void; _readHeader(): DbfHeader; /** * Gets D-base record at a specific row index. * @param id Index of the record. Starts from 1. * @param fields The fields to fetch in the row. */ get(id: number, fields?: string[] | 'all' | 'none'): DbfRecord; iterator(filter?: IQueryFilter): DbfIterator; /** * @param {Object.<{ from: number|undefined, limit: number|undefined, fields: Array.|undefined }>} filter * @returns {Array}} */ records(filter?: IQueryFilter): Array; /** * * @param {string} filePath * @param {Array} fields * @returns {Dbf} * @static */ static createEmpty(filePath: string, fields: DbfField[]): Dbf; push(props: any): void; push(props: Map): void; /** * Push single row values into memory. Call flush() to persistent into file. * @param {DbfRecord} record The one record to push. * @example * dbf.pushRecord({ rec:1, name:'china' }); */ push(record: DbfRecord): void; /** * Push multiple rows' values into memory. Call flush() to persistent into file. * @param {Array} records The field values array. * @example * dbf.pushRows([{ rec:1, name:'china'}, {rec:2, name:'usa'}]); */ pushAll(records: Array): void; /** * Update a specific row values. Call flush() to persistent into file. * @param {Object} record Record to update. * @example * const record = {id: 0, values: {rec: 1, name: 'usa'}}; * dbf.updateRow(record); */ update(record: DbfRecord): void; /** * Update a specific row values. Call flush() to persistent into file. * @param {Array} records Records to update. * @example * const records = [{id: 0, values: {rec: 1, name: 'usa'}}]; * dbf.updateRows(records); */ updateAll(records: DbfRecord[]): void; /** * * @param {DbfRecord} record * @private */ _flush(record: DbfRecord): void; /** * Remove record at index. * @param {number} id The record id to delete. Start from 1. */ remove(id: number): void; /** * Recover the deleted record by id. Edited record doesn't support. * @param {number} id The record id to delete. Start from 1. */ recover(id: number): void; pushField(field: DbfField): void; removeField(fieldName: string): void; updateField(fieldName: string, newField: DbfField): void; flushFields(): void; private _migrateToTempDbf; private static _tempFilePath; private _newFields; /** * Open file for editing. If it is opened, it will be closed and reopen with rs+ flag. */ openForEdit(): void; get __fd(): number; get __header(): DbfHeader; private _getOffsetById; private _fieldNames; } //# sourceMappingURL=Dbf.d.ts.map