# chrome-store-api

> Chrome webstore API

Latest version **1.0.5** (published 2016-09-23) · ISC license · 0 weekly downloads

## Install

```sh
npm install chrome-store-api
pnpm add chrome-store-api
yarn add chrome-store-api
bun add chrome-store-api
```

## 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.5 |
| Published | 2016-09-23 |
| First published | 2015-12-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 (+6 in 1 direct dependencies) |
| Install scripts | no |
| Author | Aleksey Tsvetkov |
| Maintainers | acvetkov |
| Keywords | chrome, webstore, api, promise |

## Links

- npm: https://www.npmjs.com/package/chrome-store-api
- Repository: https://github.com/acvetkov/chrome-store-api
- Homepage: https://github.com/acvetkov/chrome-store-api#readme
- Issues: https://github.com/acvetkov/chrome-store-api/issues
- npm.io page: https://npm.io/package/chrome-store-api

## Dependencies (6)

- [q](https://npm.io/package/q.md) ^1.4.1
- [q-io](https://npm.io/package/q-io.md) ^1.13.1
- [debug](https://npm.io/package/debug.md) ^2.2.0
- [lodash](https://npm.io/package/lodash.md) ^3.10.1
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [bluebird](https://npm.io/package/bluebird.md) ^3.0.6

## Recent versions

- 1.0.5 (latest) — 2016-09-23
- 1.0.4 — 2016-01-18
- 1.0.3 — 2016-01-15
- 1.0.2 — 2016-01-12
- 1.0.1 — 2015-12-23
- 1.0.0 — 2015-12-12

## README

[![Build Status](https://travis-ci.org/acvetkov/chrome-store-api.svg?branch=master)](https://travis-ci.org/acvetkov/chrome-store-api)

## Chrome store api

Chrome webstore [Api](https://developer.chrome.com/webstore/using_webstore_api) for Node.js

### install

```bash
npm install chrome-store-api
```

### usage

```js
var WebstoreApi = require('chrome-store-api').Webstore;
var TokenManager = require('chrome-store-api').TokenManager;

var code = 'app-code';
var clientId = 'your-client-id';
var clientSecret = 'your-client-secret';

var tokenManager = new TokenManager(code, clientId, clientSecret);
var api = new WebstoreApi(tokenManager);
```

#### Storage

You can use storage for save token data between sessions.

```js
var WebstoreApi = require('chrome-store-api').Webstore;
var TokenManager = require('chrome-store-api').TokenManager;
var FileStorage = require('chrome-store-api').FileStorage;

var code = 'app-code';
var clientId = 'your-client-id';
var clientSecret = 'your-client-secret';

var storage = new FileStorage('data.json');

// you can use every storage module, which implements IStorage interface
var tokenManager = new TokenManager(code, clientId, clientSecret, storage);
var api = new WebstoreApi(tokenManager);
```

#### get item info

```js
api.get('extensiond-id')
   .then(function (data) {
      console.log(data);
   })
   .catch(function (err) {
      console.log(err);
   });
```

#### insert new item

```js
var fs = require('q-io/fs');

fs.read('path/to/extension.zip', 'b')
   .then(function (blob) {
      return api.insert(blob);
   })
   .then(function (data) {
       console.log(data); // new item info
   })
   .catch(function (err) {
      console.log(err);
   });
```

#### update existing item

```js
var fs = require('q-io/fs');

fs.read('path/to/extension.zip', 'b')
   .then(function (blob) {
      return api.update('extension-id', blob);
   })
   .then(function (data) {
       console.log(data); // item info
   })
   .catch(function (err) {
      console.log(err);
   });
```

#### publish item

```js
api.publish('extension-id')
   .then(function (data) {
      console.log(data);
   })
   .catch(function (err) {
      console.log(err);
   });
```

#### publish for trusted users only

```js
api.publish('extension-id', 'trusted')
   .then(function (data) {
      console.log(data);
   })
   .catch(function (err) {
      console.log(err);
   });
```

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