# archive.is

> Unofficial Node.js API for archive.is

Latest version **0.0.2** (published 2016-01-28) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install archive.is
pnpm add archive.is
yarn add archive.is
bun add archive.is
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2016-01-28 |
| First published | 2016-01-28 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 20 |
| Author | qvint |
| Maintainers | qvint |
| Keywords | archive.is, archive, snapshot, wayback |

## Links

- npm: https://www.npmjs.com/package/archive.is
- Repository: https://github.com/qvint/archive.is
- Homepage: https://github.com/qvint/archive.is#readme
- Issues: https://github.com/qvint/archive.is/issues
- npm.io page: https://npm.io/package/archive.is

## Dependencies (5)

- [request](https://npm.io/package/request.md) ^2.67.0
- [http-errors](https://npm.io/package/http-errors.md) ^1.3.1
- [h5.linkformat](https://npm.io/package/h5.linkformat.md) 0.0.0
- [object.assign](https://npm.io/package/object.assign.md) ^4.0.3
- [pinkie-promise](https://npm.io/package/pinkie-promise.md) ^2.0.0

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 0.0.2 (latest) — 2016-01-28
- 0.0.1 — 2016-01-28

## README

# archive.is

Unofficial Node.js API for [archive.is][1]

[![Build Status](https://travis-ci.org/qvint/archive.is.svg?branch=master)](https://travis-ci.org/qvint/archive.is)
[![Dependency Status](https://david-dm.org/qvint/archive.is.svg)](https://david-dm.org/qvint/archive.is)
[![devDependency Status](https://david-dm.org/qvint/archive.is/dev-status.svg)](https://david-dm.org/qvint/archive.is#info=devDependencies)

## Install

```bash
npm install archive.is --save
```

## Usage

```js
var archive = require('archive.is');

// Get the last existing snapshot of https://www.kernel.org
archive.timemap('https://www.kernel.org').then(function (timemap) {
  console.log(timemap.last);
  // { url: 'https://archive.is/20160109153444/https://www.kernel.org/',
  //   date: Sat, 09 Jan 2016 15:34:44 GMT }
});

// Take a new snapshot of https://www.kernel.org
archive.save('https://www.kernel.org').then(function (result) {
  console.log(result.shortUrl); // https://archive.is/EJoGi
});
```

## API

### `timemap(url, [callback])`

Get a list of all snapshots of a given page.

* **`url`** `{string}` Page URL
* **`callback`** `{function}` If omitted, a promise will be returned

Returned promise will be fulfilled with an object with the following keys:

* **`original`** `{string}` Original page URL
* **`timegate`** `{string}` Timegate URL
* **`first`** <code>{[Memento][3]}</code> The oldest snapshot
* **`last`** <code>{[Memento][3]}</code> The newest snapshot
* **`mementos`** <code>{Array.<[Memento][3]>}</code> All snapshots sorted by `date` in ascending order

Example result:

```
{ original: 'https://www.kernel.org/',
  timegate: 'https://archive.is/timegate/https://www.kernel.org/',
  first:
   { url: 'https://archive.is/19980130085039/http://www.kernel.org/',
     date: Fri, 30 Jan 1998 08:50:39 GMT },
  last:
   { url: 'https://archive.is/20160127210011/https://www.kernel.org/',
     date: Wed, 27 Jan 2016 21:00:11 GMT } }
  mementos:
   [ { url: 'https://archive.is/19980130085039/http://www.kernel.org/',
       date: Fri, 30 Jan 1998 08:50:39 GMT },
     { url: 'https://archive.is/19990429093120/http://www.kernel.org/',
       date:Thu, 29 Apr 1999 09:31:20 GMT },
     ...
     { url: 'https://archive.is/20160127180405/https://www.kernel.org/',
       date: Wed, 27 Jan 2016 18:04:05 GMT },
     { url: 'https://archive.is/20160127210011/https://www.kernel.org/',
       date: Wed, 27 Jan 2016 21:00:11 GMT } ]
```

### `save(url, [options], [callback])`

Take a new snapshot of a page.

* **`url`** `{string}` Page URL
* **`options`** `{Object}`
* **`options.anyway`** `{boolean}` Force snapshot taking, even if it already exists `[false]`
* **`callback`** `{function}` If omitted, a promise will be returned

Returned promise will be fulfilled with an object with the following keys:

* **`id`** `{string}` Snapshot ID
* **`shortUrl`** `{string}` Short URL (https://archive.is/ + id)
* **`alreadyExists`** `{boolean}` Shows if the returned snapshot was newly created (false) or not (true)

Note that `anyway` option cannot be used more than once in ~3–5 minutes for the same URL. So it is possible to get already existing snapshot, even after setting `anyway` to true.

Example result:

```
{ id: 'nUdVJ',
  shortUrl: 'https://archive.is/nUdVJ',
  alreadyExists: true }
```

<a name="memento"></a>
### `Memento` object

* **`url`** `{string}` Snapshot access URL
* **`date`** `{Date}` Snapshot taking date

## License

The `archive.is` package is released under the GPL-3.0 license. See the [LICENSE][2] for more information.

[1]: https://archive.is
[2]: https://github.com/qvint/archive.is/blob/master/LICENSE
[3]: #memento

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