# gpi

> Get a specific version of the package data

Latest version **1.0.4** (published 2022-12-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install gpi
pnpm add gpi
yarn add gpi
bun add gpi
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2022-12-12 |
| First published | 2022-10-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 158.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | imtaotao |
| Maintainers | rustle |
| Keywords | pkg, info |

## Links

- npm: https://www.npmjs.com/package/gpi
- Repository: https://github.com/imtaotao/gpi
- Homepage: https://github.com/imtaotao/gpi#readme
- Issues: https://github.com/imtaotao/gpi/issues
- npm.io page: https://npm.io/package/gpi

## Dependencies (1)

- [esm-semver](https://npm.io/package/esm-semver.md) ^1.0.0

## Recent versions

- 1.0.4 (latest) — 2022-12-12
- 1.0.3 — 2022-12-03
- 1.0.2 — 2022-12-02
- 1.0.1 — 2022-12-02
- 1.0.0 — 2022-12-02
- 0.0.6 — 2022-10-18
- 0.0.5 — 2022-10-18
- 0.0.4 — 2022-10-18
- 0.0.3 — 2022-10-17
- 0.0.2 — 2022-10-17
- 0.0.1 — 2022-10-17

## README

<div align='center'>
<h2>gpi</h2>

[![NPM version](https://img.shields.io/npm/v/gpi.svg?color=a1b858&label=)](https://www.npmjs.com/package/gpi)

</div>

Get a specific package information through a version with range selection, the search algorithm comes from `npm/cli`.

[Online test platform](https://imtaotao.github.io/gpi/)

### NPM

```js
import { gpi, preload } from 'gpi';

gpi('react-dom', '^16.x.x', {
  customFetch: window.fetch, // Default value is `window.fetch`
  registry: 'https://registry.npmjs.org', // Default value is `https://registry.npmjs.org`
  retry(err, pkgName, times, nextRequest) {  // Retry callback
    if (times < 5) {
      console.log(`"${pkgName}" retry times (${times})`);
      nextRequest();
    } else {
      throw err; // Must throw an error
    }
  },
}).then(res => {
  console.log(res);
})

// Preload packge information
preload('react', {
  customFetch: window.fetch, // Default value is `window.fetch`
  registry: 'https://registry.npmjs.org', // Default value is `https://registry.npmjs.org`
  retry(err, pkgName, times, nextRequest) {
    if (times < 5) {
      console.log(`"${pkgName}" retry times (${times})`);
      nextRequest();
    } else {
      throw err;
    }
  },
}).then(pkgs => {
  console.log(pkgs);
})
```


### CDN

```html
<!DOCTYPE html>
<html lang="en">
<body>
  <script src="https://unpkg.com/gpi/dist/gpi.umd.js"></script>
  <script>
    const { gpi, preload } = Gpi;

    // ...
  </script>
</body>
</html>
```

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