Category: 14. Binary Data, Files
-
JavaScript File and FileReader
Let’s explore File and FileReader in JavaScript. As a rule, a file object inherits from the Blob. It can be extended to filesystem-related facilities. You can obtain it in two ways: The first way is using a constructor similar to Blob:new File(fileParts, fileName, [options]) As a rule, a file can be received from <input type=”file”>, or drag and drop or other…
-
JavaScript Blob
The browser has additional high-level objects. Among them is the Blob. The Blob object visualizes a blob that is a file-like object of immutable. The Blob is a raw data: you can read it both as binary data or text. It consists of an optional string type, blobParts, strings, as well as BufferSource. Constructing a Blob For constructing a Blob from other data and non-blob objects, the Blob() constructor…
-
JavaScript TextDecoder and TextEncoder
In this chapter, we are going to explore TextEncoder and TextDecoder in JavaScript. Imagine that the binary data is a string. For example, getting a file with a textual data. With the help of a built-in TextDecoder object, it is possible to read the value into a JavaScript actual string, with the encoding and the buffer. First of all,…
-
JavaScript ArrayBuffer, Binary Arrays
In web-development, binary data is generally used while working with files ( for instance, creating, uploading, downloading). JavaScript allows doing it all. Multiple classes exist, among them are: ArrayBuffer ArrayBuffer, Uint8Array, DataView Uint8Array Blob, and so on. In JavaScript, binary data is performed in a non-standard way. But, it becomes simple after getting into some details. ArrayBuffer…