New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.9.2 to 1.9.3

20

dist/dbf-file.js

@@ -116,2 +116,3 @@ "use strict";

let fields = [];
const encoding = getEncoding(options.encoding);
while (headerLength > 32 + fields.length * 32) {

@@ -122,3 +123,3 @@ await utils_1.read(fd, buffer, 0, 32, 32 + fields.length * 32);

let field = {
name: iconv.decode(buffer.slice(0, 10), 'ISO-8859-1').split('\0')[0],
name: iconv.decode(buffer.slice(0, 10), encoding).split('\0')[0],
type: String.fromCharCode(buffer[0x0B]),

@@ -197,8 +198,8 @@ size: buffer.readUInt8(0x10),

// Write the field descriptors.
const encoding = getEncoding(options.encoding);
for (let i = 0; i < fields.length; ++i) {
let { name, type, size, decimalPlaces } = fields[i];
iconv.encode(name, 'ISO-8859-1').copy(buffer, 0); // Field name (up to 10 chars)
for (let j = name.length; j < 11; ++j) { // null terminator(s)
buffer.writeUInt8(0, j);
}
const l = iconv.encode(name, encoding).copy(buffer, 0); // Field name (up to 10 bytes)
for (let j = l; j < 11; ++j)
buffer.writeUInt8(0, j); // Field name null terminator(s)
buffer.writeUInt8(type.charCodeAt(0), 0x0B); // Field type

@@ -307,3 +308,3 @@ buffer.writeUInt32LE(0, 0x0C); // Field data address (set to zero)

let value = null;
let encoding = getEncodingForField(field, dbf._encoding);
let encoding = getEncoding(dbf._encoding, field);
// Decode the field from the buffer, according to its type.

@@ -504,3 +505,3 @@ switch (field.type) {

value = '';
let encoding = getEncodingForField(field, dbf._encoding);
let encoding = getEncoding(dbf._encoding, field);
// Encode the field in the buffer, according to its type.

@@ -623,7 +624,8 @@ switch (field.type) {

// Private helper function
function getEncodingForField(field, encoding) {
function getEncoding(encoding, field) {
var _a;
if (typeof encoding === 'string')
return encoding;
return encoding[field.name] || encoding.default;
return encoding[(_a = field === null || field === void 0 ? void 0 : field.name) !== null && _a !== void 0 ? _a : 'default'] || encoding.default;
}
//# sourceMappingURL=dbf-file.js.map
{
"name": "dbffile",
"version": "1.9.2",
"version": "1.9.3",
"description": "Read and write .dbf (dBase III & Visual FoxPro) files in Node.js",

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

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