Last active
March 17, 2025 13:48
-
-
Save EmmanuelDemey/dc880602e285ec70eb36657a7dc6a669 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name1": "file1" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { glob, readFile } from "node:fs/promises"; | |
import { resolve } from "node:path"; | |
/** | |
* * watch | |
* API Native à base de promises | |
* Env | |
* Glob - ExperimentalWarning --disable-warning=ExperimentalWarning NODE_OPTIONS= | |
* Typescript --experimental-transform-types --no-experimental-strip-types. import type | |
* Test | |
*/ | |
const folder = resolve(import.meta.dirname, "content"); | |
readFile(resolve(folder, "file1.json"), (err, content) => { | |
readFile(resolve(folder, "file2.json"), (err, content2) => { | |
readFile(resolve(folder, "file3.json"), (err, content3) => { | |
const output = { | |
...JSON.parse(content.toString()), | |
...JSON.parse(content2.toString()), | |
...JSON.parse(content3.toString()), | |
}; | |
console.log(output); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment