You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

chrome-store-api

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chrome-store-api

Chrome webstore API

1.0.3
Source
npmnpm
Version published
Weekly downloads
14
-44%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status

Chrome store api

Chrome webstore Api for Node.js

install

npm install chrome-store-api

usage

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.

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

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

insert new item

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

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

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

Keywords

chrome

FAQs

Package last updated on 15 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts