Skip to content

@graphty/graph-io / @graphty/graph-io / decodeEntryName

Function: decodeEntryName() ​

decodeEntryName(bytes, cp437?): string

Defined in: common/input.ts:814

A zip entry name as text (APPNOTE 4.4.17 and appendix D): UTF-8 when the bytes are valid UTF-8, whether or not the entry sets the language-encoding flag (bit 11); otherwise code page 437 when the flag is clear (what Windows and older tools write), and windows-1252 when the entry claims UTF-8 (or no flags are known). Never throws: a name is a matching key, never a path, so an undecodable one still has to name its entry.

Parameters ​

bytes ​

Uint8Array

the name bytes from the central directory or a local header

cp437? ​

boolean = false

the entry's bit 11 is clear: decode a non-UTF-8 name as code page 437

Returns ​

string

the name