Notice: file_put_contents(): Write of 4169 bytes failed with errno=28 No space left on device in /var/www/tgoop/post.php on line 50

Warning: file_put_contents(): Only 12288 of 16457 bytes written, possibly out of free disk space in /var/www/tgoop/post.php on line 50
Node.JS [ru] | Серверный JavaScript@we_use_js P.4140
WE_USE_JS Telegram 4140
👩‍💻 Запись данных в файл

Создайте Node.js скрипт, который принимает текст через стандартный ввод и сохраняет его в файл output.txt. Если файл уже существует, новые данные должны добавляться в конец файла.

Решение задачи🔽

const fs = require('fs');
const readline = require('readline');

const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});

rl.question('Введите текст для записи: ', (input) => {
fs.appendFile('output.txt', input + '\n', (err) => {
if (err) {
console.error('Ошибка записи в файл:', err);
} else {
console.log('Текст успешно сохранён в output.txt');
}
rl.close();
});
});
Please open Telegram to view this post
VIEW IN TELEGRAM
👍7



tgoop.com/we_use_js/4140
Create:
Last Update:

👩‍💻 Запись данных в файл

Создайте Node.js скрипт, который принимает текст через стандартный ввод и сохраняет его в файл output.txt. Если файл уже существует, новые данные должны добавляться в конец файла.

Решение задачи🔽

const fs = require('fs');
const readline = require('readline');

const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});

rl.question('Введите текст для записи: ', (input) => {
fs.appendFile('output.txt', input + '\n', (err) => {
if (err) {
console.error('Ошибка записи в файл:', err);
} else {
console.log('Текст успешно сохранён в output.txt');
}
rl.close();
});
});

BY Node.JS [ru] | Серверный JavaScript


Share with your friend now:
tgoop.com/we_use_js/4140

View MORE
Open in Telegram


Telegram News

Date: |

You can invite up to 200 people from your contacts to join your channel as the next step. Select the users you want to add and click “Invite.” You can skip this step altogether. Telegram has announced a number of measures aiming to tackle the spread of disinformation through its platform in Brazil. These features are part of an agreement between the platform and the country's authorities ahead of the elections in October. Although some crypto traders have moved toward screaming as a coping mechanism, several mental health experts call this therapy a pseudoscience. The crypto community finds its way to engage in one or the other way and share its feelings with other fellow members. Other crimes that the SUCK Channel incited under Ng’s watch included using corrosive chemicals to make explosives and causing grievous bodily harm with intent. The court also found Ng responsible for calling on people to assist protesters who clashed violently with police at several universities in November 2019. Deputy District Judge Peter Hui sentenced computer technician Ng Man-ho on Thursday, a month after the 27-year-old, who ran a Telegram group called SUCK Channel, was found guilty of seven charges of conspiring to incite others to commit illegal acts during the 2019 extradition bill protests and subsequent months.
from us


Telegram Node.JS [ru] | Серверный JavaScript
FROM American