Gathering detailed insights and metrics for native-url
Gathering detailed insights and metrics for native-url
Gathering detailed insights and metrics for native-url
Gathering detailed insights and metrics for native-url
jsc-safe-url
Utility functions for converting to and from URLs that encode query string data into URL paths
react-native-url-polyfill
A lightweight and trustworthy URL polyfill for React Native
cross-fetch
Universal WHATWG Fetch API for Node, Browsers and React Native
@aws-sdk/url-parser-native
[](https://www.npmjs.com/package/@aws-sdk/url-parser-node) [](https://www.npmjs.com/package/@aws-sd
Node's url module implemented using the built-in URL API.
npm install native-url
Typescript
Module System
Node Version
NPM Version
99.3
Supply Chain
97.9
Quality
75.6
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
546,095,852
Last Day
58,321
Last Week
792,010
Last Month
3,409,617
Last Year
40,372,084
Apache-2.0 License
288 Stars
65 Commits
12 Forks
6 Watchers
17 Branches
17 Contributors
Updated on Mar 30, 2025
Minified
Minified + Gzipped
Latest Version
0.3.4
Package Id
native-url@0.3.4
Size
18.49 kB
NPM Version
6.13.4
Node Version
12.16.1
Published on
Jun 29, 2020
Cumulative downloads
Total Downloads
Last Day
-26.6%
58,321
Compared to previous day
Last Week
-11.3%
792,010
Compared to previous week
Last Month
13.6%
3,409,617
Compared to previous month
Last Year
-33.3%
40,372,084
Compared to previous year
1
8
A lightweight implementation of Node's url interface atop the URL API. Use it instead of the url
module to reduce your bundle size by around 7.5 kB.
Weighs 1.6 kB gzipped, works in Node.js 7+ and all modern browsers:
Older browsers can be easily polyfilled without new browsers loading the code.
1npm i native-url
1const url = require('native-url'); 2 3url.parse('https://example.com').host; // example.com 4url.parse('/?a=b', true).query; // { a: 'b' }
When you use the url
module, webpack bundles node-url
for the browser. You can alias webpack to use native-url
instead, saving around 7.5kB:
1// webpack.config.js 2module.exports = { 3 // ... 4 resolve: { 5 alias: { 6 url: 'native-url', 7 }, 8 }, 9};
The result is functionally equivalent in Node 7+ and all modern browsers.
Rollup does not bundle shims for Node.js modules like url
by default, but we can add url
support via native-url
using aliases:
1// rollup.config.js 2import resolve from 'rollup-plugin-node-resolve'; 3import alias from '@rollup/plugin-alias'; 4 5module.exports = { 6 // ... 7 plugins: [ 8 resolve(), 9 alias({ 10 entries: { 11 url: 'native-url', 12 }, 13 }), 14 ], 15};
With this in place, import url from 'url'
will use native-url
and keep your bundle small.
Refer Node's legacy url documentation for detailed API documentation.
url.parse(urlStr, [parseQueryString], [slashesDenoteHost])
Parses a URL string and returns a URL object representation:
1url.parse('https://example.com'); 2// { 3// href: 'http://example.com/', 4// protocol: 'http:', 5// slashes: true, 6// host: 'example.com', 7// hostname: 'example.com', 8// query: {}, 9// search: null, 10// pathname: '/', 11// path: '/' 12// } 13 14url.parse('/foo?a=b', true).query.a; // "b"
url.format(urlObj)
Given a parsed URL object, returns its corresponding URL string representation:
1url.format({ protocol: 'https', host: 'example.com' }); 2// "https://example.com"
url.resolve(from, to)
Resolves a target URL based on the provided base URL:
1url.resolve('/a/b', 'c'); 2// "/a/b/c" 3url.resolve('/a/b', '/c#d'); 4// "/c#d"
native-url
relies on the DOM URL API to work. For older browsers that don't support the URL
API, a polyfill is available.
Conveniently, a polyfill is never needed for browsers that support ES Modules, so we can use <script nomodule>
to conditionally load it for older browsers:
1<script nomodule src="/path/to/url-polyfill.js"></script>
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 4/13 approved changesets -- score normalized to 3
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
121 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More