etag
Version:
Create simple HTTP ETags
21 lines (20 loc) • 680 B
TypeScript
/*!
* etag
* Copyright(c) 2014-2016 Douglas Christopher Wilson
* MIT Licensed
*/
/** Options for generating an entity tag. */
export interface Options {
/** Override the default: weak for file stats, strong for strings and ArrayBuffer views. */
weak?: boolean;
}
/** Structural type for file stats. */
export interface StatsLike<T extends number | bigint> {
ctime: Date;
mtime: Date;
ino: T;
size: T;
}
export type FileStats = StatsLike<number> | StatsLike<bigint>;
/** Create an ETag for a string, ArrayBuffer view, or file stats object. */
export declare function etag(entity: string | NodeJS.ArrayBufferView | FileStats, options?: Options): string;