Refactor: drop all Bun.write usage

This commit is contained in:
SukkaW
2024-07-23 15:22:39 +08:00
parent b947f9f818
commit eed0d58697
6 changed files with 33 additions and 8 deletions

View File

@@ -5,6 +5,8 @@ import { exclude, merge } from 'fast-cidr-tools';
import { getChnCidrPromise } from './build-chn-cidr';
import { NON_CN_CIDR_INCLUDED_IN_CHNROUTE, RESERVED_IPV4_CIDR } from './constants/cidr';
import fsp from 'fs/promises';
export const buildInternalReverseChnCIDR = task(import.meta.main, import.meta.path)(async () => {
const cidr = await getChnCidrPromise();
@@ -19,5 +21,9 @@ export const buildInternalReverseChnCIDR = task(import.meta.main, import.meta.pa
)
);
return Bun.write(path.resolve(import.meta.dir, '../Internal/reversed-chn-cidr.txt'), `${reversedCidr.join('\n')}\n`);
return fsp.writeFile(
path.resolve(import.meta.dir, '../Internal/reversed-chn-cidr.txt'),
reversedCidr.join('\n') + '\n',
{ encoding: 'utf-8' }
);
});