Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Get current machine IP.

License

NotificationsYou must be signed in to change notification settings

jaywcjlove/local-ip-url

Repository files navigation

Buy me a coffeeCoverage StatusNPM version

Get current machine IP.

Install

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

Usage

constlocalIpUrl=require('local-ip-url');localIpUrl()// => 192.168.31.69localIpUrl('public')// => 192.168.31.69localIpUrl('public','ipv4')// => 192.168.31.69localIpUrl('public','ipv6')// => fe80::c434:2eff:fe06:f90localIpUrl('private')// => 127.0.0.1localIpUrl('private','ipv4')// => 127.0.0.1localIpUrl('private','ipv6')// => fe80::1
constprepareUrls=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 withcontributors.

License

MIT


[8]ページ先頭

©2009-2025 Movatter.jp