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.6.1 to 1.7.0

2

dist/dbf-file.d.ts

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

recordCount: number;
/** Date of last update as recorded in the DBF file header. */
dateOfLastUpdate: Date;
/** Metadata for all fields defined in the DBF file. */

@@ -15,0 +17,0 @@ fields: FieldDescriptor[];

10

dist/dbf-file.js

@@ -66,2 +66,6 @@ "use strict";

let fileVersion = buffer.readUInt8(0);
let lastUpdateY = buffer.readUInt8(1); // number of years after 1900
let lastUpdateM = buffer.readUInt8(2); // 1-based
let lastUpdateD = buffer.readUInt8(3); // 1-based
const dateOfLastUpdate = utils_2.createDate(lastUpdateY + 1900, lastUpdateM, lastUpdateD);
let recordCount = buffer.readInt32LE(4);

@@ -115,2 +119,3 @@ let headerLength = buffer.readInt16LE(8);

result.recordCount = recordCount;
result.dateOfLastUpdate = dateOfLastUpdate;
result.fields = fields;

@@ -152,4 +157,4 @@ result._readMode = options.readMode;

buffer.writeUInt8(now.getFullYear() - 1900, 0x01); // YY (year minus 1900)
buffer.writeUInt8(now.getMonth(), 0x02); // MM
buffer.writeUInt8(now.getDate(), 0x03); // DD
buffer.writeUInt8(now.getMonth() /* 0-based */ + 1, 0x02); // MM (1-based)
buffer.writeUInt8(now.getDate() /* 1-based */, 0x03); // DD (1-based)
buffer.writeInt32LE(0, 0x04); // Number of records (set to zero)

@@ -195,2 +200,3 @@ let headerLength = 34 + (fields.length * 32);

result.recordCount = 0;
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

@@ -197,0 +203,0 @@ result._readMode = 'strict';

@@ -13,2 +13,4 @@ /// <reference types="node" />

export declare const write: typeof fs.write.__promisify__;
/** Creates a date with no local timezone offset. `month` and `day` are 1-based. */
export declare function createDate(year: number, month: number, day: number): Date;
/** Parses an 8-character date string of the form 'YYYYMMDD' into a UTC Date object. */

@@ -15,0 +17,0 @@ export declare function parse8CharDate(s: string): Date;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatVfpDateTime = exports.parseVfpDateTime = exports.format8CharDate = exports.parse8CharDate = exports.write = exports.stat = exports.read = exports.open = exports.close = void 0;
exports.formatVfpDateTime = exports.parseVfpDateTime = exports.format8CharDate = exports.parse8CharDate = exports.createDate = exports.write = exports.stat = exports.read = exports.open = exports.close = void 0;
const fs = require("fs");

@@ -16,2 +16,10 @@ const util_1 = require("util");

exports.write = util_1.promisify(fs.write);
/** Creates a date with no local timezone offset. `month` and `day` are 1-based. */
function createDate(year, month, day) {
const yyyy = String(year).padStart(4, '0');
const mm = String(month).padStart(2, '0');
const dd = String(day).padStart(2, '0');
return new Date(`${yyyy}-${mm}-${dd}`);
}
exports.createDate = createDate;
/** Parses an 8-character date string of the form 'YYYYMMDD' into a UTC Date object. */

@@ -18,0 +26,0 @@ function parse8CharDate(s) {

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

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

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

- Can access total record count
- Can access date of last update
- Can read records in arbitrary-sized batches

@@ -112,2 +113,5 @@ - Can include deleted records in results

/** Date of last update as recorded in the DBF file header. */
dateOfLastUpdate: Date;
/** Metadata for all fields defined in the DBF file. */

@@ -114,0 +118,0 @@ fields: FieldDescriptor[];

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