Skip to content

shokai/node-gyazo-api

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Gyazo-API

Gyazo API wrapper for Node.js

Circle CI

Usage

Register new application and get ACCESS TOKEN, then

upload("filepath") or upload("stream")

var Gyazo  = require('gyazo-api');
var client = new Gyazo('ACCESS_TOKEN');

client.upload('/path/to/file.jpg', {
  title: "my picture",
  desc: "upload from nodejs"
})
.then(function(res){
  console.log(res.data.image_id);
  console.log(res.data.permalink_url);
})
.catch(function(err){
  console.error(err);
});

list

client.list({page: 1, per_page: 50})
.then(function(res){
  console.log(res.data[0]);
  console.log(res.response.headers['x-current-page']); // => 1
  console.log(res.response.headers['x-per-page']);     // => 50
})
.catch(function(err){
  console.error(err);
});

delete

client.delete(image_id)
.then(function(res){
  console.log(res.data.image_id);
});

Test

setup

% npm install
% export GYAZO_TOKEN=a1b2cdef3456   ## set your API Token

run test

% npm test

or

% npm run watch

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

Gyazo API wrapper for Node.js

Resources

Stars

Watchers

Forks

Packages

No packages published