cloudflare-redirect-parser
v0.1.0
Published
Parse Cloudflare's _redirects file
Downloads
1,432
Readme
cloudflare-redirect-parser
Parse Cloudflare's _redirects file following https://developers.cloudflare.com/pages/platform/redirects/.
Usage
import { parse, createRedirect } from 'cloudflare-redirect-parser'
const redirectsString = '<string read from _redirects>'
const parsed = parse(redirectsString)
// output: RedirectEntry[]
const redirect = createRedirect(redirectsString) // or pass `parsed`
// output: (url: string) => RedirectResult | undefined
See index.d.ts for types.
Sponsors
License
MIT