Giter Club home page Giter Club logo

gyazo-browser-upload's Introduction

gyazo-browser-upload

Build Status

Lightweight in-browser library to simply upload a base64 image to gyazo.

Why?

gyazo-api allows upload to gyazo quite well but it requires authentication. This library is a in-browser library that allows to simply upload an image to your gyazo account.

Important

Right now only https://scrapbox.io is allowed to upload to the default reqUrl! Supply a custom reqUrl for your server/service.

How?

It uses the lightweight superagent package to send a POST request with the image data to the server.

Step-by-step

  1. Install this package: $ npm install gyazo-browser-upload --save
  2. Use the package
    const upload = require('gyazo-browser-upload')
    const redDotImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='
    const options = {clientId: 'My client'}
    upload(redDotImage, options)
      .then((info) {
         info.url // URL of the image
         info.id // ID of the image
      })

Options

  • options.clientId … Identifier to be used to show in gyazo where the request came from required!
  • options.reqUrl … URL to which the request should be sent (optional, default: https://upload.gyazo.com/api/upload/easy_auth)
  • options.referer … Browser referer to be set (optiona, default: window.location.href)
  • options.title … Title that the image should get after uploading. (optional)

gyazo-browser-upload's People

Contributors

martinheidegger avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.