@lottiefiles/relottie-metadata
Version:
relottie plugin to extract Lottie metadata
47 lines (43 loc) • 1.38 kB
TypeScript
import { filesize } from 'filesize';
import { VFile } from 'vfile';
/**
* Copyright 2024 Design Barn Inc.
*/
interface FileSizeValue {
/**
* JSON string file's size
*/
bytes: number;
/**
* full form of unit of measure
*/
formated: ReturnType<typeof filesize>;
}
/**
* reference: https://github.com/avoidwork/filesize.js
*/
declare type FileSizeOptions = Parameters<typeof filesize>[1];
/**
*
* @param jsonFile - JSON file
* @returns JSON file size in bytes
*/
declare const getByteSize: (jsonFile: string | Buffer) => number;
/**
* Converts bytes size to the closest unit byte symbol
* Reference: https://stackoverflow.com/a/18650828
* @param bytes - number in bytes
* @param options - filesize lib options
* @returns an object with bytes and formatted values
*/
declare const formatBytes: (bytes: number, options: FileSizeOptions) => FileSizeValue;
declare const getFileSize: (file: VFile, settings: FileSizeOptions) => FileSizeValue;
/**
* Converts RGBA color array to Hex color string.
* @param rgba - RGBA color array
* @param file - VFile instance
* @returns - Hex color string
*/
declare function rgbaToHex(rgba: number[], file?: VFile): string;
declare const isHexValid: (value: string) => boolean;
export { type FileSizeOptions, type FileSizeValue, formatBytes, getByteSize, getFileSize, isHexValid, rgbaToHex };