📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP

urlencode

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
u

urlencode

encodeURIComponent with charset

2.0.0
latest
100

Supply Chain Security

100

Vulnerability

100

Quality

80

Maintenance

100

License

Version published
Weekly downloads
141K
6.61%
Maintainers
3
Weekly downloads
 
Created
Issues
1

What is urlencode?

The `urlencode` npm package is used for encoding and decoding URL strings. It provides simple methods to encode a string into a URL-safe format and decode a URL-encoded string back to its original format.

What are urlencode's main functionalities?

URL Encoding

This feature allows you to encode a string into a URL-safe format. The `urlencode` function takes a string as input and returns the encoded version of that string.

const urlencode = require('urlencode');
const encoded = urlencode('Hello World!');
console.log(encoded); // Outputs: Hello%20World%21

URL Decoding

This feature allows you to decode a URL-encoded string back to its original format. The `decode` function takes an encoded string as input and returns the decoded version of that string.

const urlencode = require('urlencode');
const decoded = urlencode.decode('Hello%20World%21');
console.log(decoded); // Outputs: Hello World!

Encoding with Character Set

This feature allows you to encode a string using a specific character set. The `urlencode` function can take an additional parameter specifying the character set to use for encoding.

const urlencode = require('urlencode');
const encoded = urlencode('你好', 'gbk');
console.log(encoded); // Outputs: %C4%E3%BA%C3

Decoding with Character Set

This feature allows you to decode a URL-encoded string using a specific character set. The `decode` function can take an additional parameter specifying the character set to use for decoding.

const urlencode = require('urlencode');
const decoded = urlencode.decode('%C4%E3%BA%C3', 'gbk');
console.log(decoded); // Outputs: 你好

Other packages similar to urlencode

FAQs

Package last updated on 28 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts