Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
dbf writer
JavaScript
Branch: master

0.1.1

latest commit 79d1d8fa61
@tmcw tmcw authored
Failed to load latest commit information.
examples Rewrite, refactor.
src Modernize, integrate change, switch to tap
test Modernize, integrate change, switch to tap
.travis.yml
README.md Rewrite, refactor.
dbf.js Modernize, integrate change, switch to tap
index.js Rewrite, refactor.
json2dbf.js Rewrite, refactor.
package.json 0.1.1

README.md

dbf

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

usage

npm install dbf

Or just in a browser:

https://raw.github.com/mapbox/dbf/master/dbf.js

example

in node:

var dbf = require('../'),
    fs = require('fs');

var buf = dbf.structure([
    {foo:'bar',noo:10},
    {foo:'louie'}
]);

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;
}

API

dbf.structure(array)

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

Specifications

Something went wrong with that request. Please try again.