Questions tagged [node.js-fs]
203 questions
0
votes
0 answers
Axios Post Request with empty binary field form-data
i am trying to send an emtpy binary form-data request to an endpoint - with NODEJS. The field is required.
data.append('picture1',fs.createReadStream('./example-images/image-1.jpg'));
data.append('picture2', '');
data.append('picture3',…

MaMaRo N0
- 115
- 1
- 5
0
votes
0 answers
Get objects of audio file names from nested folders in Node.js
I'm trying to output objects of audio file names like this:
{
"dog": ["sound1.mp3", "sound2.mp3"],
"cat": ["catmeow.mp3", "play.mp3"]
}
Here is my code though it doesn't work:
const audioFolder = 'static/audio/';
import * as fs from…

LocTran016
- 25
- 5
0
votes
0 answers
Uncaught ReferenceError: process is not defined! WEBPACK AND BABEL ERROR
my MERN project has some errors ("zlib" Module not found etc..), because of that, i added some codes in module.exports={ resolve:{....}} on my webpack.config.js file in my react node moduse folder (node_modules\react-scripts\config).
resolve: {
…
0
votes
0 answers
How do I fix my Express.js app crashing when I spam requests to the server?
Recently, I've been trying to fix an error with my Express.js app that happens when I send so many PUT or PUSH requests to the server. When I send enough requests, It'll break and send 502 HTTP code to the client and logs this on server:
RangeError…

rufu
- 13
- 4
0
votes
0 answers
How to copy files recursively from multiple folders of a certain extension eg .pes to another folder in Nodejs
I have a folder that has about 112000 items. Of those items there are folders and subfolders and in the subfolders there are files that I need to be able to copy of a certain extension eg .pes
I can recursively get all the files I need in an array,…

Duane Muller
- 1
- 1
0
votes
0 answers
How to add a line to a file in discord.js?
client.on('message', function(message) {
if (message.content.startsWith("+" + "sell")) {
let sells = fs.readFileSync('sells.txt', 'utf8')
let args = message.content.trim().split(/ +/g);;
const link = args.slice(1).join(' ');
…

Simon
- 1
- 2
0
votes
0 answers
Nodejs in vercel - Dynamically create folder in vercel
Im using vercel to deploy my project's backend part - nodejs with express
I have to create folder in server dynamically and its working fine in localhost but not working vercel after deploy
const fse =…

Hunter
- 1,515
- 4
- 15
- 25
0
votes
0 answers
How to resolve the following in Node.js stream, fs, utils persisting even after installing packages
I have installed the following packages, e.g. fs, utils, and stream, although others like fs/promises cannot be installed. However, the error still persists.
Things done :
I have installed the packages
I have resolved them in Webpack
I have changed…

Bonsu
- 67
- 1
- 5
0
votes
1 answer
Is there a way to insert the value of stdout exec, node.js to an external variable?
The usual exec construct in node.js is:
exec('ls', (err, stdout, stderr) => {
if (err) {
console.error(err);
return;
}
console.log(stdout);
});
Is it possible to insert stdout value to external variable like…

L1M80 54N
- 11
- 3
0
votes
0 answers
How to upload formData file with express-upload in node js server
I'm attempting to upload a local file to a node js express server.
My local client upload looks like this:
const file = await fs.readFileSync(`${desktopDir}/ai2html-output/home-pro-Artboard_1.jpg`);
const title = "Test";
const form = new…

FabricioG
- 3,107
- 6
- 35
- 74
0
votes
1 answer
Write into file without overwriting
Here we have a function of file read and write. we want to add data in the existing file withput overwriting but this is overwriting data in text file even after using a flag.
var fs =…

Ayush
- 49
- 2
- 9
0
votes
0 answers
NodeJS, MongoDB - How to concat 2 streams to one and send the result as one array?
I have been encountering an issue for a long time but I haven't found any solution yet,
despite reading other answers that related to this issue.
I have 2 different mongo dbs and I want to concat 2 streams that came from each one,
and send the…

DanielTal
- 21
- 1
0
votes
0 answers
How to fix Module not found: Error: Can't resolve 'crypto'?
I started SSR with Quasar. And I am at the database stage. But I have changed modules, still nothing!
The suggestions are to do the following :
"browser": {
"fs": false,
"crypto": false
//...
}
Temporarily the problem is solved at…

dovstone
- 124
- 11
0
votes
0 answers
NodeJS - How to remove contents of a file from a specific point to another?
I'm trying to create a script that uses some template files and then replaces the contents of the file with some data asked to the user.
I've been using the {{word}} pattern to be able to replace specific words, but I'd like to be able to remove…

Unapedra
- 2,043
- 4
- 25
- 42
0
votes
1 answer
fs.readFile find a placehold and replace, Handlebars js also an option if need be
I currently load a file in node with fs.readFileSync:
const filename = 'test.html';
const html_code = fs.readFileSync(/var/www/vhosts/example.com/httpdocs/html/${filename}, 'utf8');
in test.html I have this div:

FabricioG
- 3,107
- 6
- 35
- 74