mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Refactor: use ROOT_DIR
This commit is contained in:
@@ -18,6 +18,7 @@ import { Custom304NotModifiedError, CustomAbortError, CustomNoETagFallbackError,
|
||||
|
||||
import type { IncomingHttpHeaders } from 'undici/types/header';
|
||||
import { Headers } from 'undici';
|
||||
import { ROOT_DIR } from '../constants/dir';
|
||||
|
||||
export interface CacheOptions<S = string> {
|
||||
/** Path to sqlite file dir */
|
||||
@@ -429,13 +430,11 @@ export class Cache<S = string> {
|
||||
}
|
||||
}
|
||||
|
||||
export const fsFetchCache = new Cache({ cachePath: path.resolve(__dirname, '../../.cache') });
|
||||
export const fsFetchCache = new Cache({ cachePath: path.resolve(ROOT_DIR, '.cache') });
|
||||
// process.on('exit', () => {
|
||||
// fsFetchCache.destroy();
|
||||
// });
|
||||
|
||||
// export const fsCache = traceSync('initializing filesystem cache', () => new Cache<Uint8Array>({ cachePath: path.resolve(__dirname, '../../.cache'), type: 'buffer' }));
|
||||
|
||||
const separator = '\u0000';
|
||||
export const serializeSet = (set: Set<string>) => fastStringArrayJoin(Array.from(set), separator);
|
||||
export const deserializeSet = (str: string) => new Set(str.split(separator));
|
||||
|
||||
Reference in New Issue
Block a user