From e5a9b066ec1ddfb4d52cd5dddc9d4ea29849c1ee Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Thu, 22 Dec 2022 13:13:38 -0500 Subject: [PATCH] Fix make target `dig-snfe` --- platform/dig/snfe.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/platform/dig/snfe.js b/platform/dig/snfe.js index f4b9b43ace14c..fc79d7c7d1c29 100644 --- a/platform/dig/snfe.js +++ b/platform/dig/snfe.js @@ -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)); @@ -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'); } /******************************************************************************/ @@ -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 })),