load json readfileSync

This commit is contained in:
Julien Bisconti 2021-10-23 23:19:10 +02:00
parent 3bdaf57c76
commit fda26b09a2

View File

@ -1,5 +1,5 @@
import fetch from 'node-fetch';
const exclude = require('./exclude_in_test.json');
import {readFileSync} from 'fs';
const LINKS_OPTIONS = {
redirect: 'error',
@ -78,6 +78,8 @@ async function batch_fetch({ arr, get, post_filter_func, BATCH_SIZE = 8 }) {
return result;
}
const data = readFileSync('./tests/exclude_in_test.json')
const exclude = JSON.parse(data)
const exclude_length = exclude.length;
const exclude_from_list = (link) => {
let is_excluded = false;
@ -90,7 +92,7 @@ const exclude_from_list = (link) => {
return is_excluded;
};
export {
export default {
LOG,
handleFailure,
extract_all_links,