mirror of
https://github.com/SukkaW/Surge.git
synced 2026-02-04 04:42:32 +08:00
Chore/CI: use fs cache to save bandwidth
This commit is contained in:
10
Build/download-publicsuffixlist.ts
Normal file
10
Build/download-publicsuffixlist.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { fsCache } from './lib/cache-filesystem';
|
||||
import { defaultRequestInit, fetchWithRetry } from './lib/fetch-retry';
|
||||
import { createMemoizedPromise } from './lib/memo-promise';
|
||||
import { traceAsync } from './lib/trace-runner';
|
||||
|
||||
export const getPublicSuffixListTextPromise = createMemoizedPromise(() => traceAsync('obtain public_suffix_list', () => fsCache.apply(
|
||||
'public_suffix_list.dat',
|
||||
() => fetchWithRetry('https://publicsuffix.org/list/public_suffix_list.dat', defaultRequestInit).then(r => r.text()),
|
||||
{ ttl: 24 * 60 * 60 * 1000 }
|
||||
)));
|
||||
Reference in New Issue
Block a user