@derhuerst/location
v1.0.0
Published
Get your current location from the OS.
Downloads
8
Maintainers
Readme
location
Get your current location from the OS, using a small Swift helper and wifi-triangulate
.
Linux or Windows user? Help me support them with this module!
See also:
browser-location
for Browsersisomorphic-location
for Browsers & Node
Installing
npm install @derhuerst/location
Keep in mind that the npm package contains a binary that will be executed. If you don't trust me or think that your users won't trust me, build the binary yourself from the source code.
Usage
const location = require('@derhuerst/location')
location((err, loc) => {
if (err) console.error(err)
else console.log(loc)
})
This will give you something similar to the following:
{
latitude: 52.547172,
longitude: 13.347745,
precision: 65, // in meters
native: true
}
API
location([timeout], cb)
timeout
is in milliseconds, optional and 10 * 1000
by default. cb(err, loc)
follows the Node callback convention.
Contributing
If you have a question, found a bug or want to propose a feature, have a look at the issues page.