Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
qflatfile
Advanced tools
Readme
qFlatFile is Flat File parser, writer and converter for node.js services:
var qff = require('qflatfile');
var qffp = qff.getParser({delim: ','})
var sFlatFileString = ""
// Load flat file into a sFlatFileString
var aData = qffp.parse(sFlatFileString)
// aData contains an Array containing the parsed contents from flat file
This library is written to be executed syncronously. As such, it is not recommended to be used in usecases where the data processed is very long. In such cases It would be best to use flat file services that run Asyncronously.
This is a first release of a code base that was ported from another language and proved to be very stable in a production environment with millions of cycles. Its not to say that this code will work 100% of the time but its quite solid. If any failure modes are found, please let me know and I will be interested to get fixes done.
npm install qflatfile
The parser will convert a string of a properly formed flat file in almost any format (comma, tab etc.)
var qff = require('qflatfile');
var qffp = qff.getParser({delim: ','})
var sFlatFileString = ""
// Load flat file into a sFlatFileString
var aData = qffp.parse(sFlatFileString)
// aData contains an Array containing the parsed contents from flat file
For qff.getParser({<opts>})
the following options are available
Field | Required? | Default | Description |
---|---|---|---|
delim | Yes | - | Deliminator for flat file. Single character only. |
asJson | No | false | When true, parser will return data in Json format otherwise, data will be as an Array |
The writer will convert a Array to a string of a properly formed flat file in almost any format (comma, tab etc.)
var qff = require('qflatfile');
var qffw = qff.getWriter({delim: ','})
var aTable = []
// Load in a 2d Array of data to be sent to a flat file
var sFlatFile = qffw.writeTable(aTable)
// sFlatFile contains a properly formed Flat file of the data
// Alternatively, you can write one record at a time
var aRecord = []
// Load in a single record into aRecord
var sFFRec = qffw.writeRecord(aRecord)
// sFFRec contains a properly formed Flat file record
For qff.getWriter({<opts>})
the following options are available
Field | Required? | Default | Description |
---|---|---|---|
delim | Yes | - | Deliminator for flat file. Single character only. |
The converter will take a file containing json and will output into a flat file.
var qff = require('qflatfile');
var qffc = qff.getConverter({
delim: '\t'
,jsonIn: true
,asFileIn: true
,asFileOut: true
,fileInName: './testFileIn.json'
,fileOutName: './flatFileOut.tsv'
,nullValue: '-'
,ignoreFields: ["accountId","errorDetails","folderId","id","broadcastMessageId","errorDetails","type"]
,jsonProcessor: function(r){
d=new Date(r.timeStamp);
r.creationDate = new Date(r.creationDate);
r.date = d.getFullYear()+"/"+d.getMonth()+"/"+d.getDay();
r.dateTime = d.getHours()+":"+d.getDate();
return r
}
});
qffc.convertSync();
// After execution, output file should be generated with properly formatted
// flat file
For qff.getConverter({<opts>})
the following options are available
Field | Required? | Default | Description |
---|---|---|---|
delim | Yes | - | Deliminator for flat file. Single character only. |
jsonIn | yes | - | Must be true. This is for future functionality which will support other conversion paths. |
asFileIn | yes | - | Must be true. This is for future functionality which will support other conversion paths. |
asFileOut | yes | - | Must be true. This is for future functionality which will support other conversion paths. |
fileInName | yes | - | Path to file including file name for input. |
fileOutName | yes | - | Path to file including file name for output. |
nullValue | no | (null) | String to insert when a null / undefined is resolved in processing of json in |
ignoreFields | no | false | Array of strings for field names to ignore when processing |
jsonProcessor | no | - | Function to be executed for each json record in. Must return json record. |
BSD 2 Clause. See "LICENSE.txt"
FAQs
Syncronous Flat File tools - parsing, writing, conversion
The npm package qflatfile receives a total of 0 weekly downloads. As such, qflatfile popularity was classified as not popular.
We found that qflatfile demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.