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
}
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);
})