Generating package.json file
Every Node application contains a file with the name package.json. This tutorial explains what this file is and why every app / project must have this file. You'll also learn how to generate package.json file, install necessary modules (dependencies and devDependencies) and list them to package.json.
fs - synchronous read, write, or append files
In this tutorial, we’ll learn how to read, write, and append to files in a synchronous manner. We’re going to write a simple program that grab text from a file, and saves it in a new file. We’ll also learn how to read a dir in a synchronous manner recursively.
fs - asynchronous read, write, append files
In this tutorial, we’ll learn how to read, write, and append to files in an asynchronous manner. We’re going to write a simple program that grab text from a file, and saves it in a new file. We’ll also learn how to read a dir in an asynchronous manner recursively.
fs - open, read and write files bytes by bytes
Another way to access a file is fs.open()
function. Once a file is accessed, you can read data from it using fs.read()
function or write data to it using fs.write()
function.
fs - Using Stat object to get file or path information
Lean how to query the status of files using Node.js, returning information such as the file type, file owner, access permission file size, number of links, inode number and file birth, access, change and modify times.
crypto - create hash from string or file
Hash is a way to encrypt data into a fixed-length digest. This digest serves as a signature representing the original data that hashed. The various types of hashing algorithms are available in Node.js through the crypto
module.
Synchronous vs. Asynchronous vs. Callbacks
A synchronous function blocks until it completes its operations. An asynchronous function returns immediately and the result is passed to a callback function.
events - event loop (queue) and EventEmitter
So, if you have functionality that needs to wait on something, such as opening a file, retrieving data from the database, a web response, or other activity of this nature, then blocking the application until the operation is finished would be a major point of failure in a server-based application. The solution to prevent blocking is the event loop.
understanding child processes
A child process is a process created by a parent process. Node allows us to run a system command within a child process and listen in on its input/output. This includes being able to pass arguments to the command, and even pipe the results of one command to another.
Create a Node class to store duplicate files
A data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently. In JavaScript, data structure is a value that refers to zero or more other values that represent data. The Arrays and Objects are built-in data structures and can be use to build other complex data structures.
Make Node's file or dir walker
FileWalker - Make file or dir walker class by extending EventEmitter
In this tutorial, we'll make an event driven file walker which will scan a directory tree asynchronously.
FileWalker - How to make Node modules
You can split off reusable JavaScript into its own libraries called modules. A Node module is simply a JavaScript file. The export or module.exports statement is used when creating a Node module. You can convert functions, objects, or primitive values into module.
FileWalker - Add pause, resume and filter feature
Now its time to extend our FileWalker module by adding the pause and resume functionality to make our Duplicate File Finder pausable and resumable. We’ll also add two methods filterDir and filterFile to filter out directories and files for inclusion or exclusion.
FileWalker - Add "generate Hash" method
In this tutorial we’ll add another method, generateHash
, to FileWalker class. This method will open a file, read 4Kb chunk, generate hash and emit an event containing file hash. We’ll use this hash to compare files with each other to find their duplicate/copies.
FileWalker - Data structure to store files in Array object for comparison
The FileWalker class is now able to generate file Hash, now its time to use these hashes to compare files with each other. In this tutorial we'll create two Objects to store files and a method to find duplicate files.
Electron Tutorials
Electron Tutorials
Learn how to make desktop applications out of the very same technologies used in web development.