1.0.4 • Published 7 years ago

imgur-tags v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

Installation

npm i imgur-tags --save

Initialize in node

const tags = require("imgur-tags");

Simple module - 3 commands.

tags.get(tag)

Attempts to get a tag from the API.

  • tag (string): The tag you want to fetch.

Returns a promise:

  • On resolve: returns a link to an image with the tag.
  • On reject: returns a string describing an error.
tags.get("dog")
    .then(resp => {
        console.log("Image url: " + resp);
    })
    .catch(err => {
        console.error(err);
    });

tags.add(tag, imgUrl)

Attempts to add a tag to the API.

  • tag (string): The tag you want to add.
  • imgUrl (string): A url that contains the image to link the tag to. The url is automatically cleaned of query strings.

Returns a promise:

  • On resolve: returns a link to an image with the tag.
  • On reject: returns a string describing an error.
tags.add("cat", "some.pictureo.fa/cat.png")
    .then(resp => {
        console.log("Image url: " + resp);
    })
    .catch(err => {
        console.error(err);
    });

tags.count()

Counts up all the tags available for use and returns them in an array.

Returns a promise:

  • On resolve: returns an array of tags (all of them).
  • On reject: returns a string describing an error.
tags.count()
    .then(resp => {
        console.log("tags: " + resp);
    })
    .catch(err => {
        console.error(err);
    });
1.0.4

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago