mirror of
https://github.com/SukkaW/Surge.git
synced 2026-02-02 03:51:53 +08:00
Replace more utilities w/ foxts
This commit is contained in:
@@ -10,7 +10,7 @@ import { identity } from 'foxts/identity';
|
||||
import { fastStringArrayJoin } from 'foxts/fast-string-array-join';
|
||||
import { performance } from 'node:perf_hooks';
|
||||
import fs from 'node:fs';
|
||||
import { stringHash } from './string-hash';
|
||||
import { simpleStringHash } from 'foxts/simple-string-hash';
|
||||
import { defaultRequestInit, requestWithLog, ResponseError } from './fetch-retry';
|
||||
import type { UndiciResponseData } from './fetch-retry';
|
||||
// import type { UndiciResponseData } from './fetch-retry';
|
||||
@@ -447,7 +447,7 @@ export const deserializeSet = (str: string) => new Set(str.split(separator));
|
||||
export const serializeArray = (arr: string[]) => fastStringArrayJoin(arr, separator);
|
||||
export const deserializeArray = (str: string) => str.split(separator);
|
||||
|
||||
export const getFileContentHash = (filename: string) => stringHash(fs.readFileSync(filename, 'utf-8'));
|
||||
export const getFileContentHash = (filename: string) => simpleStringHash(fs.readFileSync(filename, 'utf-8'));
|
||||
export function createCacheKey(filename: string) {
|
||||
const fileHash = getFileContentHash(filename);
|
||||
return (key: string) => key + '$' + fileHash + '$';
|
||||
|
||||
Reference in New Issue
Block a user