Skip to content

Instantly share code, notes, and snippets.

@cviniciussn
Created July 8, 2021 20:51
Show Gist options
  • Save cviniciussn/ea6ca378840f272f849a09359d01449f to your computer and use it in GitHub Desktop.
Save cviniciussn/ea6ca378840f272f849a09359d01449f to your computer and use it in GitHub Desktop.
import { Dbf } from 'dbf-reader';
import { Column, DataTable } from 'dbf-reader/models/dbf-file';
import * as fs from 'fs';
let buffer:Buffer = fs.readFileSync('/home/vini-ubnt/Documentos/HNSA/FUSMA.dbf')
let datatable:DataTable = Dbf.read(buffer)
if(datatable){
datatable.rows.forEach((row: any) => {
datatable.columns.forEach((collum: Column) => {
console.log(row[collum.name])
})
})
}
@cviniciussn
Copy link
Author

/home/vini-ubnt/Documentos/CODING/MISC/Read_DBF/reading_dbf.ts:1
import { Dbf } from 'dbf-reader';
^

SyntaxError: Unexpected token {
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment