Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Saves XML and CSV data to a database - based on models
This packages aims on providing a high performance, fast and convenient way to save data obtained via XML or CSV files.
It uses LOAD DATA LOCAL INFILE
for CSV files and parses XML data according to your models. Everything is created for you.
Models are created by running npm run-script createModel
. The model creator requires redis for convenience,
but currently only saves your databases. Redis uses database 10 by default and for now only creates an entry called
modelCreator_database
.
npm i data2model --save
For the sake of this example, it creates this INSERT ... ON DUPLICATE KEY UPDATE
query:
INSERT INTO exampleModel (`col1`,`col2`,`created_at`,`updated_at`) VALUES ('hello','test','2015-09-22T16:48:41.355Z','2015-09-22T16:48:41.355Z'),('hello','test2','2015-09-22T16:48:41.355Z','2015-09-22T16:48:41.355Z'),('hello','test3','2015-09-22T16:48:41.355Z','2015-09-22T16:48:41.355Z') ON DUPLICATE KEY UPDATE `col1`=VALUES(`col1`),`col2`=VALUES(`col2`),`updated_at`=VALUES(`updated_at`)
and executes the query, given the exampleModel
found in the models directory.
Feel free to contribute or to post any issues. Needs node.js version >= 4.0.0.
.env.example
file to .env
in your apps root dir and fill in your credentials. You don't need to specify a database here.npm run-script createModel
, follow the instructions./models
directory, you can add valueOptions, defaultValues and whatsoever2
'use strict';
const _Parser = require('data2model');
const XmlParser = _Parser.xml;
const CsvParser = _Parser.csv;
let parser = new XmlParser({database: 'databaseToUse'});
parser.parseFile("./examples/example.xml", ['exampleModel']);
Saving CSV data is quite similar:
let model = new CsvParser({
model: 'model',
file: 'file.csv',
database: 'database'
});
model.parse();
The XML parser uses dotNotation to access the xml nodes. A convenient way to get the dot notation is this:
parser.parseFile("./examples/example.xml", {toDotNotation:true})
.then(val => console.log(val));
I'll add some examples and easier usage later, feel free to ask on stackoverflow.com or post your issues here.
Check out the example Model in /models
and the example xml/js file in /examples
folder.
FAQs
Saves XML and CSV data to a database - based on models
The npm package data2model receives a total of 3 weekly downloads. As such, data2model popularity was classified as not popular.
We found that data2model 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.