npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tineye-api

v2.0.6

Published

TinEye API node.js library

Downloads

11,566

Readme

tineye-api

tineye-api is the official Node.js library for the TinEye API. The TinEye API is TinEye's paid reverse image search solution for professional, commercial or high-volume users. See https://api.tineye.com/ for more information.

Contents

Installation

Install the latest version of the library using npm:

$ npm install tineye-api

Migrating from previous versions

If you were using any version of the TinEye API library before 2.0.0, you will need to make minor changes to your code.

The API object is now instantiated using a single key, api_key. The value of this key is the same as your previous private_key. The public key is no longer used.

New ✅

// Sandbox key
// Note that this is the same value as the old private_key
var apiKey = "6mm60lsCNIB,FwOWjJqA80QZHh9BMwc-ber4u=t^";
var api = new TinEye("https://api.tineye.com/rest/", apiKey);

Old ❌

// Sandbox keys
var publicKey = "LCkn,2K7osVwkX95K4Oy";
var privateKey = "6mm60lsCNIB,FwOWjJqA80QZHh9BMwc-ber4u=t^";
var api = new TinEye("https://api.tineye.com/rest/", publicKey, privateKey);

Getting started

After installation, require the library to start using it:

var TinEye = require("tineye-api");

Now that you've required the library, you can use it to create an instance of the API object.

var api = new TinEye("https://api.tineye.com/rest/", "yourApiKey");

Be sure to populate api_key with your own key. You can test your code with our API sandbox keys, but you won't get real search results until you start using your real keys.

Once you have an api object, you can start searching. You can submit an image using either an image URL or by submitting image data by uploading an image file. You can also check the number of remaining searches in your account or check the number of images in the TinEye index.

Methods

Search using an image URL

var url = "https://tineye.com/images/meloncat.jpg";
var params = {
  offset: 0,
  limit: 10,
  sort: "score",
  order: "desc",
};
api
  .searchUrl(url, params)
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

Search using image data

var img = fs.readFileSync("/Users/Mypath/image.jpg");
var params = {
  offset: 0,
  limit: 10,
  sort: "size",
  order: "asc",
};
api
  .searchData(img, params)
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

Get remaining searches

api
  .remainingSearches()
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

Get number of indexed images

api
  .imageCount()
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

Release history

2.0.4

  • Updated axios to 1.2.2
  • Updated Jest to 29.3.1
  • Added prettier to dev deps

2.0.3

  • No need to import URLSearchParams from url module as it is now exposed as global.
  • Updated axios from 0.25.0 -> 0.26.13
  • Updated jest from 27.5.0 -> 27.5.1

2.0.0

  • Swapping HMAC-SHA256 authentication with header key
  • Updated jest 27.0.1 -> 27.0.6

1.1.5

  • Updated form-data 3.0.0 -> 4.0.0
  • Updated jest 26.1.0 -> 27.0.1
  • Fixed an encoding bug when searching with URLs

1.1.4

  • Updated Axios 0.19.0 -> 0.21.1
  • Fixed a bug when performing a search with no options

1.1.3

  • Updated jest 25.1.0 -> 26.1.0

1.1.2

  • Updated Axios 0.19.0 -> 0.19.2
  • Updated form-data 2.5.0 -> 3.0.0
  • Updated jest 24.8.0 -> 25.1.0
  • Updated Sandbox key link in Readme
  • Removed the tests from being packaged
  • Removed unneeded git folder from .gitignore

1.1.0

  • Changed tests from BusterJS to Jest
  • Removed BlueBird and switched to native promises
  • Switch library for making GET requests from Requests to Axios

1.0.2

  • Switched hashing algorithm from SHA1 to SHA256
  • Switched README from reStructuredText to Markdown

1.0.1

  • Cleaning up some code and comments
  • Some error handling fixes

1.0.0

  • Adding promises
  • Better error handling
  • Switched method names to camelCasing
  • searchUrl and searchData now take an option array

0.1.0

  • Initial release