Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const fs = require('fs');
const _ = require('lodash');
const thuLearnLib = require('thu-learn-lib');
const crossFetch = require('cross-fetch');
const realIsomorphicFetch = require('real-isomorphic-fetch');
const textVersionJs = require('textversionjs');
const htmlEntities = require('html-entities').AllHtmlEntities;
const config = require('./config');
const dirHomework = config.dirHomework;
const dirNotice = config.dirNotice;
const dirFile = config.dirFile;
let helper = new thuLearnLib.Learn2018Helper();
let current = 0;
let all = 0;
function bytesToSize(bytes) {
if (bytes === 0) return '0B';
var k = 1024, sizes = ['B', 'K', 'M', 'G'],
i = Math.floor(Math.log(bytes) / Math.log(k));
if (i == 2)
return String(Math.floor(bytes / Math.pow(k, i)).toFixed(0)) + '.0' + sizes[i];
return String(Math.floor(bytes / Math.pow(k, i)).toFixed(0)) + sizes[i];
}
function isSameSize(document_size, stats_size) {
if (typeof document_size == 'string') {
if (document_size[document_size.length - 1] === 'B') {