Chaining is a mechanism to connect the output of one stream to another stream and create a chain of multiple stream operations. It is normally used with piping operations. Now we'll use piping and chaining to first compress a file and then decompress the same. Create a js file named main.js with the following code −
Simple writer: This example shows how to to write to a writable stream, then decode the stream and write the contents to the UI. Unpack chunks of a PNG: This example shows how pipeThrough() can be used to transform a ReadableStream into a stream of other data types by transforming a data of a PNG file into a stream of PNG chunks. Simple File Upload Example. In this example, we are using the async readFile function and uploading the file in the callback. As the file is read, the data is converted to a binary format and passed it to the upload Body parameter. Downloading File. To download a file, we can use getObject().The data from S3 comes in a binary format.