Load the most popular passwords in Node.js


This page presents how to load the most common passwords in Node.js. The list can be downloaded on one from the following pages:

The following source code open the file with readFileSync() as a string. It then split the string with the function split() to create an object. The loop ends when the end of file (EOF) is reached.

The code loads the file with 1000 passwords. Change the filename to load more passwords.

Node.js source code

The following source codes can be used to load one of the files in C or C++:

const {readFileSync} = require('fs');
const contents = readFileSync('1000-most-common-passwords.txt', 'utf-8');
const passwords = contents.split(/\r?\n/);
console.log (passwords);

See also

Last update : 12/29/2022