Wondering what’s next for npm?Check out our public roadmap! »

    mapc.shp-write-dbf

    0.1.4 • Public • Published

    dbf

    Build Status

    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://unpkg.com/dbf@latest/dbf.js
    

    Replace latest with the latest version if you want to be sure.

    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

    Install

    npm i mapc.shp-write-dbf

    DownloadsWeekly Downloads

    1

    Version

    0.1.4

    License

    ISC

    Unpacked Size

    15.1 kB

    Total Files

    9

    Last publish

    Collaborators

    • avatar