generate dbf files


Write dBase files in pure JavaScript, in node.js or browsers. Requires ArrayBuffer and DataView support.

npm install dbf

Or just in a browser:


in node:

var dbf = require('../'),
    fs = require('fs');
var buf = dbf.structure([
fs.writeFileSync('foo.dbf', toBuffer(buf.buffer));
function toBuffer(ab) {
    var buffer = new Buffer(ab.byteLength);
    var view = new Uint8Array(ab);
    for (var i = 0; i < buffer.length; ++i) {
        buffer[i] = view[i];
    return buffer;

Given an array of objects with string or number attributes, return a DataView object referencing an ArrayBuffer that contains a full DBF file structure.

  • http://www.clicketyclick.dk/databases/xbase/format/dbf.html#DBF_STRUCT
  • http://www.quantdec.com/SYSEN597/GTKAV/section4/chapter_15a.htm
  • http://ulisse.elettra.trieste.it/services/doc/dbase/DBFstruct.htm