Giter Club home page Giter Club logo

imgbi-client's Introduction

imgbi-client

Simple command-line client and Node.js library for use img.bi.

Install

npm install imgbi -g

Usage

$ imgbi-client -i image.png
https://img.bi/#!XqL4IVp!jxJccrgkodebbxlaplteabgtbkllab5tberiWkam
https://img.bi/rm/#!XqL4IVp!jxJccrgkodebbxlaplteabgtbkllab5tberiWkam!Rl80pmqeXIgRhZz9TQvCrYLAIAi

$ imgbi-client -d 'https://img.bi/#!XqL4IVp!jxJccrgkodebbxlaplteabgtbkllab5tberiWkam' -o images
OK: Saved to XqL4IVp.png

$ imgbi-client -r 'https://img.bi/rm/#!XqL4IVp!jxJccrgkodebbxlaplteabgtbkllab5tberiWkam!Rl80pmqeXIgRhZz9TQvCrYLAIAi'
OK: Removed

--help

Usage:
  imgbi-client [OPTIONS] [ARGS]

Options: 
  -i, --image FILE       Image location
  -r, --remove URL       URL of file to be removed
  -d, --download URL     URL of file to be downloaded and decrypted
  -e, --expire [NUMBER]  Set expire time in days for image, 0 for store forever  (Default is 180)
  -o, --output [PATH]    Location to save file (Default is .)
  -u, --url [URL]        URL of img.bi instance (Default is https://img.bi)
  -n, --norm             Don't print removal link
  -l, --nolink           Don't print link to show image
  -a, --autorm           Print autoremove link
  -em, --embed           Print embed code
  -k, --no-color         Omit color from output
      --debug            Show debug information
  -h, --help             Display help and usage details

Programmatic usage

Uploading

var imgbi = require('imgbi');
var options = {};
options.image = 'image.jpg'; // image location
options.expire = '180'; // time to expire in days, default 180
options.url = 'https://img.bi'; // url of img.bi server, https://img.bi by default

imgbi.upload(options, function(err, result) {
  if (err) {
    new Error(err); // if there any error during the upload
  }
  else {
    console.log(result.id); // id of file
    console.log(result.pass); // pass used for encryption
    console.log(result.removalpass); // pass for remove file
    console.log(result.viewlink); // link to view image
    console.log(result.rmlink); // link to remove image
    console.log(result.autormlink); // link to autoremove image after first view
    console.log(result.embedcode); // code to embed image using img.bi.js script
  }
});

Removing

imgbi = require('imgbi');

var url = 'https://img.bi/rm/#!XqL4IVp!jxJccrgkodebbxlaplteabgtbkllab5tberiWkam!Rl80pmqeXIgRhZz9TQvCrYLAIAi'; // link to remove image

imgbi.remove(url, function(err) {
  if (err) {
    new Error(err); // if there any error during the remove
  }
  else {
    console.log('Removed');
  }
});

Downloading

imgbi = require('imgbi');

var url = 'https://img.bi/#!XqL4IVp!jxJccrgkodebbxlaplteabgtbkllab5tberiWkam'; // link to view image
var path = '~/images'; // path to save image

imgbi.download(url, path, function(err, result) {
  if (err) {
    new Error(err); // if there any error during the download
  }
  else {
    console.log(result); // filename
  }
});

imgbi-client's People

Watchers

 avatar  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.