TextDecoder class
WHATWG Kodlama StandartTextDecoder API'sinin bir uygulaması.
const decoder = new TextDecoder();
const u8arr = new Uint8Array([72, 101, 108, 108, 111]);
console.log(decoder.decode(u8arr)); // Hello
Özellikler
| encoding |
|
| fatal | Kod çözme hataları bir |
| ignoreBOM | Kod çözme sonucu bayt sırası işaretini içerecekse değer |
Yöntemler
| decode(null | Array |
|
Oluşturucu Ayrıntıları
TextDecoder(string, { fatal?: boolean, ignoreBOM?: boolean })
new TextDecoder(encoding?: string, options?: { fatal?: boolean, ignoreBOM?: boolean })
Parametreler
- encoding
-
string
- options
-
{ fatal?: boolean, ignoreBOM?: boolean }
Özellik Ayrıntıları
encoding
TextDecoder örneği tarafından desteklenen kodlama.
encoding: string
Özellik Değeri
string
fatal
Kod çözme hataları bir true oluşursa değer TypeError.
fatal: boolean
Özellik Değeri
boolean
ignoreBOM
Kod çözme sonucu bayt sırası işaretini içerecekse değer true.
ignoreBOM: boolean
Özellik Değeri
boolean
Yöntem Ayrıntıları
decode(null | ArrayBuffer | ArrayBufferView, { stream?: boolean })
input kodunu çözer ve bir dize döndürür.
options.stream
trueise, input sonunda gerçekleşen eksik bayt dizileri dahili olarak arabelleğe alınır ve textDecoder.decode()sonraki çağrıdan sonra yayılır.
textDecoder.fatal
trueise, oluşan kod çözme hataları bir TypeError oluşmasına neden olur.
function decode(input?: null | ArrayBuffer | ArrayBufferView, options?: { stream?: boolean }): string
Parametreler
- input
-
null | ArrayBuffer | ArrayBufferView
Kodlanmış verileri içeren bir ArrayBuffer, DataViewveya TypedArray örneği.
- options
-
{ stream?: boolean }
Döndürülenler
string