Gathering detailed insights and metrics for mysql2-import
Gathering detailed insights and metrics for mysql2-import
npm install mysql2-import
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
100,546
Last Day
14
Last Week
257
Last Month
1,518
Last Year
44,325
110 Commits
1 Forks
4 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
5.0.22
Package Id
mysql2-import@5.0.22
Size
39.53 kB
NPM Version
6.14.12
Node Version
14.16.1
Publised On
03 May 2021
Cumulative downloads
Total Downloads
Last day
-87.8%
14
Compared to previous day
Last week
-47%
257
Compared to previous week
Last month
-41.4%
1,518
Compared to previous month
Last year
24.1%
44,325
Compared to previous year
1
7
Import MySQL files with Node!
via NPM:
$ npm install --save-dev mysql-import
Via Github:
git clone https://github.com/Pamblam/mysql-import.git
1const host = 'localhost'; 2const user = 'root'; 3const password = 'password'; 4const database = 'mydb'; 5 6const Importer = require('mysql-import'); 7const importer = new Importer({host, user, password, database}); 8 9// New onProgress method, added in version 5.0! 10importer.onProgress(progress=>{ 11 var percent = Math.floor(progress.bytes_processed / progress.total_bytes * 10000) / 100; 12 console.log(`${percent}% Completed`); 13}); 14 15importer.import('path/to/dump.sql').then(()=>{ 16 var files_imported = importer.getImported(); 17 console.log(`${files_imported.length} SQL file(s) imported.`); 18}).catch(err=>{ 19 console.error(err); 20});
new Importer({host, user, password[, database]})
The constructor requires an object with a host
, user
, and password
parameter. Passing in a database parameter is optional.
Importer.prototype.getImported()
Get an array of files imported.
Importer.prototype.setEncoding(encoding)
Set the encoding to use when reading import files. Supported arguments are: utf8
, ucs2
, utf16le
, latin1
, ascii
, base64
, or hex
.
Importer.prototype.use(database)
Set or change the database to import to.
Importer.prototype.onProgress(callback)
(New in v. 5.0!) - Set a callback to be called as the importer processes chunks of the dump file. Callback is provided an object with the following properties:
total_files
: The total files in the queue.file_no
: The number of the current dump file in the queue.bytes_processed
: The number of bytes of the file processed.total_bytes
: The size of the dump file.file_path
: The full path to the dump file.Importer.prototype.onDumpCompleted(callback)
(New in v. 5.0!) - Set a callback to be called after each dump file has completed processing. Callback is provided an object with the following properties:
total_files
: The total files in the queue.file_no
: The number of the current dump file in the queue.file_path
: The full path to the dump file.error
: If there was an error, the error object; if no errors, this will be null
.Importer.prototype.import(...input)
Import an .sql
file or files into the database. This method will take...
.sql
files.
importer.import('path/to/dump1.sql', 'path/to/dum2.sql')
.sql
files.
importer.import('path/to/mysqldumps/')
importer.import(['path/to/dump.sql', 'path/to/dumps/'])
Importer.prototype.disconnect(graceful=true)
Disconnects the connection. If graceful
is switched to false it will force close any connections. This is called automatically after files are imported so typically this method should never be required.
Contributions are more than welcome! Please check out the Contributing Guidelines for this project.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
35 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More