Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 28, 2024 via pnpm

encodeurl 1.0.2

Encode a URL to a percent-encoded form, excluding already-encoded sequences
Package summary
Share
0
issues
1
license
1
MIT
Package created
8 Jun 2016
Version published
22 Jan 2018
Maintainers
1
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
encodeurl@1.0.2
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of encodeurl 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does encodeurl do?

Encodeurl is a popular Node.js module available through the npm registry. It's designed to encode a URL into a percent-encoded form, excluding sequences that have already been encoded. The purpose is to render safe and properly formatted URLs. Importantly, it also ensures not to encode "%" character if it's part of a valid encoded sequence.

How do you use encodeurl?

To use encodeurl in your JavaScript project, you first need to install it by running npm install encodeurl in your project directory using your terminal. Once installed, you can import the function with var encodeUrl = require('encodeurl') and use it to encode any URL.

Here are a few examples how to use encodeurl:

var encodeUrl = require('encodeurl')
var escapeHtml = require('escape-html')

http.createServer(function onRequest (req, res) {
  var url = encodeUrl(req.url)
  var body = '<p>Location ' + escapeHtml(url) + ' not found</p>'
  res.statusCode = 404
  res.setHeader('Content-Type', 'text/html; charset=UTF-8')
  res.setHeader('Content-Length', String(Buffer.byteLength(body, 'utf-8')))
  res.end(body, 'utf-8')
})

And here's another example:

var encodeUrl = require('encodeurl')
var escapeHtml = require('escape-html')
var url = require('url')

http.createServer(function onRequest (req, res) {
  var href = url.parse(req)
  href.host = 'localhost'
  href.protocol = 'https:'
  href.slashes = true

  var location = encodeUrl(url.format(href))
  var body = '<p>Redirecting to new site: ' + escapeHtml(location) + '</p>'
  res.statusCode = 301
  res.setHeader('Content-Type', 'text/html; charset=UTF-8')
  res.setHeader('Content-Length', String(Buffer.byteLength(body, 'utf-8')))
  res.setHeader('Location', location)
  res.end(body, 'utf-8')
})

Where are the encodeurl docs?

You can find the documentation for encodeurl on the GitHub page of the project: https://github.com/pillarjs/encodeurl. Additionally, the package's npm page probably contains valuable information: https://www.npmjs.com/package/encodeurl. In these resources, you can find information about its methods, usage examples, and other details about the package.

All Versions