npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dbfread

v1.0.0

Published

A lightweight parser for DBF (dBase/Visual FoxPro) files with memo support

Readme

dbfread

A lightweight parser for DBF (dBase/Visual FoxPro) files with memo support, written in TypeScript.

Features

  • 🚀 Lightweight: No external dependencies, pure TypeScript/JavaScript
  • 📄 Memo Support: Automatically detects and parses associated .fpt memo files
  • 🔧 TypeScript: Full TypeScript support with type definitions
  • 📊 Multiple Data Types: Supports all common DBF field types
  • 🎯 Simple API: Easy-to-use function with minimal configuration
  • 🧪 Well Tested: Comprehensive test suite

Installation

npm install dbfread

Quick Start

import { parseDBF } from 'dbfread';

// Parse a DBF file
const records = parseDBF('./path/to/your/file.dbf');

// Each record is a plain object with field names as keys
console.log(records[0]);
// Output: { id: 1, name: "John Doe", age: 30, active: true }

API Reference

parseDBF(dbfPath: string, encoding?: string): Record<string, any>[]

Parses a DBF file and returns an array of records.

Parameters:

  • dbfPath (string): Path to the .dbf file
  • encoding (optional string): Text encoding (defaults to Windows-1252)

Returns:

  • Array of record objects where keys are field names

Supported Field Types

| Type | Description | JavaScript Type | |------|-------------|-----------------| | C | Character/String | string | | N | Numeric | number | | F | Float | number | | D | Date | Date | | L | Logical/Boolean | boolean | | M | Memo | string | | I | Integer | number | | B | Binary/Double | number | | Y | Currency | number | | T | DateTime | Date | | O | Double | number |

Examples

Basic Usage

import { parseDBF } from 'dbfread';

const records = parseDBF('./data/employees.dbf');

records.forEach(record => {
  console.log(`${record.name}: ${record.salary}`);
});

With Custom Encoding

import { parseDBF } from 'dbfread';

// Use UTF-8 encoding
const records = parseDBF('./data/employees.dbf', 'utf-8');

// Use Windows-1251 encoding
const records = parseDBF('./data/employees.dbf', 'windows-1251');

Working with Memo Fields

import { parseDBF } from 'dbfread';

const records = parseDBF('./data/employees.dbf');

// Memo fields are automatically parsed if .fpt file exists
records.forEach(record => {
  if (record.notes) {
    console.log(`Notes for ${record.name}: ${record.notes}`);
  }
});

TypeScript Usage

import { parseDBF } from 'dbfread';

interface Employee {
  id: number;
  name: string;
  salary: number;
  hireDate: Date;
  active: boolean;
  notes?: string;
}

const records = parseDBF('./data/employees.dbf') as Employee[];

records.forEach((employee: Employee) => {
  console.log(`${employee.name} was hired on ${employee.hireDate.toLocaleDateString()}`);
});

File Format Support

This library supports:

  • dBase III+ (.dbf files)
  • Visual FoxPro (.dbf files)
  • Memo files (.fpt files) - automatically detected and parsed
  • Various encodings - with fallback to Windows-1252

Development

# Install dependencies
npm install

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

# Build the project
npm run build

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Repository

📦 GitHub: https://github.com/richardhristov/dbfread