V
V
Vsevolod Kamenovsky2021-06-11 18:20:55
linux
Vsevolod Kamenovsky, 2021-06-11 18:20:55

How to run bash command from js telegram bot?

The bot is on a Linux(CentOS) server. By pressing a button in the tg-bot (on js), a command is launched in this Linux server, for example wget 'url to some image to download to the server'. What library to implement?
I know that in python there is a subprocess library.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-06-11
@vsev00

1. Why use wget if you can download the file using js?
2. https://nodejs.org/api/child_process.html

const { spawn } = require('child_process');
spawn("wget", []); // в массив пихаешь все параметры.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question