Read and Print All Files from Zip File in Go

Akhil Sharma
Updated on 22-Feb-2023 15:29:47

2K+ Views

Golang has packages like os, io, and Archie/zip that can be used to read and print all the files from a zipped file. A zip file is a compressed collection of a set of files/folders. The OS package is used for performing copy operations, the io pacakge is for reading and writing operations whereas the archive/zip package is for unzipping and zipping the file. In this article, we are going to learn about using all these packages to perform the copy and unzipping of the files and printing the same. Method 1: Using io and os package This program uses ... Read More

Read File Content Line by Line in Go

Akhil Sharma
Updated on 22-Feb-2023 15:27:42

3K+ Views

In golang there are various internal packages such as bufio, os and io that can be used for reading the content of a file line by line. The bufio and os packages are used for opening and scanning the file using os.open and bufio.NewScanner function. The io package we are going to use ioutil.ReadFile to read the file from the given destination and the use the string function to display it in the output. Method 1: Using bufio and os package In this illustration, bufio.NewScanner is used to read line by line content and os.Open is used to open the ... Read More

Get All Files Present in a Directory using Go

Akhil Sharma
Updated on 22-Feb-2023 15:26:31

3K+ Views

Golang has OS package such as OS.open(), os.closs(), os.copy() and move more that are used for performing different operations with the external files. Similiary we have io package in golang that is used for performing read and write operations on the external file. Here in this article, we are going to use these two packages to print all the files in the given directory. Method 1: Using OS Package This program opens the provided directory and reads its contents using the os package. A slice of os.FileInfo objects, which are returned by the Readdir function and include details about each ... Read More

Create Pay Roll Management Webpage Using JavaScript

Riya Kumari
Updated on 22-Feb-2023 15:23:58

2K+ Views

Nowadays, there are many companies and small-scale businesses rising and booming in the world. There are so many people working in these industries or firms. It has become a crucial task for the employer to manage the payment records of his employee. Thus, arises the need of proper payroll management system in every big or small firm. It is almost impossible for the employer to manually maintain the pay roll record of each and every employee in big firms. So, they need digital pay roll management system. In this article, we will discuss about how to create a pay ... Read More

Create Incoming Call Animation Effect Using CSS

Riya Kumari
Updated on 22-Feb-2023 15:22:43

940 Views

Cascading style sheets (CSS) enables the developers to create visual effects to your web page which makes it attractive and user-friendly. CSS provides a variety of properties, such as colours, flexbox, grids, animation, shadowing, etc., to style the elements, resulting in a website that is appealing to many users and is user-friendly. In this article, we have discussed about how to design Incoming Call Animation effect using HTML and CSS. In order to create this effect, we will be using CSS animation property and box-shadow property. CSS Animations It enables the developers to add animation effects like moving, vibrating ... Read More

Use HTTP GET or POST for AJAX Calls

Rushi Javiya
Updated on 22-Feb-2023 15:19:39

8K+ Views

We need to use JavaScript, and an AJAX library like jQuery, Axios, or Fetch API to make an AJAX call using HTTP GET or POST. Ajax (Asynchronous JavaScript and XML) creates fast and dynamic web pages by updating content asynchronously without reloading the entire page. It uses JavaScript to send and receive data from a server, which can be in the form of XML, JSON, or plain text. This tutorial will teach us to use an HTTP GET or POST for Ajax Calls. Ajax has two common types of requests: GET and POST. GET Request The GET request is ... Read More

Sort Order of Keys in JavaScript Objects

Rushi Javiya
Updated on 22-Feb-2023 15:14:58

16K+ Views

In JavaScript, an object contains the key-value pair. Sometimes, we may require to sort the object keys. We can’t use the sort() method directly with the object as like array, as we need to sort the key-value pair of the object together rather than sorting only keys. Below, we will learn various methods to sort the object keys in ascending and descending order. Use the sort() method to order keys in JavaScript objects We can use the Object.keys() method to get all keys of the object in the array. After that, we can use the array.sort() method to sort ... Read More

Sort Rows in a Table Using JavaScript

Rushi Javiya
Updated on 22-Feb-2023 15:13:02

2K+ Views

We can’t use the built-in sort() method of JavaScript to sort the table rows based on the particular column. So, we need to create a custom algorithm to sort table rows. In this tutorial, we will learn to sort tables and rows using JavaScript. Here, we will look at different examples to sort table rows in ascending and descending order. Syntax Users can follow the syntax below to sort rows in a table using JavaScript. var switchContinue = true; while (switchContinue) { switchContinue = false; var allRows = table.rows; for ... Read More

Set Default Values When Destructuring an Object in JavaScript

Rushi Javiya
Updated on 22-Feb-2023 15:04:45

6K+ Views

The array and object destructuring feature was introduced in the ES6 version of JavaScript. The destructuring of the array and object allows us to store its values in a separate variable. After that, we can use that variable to access the value of the particular property of the object. The main thing we need to focus on while destructuring the array object is the default values. For example, we have added the property3 variable in the destructuring object, but if the object doesn’t contain the property3, destructuring sets the undefined value to the property3 variable. Users can follow ... Read More

Set Cursor Style to Pointer for Links Without Href

Rushi Javiya
Updated on 22-Feb-2023 15:03:05

3K+ Views

We can use the tag in HTML to add a link to the web page. The default cursor style for the elements is the pointer, but removing the href attribute from the tag changes the cursor style. So, in this tutorial, we will learn to keep the cursor style to pointer for tags without the href attribute. Users can follow the example below to check out the default cursor style for the elements Example In the example below, we have used the tag to create three different links. In the output, we ... Read More

Advertisements