Automatically prefer offline if connected to a metered network #4482
ChocolateLoverRaj
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When I'm connected to my phone's hotspot, I would like to automatically have the
--prefer-offline
behavior to reduce mobile data usage. On my computer it's called a metered connection.I don't know how to programmatically check if the internet connection is 'metered', but it would be cool if this was a Pnpm feature.I found out how to programmatically check if a connection is metered - https://gist.github.com/nijave/d657fb4cdb518286942f6c2dd933b472:
Then I realized that example uses a Windows API: https://docs.microsoft.com/en-us/uwp/api/windows.networking.connectivity.networkcosttype?view=winrt-22000. I'm guessing that it is possible to create a Node.js binding for that.
Beta Was this translation helpful? Give feedback.
All reactions