Created
June 25, 2021 00:52
-
-
Save deguchi/1e2a9579a6f9c058dfac06e4fe0e79b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const fs = require('fs'); | |
require('dotenv').config() | |
const Gyazo = require('gyazo-api'); | |
const client = new Gyazo(process.env.GYAZO_TOKEN); | |
const gyazo = async (path) => { | |
return new Promise((resolve, reject) => { | |
client.upload(path, { | |
title: "screenshot", | |
desc: "upload from nodejs" | |
}) | |
.then((res) => { | |
// console.log(res.data.image_id); | |
// console.log(res.data.permalink_url); | |
resolve(res.data.permalink_url) | |
}) | |
.catch((err) => { | |
console.error(err); | |
reject(err); | |
}); | |
}); | |
} | |
module.exports = gyazo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment