wasmagic
Version:
WASM compiled version of libmagic
78 lines (77 loc) • 2.43 kB
TypeScript
import type StdioOverrideFunction from "./StdioOverrideFunction";
export { default as StdioOverrideFunction } from "./StdioOverrideFunction";
export declare enum WASMagicFlags {
/** No flags */
NONE = 0,
/** Turn on debugging */
DEBUG = 1,
/** Follow symlinks */
SYMLINK = 2,
/** Check inside compressed files */
COMPRESS = 4,
/** Look at the contents of devices */
DEVICES = 8,
/** Return the MIME type */
MIME_TYPE = 16,
/** Return all matches */
CONTINUE = 32,
/** Print warnings to stderr */
CHECK = 64,
/** Restore access time on exit */
PRESERVE_ATIME = 128,
/** Don't convert unprintable chars */
RAW = 256,
/** Handle ENOENT etc as real errors */
ERROR = 512,
/** Return the MIME encoding */
MIME_ENCODING = 1024,
/** Return the Apple creator/type */
APPLE = 2048,
/** Return a /-separated list of extensions */
EXTENSION = 16777216,
/** Check inside compressed files but not report compression */
COMPRESS_TRANSP = 33554432,
/** Don't allow decompression that needs to fork */
NO_COMPRESS_FORK = 67108864,
/** Don't check for compressed files */
NO_CHECK_COMPRESS = 4096,
/** Don't check for tar files */
NO_CHECK_TAR = 8192,
/** Don't check magic entries */
NO_CHECK_SOFT = 16384,
/** Don't check application type */
NO_CHECK_APPTYPE = 32768,
/** Don't check for elf details */
NO_CHECK_ELF = 65536,
/** Don't check for text files */
NO_CHECK_TEXT = 131072,
/** Don't check for cdf files */
NO_CHECK_CDF = 262144,
/** Don't check for CSV files */
NO_CHECK_CSV = 524288,
/** Don't check tokens */
NO_CHECK_TOKENS = 1048576,
/** Don't check text encodings */
NO_CHECK_ENCODING = 2097152,
/** Don't check for JSON files */
NO_CHECK_JSON = 4194304,
/** Don't check for SIMH tape files */
NO_CHECK_SIMH = 8388608
}
export type WASMagicOptions = {
flags?: WASMagicFlags;
loadDefaultMagicfile?: boolean;
magicFiles?: Uint8Array[];
stdio?: StdioOverrideFunction;
};
export declare class WASMagic {
static create(options?: WASMagicOptions): Promise<WASMagic>;
private Module;
private detectFromWasm;
private constructor();
detect(buf: Uint8Array): string;
/**
* @deprecated Use {@link WASMagic#detect} instead
*/
getMime(buf: Uint8Array): string;
}