Options
All
  • Public
  • Public/Protected
  • All
Menu

Contains tools for encoding/decoding data in different circumstances.

Will only attempt to use the native compiled npm libraries, returning an error if they aren't available. This class will not work in browsers.

Hierarchy

Implements

Index

Constructors

constructor

Properties

options

options: EncodingOptions = ...

Accessors

convertableFormatMimeTypes

mimeTypesConvertableFormat

Static ObjectId

  • get ObjectId(): any
  • Returns an instance of the ObjectId constructor bson node module, using the native bson-ext if available.

    Returns any

Static WithDefaults

Static Protected bson

  • get bson(): any

Methods

adjustImageBrightness

  • adjustImageBrightness(buffer: Buffer | ArrayBuffer, factor: number, format?: png): Promise<Buffer>
  • adjustImageBrightness(buffer: Buffer | ArrayBuffer, factor: number, format?: jpeg): Promise<Buffer>
  • adjustImageBrightness(buffer: Buffer | ArrayBuffer, factor: number, format?: webp): Promise<Buffer>
  • adjustImageBrightness(buffer: Buffer | ArrayBuffer, factor: number, format?: avif): Promise<Buffer>
  • adjustImageBrightness(buffer: Buffer | ArrayBuffer, factor: number, format?: tiff): Promise<Buffer>
  • adjustImageBrightness(data: BinaryInputOutput, factor: number, format?: ImageFormat): Promise<Buffer>
  • Adjust brightness of image

    Parameters

    • buffer: Buffer | ArrayBuffer

      Image

    • factor: number
    • Optional format: png

      Format to save result as

    Returns Promise<Buffer>

  • Adjust brightness of image

    Parameters

    • buffer: Buffer | ArrayBuffer

      Image

    • factor: number
    • Optional format: jpeg

      Format to save result as

    Returns Promise<Buffer>

  • Adjust brightness of image

    Parameters

    • buffer: Buffer | ArrayBuffer

      Image

    • factor: number
    • Optional format: webp

      Format to save result as

    Returns Promise<Buffer>

  • Adjust brightness of image

    Parameters

    • buffer: Buffer | ArrayBuffer

      Image

    • factor: number
    • Optional format: avif

      Format to save result as

    Returns Promise<Buffer>

  • Adjust brightness of image

    Parameters

    • buffer: Buffer | ArrayBuffer

      Image

    • factor: number
    • Optional format: tiff

      Format to save result as

    Returns Promise<Buffer>

  • Adjust brightness of image

    Parameters

    Returns Promise<Buffer>

compress

  • compress(data: Buffer | ArrayBuffer, format?: lzma, level?: number, ...args: any[]): Promise<Buffer>
  • compress(data: Buffer | ArrayBuffer, format?: zstd, level?: number, ...args: any[]): Promise<Buffer>
  • compress(data: BinaryInputOutput, format?: CompressionFormat, level?: number, ...args: any[]): Promise<Buffer>
  • Compresses arbitrary data using the provided format and any options

    Parameters

    • data: Buffer | ArrayBuffer

      Data to compress

    • Optional format: lzma

      Format to use

    • Optional level: number
    • Rest ...args: any[]

      Options

    Returns Promise<Buffer>

  • Compresses arbitrary data using the provided format and any options

    Parameters

    • data: Buffer | ArrayBuffer

      Data to compress

    • Optional format: zstd

      Format to use

    • Optional level: number
    • Rest ...args: any[]

      Options

    Returns Promise<Buffer>

  • Compresses arbitrary data using the provided format and any options

    Parameters

    Returns Promise<Buffer>

convertImage

  • convertImage(buffer: Buffer | ArrayBuffer, format?: png): Promise<Buffer>
  • convertImage(buffer: Buffer | ArrayBuffer, format?: jpeg): Promise<Buffer>
  • convertImage(buffer: Buffer | ArrayBuffer, format?: webp): Promise<Buffer>
  • convertImage(buffer: Buffer | ArrayBuffer, format?: avif): Promise<Buffer>
  • convertImage(buffer: Buffer | ArrayBuffer, format?: tiff): Promise<Buffer>
  • convertImage(data: BinaryInputOutput, format?: ImageFormat): Promise<Buffer>
  • Saves an image in the provided format, performing no operations on the image

    Parameters

    • buffer: Buffer | ArrayBuffer
    • Optional format: png

      Format to save result as

    Returns Promise<Buffer>

  • Saves an image in the provided format, performing no operations on the image

    Parameters

    • buffer: Buffer | ArrayBuffer
    • Optional format: jpeg

      Format to save result as

    Returns Promise<Buffer>

  • Saves an image in the provided format, performing no operations on the image

    Parameters

    • buffer: Buffer | ArrayBuffer
    • Optional format: webp

      Format to save result as

    Returns Promise<Buffer>

  • Saves an image in the provided format, performing no operations on the image

    Parameters

    • buffer: Buffer | ArrayBuffer
    • Optional format: avif

      Format to save result as

    Returns Promise<Buffer>

  • Saves an image in the provided format, performing no operations on the image

    Parameters

    • buffer: Buffer | ArrayBuffer
    • Optional format: tiff

      Format to save result as

    Returns Promise<Buffer>

  • Saves an image in the provided format, performing no operations on the image

    Parameters

    Returns Promise<Buffer>

cropImage

  • cropImage(buffer: Buffer | ArrayBuffer, dims: CropDims, format?: png): Promise<Buffer>
  • cropImage(buffer: Buffer | ArrayBuffer, dims: CropDims, format?: jpeg): Promise<Buffer>
  • cropImage(buffer: Buffer | ArrayBuffer, dims: CropDims, format?: webp): Promise<Buffer>
  • cropImage(buffer: Buffer | ArrayBuffer, dims: CropDims, format?: avif): Promise<Buffer>
  • cropImage(buffer: Buffer | ArrayBuffer, dims: CropDims, format?: tiff): Promise<Buffer>
  • cropImage(data: BinaryInputOutput, dims: CropDims, format?: ImageFormat): Promise<Buffer>
  • Crops an image and returns a Buffer containing the result in the provided format

    Parameters

    • buffer: Buffer | ArrayBuffer

      Image

    • dims: CropDims

      Height/Width to resize to

    • Optional format: png

      Format to save result as

    Returns Promise<Buffer>

  • Crops an image and returns a Buffer containing the result in the provided format

    Parameters

    • buffer: Buffer | ArrayBuffer

      Image

    • dims: CropDims

      Height/Width to resize to

    • Optional format: jpeg

      Format to save result as

    Returns Promise<Buffer>

  • Crops an image and returns a Buffer containing the result in the provided format

    Parameters

    • buffer: Buffer | ArrayBuffer

      Image

    • dims: CropDims

      Height/Width to resize to

    • Optional format: webp

      Format to save result as

    Returns Promise<Buffer>

  • Crops an image and returns a Buffer containing the result in the provided format

    Parameters

    • buffer: Buffer | ArrayBuffer

      Image

    • dims: CropDims

      Height/Width to resize to

    • Optional format: avif

      Format to save result as

    Returns Promise<Buffer>

  • Crops an image and returns a Buffer containing the result in the provided format

    Parameters

    • buffer: Buffer | ArrayBuffer

      Image

    • dims: CropDims

      Height/Width to resize to

    • Optional format: tiff

      Format to save result as

    Returns Promise<Buffer>

  • Crops an image and returns a Buffer containing the result in the provided format

    Parameters

    Returns Promise<Buffer>

decodeBuffer

  • decodeBuffer(buffer: ArrayBuffer, format?: arrayBuffer, ...args: any[]): Buffer
  • decodeBuffer(buffer: Buffer, format?: nodeBuffer, ...args: any[]): Buffer
  • decodeBuffer(input: string, format?: hex, ...args: any[]): Buffer
  • decodeBuffer(input: string, format?: base32, ...args: any[]): Buffer
  • decodeBuffer(input: string, format?: hashids, ...args: any[]): Buffer
  • decodeBuffer(input: string, format?: base64, ...args: any[]): Buffer
  • decodeBuffer(input: string, format?: base64url, ...args: any[]): Buffer
  • decodeBuffer(input: string, format?: ascii85, ...args: any[]): Buffer
  • decodeBuffer(input: string, format?: ascii85, ...args: any[]): Buffer
  • decodeBuffer(buffer: BinaryInputOutput, format?: BinaryEncoding, ...args: any[]): Buffer
  • Decodes binary data from the provided format returning either a node.js buffer.

    Parameters

    • buffer: ArrayBuffer
    • Optional format: arrayBuffer
    • Rest ...args: any[]

    Returns Buffer

  • Decodes binary data from the provided format returning either a node.js buffer.

    Parameters

    • buffer: Buffer
    • Optional format: nodeBuffer
    • Rest ...args: any[]

    Returns Buffer

  • Decodes binary data from the provided format returning either a node.js buffer.

    Parameters

    • input: string
    • Optional format: hex
    • Rest ...args: any[]

    Returns Buffer

  • Decodes binary data from the provided format returning either a node.js buffer.

    Parameters

    • input: string
    • Optional format: base32
    • Rest ...args: any[]

    Returns Buffer

  • Decodes binary data from the provided format returning either a node.js buffer.

    Parameters

    • input: string
    • Optional format: hashids
    • Rest ...args: any[]

    Returns Buffer

  • Decodes binary data from the provided format returning either a node.js buffer.

    Parameters

    • input: string
    • Optional format: base64
    • Rest ...args: any[]

    Returns Buffer

  • Decodes binary data from the provided format returning either a node.js buffer.

    Parameters

    • input: string
    • Optional format: base64url
    • Rest ...args: any[]

    Returns Buffer

  • Decodes binary data from the provided format returning either a node.js buffer.

    Parameters

    • input: string
    • Optional format: ascii85
    • Rest ...args: any[]

    Returns Buffer

  • Decodes binary data from the provided format returning either a node.js buffer.

    Parameters

    • input: string
    • Optional format: ascii85
    • Rest ...args: any[]

    Returns Buffer

  • Decodes binary data from the provided format returning either a node.js buffer.

    Parameters

    Returns Buffer

decodeObject

  • decodeObject<T>(buffer: Buffer, format?: nodeBuffer, ...args: any[]): T
  • decodeObject<T>(buffer: string, format?: base64, ...args: any[]): T
  • decodeObject<T>(buffer: string, format?: base64url, ...args: any[]): T
  • decodeObject<T>(buffer: string, format?: hex, ...args: any[]): T
  • decodeObject<T>(buffer: string, format?: base32, ...args: any[]): T
  • decodeObject<T>(buffer: string, format?: hashids, ...args: any[]): T
  • decodeObject<T>(buffer: ArrayBuffer, format?: arrayBuffer, ...args: any[]): T
  • decodeObject<T>(buffer: string, format?: ascii85, ...args: any[]): T
  • decodeObject<T>(buffer: string, format?: ascii85, ...args: any[]): T
  • decodeObject<T>(inputBuffer: BinaryInputOutput, format?: BinaryEncoding, ...args: any[]): T
  • Decodes binary data from the provided format returning either a node.js buffer.

    Type parameters

    • T

    Parameters

    • buffer: Buffer
    • Optional format: nodeBuffer
    • Rest ...args: any[]

    Returns T

  • Decodes binary data from the provided format returning either a node.js buffer.

    Type parameters

    • T

    Parameters

    • buffer: string
    • Optional format: base64
    • Rest ...args: any[]

    Returns T

  • Decodes binary data from the provided format returning either a node.js buffer.

    Type parameters

    • T

    Parameters

    • buffer: string
    • Optional format: base64url
    • Rest ...args: any[]

    Returns T

  • Decodes binary data from the provided format returning either a node.js buffer.

    Type parameters

    • T

    Parameters

    • buffer: string
    • Optional format: hex
    • Rest ...args: any[]

    Returns T

  • Decodes binary data from the provided format returning either a node.js buffer.

    Type parameters

    • T

    Parameters

    • buffer: string
    • Optional format: base32
    • Rest ...args: any[]

    Returns T

  • Decodes binary data from the provided format returning either a node.js buffer.

    Type parameters

    • T

    Parameters

    • buffer: string
    • Optional format: hashids
    • Rest ...args: any[]

    Returns T

  • Decodes binary data from the provided format returning either a node.js buffer.

    Type parameters

    • T

    Parameters

    • buffer: ArrayBuffer
    • Optional format: arrayBuffer
    • Rest ...args: any[]

    Returns T

  • Decodes binary data from the provided format returning either a node.js buffer.

    Type parameters

    • T

    Parameters

    • buffer: string
    • Optional format: ascii85
    • Rest ...args: any[]

    Returns T

  • Decodes binary data from the provided format returning either a node.js buffer.

    Type parameters

    • T

    Parameters

    • buffer: string
    • Optional format: ascii85
    • Rest ...args: any[]

    Returns T

  • Decodes binary data from the provided format returning either a node.js buffer.

    Type parameters

    • T

    Parameters

    Returns T

decompress

  • decompress(data: Buffer | ArrayBuffer, format: lzma, ...args: any[]): Promise<Buffer>
  • decompress(data: Buffer | ArrayBuffer, format: zstd, ...args: any[]): Promise<Buffer>
  • decompress(data: BinaryInputOutput, format: CompressionFormat, ...args: any[]): Promise<Buffer>

deserializeObject

  • deserializeObject<T>(data: BinaryInputOutput, serializationFormat?: json): T
  • deserializeObject<T>(data: Buffer | ArrayBuffer, serializationFormat?: cbor): T
  • deserializeObject<T>(data: Buffer | ArrayBuffer, serializationFormat?: msgpack): T
  • deserializeObject<T>(data: Buffer | ArrayBuffer, serializationFormat?: bson): T
  • deserializeObject<T>(data: 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: BinaryInputOutput

      Data to deserialize

    • Optional serializationFormat: json

      Algorithm to deserialize with

    Returns T

  • Deserializes an object serialized using one of the available algorithms, returning the result as an object

    Type parameters

    • T

    Parameters

    • data: Buffer | ArrayBuffer

      Data to deserialize

    • Optional serializationFormat: cbor

      Algorithm to deserialize with

    Returns T

  • Deserializes an object serialized using one of the available algorithms, returning the result as an object

    Type parameters

    • T

    Parameters

    • data: Buffer | ArrayBuffer

      Data to deserialize

    • Optional serializationFormat: msgpack

      Algorithm to deserialize with

    Returns T

  • Deserializes an object serialized using one of the available algorithms, returning the result as an object

    Type parameters

    • T

    Parameters

    • data: Buffer | ArrayBuffer

      Data to deserialize

    • Optional serializationFormat: bson

      Algorithm to deserialize with

    Returns T

  • Deserializes an object serialized using one of the available algorithms, returning the result as an object

    Type parameters

    • T

    Parameters

    • data: Buffer | ArrayBuffer

      Data to deserialize

    • Optional serializationFormat: SerializationFormat

      Algorithm to deserialize with

    Returns T

encodeBuffer

encodeObject

  • encodeObject<T>(inputObject: T, format?: nodeBuffer, ...args: any[]): Buffer
  • encodeObject<T>(inputObject: T, format?: base64, ...args: any[]): string
  • encodeObject<T>(inputObject: T, format?: base64url, ...args: any[]): string
  • encodeObject<T>(inputObject: T, format?: hex, ...args: any[]): string
  • encodeObject<T>(inputObject: T, format?: base32, ...args: any[]): string
  • encodeObject<T>(inputObject: T, format?: hashids, ...args: any[]): string
  • encodeObject<T>(inputObject: T, format?: arrayBuffer, ...args: any[]): ArrayBuffer
  • encodeObject<T>(inputObject: T, format?: ascii85, ...args: any[]): string
  • encodeObject<T>(inputObject: T, format?: ascii85, ...args: any[]): string
  • encodeObject<T>(inputObject: T, format?: BinaryEncoding, ...args: any[]): BinaryInputOutput
  • Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string

    Type parameters

    • T

    Parameters

    • inputObject: T
    • Optional format: nodeBuffer
    • Rest ...args: any[]

    Returns Buffer

  • Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string

    Type parameters

    • T

    Parameters

    • inputObject: T
    • Optional format: base64
    • Rest ...args: any[]

    Returns string

  • Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string

    Type parameters

    • T

    Parameters

    • inputObject: T
    • Optional format: base64url
    • Rest ...args: any[]

    Returns string

  • Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string

    Type parameters

    • T

    Parameters

    • inputObject: T
    • Optional format: hex
    • Rest ...args: any[]

    Returns string

  • Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string

    Type parameters

    • T

    Parameters

    • inputObject: T
    • Optional format: base32
    • Rest ...args: any[]

    Returns string

  • Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string

    Type parameters

    • T

    Parameters

    • inputObject: T
    • Optional format: hashids
    • Rest ...args: any[]

    Returns string

  • Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string

    Type parameters

    • T

    Parameters

    • inputObject: T
    • Optional format: arrayBuffer
    • Rest ...args: any[]

    Returns ArrayBuffer

  • Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string

    Type parameters

    • T

    Parameters

    • inputObject: T
    • Optional format: ascii85
    • Rest ...args: any[]

    Returns string

  • Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string

    Type parameters

    • T

    Parameters

    • inputObject: T
    • Optional format: ascii85
    • Rest ...args: any[]

    Returns string

  • Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string

    Type parameters

    • T

    Parameters

    Returns BinaryInputOutput

hash

hashObject

  • hashObject(obj: any, algorithm?: HashAlgorithm, ...args: any[]): Promise<Buffer>

hashString

headerToConvertableFormat

headerToImageFormat

headerToSerializationFormat

resizeImage

  • resizeImage(buffer: Buffer | ArrayBuffer, dims: { height: number; width?: number } | { height?: number; width: number }, format?: png): Promise<Buffer>
  • resizeImage(buffer: Buffer | ArrayBuffer, dims: { height: number; width?: number } | { height?: number; width: number }, format?: jpeg): Promise<Buffer>
  • resizeImage(buffer: Buffer | ArrayBuffer, dims: { height: number; width?: number } | { height?: number; width: number }, format?: webp): Promise<Buffer>
  • resizeImage(buffer: Buffer | ArrayBuffer, dims: { height: number; width?: number } | { height?: number; width: number }, format?: avif): Promise<Buffer>
  • resizeImage(buffer: Buffer | ArrayBuffer, dims: { height: number; width?: number } | { height?: number; width: number }, format?: tiff): Promise<Buffer>
  • resizeImage(data: BinaryInputOutput, dims: { height: number; width?: number } | { height?: number; width: number }, format?: ImageFormat): Promise<Buffer>
  • Resizes an image and returns a Buffer containing the result in the provided format

    Parameters

    • buffer: Buffer | ArrayBuffer

      Image

    • dims: { height: number; width?: number } | { height?: number; width: number }

      Height/Width to resize to

    • Optional format: png

      Format to save result as

    Returns Promise<Buffer>

  • Resizes an image and returns a Buffer containing the result in the provided format

    Parameters

    • buffer: Buffer | ArrayBuffer

      Image

    • dims: { height: number; width?: number } | { height?: number; width: number }

      Height/Width to resize to

    • Optional format: jpeg

      Format to save result as

    Returns Promise<Buffer>

  • Resizes an image and returns a Buffer containing the result in the provided format

    Parameters

    • buffer: Buffer | ArrayBuffer

      Image

    • dims: { height: number; width?: number } | { height?: number; width: number }

      Height/Width to resize to

    • Optional format: webp

      Format to save result as

    Returns Promise<Buffer>

  • Resizes an image and returns a Buffer containing the result in the provided format

    Parameters

    • buffer: Buffer | ArrayBuffer

      Image

    • dims: { height: number; width?: number } | { height?: number; width: number }

      Height/Width to resize to

    • Optional format: avif

      Format to save result as

    Returns Promise<Buffer>

  • Resizes an image and returns a Buffer containing the result in the provided format

    Parameters

    • buffer: Buffer | ArrayBuffer

      Image

    • dims: { height: number; width?: number } | { height?: number; width: number }

      Height/Width to resize to

    • Optional format: tiff

      Format to save result as

    Returns Promise<Buffer>

  • Resizes an image and returns a Buffer containing the result in the provided format

    Parameters

    • data: BinaryInputOutput

      Image

    • dims: { height: number; width?: number } | { height?: number; width: number }

      Height/Width to resize to

    • Optional format: ImageFormat

      Format to save result as

    Returns Promise<Buffer>

serializeObject

  • serializeObject<T>(obj: T, serializationFormat?: json): string
  • serializeObject<T>(obj: T, serializationFormat?: cbor): Buffer
  • serializeObject<T>(obj: T, serializationFormat?: msgpack): Buffer
  • serializeObject<T>(obj: T, serializationFormat?: bson): Buffer
  • serializeObject<T>(obj: T, serializationFormat?: SerializationFormat): 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

    • Optional serializationFormat: json

      Algorithm to serialize with

    Returns string

  • 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

    • Optional serializationFormat: cbor

      Algorithm to serialize with

    Returns 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

    • Optional serializationFormat: msgpack

      Algorithm to serialize with

    Returns 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

    • Optional serializationFormat: bson

      Algorithm to serialize with

    Returns 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

    • Optional serializationFormat: SerializationFormat

      Algorithm to serialize with

    Returns Buffer

uniqueId

  • uniqueId(idFormat: uuidv4): Buffer
  • uniqueId(idFormat: uuidv1): Buffer
  • uniqueId(idFormat: uuidv4String): string
  • uniqueId(idFormat: uuidv1String): string
  • uniqueId(idFormat: objectId): Buffer
  • uniqueId(idFormat: nanoid, size?: number): string
  • uniqueId(idFormat: timestamp): number
  • 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: uuidv4

      Algorithm to use to generate the unique id

    Returns Buffer

  • Generates a unique ID using one of the available algorithms, returning the result as a Buffer, string or number.

    Parameters

    • idFormat: uuidv1

      Algorithm to use to generate the unique id

    Returns Buffer

  • Generates a unique ID using one of the available algorithms, returning the result as a Buffer, string or number.

    Parameters

    • idFormat: uuidv4String

      Algorithm to use to generate the unique id

    Returns string

  • Generates a unique ID using one of the available algorithms, returning the result as a Buffer, string or number.

    Parameters

    • idFormat: uuidv1String

      Algorithm to use to generate the unique id

    Returns string

  • Generates a unique ID using one of the available algorithms, returning the result as a Buffer, string or number.

    Parameters

    • idFormat: objectId

      Algorithm to use to generate the unique id

    Returns Buffer

  • Generates a unique ID using one of the available algorithms, returning the result as a Buffer, string or number.

    Parameters

    • idFormat: nanoid

      Algorithm to use to generate the unique id

    • Optional size: number

    Returns string

  • Generates a unique ID using one of the available algorithms, returning the result as a Buffer, string or number.

    Parameters

    • idFormat: timestamp

      Algorithm to use to generate the unique id

    Returns number

  • Generates a unique ID using one of the available algorithms, returning the result as a Buffer, string or number.

    Parameters

    • Optional 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

Static arrayBufferToNodeBuffer

  • arrayBufferToNodeBuffer(arrayBuffer: any): Buffer

Static ascii85ToNodeBuffer

  • ascii85ToNodeBuffer(base85: string): Buffer

Static base32ToNodeBuffer

  • base32ToNodeBuffer(base32String: string, ...args: any[]): Buffer
  • Encodes a node.js buffer as a base32 string using npm:base32.js

    Parameters

    • base32String: string

      Base32 string to decode.

    • Rest ...args: any[]

      Additional arguments to be passed to the Decoder constructor in npm:base32.js

    Returns Buffer

Static base64ToNodeBuffer

  • base64ToNodeBuffer(base64: string): Buffer

Static base64urlToNodeBuffer

  • base64urlToNodeBuffer(base64url: string): Buffer

Static base85ToNodeBuffer

  • base85ToNodeBuffer(base85: string): Buffer

Static bcrypt

Static bcryptVerify

Static bsonToObject

  • bsonToObject<T>(bson: Buffer): T

Static cborToObject

  • cborToObject<T>(data: Buffer): T

Static compressLZMA

  • compressLZMA(buf: Buffer, level: number): Promise<Buffer>

Static compressZStd

  • compressZStd(buf: Buffer, level: number): Promise<Buffer>

Static crc32

Static create

Static decodeSlugID

  • decodeSlugID(id: string): Buffer

Static decompressLZMA

  • decompressLZMA(buf: Buffer): Promise<Buffer>

Static decompressZStd

  • decompressZStd(buf: Buffer): Promise<Buffer>

Static encodeSlugID

  • encodeSlugID(uuid: Buffer): string

Static ensureBuffer

Static getImageMetadata

Static getRandomBytes

  • getRandomBytes(n: number): Buffer

Static hashidsToNodeBuffer

  • hashidsToNodeBuffer(hashid: string, ...args: any[]): Buffer
  • Decodes a hashids string, first to hex, then to a node.js buffer using npm:hashids.

    Parameters

    • hashid: string

      Hashid string to decode

    • Rest ...args: any[]

      Additional arguments to be passed to the Hashids constructor in npm:hashids

    Returns Buffer

Static hexToNodeBuffer

  • hexToNodeBuffer(hex: string): Buffer

Static jsonToObject

  • jsonToObject<T>(data: string | Buffer): T

Static lzmaNative

  • lzmaNative(): any

Static md5

Static msgpackToObject

  • msgpackToObject<T>(data: Buffer): T

Static nanoid

  • nanoid(size?: number): string

Static Protected nativeHash

Static newObjectId

  • newObjectId(): Buffer

Static nodeBufferToArrayBuffer

Static nodeBufferToAscii85

  • nodeBufferToAscii85(buffer: Buffer): string

Static nodeBufferToBase32

Static nodeBufferToBase64

  • nodeBufferToBase64(buffer: Buffer): string

Static nodeBufferToBase64url

Static nodeBufferToBase85

  • nodeBufferToBase85(buffer: Buffer): string

Static nodeBufferToHashids

Static nodeBufferToHex

  • nodeBufferToHex(buffer: Buffer): string

Static objectToBson

  • objectToBson<T>(obj: T): Buffer

Static objectToCbor

  • objectToCbor<T>(obj: T): Buffer

Static objectToJson

  • objectToJson<T>(obj: T): string

Static objectToMsgpack

  • objectToMsgpack<T>(obj: T): Buffer

Static safeLoadModule

  • safeLoadModule(name: string): any

Static sha1

Static sha2

Static sha3

Static sha512

Static sharpNative

  • sharpNative(): any

Static timestamp

  • timestamp(): number

Static uuidv1

  • uuidv1(): Buffer

Static Protected uuidv1Array

  • uuidv1Array(): number[]

Static uuidv1String

  • uuidv1String(): string

Static uuidv4

  • uuidv4(): Buffer

Static Protected uuidv4Array

  • uuidv4Array(): number[]

Static uuidv4String

  • uuidv4String(): string

Static xxhash3

Static xxhash32

Static xxhash64

Static xxhashNative

  • xxhashNative(): any

Generated using TypeDoc