Remove delimiter from text variable while reading

Issue

i received this file form the server and stored it automatically
Text file chall.txt :

"rnIgOUXql5SEgpYy6vul"

JAVASCRIPT :

const fs = require('fs');
var challange = fs.readFileSync('chall.txt', 'utf8');

i want that variable to be stored like this rnIgOUXql5SEgpYy6vul not this "rnIgOUXql5SEgpYy6vul"
so i don’t need every time open txt and remove delimiters

Solution

Replace the quotes.

const fs = require('fs');
let content = fs.readFileSync('chall.txt', 'utf-8');
content = content.replace('"', '');

Answered By – Exortions

Answer Checked By – Jay B. (AngularFixing Admin)

Leave a Reply

Your email address will not be published.