new class js -advanced

This commit is contained in:
Philippe Torrel
2026-06-29 11:35:03 +02:00
parent ee8a87bf2a
commit 31c13250b0
104 changed files with 2632 additions and 138 deletions

View File

@@ -0,0 +1 @@
This is the contents of file 01.

View File

@@ -0,0 +1 @@
This is the contents of file 02.

View File

@@ -0,0 +1 @@
This is the contents of file 03.

View File

@@ -0,0 +1 @@
This is the contents of file 04.

View File

@@ -0,0 +1 @@
This is the contents of file 05.

View File

@@ -0,0 +1 @@
This is the contents of file 06.

View File

@@ -0,0 +1,30 @@
const fs = require('fs');
const getFileContent = (name, encoding = 'UTF8') => {
return new Promise((resolve, reject) => {
fs.readFile(name, encoding, (error, content) => {
if (error) {
reject(`could not read file ${name}`);
} else {
resolve(content);
}
});
});
};
Promise.all([
getFileContent('data/file_1.txt'),
getFileContent('data/file_2.txt'),
getFileContent('data/file_3.txt'),
getFileContent('data/file_4.txt'),
getFileContent('data/file_5.txt'),
getFileContent('data/file_6.txt'),
])
.then((contents) =>
contents.forEach((content) => {
console.log(content);
})
)
.catch((error) => {
console.log(error);
});