Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

deno
class textdecoder
class textencoder
deno classes

Deno class TextDecoder and TextEncoder

Educative Answers Team

What is Deno?

Deno is a small, general-purpose runtime environment for JavaScript with first-class support for various interfaces, ECMAScript modules, and seamless TypeScript integration.

Class TextDecoder

Deno class contains a widely used method, decode(). This function runs the decoder based on the encoding used, and the method returns the result from the encoding’s decoder.

Constructors

constructor(label?: string, options?: { fatal: boolean, ignoreBOM: boolean })
// parameters of constructor function

Properties

readonly encoding: string
// Returns the name of the encoding in lowercased form.
readonly fatal: boolean
// Returns true if error mode is "fatal".
readonly ignoreBOM
// Returns true if ignore BOM flag is set.
readonly [Symbol.toStringTag]: string

Methods

decode(input?: BufferSource, options?: { stream: false }): string
// Returns the result from the  running of encoding's decoder.

Class TextEncoder

Deno class which contains a method encode() which returns the result of running UTF-8’s encoder.

Properties

readonly encoding
// Returns type of encoding which is "utf-8".
readonly [Symbol.toStringTag]: string

Methods

encode(input?: string): Uint8Array
// Returns the result of running UTF-8's encoder.
encodeInto(input: string, dest: Uint8Array): {read: number, written: number}

RELATED TAGS

deno
class textdecoder
class textencoder
deno classes
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring