Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise((resolve, reject) => {
log.log('starting metascan...')
const pathStats = fs.statSync(pathname)
log.log('file size: ', pathStats.size)
const msStart = process.hrtime()
let firstRow = true
var colTypes: Array
let rowCount = 0
// extract table name from file path:
const tableName = genTableName(pathname)
let csvOptions = { delimiter }
const pathStream = fs.createReadStream(pathname)
let gauge = new Gauge()
const numREs = (delimiter === ';') ? eurNumREs : usNumREs
const guessFunc = guessColumnType(numREs)
gauge.show('scanning...', 0)
let bytesRead = 0
const countStream = through(function write (buf) {
bytesRead += buf.length
const pctComplete = bytesRead / pathStats.size
const msg = 'scanning... ( ' + Math.round(pctComplete * 100) + '%)'
gauge.show(msg, pctComplete)
this.emit('data', buf)
}, function end () {
gauge.hide()
log.log('countStream: bytesRead: ', bytesRead)
this.emit('end')
env: {PATH: [binDir, process.env.PATH].join(path.delimiter)}
},
options.execOpts || {}
)
const nodePath = process.argv[0]
const nodeArgs = [yarnPath].concat(args, [
'--json',
'--non-interactive',
'--ignore-engines',
'--registry',
'https://registry.npmjs.org'
])
const state = {firstStepReceived: false, currentProgressStep: null}
state.progress = new Gauge(process.stderr, {
theme: 'colorASCII',
enabled: true
})
// Yarn takes a while before starting to emit events, we want to show
// some sort of indication while it's getting started
onStep({data: {message: 'Resolving dependencies'}})
onActivityStart({})
const proc = execa(nodePath, nodeArgs, execOpts)
proc.catch(onNativeError)
// Will throw error async through the promise above
if (!proc.stdout) {
return proc
}
qx.tool.compiler.Console.getInstance().setMachineReadable(true);
} else {
let configDb = await qx.tool.cli.ConfigDb.getInstance();
let color = configDb.db("qx.default.color", null);
if (color) {
let colorOn = consoleControl.color(color.split(" "));
process.stdout.write(colorOn + consoleControl.eraseLine());
let colorReset = consoleControl.color("reset");
process.on("exit", () => process.stdout.write(colorReset + consoleControl.eraseLine()));
let Console = qx.tool.compiler.Console.getInstance();
Console.setColorOn(colorOn);
}
if (this.argv["feedback"]) {
var themes = require("gauge/themes");
var ourTheme = themes.newTheme(themes({hasUnicode: true, hasColor: true}));
let colorOn = qx.tool.compiler.Console.getInstance().getColorOn();
ourTheme.preProgressbar = colorOn + ourTheme.preProgressbar;
ourTheme.preSubsection = colorOn + ourTheme.preSubsection;
ourTheme.progressbarTheme.postComplete += colorOn;
ourTheme.progressbarTheme.postRemaining += colorOn;
this.__gauge = new Gauge();
this.__gauge.setTheme(ourTheme);
this.__gauge.show("Compiling", 0);
const TYPES = {
"error": "ERROR",
"warning": "Warning"
};
qx.tool.compiler.Console.getInstance().setWriter((str, msgId) => {
msgId = qx.tool.compiler.Console.MESSAGE_IDS[msgId];
if (msgId.type !== "message") {
const run = () =>
{
Object.values(gaugeThemes).forEach(theme =>
{
//theme.preProgressbar = `\n\n${theme.preProgressbar}`;
theme.preSubsection = gray("—");
});
gauge = new Gauge();
stats = new Statistics();
if (logOptions.recursive)
{
checker = new SiteChecker(checkerOptions);
}
else
{
checker = new HtmlUrlChecker(checkerOptions);
}
checker
.on(HTML_EVENT, (tree, robots, response, pageURL) =>
{
logPage(pageURL);
})
log.disableUnicode = function () {
gaugeTheme = Gauge.ascii
log.gauge.setTheme(gaugeTheme)
}
log.enableUnicode = function () {
gaugeTheme = Gauge.unicode
log.gauge.setTheme(gaugeTheme)
}