# backuparcgis-service

> Async module to backup content from ArcGIS Online hosted feature services.

Latest version **1.0.2** (published 2019-02-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install backuparcgis-service
pnpm add backuparcgis-service
yarn add backuparcgis-service
bun add backuparcgis-service
```

Provides the command `backuparcgis-service`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2019-02-05 |
| First published | 2019-01-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >8.9.0 |
| Dependencies | 1 |
| Unpacked size | 14.2 KB |
| Known vulnerabilities | 0 (+24 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Joshua Tanner |
| Maintainers | tannerjt |

## Links

- npm: https://www.npmjs.com/package/backuparcgis-service
- Repository: https://github.com/tannerjt/backuparcgis-service
- Homepage: https://github.com/tannerjt/backuparcgis-service#readme
- Issues: https://github.com/tannerjt/backuparcgis-service/issues
- npm.io page: https://npm.io/package/backuparcgis-service

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^0.18.0

## Recent versions

- 1.0.2 (latest) — 2019-02-05
- 1.0.1 — 2019-01-29
- 1.0.0 — 2019-01-29

## README

## backuparcgis-service
backuparcgis-service to backup content from ArcGIS Online hosted feature services.

## About

Hosted Feature Services in ArcGIS Online are a great way to host and serve geospatial data into your online maps.  The infrastructure of ArcGIS Online has proven to be performant and highly available.  There is, however, always a chance your mission critical services will run into issues.  ArcGIS Online outages, accidental deletion, or service corruption can all happen.  It's best to be prepared and at least have a backup of your data on hand.

This library, *backuparcgis-service*, is a performant asynchronous streaming nodejs library that can be imported as a nodejs module or run directly from command line.

## Features

### Asynchronous 

backuparcgis-service is asynchronous and returns a promise when complete.

### Versioned

backuparcgis-service only stores a backup of the data if changes has been made.  It uses sha256 hashing algorithm to compare new and existing backups.  Only services with new data are backed up, saving space.

### Streaming

backuparcgis-service streams feature service content directly to a file and does not store it in memory.  This allows the script to run faster and avoid memory issues with larger datasets.

## Use require()

```bash
$ npm install backuparcgis-service
```

```javascript
const BackupArcGISService = require('backuparcgis-service')

// new BackupArcGIS(serviceURL, archiveDirectory, ?token)
const Backup = new BackupArcGISService('https://services.arcgis.com/uUvqNMGPm7axC2dD/arcgis/rest/services/state_parks/FeatureServer/0', outDir)

Backup.run().then((resp) => {
    if(!resp.duplicate) {
        console.log(`${resp.serviceDetails.name} completed: ${resp.filename}`)
    } else {
        console.log(`No updates to ${resp.serviceDetails.name}.`)
    }
})
```

## Run from command line

```bash
$ npm install backuparcgis-service --global
```

**Format:**

*backuparcgis-service serviceUrl archiveDirectory*

```bash
#!/bin/bash

backuparcgis-service https://services.arcgis.com/uUvqNMGPm7axC2dD/arcgis/rest/services/state_parks/FeatureServer/0 ./terminal
backuparcgis-service https://services.arcgis.com/uUvqNMGPm7axC2dD/ArcGIS/rest/services/Brookings_Sites/FeatureServer/0 ./terminal
```

## Response

The library will respond with a promise with the following object:

```json
{
    "duplicate": "boolean",
    "serviceDetails": "object",
    "filename": "string"
}
```

## File Storage Format

A new archive directory will be created in your specified output directory.  Within the archive directory, a new folder will be created for each feature service, which is named the same as the item id in ArcGIS Online.  Data will be versioned by timestamp, only storing new datasets that are different from the previous export (sha256 hash comparisons).

```
archive  
└───arcgis_item_id
    │--timestamp.geojson
    │--timestamp.geojson
```

---
_Source: https://npm.io/package/backuparcgis-service · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
