Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dbffile

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dbffile - npm Package Compare versions

Comparing version 1.8.1 to 1.9.0

8

dist/dbf-file.d.ts

@@ -27,2 +27,10 @@ import { FieldDescriptor } from './field-descriptor';

appendRecords(records: any[]): Promise<DBFFile>;
/**
* Iterates over each record in this DBF file. If the `includeDeletedRecords` option is set, then deleted records
* are yielded, otherwise they are skipped. Deleted records have the property `[DELETED]: true`, using the `DELETED`
* symbol exported from this library.
*/
[Symbol.asyncIterator](): AsyncGenerator<Record<string, unknown> & {
[DELETED]?: true | undefined;
}, void, undefined>;
_readMode: "strict" | "loose";

@@ -29,0 +37,0 @@ _encoding: Encoding;

12

dist/dbf-file.js

@@ -51,2 +51,12 @@ "use strict";

}
/**
* Iterates over each record in this DBF file. If the `includeDeletedRecords` option is set, then deleted records
* are yielded, otherwise they are skipped. Deleted records have the property `[DELETED]: true`, using the `DELETED`
* symbol exported from this library.
*/
async *[Symbol.asyncIterator]() {
while (this._recordsRead !== this.recordCount) {
yield* await this.readRecords(1000);
}
}
}

@@ -215,3 +225,3 @@ exports.DBFFile = DBFFile;

result.dateOfLastUpdate = utils_2.createDate(now.getFullYear(), now.getMonth() + 1, now.getDate());
result.fields = fields.map(field => (Object.assign({}, field))); // make new copy of field descriptors
result.fields = fields.map(field => ({ ...field })); // make new copy of field descriptors
result._readMode = 'strict';

@@ -218,0 +228,0 @@ result._encoding = options.encoding;

2

package.json
{
"name": "dbffile",
"version": "1.8.1",
"version": "1.9.0",
"description": "Read and write .dbf (dBase III & Visual FoxPro) files in Node.js",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -24,2 +24,3 @@ # DBFFile

- Can access date of last update
- Can read records using async iteration
- Can read records in arbitrary-sized batches

@@ -43,3 +44,3 @@ - Can include deleted records in results

### Example: reading a .dbf file
### Example: read all records in a .dbf file using for-await-of

@@ -49,7 +50,20 @@ ```javascript

async function testRead() {
async function iterativeRead() {
let dbf = await DBFFile.open('<full path to .dbf file>');
console.log(`DBF file contains ${dbf.recordCount} records.`);
console.log(`Field names: ${dbf.fields.map(f => f.name).join(', ')}`);
let records = await dbf.readRecords(100);
for await (const record of dbf) console.log(record);
}
```
### Example: reading a batch of records from a .dbf file
```javascript
import {DBFFile} from 'dbffile';
async function batchRead() {
let dbf = await DBFFile.open('<full path to .dbf file>');
console.log(`DBF file contains ${dbf.recordCount} records.`);
console.log(`Field names: ${dbf.fields.map(f => f.name).join(', ')}`);
let records = await dbf.readRecords(100); // batch-reads up to 100 records, returned as an array
for (let record of records) console.log(record);

@@ -64,3 +78,3 @@ }

async function testWrite() {
async function batchWrite() {
let fieldDescriptors = [

@@ -127,2 +141,5 @@ { name: 'fname', type: 'C', size: 255 },

appendRecords(records: object[]): Promise<DBFFile>;
/** Iterates over each record in this DBF file. */
[Symbol.asyncIterator](): AsyncGenerator<object>;
}

@@ -129,0 +146,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc