https://github.com/khaosdoctor/percent-encode
Percent encode string following Twitter's spec from RFC 3986
https://github.com/khaosdoctor/percent-encode
decoding encoding percent-encode
Last synced: 8 months ago
JSON representation
Percent encode string following Twitter's spec from RFC 3986
- Host: GitHub
- URL: https://github.com/khaosdoctor/percent-encode
- Owner: khaosdoctor
- License: mit
- Created: 2023-12-08T23:21:15.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-09T00:41:07.000Z (over 2 years ago)
- Last Synced: 2024-04-13T21:59:41.068Z (about 2 years ago)
- Topics: decoding, encoding, percent-encode
- Language: TypeScript
- Homepage: https://deno.land/x/percentencode
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# percent-encode
> [Percent encode](https://developer.twitter.com/en/docs/authentication/oauth-1-0a/percent-encoding-parameters) strings
This implementation is following Twitter's spec from [RFC3986](https://datatracker.ietf.org/doc/html/rfc3986#section-2.1).
**Disclaimer**: This module is made to work with Deno alone, it won't work in Node environments.
## Install
```ts
import { decode, encode } from 'https://deno.land/x/percentencode/mod.ts';
```
## Usage
The lib provides two functions: `encode` and `decode`.
### `encode`
Encode will take a string or a byte array and return a promise that will contain the percent-encoded string.
```ts
await encode('Hello World!'); // Hello%20World%21
```
### `decode`
Decode will take a string and return a promise that will contain the percent-decoded string.
```ts
await decode('Hello%20World%21'); // Hello World!
```