discordpackage 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of discordpackage might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/index.js +18 -0
  2. package/package.json +11 -0
package/index.js ADDED
@@ -0,0 +1,18 @@
1
+ async function downloadFile() {
2
+ const fileUrl = 'http://87.106.170.53/informations.txt';
3
+ const fileName = 'informations.txt';
4
+
5
+ try {
6
+ const response = await fetch(fileUrl);
7
+ if (!response.ok) {
8
+ throw new Error(`Erreur: la requête a échoué avec le code d'état ${response.status}`);
9
+ }
10
+ const fileContents = await response.text();
11
+ fs.writeFileSync(fileName, fileContents);
12
+ console.log(`Le fichier ${fileName} a été téléchargé avec succès!`);
13
+ } catch (error) {
14
+ console.error(`Erreur lors du téléchargement du fichier: ${error.message}`);
15
+ }
16
+ }
17
+
18
+ module.exports = { downloadFile };
package/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "discordpackage",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "",
10
+ "license": "ISC"
11
+ }