Skip to content

uri.jsvshttptools

MIT 103 2 6,252
89 (month) Jun 18 2013 0.1.3(1 year, 9 months ago)
1,160 2 9 MIT
0.6.1(5 months ago) Dec 28 2012 8.8 million (month)

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