Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
68 views

According to the documentation on Reading files with Node.js, there are three ways to read the full contents of a file in memory and return its content: fs.readFile(), fs.readFileSync(), and ...
hb20007's user avatar
  • 635
0 votes
1 answer
70 views

If I watch a directory that has a .git inside of it and run fs.watch, does that listen to changes within .git folder? For example if I use: fs.watch(dir, { recursive: true }
Yousaf Wazir's user avatar
0 votes
0 answers
80 views

I am working on an electron pet project of mine to send files over local network. For the actual sending part I choose to use wrtc via Simple-Peer, and it's on a backend(maybe weird I know) so I ...
Vlad Karelov's user avatar
-5 votes
1 answer
131 views

const randomGIFFunc = async function(dirname) { const dirPath = 'src/gifs/' + dirname; fs.readdir(dirPath, (err, files) => { if (err) { console.log('Error reading directory: ', err ); ...
M.E.G.'s user avatar
  • 11
3 votes
2 answers
566 views

I have a write-ahead log that stores some metadata using atomic renames. Currently I am only fsyncing the file before rename, but it is my understanding that I should also be fsyncing the directory ...
David Callanan's user avatar
0 votes
0 answers
48 views

I'm working on a directory-level snapshot feature based on a file system, where a snapshot of a directory is recorded by an inode, and I want to implement how the snapshot sharing mount should be ...
yourfriendccy's user avatar
0 votes
1 answer
94 views

I'm having trouble understanding the following code: const fs = require('fs') const readableStream = fs.createReadStream(__filename) readableStream.close() readableStream.on('close', () => { ...
russell.price's user avatar
1 vote
0 answers
35 views

I am trying to the select the most recently created file from an array of files. This works just fine on my local node environment on mac, however when I push to my production server instead of ...
kdub1312's user avatar
  • 1,017
0 votes
0 answers
75 views

I’m running Node.js v14.17.0 on Windows 10 (Build 19042) as a normal user. I’ve enabled Developer Mode so that creating symlinks shouldn’t require elevation, but whenever I try: const fs = require('fs'...
CLrrrr's user avatar
  • 31
0 votes
0 answers
111 views

I’m facing an issue with a Node.js application that uses the fs module to read files from a network drive on Windows. The app works fine during development, but when I run it as a PM2 service, it ...
Narendra Singh's user avatar
0 votes
1 answer
64 views

I am attempting to write a file to an existing directory, using node, path, and fs. How it's supposed to work: Init mock data. Loop through mock data. Write mock string to existing directory 'output' ...
user avatar
3 votes
1 answer
371 views

I created an App using electron that interacts with local files using IPC. When i run it using npm start, éverything works as excpected, but when i try to package the app into an .exe file using the ...
MabMab's user avatar
  • 41
1 vote
1 answer
89 views

I'm trying to update one JSON file in a for loop called asynchronously. Each time I update the whole file, with 1 object. This is my very complex code after half a day of research. (I know it's too ...
Magor Menessy's user avatar
0 votes
1 answer
110 views

I've got a daily automated function in nodejs which builds and populates an excel spreadsheet via the package xlsx-populate, which has been running for a couple of years now with no problems. A ...
SosijElizabeth's user avatar
1 vote
0 answers
68 views

What I want to do: load a large opus file processing it using fluent-ffmpeg output a stream for further use (realtime output is required) Runnable codes(file path needs to be changed): const fs = ...
DanielBUBU's user avatar
1 vote
1 answer
56 views

When sending a big file, such as one over twenty megabytes from the client to the server using a fetch request, the HTML page with the file input freezes for about 10 seconds and gives the error in ...
Aayush's user avatar
  • 13
0 votes
2 answers
66 views

I want to serve some static files under the directory /var/www I would like to swap in a new set of files (which exist as, for example, /var/data/example) every few days or so. The server does not ...
gischer's user avatar
  • 385
0 votes
2 answers
69 views

I understand that I cannot simply use fs in React Native as in Node. However, my situation is a bit different. Here's a simple representation of my problem. Library: const fs = require('fs') function ...
ssamtkwon's user avatar
  • 305
0 votes
1 answer
83 views

I have an Electron React App Where I'm trying to call .close() on the object that I assigned an fs.watch to. But I think Vite, Electron or something is wrapping something around the object returned ...
Fluxian's user avatar
  • 1,014
0 votes
1 answer
89 views

I'm newbie with electronjs so i tried to save my file as a TXT file via fs like this: simple consts in data.ts file: export const users = [{ id: 1, name: 'a', classId: 1 }] export const classes = [ ...
Morteza Mazrae's user avatar
2 votes
1 answer
365 views

Using nextjs 14.2.5, in one of the server component, I need to save a temp file to server storage, the code works fine, but every time the server component is called, there's the this warning lint ...
H.Sheng's user avatar
  • 481
0 votes
0 answers
70 views

I am creating a project. This project will log payment details when a payment is created. import * as fs from 'fs/promises'; import * as path from 'path'; app.use('/files', async (req, res) => { ...
EQ0920's user avatar
  • 124
0 votes
1 answer
51 views

This task work ok. I use path ".wwwroot/css/site.min.css" var gulp = require("gulp"); const fs = require('fs').promises; gulp.task('clean', async function (done) { try { ...
Viktor Bylbas's user avatar
0 votes
1 answer
54 views

I am using discord.js to write a bot. I am using a json called data in order to hold information that can be changed via slash commands. However, using fs.writeFile doesn't modify the targeted json. ...
Kovu Bentley's user avatar
0 votes
0 answers
69 views

I am running a server in which users get a javascript file when they sign up. They can use this on their website, and I can track it. So people register through my expressjs project, but to change the ...
Sophax's user avatar
  • 1
0 votes
0 answers
79 views

Is there a correct / better approach to using a file descriptor that several process running asynchronously can write to? e.g.: const allTheAsyncJobs = [] const fileDescriptor = fs.openSync(pathToFile,...
yen's user avatar
  • 2,432
1 vote
1 answer
307 views

I am trying to read a csv file from 4th row, in my csv file first 3 rows contains some meta data in column1. But the actual number of columns in csv is 6. eg: metadata1 metadata2 metadata3 head01,...
Shashi Ranjan's user avatar
1 vote
1 answer
2k views

Just so you get an understanding of the situation, I am trying to build a web game library that runs on my computer. It is pretty much a rip off of the Nintendo Wii and 3DS. I'm using Vite as the ...
Alex's user avatar
  • 149
1 vote
0 answers
192 views

In Next.js, I implemented a feature to fetch a list of files in a specific directory using a module like fs. When I deployed it, the functionality itself worked fine, but when I took actions such as ...
JisuEun's user avatar
  • 35
1 vote
0 answers
69 views

I have Node Server inside Docker, inside server, I have upload file function, which save file to /uploads. Here is the success code which help me make the file in this folder : app.post('/uploadFile',...
famfamfam's user avatar
  • 556
0 votes
0 answers
52 views

Essentially I'm trying to store all of file system in a certain dir in an array of objects. Here is my code: type Cache = { path: string; content: Buffer; }; const readdir = (dir: string, ...
Ethan's user avatar
  • 1,918
2 votes
1 answer
923 views

I have being trying to upload image from frontend to backend but cannot workaround my head over this. Frontend Send some data including "image" to backend. Backend Below is my backend code //...
Pratik Patel's user avatar
0 votes
0 answers
69 views

How can I read a file with nodejs, even json, from url? My file is on a server. I tried with ftp download but it is very inefficient. Now is working on this, but is very slow for download and running.....
Alexie01's user avatar
  • 141
0 votes
1 answer
2k views

In my project there is an one dependency better-sqlite3. This dependency is working fine.But after some time i am getting the fs module not found error again and again. I tried all the methods like ...
Avnish Kumar's user avatar
0 votes
0 answers
76 views

A few hours ago i made a similar question but i was addressing the wrong issues. the real problem is, i have this functional login function: async function entrar() { const user_name = ...
Mind full of blanks's user avatar
0 votes
0 answers
66 views

I have the following code: const fs = await import("fs"); let hashedPassword; if (!fs.existsSync(".fs")) { fs.mkdirSync(".fs"); console.info("...
Ethan's user avatar
  • 1,918
-1 votes
1 answer
45 views

In nodejs, how do I overwrite a section of a file without creating additional files or reading all the data into memory? let filename= '123.txt'; const fd = fs.openSync(filename, 'w+'); fs.writeSync(...
Kopkan's user avatar
  • 150
0 votes
0 answers
55 views

My goal is to make an array of file content from a directory. The directory can resemble a project with source code like Python, JS, etc. So far I have it loop through an array of every file in the ...
BeratK2's user avatar
  • 63
0 votes
1 answer
67 views

For the below posted code in section code-1, I extract the contents of .tar file to a specific path. Then I want to rename the the extracted files as shown in the code. The number of extracted files ...
Amr's user avatar
  • 27
1 vote
1 answer
1k views

" The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this ...
Michael Vaughn's user avatar
0 votes
0 answers
89 views

I make RESTAPI call to an endpoint, and I receive the response in the following format <Buffer 4d 4d 00 2a 00 00 00 08 00 13 01 00 00 03 00 00 00 01 01...... what i am receiving is tar file ...
Amr's user avatar
  • 27
1 vote
1 answer
72 views

I make RESTAPI call to an endpoint and I expect to receive .tar contents. But what I received is <Buffer 4d 4d 00 2a 00 00 00 08 00 13 01 00 00 03 00 00 00 01 01...... The method connectForTar ...
Amr's user avatar
  • 27
0 votes
1 answer
144 views

I have the following code to read a file in my project with Node fs. const files: FileSystemTree = { "Component.tsx": { file: { contents: fs.readFileSync( ...
Ethan's user avatar
  • 1,918
0 votes
1 answer
190 views

In my index.mjs file I have a function that concatenates and minifies JS utility files. I have it set up like this: import fs from "fs"; import { minify } from "terser"; function ...
Matt Smith's user avatar
  • 2,178
0 votes
1 answer
52 views

I am trying to declare a POST method for a RESTful API using node and express. I need to accept the request body and write it onto a JSON file that I'm using to store my users data. I am using the fs ...
ambiasm's user avatar
  • 39
0 votes
1 answer
70 views

I am trying to get an image and data from MySQL and send it to the front end as JSON and display the content in HTML. In MySQL, I have the path of the image, and I print it with fs as you well see in ...
Almashdaly's user avatar
0 votes
0 answers
160 views

I'm scaling my NodeJS app (on Windows 11) and need to setup additional workstations (Windows 11 aswell). Right now I simply need a shared folder, so I created one and made it visible on the network. ...
Axel Carré's user avatar
-1 votes
1 answer
176 views

I am trying to use the fs::read_dir() and iterate through the results and append all file names to an array. Something like this, except this isn't working: let mut result: Vec<&str> = Vec::...
Lars S.K.'s user avatar
0 votes
0 answers
22 views

Here is my function (which should rename the newest file of a given directory, if the file has a type of extension) : const fs = require('fs').promises; // Note the .promises function renameLatestFile(...
Jean François Manatane's user avatar
0 votes
2 answers
4k views

I have a JSON file that contains a value that I need to update as a step of a Playwright test as well as containing other values that need to remain unchanged. I have found a solution but it's not ...
Lank's user avatar
  • 85

1
2 3 4 5
64