Research
Recent Trends in Malicious Packages Targeting Discord
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
@episage/dbf-parser
Advanced tools
Readme
This is an event-based dBase file parser for very efficiently reading data from *.dbf
files.
iconv-lite
to support multiple encodingsstdin
.dbf
to .csv
To get started, simply install the module using npm:
$ npm install @episage/dbf-parser
and then require
it:
var Parser = require('@episage/dbf-parser');
This is the main interface for reading data from dBase files.
readableStream
- stream from process.stdin
or fs.createReadStream
or otherencoding
- the character encoding to use (default = utf-8
, uses iconv-lite
under the hood)Creates a new parser and attaches it to the specified filename.
var fs = require('fs');
var Parser = require('@episage/dbf-parser');
var parser = Parser(fs.createReadStream('/path/to/my/dbase/file.dbf'));
String
- The event name to listen for (see below for details)Function
- The callback to bind to the eventHeader
The header object as parsed from the dBase fileThis event is emitted once the header has been parsed from the dBase file
Object
An object representing the record that has been foundThe record object will have a key for each field within the record, named after the field. It is trimmed (leading and trailing) of any blank characters (dBase files use \x20 for padding).
In addition to the fields, the object contains two special keys:
Number
indicates the order in which it was extractedBoolean
whether this record has been deleted or notThis object may look like:
{
"@sequenceNumber": 123,
"@deleted": false,
"firstName": "John",
"lastName": "Smith"
}
This event is emitted when the parser reached end of the stream or end of DBF database.
The following code example illustrates a very simple usage for this module:
var fs = require('fs');
var Parser = require('@episage/dbf-parser');
var parser = Parser(fs.createReadStream('/path/to/my/dbase/file.dbf'));
parser.on('header', (h) => {
console.log('dBase file header has been parsed');
console.log(h);
});
parser.on('record', (record) => {
console.log('Name: ' + record.firstName + ' ' + record.lastName); // Name: John Smith
});
The parser also supports a command-line interface (CLI) for converting DBF files to CSV. You can invoke it as follows:
$ dbf-parser < /path/to/file.dbf
This will write the converted rows to stdout
.
$ dbf-parser < /path/to/file.dbf > file.csv
For more help information on using the command line options, use the integrated help:
$ dbf-parser --help
On MacBook Pro (Retina, 13-inch, Early 2015):
iconv-lite
- ~5MB/s - currently implemented versionBuffer.toString()
- ~10MB/sTests are written in Mocha using Chai BDD for the expectations. Data on San Francisco zip codes was used as a reference test file - downloaded from SF OpenData and included in the ./test/fixtures/bayarea_zipcodes.dbf
file within the repository.
Some of the texts and inspiration for the rewrite were taken from https://github.com/abstractvector/node-dbf
FAQs
An efficient dBase DBF file parser written in pure JavaScript
The npm package @episage/dbf-parser receives a total of 68 weekly downloads. As such, @episage/dbf-parser popularity was classified as not popular.
We found that @episage/dbf-parser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
Security News
Socket CEO Feross Aboukhadijeh joins a16z partners to discuss how modern, sophisticated supply chain attacks require AI-driven defenses and explore the challenges and solutions in leveraging AI for threat detection early in the development life cycle.
Security News
NIST's new AI Risk Management Framework aims to enhance the security and reliability of generative AI systems and address the unique challenges of malicious AI exploits.