wttp-core
Version:
Core contracts, interfaces, and TypeScript types for the Web3 Transfer Protocol (WTTP).
186 lines • 7.02 kB
TypeScript
export * from "mime-types";
export declare const mimeTypesToBytes: {
'text/html': string;
'text/javascript': string;
'text/css': string;
'text/markdown': string;
'text/plain': string;
'application/javascript': string;
'application/xml': string;
'application/pdf': string;
'application/json': string;
'image/png': string;
'image/jpeg': string;
'image/gif': string;
'image/svg+xml': string;
'image/webp': string;
'image/x-icon': string;
'font/ttf': string;
'font/otf': string;
'font/woff': string;
'font/woff2': string;
'application/octet-stream': string;
};
export declare const bytesToMimeTypes: {
'0x7468': string;
'0x7463': string;
'0x746d': string;
'0x7470': string;
'0x616a': string;
'0x6178': string;
'0x6170': string;
'0x616f': string;
'0x6970': string;
'0x696a': string;
'0x6967': string;
'0x6973': string;
'0x6977': string;
'0x6969': string;
'0x6674': string;
'0x666f': string;
'0x6677': string;
'0x6632': string;
'0x6273': string;
};
export type MimeType = keyof typeof mimeTypesToBytes;
export type MimeBytes = keyof typeof bytesToMimeTypes;
export declare function encodeMimeType(mimeType: MimeType): MimeBytes;
export declare function decodeMimeType(bytes: MimeBytes): MimeType;
export declare const charsetToBytes: {
'utf-8': string;
'utf-16': string;
'utf-32': string;
'utf-16le': string;
'utf-16be': string;
'utf-32le': string;
'utf-32be': string;
'us-ascii': string;
unicode: string;
'iso-8859-1': string;
'iso-8859-2': string;
'iso-8859-3': string;
'iso-8859-4': string;
'iso-8859-5': string;
'iso-8859-6': string;
'iso-8859-7': string;
'iso-8859-8': string;
'iso-8859-9': string;
'iso-8859-10': string;
'iso-8859-11': string;
'iso-8859-13': string;
'iso-8859-14': string;
'iso-8859-15': string;
'iso-8859-16': string;
'windows-1250': string;
'windows-1251': string;
'windows-1252': string;
'windows-1253': string;
'windows-1254': string;
'windows-1255': string;
'windows-1256': string;
'windows-1257': string;
'windows-1258': string;
big5: string;
shift_jis: string;
'euc-jp': string;
'euc-kr': string;
gbk: string;
gb18030: string;
gb2312: string;
'gb2312-80': string;
'gb2312-90': string;
'gb2312-95': string;
'gb2312-00': string;
};
export declare const bytesToCharset: {
'0x7508': string;
'0x7510': string;
'0x7520': string;
'0x106c': string;
'0x1062': string;
'0x206c': string;
'0x2062': string;
'0x7561': string;
'0x7563': string;
'0x6901': string;
'0x6902': string;
'0x6903': string;
'0x6904': string;
'0x6905': string;
'0x6906': string;
'0x6907': string;
'0x6908': string;
'0x6909': string;
'0x690a': string;
'0x690b': string;
'0x690d': string;
'0x690e': string;
'0x690f': string;
'0x6910': string;
'0x7732': string;
'0x7733': string;
'0x7734': string;
'0x7735': string;
'0x7736': string;
'0x7737': string;
'0x7738': string;
'0x7739': string;
'0x773a': string;
'0x6205': string;
};
export type Charset = keyof typeof charsetToBytes;
export type CharsetBytes = keyof typeof bytesToCharset;
export declare function encodeCharset(charset: Charset): CharsetBytes;
export declare function decodeCharset(bytes: CharsetBytes): Charset;
export declare const encodingToBytes: {
gzip: string;
identity: string;
zstd: string;
zlib: string;
brotli: string;
lz4: string;
snappy: string;
lzma: string;
};
export declare const bytesToEncoding: {
'0x677a': string;
'0x6964': string;
'0x7a73': string;
'0x7a6c': string;
'0x6272': string;
'0x6c34': string;
'0x736e': string;
'0x6c6d': string;
};
export type Encoding = keyof typeof encodingToBytes;
export type EncodingBytes = keyof typeof bytesToEncoding;
export declare function encodeEncoding(encoding: Encoding): EncodingBytes;
export declare function decodeEncoding(bytes: EncodingBytes): Encoding;
export declare const languageToBytes: {
en: string;
fr: string;
de: string;
es: string;
it: string;
ja: string;
ko: string;
ru: string;
};
export declare const bytesToLanguage: {
'0x6500': string;
'0x6600': string;
'0x6400': string;
'0x7300': string;
'0x6900': string;
'0x6a00': string;
'0x6b00': string;
'0x7200': string;
};
export type Language = keyof typeof languageToBytes;
export type LanguageBytes = keyof typeof bytesToLanguage;
export declare function encodeLanguage(language: Language): LanguageBytes;
export declare function decodeLanguage(bytes: LanguageBytes): Language;
export type MetadataProperty = 'mime' | 'charset' | 'encoding' | 'language';
export declare function encodeProperty(property: MetadataProperty, value: string): "0x7468" | "0x616a" | "0x7463" | "0x746d" | "0x7470" | "0x6178" | "0x6170" | "0x616f" | "0x6970" | "0x696a" | "0x6967" | "0x6973" | "0x6977" | "0x6969" | "0x6674" | "0x666f" | "0x6677" | "0x6632" | "0x6273" | "0x7508" | "0x7510" | "0x7520" | "0x106c" | "0x1062" | "0x206c" | "0x2062" | "0x7561" | "0x7563" | "0x6901" | "0x6902" | "0x6903" | "0x6904" | "0x6905" | "0x6906" | "0x6907" | "0x6908" | "0x6909" | "0x690a" | "0x690b" | "0x690d" | "0x690e" | "0x690f" | "0x6910" | "0x7732" | "0x7733" | "0x7734" | "0x7735" | "0x7736" | "0x7737" | "0x7738" | "0x7739" | "0x773a" | "0x6205" | "0x677a" | "0x6964" | "0x7a73" | "0x7a6c" | "0x6272" | "0x6c34" | "0x736e" | "0x6c6d" | "0x6500" | "0x6600" | "0x6400" | "0x7300" | "0x6900" | "0x6a00" | "0x6b00" | "0x7200" | undefined;
export declare function decodeProperty(property: MetadataProperty, value: string): "text/html" | "text/css" | "text/markdown" | "text/plain" | "application/javascript" | "application/xml" | "application/pdf" | "application/json" | "image/png" | "image/jpeg" | "image/gif" | "image/svg+xml" | "image/webp" | "image/x-icon" | "font/ttf" | "font/otf" | "font/woff" | "font/woff2" | "application/octet-stream" | "text/javascript" | "utf-8" | "utf-16" | "utf-32" | "utf-16le" | "utf-16be" | "utf-32le" | "utf-32be" | "us-ascii" | "unicode" | "iso-8859-1" | "iso-8859-2" | "iso-8859-3" | "iso-8859-4" | "iso-8859-5" | "iso-8859-6" | "iso-8859-7" | "iso-8859-8" | "iso-8859-9" | "iso-8859-10" | "iso-8859-11" | "iso-8859-13" | "iso-8859-14" | "iso-8859-15" | "iso-8859-16" | "windows-1250" | "windows-1251" | "windows-1252" | "windows-1253" | "windows-1254" | "windows-1255" | "windows-1256" | "windows-1257" | "windows-1258" | "big5" | "shift_jis" | "euc-jp" | "euc-kr" | "gbk" | "gb18030" | "gb2312" | "gb2312-80" | "gb2312-90" | "gb2312-95" | "gb2312-00" | "gzip" | "identity" | "zstd" | "zlib" | "brotli" | "lz4" | "snappy" | "lzma" | "en" | "fr" | "de" | "es" | "it" | "ja" | "ko" | "ru" | undefined;
//# sourceMappingURL=propertyEncoding.d.ts.map