ilurl

1.0.9 • Public • Published

ILURL DOCUMENT

The easy way to read url as an object

npm i ilurl

There are 4 thing for which you can use ilurl =>

NAME MEANING
Query It is used read the query from the url and .
Hostname It is used to read the host name.
Path It is used to read path of page you are in the website.
Scheme It is used to identify whether the website is secure or not.
Parse You can use it to get all the information from the url.

Query

A query string is a part of a uniform resource locator (URL) that assigns values to specified parameters. A query string commonly includes fields added to a base URL by a Web browser or other client application, for example as part of an HTML form.

code :

var ilurl = require("ilurl");
var url = "https://example.com/path/to/page?name=ferret&color=purple";
console.log(ilurl.query(url));

HostName

Most web browsers display the URL of a web page above the page in an address bar. A typical URL could have the form http://**www.example.com**/index.html , which indicates a protocol ( http ), a hostname ( www.example.com ), and a file name ( index. html ).

code :

var ilurl = require("ilurl");
var url = "https://example.com/path/to/page?name=ferret&color=purple";
console.log(ilurl.hostname(url));

Path

The path refers to the exact location of a page, post, file, or other asset. It is often analogous to the underlying file structure of the website. The path resides after the hostname and is separated by “/” (forward slash).

code :

var ilurl = require("ilurl");
var url = "https://example.com/path/to/page?name=ferret&color=purple";
console.log(ilurl.path(url));

Scheme

A URL for HTTP (or HTTPS) is normally made up of three or four components: A scheme. The scheme identifies the protocol to be used to access the resource on the Internet. It can be HTTP (without SSL) or HTTPS (with SSL).

code :

var ilurl = require("ilurl");
var url = "https://example.com/path/to/page?name=ferret&color=purple";
console.log(ilurl.scheme(url));

Parse

You will get all the information of url using this method.

code :

var ilurl = require("ilurl");
var url = "https://example.com/path/to/page?name=ferret&color=purple";
console.log(ilurl.parse(url));

GitHub Profile Of ilurl

-- created by Mridul

Dependents (1)

Package Sidebar

Install

npm i ilurl

Weekly Downloads

2

Version

1.0.9

License

MIT

Unpacked Size

6.34 kB

Total Files

5

Last publish

Collaborators

  • lmodules