8000 GitHub - jaywcjlove/local-ip-url: Get current machine IP.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

jaywcjlove/local-ip-url

Folders and files

< 8000 td class="react-directory-row-name-cell-small-screen" colSpan="2">
NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

local-ip-url

Buy me a coffee Coverage Status NPM version

Get current machine IP.

Install

npm install local-ip-url --save-dev

Usage

const localIpUrl = require('local-ip-url');
localIpUrl() // => 192.168.31.69
localIpUrl('public') // => 192.168.31.69
localIpUrl('public', 'ipv4') // => 192.168.31.69
localIpUrl('public', 'ipv6') // => fe80::c434:2eff:fe06:f90
localIpUrl('private') // => 127.0.0.1
localIpUrl('private', 'ipv4') // => 127.0.0.1
localIpUrl('private', 'ipv6') // => fe80::1
const prepareUrls = require('local-ip-url/prepareUrls');

prepareUrls({
  protocol: 'http',
  host: '0.0.0.0',
  port: 3001
});

// ===output==>
// {
//   ip: '192.168.31.69',
//   localUrl: 'http://localhost:3001/',
//   lanUrl: 'http://192.168.31.69:3001/'
// }

Contributors

As always, thanks to our amazing contributors!

Made with contributors.

License

MIT

Sponsor this project

Packages

No packages published

Contributors 3

  •  
  •  
  •  
0