Skip to content

Commit

Permalink
Fix make target dig-snfe
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Dec 22, 2022
1 parent bfed605 commit e5a9b06
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions platform/dig/snfe.js
Expand Up @@ -28,8 +28,8 @@

import { strict as assert } from 'assert';
import { createRequire } from 'module';
import { readFileSync, writeFileSync } from 'fs';
import { dirname, resolve } from 'path';
import { readFile, writeFile, mkdir } from 'fs/promises';
import { dirname } from 'path';
import { fileURLToPath } from 'url';

const __dirname = dirname(fileURLToPath(import.meta.url));
Expand Down Expand Up @@ -81,11 +81,12 @@ function nanoToMicro(bigint) {
}

async function read(path) {
return readFileSync(resolve(__dirname, path), 'utf8');
return readFile(path, 'utf8');
}

async function write(path, data) {
return writeFileSync(resolve(__dirname, path), data, 'utf8');
await mkdir(dirname(path), { recursive: true });
return writeFile(path, data, 'utf8');
}

/******************************************************************************/
Expand Down Expand Up @@ -356,9 +357,9 @@ async function bench() {
.then(raw => ({ name: 'resource-abuse', raw })),
read('assets/ublock/unbreak.txt')
.then(raw => ({ name: 'unbreak.txt', raw })),
read('assets/thirdparties/easylist-downloads.adblockplus.org/easylist.txt')
read('assets/thirdparties/easylist/easylist.txt')
.then(raw => ({ name: 'easylist', raw })),
read('assets/thirdparties/easylist-downloads.adblockplus.org/easyprivacy.txt')
read('assets/thirdparties/easylist/easyprivacy.txt')
.then(raw => ({ name: 'easyprivacy', raw })),
read('assets/thirdparties/pgl.yoyo.org/as/serverlist')
.then(raw => ({ name: 'PGL', raw })),
Expand Down

0 comments on commit e5a9b06

Please sign in to comment.