An open API service indexing awesome lists of open source software.

https://github.com/tobilg/azure-edge-locations

Approximation of Azure edge locations
https://github.com/tobilg/azure-edge-locations

Last synced: 7 months ago
JSON representation

Approximation of Azure edge locations

Awesome Lists containing this project

README

          

# azure-edge-locations
Approximation of Azure edge locations, usable via a lookup mechanism.

## Installation
To install, you can do the following:

```bash
$ npm i azure-edge-locations
```

This package includes TypeScript definitions and is written in TypeScript for better type safety and developer experience.

## Usage

### Node (JavaScript)

```javascript
const AzureEdgeLocations = require('azure-edge-locations');
const el = new AzureEdgeLocations();
const location = el.lookup('ATL');

/* returns
{
"city": "Atlanta",
"country": "United States",
"countryCode": "US",
"latitude": 33.6367,
"longitude": -84.428101,
"count": 3
}
*/

const invalid = el.lookup('FOO'); // returns false

// Get edge location count
const locationCount = el.getLocationCount(); // returns 104

// Get all edge locations
const locations = el.getLocations();

// Get PoP count
const popCount = el.getPoPCount() // returns 182
```

### Node (TypeScript)

```typescript
import { AzureEdgeLocations } from 'azure-edge-locations';

const el = new AzureEdgeLocations();
const location = el.lookup('ATL');

/* returns
{
"city": "Atlanta",
"country": "United States",
"countryCode": "US",
"latitude": 33.6367,
"longitude": -84.428101,
"count": 3
}
*/

const invalid = el.lookup('FOO'); // returns false

// Get edge location count
const locationCount = el.getLocationCount(); // returns 104

// Get all edge locations
const locations = el.getLocations();

// Get PoP count
const popCount = el.getPoPCount() // returns 182
```

### Browser

This package is published as an UMD module, and can be used in the browser directly from [unpkg](https://unpkg.com/).

```html






// Using the global variable
document.write('There are ' + azureEdgeLocations.getLocationCount() + ' edge locations');

```

## Data generation

### TLDR

Run `npm run build`

## Data

This project is considered as in the `alpha` stage, so there's **no guarantee that the data is accurate**. Please feel free to test and give feedback either via creating an [issue](https://github.com/tobilg/azure-edge-locations/issues) or a [pr](https://github.com/tobilg/azure-edge-locations/pulls)

The data files can be found at
* [data/azure-edge-locations.csv](data/azure-edge-locations.csv)
* [data/azure-edge-locations.json](data/azure-edge-locations.json)