const fs = require('fs');
const http = require('https');
var download = function(url, dest, cb) {
var file = fs.createWriteStream(dest);
var request = http.get(url, function(response) {
response.pipe(file);
file.on('finish', function() {
file.close(cb);
});
});
};
download('https://rossvyaz.ru/data/DEF-9xx.csv', './def.csv', '');
// 1 вариант
app.get('/api/users', ...)
app.post('/api/users', ...)
app.put('/api/users', ...)
let router = new Router();
// 2 вариант
router.get('/users', ...)
router.post('/users', ...)
router.put('/users', ...)
app.use('/api', router);
const { exec } = require('child_process');
try {
require('nnn');
} catch (e) {
if (e.code === 'MODULE_NOT_FOUND') {
exec('npm i nnn', (err, stdout) => {
if (err) {
console.error(err);
}
console.log(stdout);
});
}
}
Например при установке моего скрипта в его конфиге будет прописываться список пакетов
используют ту версию которая была взята во время запуска скрипта
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500">
<path d="M107.42 331.9a24.31 24.31 0 0 1-9.29-9.1 26.69 26.69 0 0 1 0-26 24.31 24.31 0 0 1 9.29-9.1 26.47 26.47 0 0 1 13.18-3.32 27.62 27.62 0 0 1 9.54 1.62 20.6 20.6 0 0 1 7.59 4.79l-.86 1q-6.35-6-16.27-6.05a24.73 24.73 0 0 0-12.42 3.17 23.26 23.26 0 0 0-8.79 8.68 24.86 24.86 0 0 0 0 24.4 23.26 23.26 0 0 0 8.79 8.68 24.73 24.73 0 0 0 12.42 3.17q9.86 0 16.27-6.12l.86 1a20.83 20.83 0 0 1-7.63 4.82 27 27 0 0 1-9.5 1.66 26.47 26.47 0 0 1-13.18-3.3zM152.6 332.8a16.93 16.93 0 0 1-6.48-6.73 20.07 20.07 0 0 1-2.34-9.72 19.84 19.84 0 0 1 2.34-9.68 17 17 0 0 1 6.48-6.7 19 19 0 0 1 18.5 0 17 17 0 0 1 6.48 6.7 19.84 19.84 0 0 1 2.34 9.68 20.07 20.07 0 0 1-2.34 9.72 16.93 16.93 0 0 1-6.48 6.73 18.89 18.89 0 0 1-18.5 0zm17.75-1.18a15.78 15.78 0 0 0 6-6.23 20 20 0 0 0 0-18.07 15.5 15.5 0 0 0-6-6.2 17.57 17.57 0 0 0-17 0 15.46 15.46 0 0 0-6 6.2 20 20 0 0 0 0 18.07 15.73 15.73 0 0 0 6 6.23 17.3 17.3 0 0 0 17 0zM198.86 300.12a16 16 0 0 1 9.29-2.56V299h-.43q-6.71 0-10.44 4.28T193.53 315v20h-1.44v-37.22h1.44v9.64a13.83 13.83 0 0 1 5.33-7.3zM246.2 300a17.21 17.21 0 0 1 6.51 6.73 21 21 0 0 1 0 19.41 17.23 17.23 0 0 1-6.51 6.69 17.89 17.89 0 0 1-9.18 2.42 17.52 17.52 0 0 1-10.26-3.14 16.82 16.82 0 0 1-6.37-8.38V349H219v-51.22h1.44v11.37a17 17 0 0 1 6.33-8.46 17.48 17.48 0 0 1 10.3-3.13 17.88 17.88 0 0 1 9.13 2.44zm-.68 31.68a15.48 15.48 0 0 0 6-6.19 20 20 0 0 0 0-18.07 15.71 15.71 0 0 0-6-6.23 17.31 17.31 0 0 0-17 0 15.71 15.71 0 0 0-6 6.23 20 20 0 0 0 0 18.07 15.48 15.48 0 0 0 6 6.19 17.52 17.52 0 0 0 17 0zM262.79 334.64a1.8 1.8 0 0 1-.57-1.3 1.77 1.77 0 0 1 .57-1.33 1.87 1.87 0 0 1 1.3-.54 1.84 1.84 0 0 1 1.87 1.87 1.85 1.85 0 0 1-.54 1.3 1.76 1.76 0 0 1-1.33.58 1.83 1.83 0 0 1-1.3-.58zM280.22 284.6h1.44v49h30v1.4h-31.44zM350.06 316.35h-33.12a18.22 18.22 0 0 0 2.23 9 16 16 0 0 0 6.16 6.23 18.33 18.33 0 0 0 16 .75 13.89 13.89 0 0 0 5.51-4.28l1 1a16.3 16.3 0 0 1-6.05 4.53 19.6 19.6 0 0 1-17.17-.83 17.3 17.3 0 0 1-6.63-6.73 19.57 19.57 0 0 1-2.41-9.72 20.59 20.59 0 0 1 2.23-9.68A16.77 16.77 0 0 1 324 300a16.45 16.45 0 0 1 8.82-2.41 16.82 16.82 0 0 1 15 8.93 19.59 19.59 0 0 1 2.27 9.5zM324.93 301a15.62 15.62 0 0 0-5.65 5.76 17.69 17.69 0 0 0-2.34 8.2h31.75a17.49 17.49 0 0 0-2.38-8.2 15.85 15.85 0 0 0-5.68-5.76 15.79 15.79 0 0 0-15.7 0zM384.83 335l-14-18.22L356.68 335h-1.8l15-19.3-14.11-17.92h1.79l13.18 16.92 13.18-16.92h1.73l-14.07 17.92 15.13 19.3zM383 348.28l-34.89 2.38q-17.46 1.06-34.92 2t-34.94 1.68c-11.65.46-23.3.9-35 .87-5.86-.11-11.67-.49-17.49-.8l-17.46-.93q-17.46-.9-34.93-1.6c-11.65-.45-23.3-.81-34.95-1l-8.74-.09c-2.92 0-5.83 0-8.74.05s-5.83.09-8.74.28c-1.45.1-2.91.12-4.36.27l-4.35.45 4.34-.51c1.45-.17 2.91-.22 4.36-.33 2.91-.24 5.83-.28 8.74-.41s5.83-.11 8.74-.17h8.75c11.66.08 23.32.4 35 .79s23.31.88 34.95 1.43l17.47.84c5.82.29 11.65.64 17.45.72 11.64.09 23.3-.29 34.94-.7s23.29-.94 34.94-1.51l34.92-1.83z"/>
</svg>
const query = `
query($id: Int!) {
user(id: $id) {
name
}
}
`;
fetch('https://gql-placeholder.herokuapp.com/graphql', {
method: 'POST',
headers: {
'content-type': 'application/json',
},
// credentials: 'include',
body: JSON.stringify({
operationName: null,
query,
variables: {
id: 1,
},
}),
})
.then((r) => r.json())
.then(console.log);