FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

AegisJSProject/url: Safe URL parsing/escaping via JS tagged templates · GitHub

@aegisjsproject/url

Safe URL parsing/escaping via JS tagged templates


Installation

npm i @aegisjsproject/url

Usage

import { url } from '@aegisjsproject/url';

// Santize user input (encodes and escapes as necessary)
const url1 = url`https://example.com/${userInput}`;
const url2 = url`${location.origin}/path/${someVar}`;

// Create a `blob:` URI from a file
const file = new File(['Hello, World!'], hi.txt, { type: 'text/plain' });
const download = `<a href="${url`file`}" download="${file.name}">Download File</a>`;

About

Safe URL parsing/escaping via JS tagged templates

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages


Back | FazBrowse Home | New Git URL