cky-image-public
Version:
public image to public host
74 lines (62 loc) • 1.84 kB
JavaScript
const path = require('path');
require('dotenv').config({
path: path.join(__dirname, '../.env')
})
const { ImgPublic } = require('../index');
const GOOGLE_ACCESS_TOKEN = process.env.GOOGLE_ACCESS_TOKEN;
const GOOGLE_REDIRECT_URI = process.env.GOOGLE_REDIRECT_URI;
const DROPBOX_ACCESS_TOKEN = process.env.DROPBOX_ACCESS_TOKEN;
const IMAGESHACK_API_KEY = process.env.IMAGESHACK_API_KEY;
const PINTEREST_TOKEN = process.env.PINTEREST_TOKEN;
const FILESTACK_API_KEY = process.env.FILESTACK_API_KEY;
let imgPub = new ImgPublic({
// cloudinary: true,
// drive: {
// access_token: GOOGLE_ACCESS_TOKEN,
// },
// dropbox: {
// token: DROPBOX_ACCESS_TOKEN
// },
// dropshots: {
// user_name: 'Chickyky'
// },
// filestack: {
// api_key: FILESTACK_API_KEY
// },
// imageshack: {
// api_key: IMAGESHACK_API_KEY
// },
// imgbb: true,
// imgbox: true,
// imgeto: true,
// imggmi: {
// cookie: '__cfduid=dbc2e44eb94feeaf7e16d944ccb567e801565277263; PHPSESSID=bs2u9jddv1lt8u1uuqlmlm6d53; cf_clearance=94e8b11615857b73f0721bd0a4092d627d76b4f1-1565776191-1800-150'
// },
imgur: {
accesstoken: false
},
// pinterest: {
// token: PINTEREST_TOKEN
// },
// postimg: true,
});
imgPub.upload({
filePath: path.join(__dirname, '1.jpg'),
// type: 'RANDOM',
// hosts: ['IMGGMI']
}, (err, result) => {
console.log('err=', err);
console.log('result=', JSON.stringify(result));
})
// let Imgbox = require('../lib/imgbox');
// let imgbox = new Imgbox();
// let Imgeto = require('../lib/imgeto');
// let imgeto = new Imgeto();
// imgbox.generateToken((err, result) => {
// console.log('err=', err);
// console.log('result=', JSON.stringify(result));
// });
// imgeto.upload(path.join(__dirname, 'spiderman.jpg'), (err, result) => {
// console.log('err=', err);
// console.log('result=', JSON.stringify(result));
// })