Skip to content

uri.jsvshttptools

MIT 104 2 6,257
885 (month) Jun 18 2013 0.1.3(2 years ago)
1,194 2 13 MIT
Dec 28 2012 17.9 million (month) 0.6.1(10 months ago)

URI.js is a lightweight JavaScript library for working with URLs and URIs in Node.js and the browser. It provides a simple and consistent interface for parsing, manipulating, and building URLs and URIs.

httptools is a package for parsing and modifying HTTP protocol strings which supports HTTP1.1 and HTTP2 protocol versions.

httptools is a Python binding for the nodejs HTTP parser. The package is available on PyPI: pip install httptools

Example Use


const URI = require('uri-js');

// parse url for values
const parsedUrl = URI.parse("https://www.example.com/search?q=query+string#fragment");
console.log(parsedUrl);
/* Output:
{
    scheme: 'https',
    authority: 'www.example.com',
    path: '/search',
    query: 'q=query+string',
    fragment: 'fragment'
}
*/

// create url from values
const urlComponents = {
    scheme: 'https',
    authority: 'www.example.com',
    path: '/search',
    query: 'q=query+string',
    fragment: 'fragment'
};
const url = URI.serialize(urlComponents);
console.log(url);
// Output: 'https://www.example.com/search?q=query+string#fragment'

Alternatives / Similar


Was this page helpful?