Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • IEncodeTools

Implemented by

Index

Properties

convertableFormatMimeTypes

convertableFormatMimeTypes: Map<ConvertableFormat, string>

Combined map of all SerializationFormat and ImageFormat entries to their respective MIME Types

mimeTypesConvertableFormat

mimeTypesConvertableFormat: Map<string, ConvertableFormat>

Map of MIME Type to each ImageFormat or SerializationFormat.

options

toPojoInstance

toPojoInstance: ToPojo<unknown, unknown>

Instance of toPojo to use when serializing objects

Methods

adjustImageBrightness

compress

convertImage

cropImage

decodeBuffer

decodeObject

decompress

deserializeObject

  • deserializeObject<T>(data: string | Buffer | ArrayBuffer, serializationFormat: SerializationFormat): T
  • Deserializes an object serialized using one of the available algorithms, returning the result as an object

    Type parameters

    • T

    Parameters

    • data: string | Buffer | ArrayBuffer

      Data to deserialize

    • serializationFormat: SerializationFormat

      Algorithm to deserialize with

    Returns T

encodeBuffer

encodeObject

hash

hashObject

  • hashObject(obj: any, algorithm: HashAlgorithm, ...args: any[]): Promise<Buffer>
  • Hashes an object using the provided algorithm, returning a node.js Buffer.

    Parameters

    Returns Promise<Buffer>

hashString

headerToConvertableFormat

headerToImageFormat

headerToSerializationFormat

resizeImage

serializeObject

  • serializeObject<T>(obj: T, serializationFormat: SerializationFormat, useToPojoBeforeSerializing?: boolean, encodeBuffersWhenUsingToPojo?: boolean): string | Buffer
  • Serializes an object using one of the available algorithms, returning the result as a Buffer or a string

    Type parameters

    • T

    Parameters

    • obj: T

      Object to serialize

    • serializationFormat: SerializationFormat

      Algorithm to serialize with

    • Optional useToPojoBeforeSerializing: boolean

      Use toPojo on the object before serializing

    • Optional encodeBuffersWhenUsingToPojo: boolean

      If true, Buffers will be encoded with this.encodeBuffer when encountered.

    Returns string | Buffer

uniqueId

  • uniqueId(idFormat: IDFormat, ...args: any[]): string | number | Buffer
  • Generates a unique ID using one of the available algorithms, returning the result as a Buffer, string or number.

    Parameters

    • idFormat: IDFormat

      Algorithm to use to generate the unique id

    • Rest ...args: any[]

      Extra args to pass to the ID generation function

    Returns string | number | Buffer

Generated using TypeDoc