Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Post

An image from a booru with a few common props

example
Post {
 fileUrl: 'https://aaaa.com/image.jpg',
 id: '124125',
 tags: ['cat', 'cute'],
 score: 5,
 source: 'https://giraffeduck.com/aaaa.png',
 rating: 's'
}

Hierarchy

  • Post

Index

Constructors

constructor

  • Create an image from a booru

    Parameters

    • data: any

      The raw data from the Booru

    • booru: Booru

      The booru that created the image

    Returns Post

Properties

booru

booru: Booru

The Booru it came from

Optional createdAt

createdAt: Date | null

The Date this post was created at

Protected data

data: any

All the data given by the booru @private

fileUrl

fileUrl: string | null

The direct link to the file

height

height: number

The height of the file

id

id: string

The id of this post

previewHeight

previewHeight: number | null

The height of the smallest image (if available)

previewUrl

previewUrl: string | null

The url to the smallest image (if available)

previewWidth

previewWidth: number | null

The width of the smallest image (if available)

rating

rating: string

The rating of the image, as just the first letter (s/q/e/u) => safe/questionable/explicit/unrated

sampleHeight

sampleHeight: number | null

The height of the medium-sized image (if available)

sampleUrl

sampleUrl: string | null

The url to the medium-sized image (if available)

sampleWidth

sampleWidth: number | null

The width of the medium-sized image (if available)

score

score: number

The score of this post

Optional source

source: undefined | string

The source of this post, if available

tags

tags: string[]

The tags of this post

width

width: number

The width of the file

Accessors

common

  • get common(): this
  • Get some common props on the image

    deprecated

    All common props are now attached directly to the image

    type

    {Object}

    example
    image.id
    // deprecated, use this instead
    image.id
    
    // To access the post's raw data from the booru, do
    image._data.id

    Returns this

file_url

  • get file_url(): string | null
  • The direct link to the file

    It's prefered to use `.fileUrl` instead because camelCase

    Returns string | null

postView

  • get postView(): string
  • Get the post view (url to the post) of this image

    type

    {String}

    example
    const e9 = Booru('e9')
    const imgs = e9.search(['cat', 'dog'])
    
    // Log the post url of the first image
    console.log(imgs[0].postView)

    Returns string

preview_height

  • get preview_height(): number | null
  • The height of the smallest image (if available)

    It's prefered to use `.previewHeight` instead because camelCase

    Returns number | null

preview_url

  • get preview_url(): string | null
  • The url to the smallest image (if available)

    It's prefered to use `.previewUrl` instead because camelCase

    Returns string | null

preview_width

  • get preview_width(): number | null
  • The width of the smallest image (if available)

    It's prefered to use `.previewWidth` instead because camelCase

    Returns number | null

sample_height

  • get sample_height(): number | null
  • The height of the medium-sized image (if available)

    It's prefered to use `.sampleHeight` instead because camelCase

    Returns number | null

sample_url

  • get sample_url(): string | null
  • The url to the medium-sized image (if available)

    It's prefered to use `.sampleUrl` instead because camelCase

    Returns string | null

sample_width

  • get sample_width(): number | null
  • The width of the medium-sized image (if available)

    It's prefered to use `.sampleWidth` instead because camelCase

    Returns number | null

Generated using TypeDoc