プロジェクト
概要
人が読みやすい時間文字列を秒数に変換するCache-Controlヘッダー用ユーティリティ。
その他のプロジェクト計測したスター増加
- 24時間
- 0
- 7日間
- -1
- 15日間
- -1
- 1か月
- 履歴を収集中
期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。
README.md
オリジナルpretty-cache-header
Cache-control header utility that parses human readable time strings into seconds.
Time based values use Template Literal Types to help avoid passing invalid time string formats.
Installation
npm i pretty-cache-header
Usage
import { cacheHeader } from 'pretty-cache-header';
return new Response(..., {
headers: {
// sets cache control header to "public, max-age=604800, stale-while-revalidate=31536000"
'Cache-Control': cacheHeader({
public: true,
maxAge: '1week',
staleWhileRevalidate: '1year'
})
}
})
TimeString format
Any number followed by a timestring keyword:
ms,milli,millisecond,milliseconds- will parse to millisecondss,sec,secs,second,seconds- will parse to secondsm,min,mins,minute,minutes- will parse to minutesh,hr,hrs,hour,hours- will parse to hoursd,day,days- will parse to daysw,week,weeks- will parse to weeksmon,mth,mths,month,months- will parse to monthsy,yr,yrs,year,years- will parse to years
関連プロジェクトを探す
読み込み中…