Giter VIP home page Giter VIP logo

eve-image-service's Introduction

Eve images

Easily fetch Eve Online logos, character portraits, type icons, and type renders from the official image service. Works in node.js and in the browser.

All methods return a Buffer in node.js, and an ArrayBuffer in the browser.

See this blog post for more information on the image service.

API

fetchAllianceLogo(allianceId: number, size: number[, tenant: 'tranquility' | 'singularity' = 'tranquility'])

Fetch the alliance logo.

  • allianceId: The ID of the alliance to fetch the logo for
  • size: The requested image size. Needs to be a power of two
  • tenant: The tenant, defaults to tranquility

fetchCharacterPortrait(characterId: number, size: number[, tenant: 'tranquility' | 'singularity' = 'tranquility'])

Fetch the character's portrait.

  • characterId: The ID of the character to fetch the portrait for
  • size: The requested image size. Needs to be a power of two
  • tenant: The tenant, defaults to tranquility

fetchCorporationLogo(corporationId: number, size: number[, tenant: 'tranquility' | 'singularity' = 'tranquility'])

Fetch the corporation logo.

  • corporationId: The ID of the corporation to fetch the logo for
  • size: The requested image size. Needs to be a power of two
  • tenant: The tenant, defaults to tranquility

fetchTypeIcon(typeId: number, size: number[, tenant: 'tranquility' | 'singularity' = 'tranquility'])

Fetch the inventory type icon.

  • typeId: The type ID to fetch the icon for
  • size: The requested image size. Needs to be a power of two
  • tenant: The tenant, defaults to tranquility

fetchTypeRender(typeId: number, size: number[, tenant: 'tranquility' | 'singularity' = 'tranquility'])

Fetch the inventory type render.

  • typeId: The type ID to fetch the render for
  • size: The requested image size. Needs to be a power of two
  • tenant: The tenant, defaults to tranquility

Example (node.js)

The following node.js example fetches the corporation logo for Eve University and writes it to file.

import { fetchCorporationLogo } from './index'

import { resolve } from 'path'
import { writeFile } from 'fs'

const path = resolve(__dirname, './Eve-University.png')

fetchCorporationLogo(917701062, 256).then(buf => {
  writeFile(path, buf, err => {
    if (err) {
      console.error(err)
    } else {
      console.log(`Image written to ${path}`)
    }
  })
})

License

Copyright 2020 Michiel van der Velde.

This software is licensed under the MIT License.

eve-image-service's People

Contributors

michielvdvelde avatar

Watchers

 avatar  avatar

eve-image-service's Issues

Create link strings as well

It's not always necessary to fetch the requested image. In the browser, for example, having the URL is enough for an image tag.

Add methods to return the URL for the given image, next to the currently existing methods.

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.