Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
15 views

Correct way to have several async processes in nodejs append to the same file

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,150
0 votes
2 answers
49 views

Read from nth row in csv typescript

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
0 votes
0 answers
13 views

Problem ordering writes using writeStream

I'm using node.js v22.6.0 on Windows 10. I'm trying to write a command that queries multiple sqlite3 tables and writes data to createWriteStream handle. The process is controlled by multiple functions ...
Stephen Woodbridge's user avatar
-1 votes
0 answers
25 views

FS import -> null [closed]

When I try to install fs, I get an error that fs is null. Just to make sure that my node modules are actually being read, I tried importing a made up module to see if it would ether become null or ...
Alex's user avatar
  • 41
-1 votes
1 answer
34 views

Cannot find module 'solc' when compiling in Node

Getting back to updating my Ethereum projects, but I am getting an error when I run node compile.js of: Error: Cannot find module 'solc' This is my compile.js file: const path = require("path&...
Daniel's user avatar
  • 15.1k
0 votes
0 answers
63 views

Am I overlooking the solution to "Module 'fs' has been externalized for browser compatibility"?

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
  • 41
1 vote
0 answers
36 views

Loading file list in Next.js does not reflect the latest changes

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
  • 37
1 vote
0 answers
25 views

docker container can not save/mapping file folder to host

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
  • 533
0 votes
0 answers
37 views

Cannot read a double nested directory

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,316
0 votes
1 answer
47 views

How to handle multipart/form-data file using nextjs?

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
49 views

How to read a file from url with Node.js and Electron

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
0 answers
81 views

Module not found: Can't resolve 'fs' in nextjs

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
21 views

Why am I getting an error when I pull a fetchDir function?

I have written this piece of code where I listen to a function in the frontend and then pull 2 function when it is called here are the 2 functions. Here is where we listen to the frontend: socket....
Divyansh Pathak's user avatar
1 vote
0 answers
54 views

Login page HTTP request sends infinitely

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
37 views

Node.js fs.existsSync returning false postives

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,316
-1 votes
1 answer
28 views

nodejs rewrite file segment

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
29 views

manipulate json from a jsx component into another jsx file with 'fs'

I'm trying to create this package to manipulate a jsx component file in another jsx file. But I realized later that 'fs is not available on the web (and it makes a lot of sense). would you have an ...
Abiner Da Silva Maleiane Junio's user avatar
0 votes
0 answers
82 views

NextJS 14 - Error when using fs inside app router

I am using the fs module to read markdown files to later display them. Below you can find my implementation: import fs from "fs"; import matter from "gray-matter"; export default ...
Anomaly's user avatar
0 votes
0 answers
32 views

How to read program files' content in NodeJS

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
  • 61
0 votes
1 answer
52 views

How to wait till all compressed files are extracted

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
0 answers
136 views

How to get node fs to work in an Angular and Electron application

" 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
32 views

How to extract and write contents of tar file to disk

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
47 views

How to get tar contents out of a hexa representation

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
58 views

Node fs file does not exist

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,316
0 votes
1 answer
79 views

Node file system fs.writeFile() throwing error in JavaScript module

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,046
0 votes
1 answer
44 views

Difference between two blocks of code involving fs.writeFile() in Node.js

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
  • 41
0 votes
1 answer
34 views

Error: why i can't display image on frontend?

what i am trying is to get image and data from mysql and send it to front end as json and display the content in html , in mysql i have the path of image and i pring it with fs as you well see in code ...
Almashdaly's user avatar
0 votes
0 answers
34 views

Server join and leave logger doesn't save data in file

I had an idea of developing a logging tool for my Discord Bot, so everytime it joins or leaves a server (with the guildCreate and guildDelete function) that it should save some data like the server ...
Blaxyy's user avatar
  • 7
0 votes
0 answers
30 views

Why NodeJS fs module won't read or write to visible folder shared on the network?

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
62 views

Iterate through a ReadDir and append file names to an array in Rust

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
20 views

fs.readdir give no results and no errors

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
1k views

How to update a JSON file for a Playwright test

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
  • 105
0 votes
0 answers
16 views

watching a video from home directory of ubuntu using nextjs

I want to know how to watch a video that's in home directory of ubuntu (/home/user/folder/video.mp4) using nextjs 14. I can get the file using app/api/file/route.ts code below: import fs from "fs&...
Ajmal Shahabudeen's user avatar
1 vote
1 answer
40 views

why does it seem my variable is updating with the new data after it saves to the file? React and NWJS

I'm working on a note-taking app using React and NWJS, where notes are saved to a separate file (save.json). The app fetches initial data from this file using a useEffect hook, handles input changes ...
Christopher Dirksen's user avatar
1 vote
1 answer
99 views

I'm using @typescript-eslint/parser to parse a typescript function, how can I get the range of the function?

I am trying to write a script that reads a TypeScript file, and returns the function names from that function getFunctionsFromFile(filePath) { const code = readFileSync(filePath, 'utf8'); ...
Zelda's user avatar
  • 21
0 votes
0 answers
149 views

Troubles with fs.cpSync() in NodeJS

I'm currently trying to make a folder-syncing extension to VS Code just to get the hang of extensions. Everything went smoothly for me until the point where I actually had to copy a folder to ...
ObSp's user avatar
  • 21
-3 votes
1 answer
40 views

Read a Java file using fs module (express.js)

I'm trying to use express's fs module to scan text files and display them on screen. I managed to do this in my tests using a txt file, but I'm having trouble getting the same code to work with java ...
Jpdl's user avatar
  • 1
0 votes
1 answer
46 views

Receive file contents in React front-end application

I am having an API endpoint in my NodeJS application. I am posting a filename to it to find the specific file in a folder. I am doing it like this: const fileDirectory = 'C:/Sites/private-uploads'; ...
Gery's user avatar
  • 23
1 vote
1 answer
91 views

@types/fs-extra: error TS2694: Namespace '"fs"' has no exported member 'EncodingOption'

All, I have this following error while trying to build project in aws node_modules/@types/fs-extra/index.d.ts(917,48): error TS2694: Namespace '"fs"' has no exported member 'EncodingOption'. ...
codeflinger's user avatar
0 votes
0 answers
480 views

Failed to resolve entry for package "fs". The package may have incorrect main/module/exports

[ERROR] Failed to resolve entry for package "fs". The package may have incorrect main/module/exports specified in its package.json. [plugin vite:dep-pre-bundle] node_modules/esbuild/lib/main....
kumaar kandugula's user avatar
1 vote
0 answers
32 views

I am building next js application the page works on local but when I deploy it in Vercel following error occurs

I have updated npm install and also mongodb. I have researched on google but didn't get any solution. I am using next js version 14. It works on local but when i deploy it in Vercel error occurs. Is ...
Selman Anver's user avatar
1 vote
0 answers
28 views

Detecting File Closure After Saving in Electron with Chokidar

Here is the code snippet ipcMain.handle("open-dialog", async (event: Electron.IpcMainInvokeEvent) => { let filePaths = await dialog.showOpenDialog({ properties: ["...
Balaji's user avatar
  • 11
0 votes
0 answers
207 views

Why fs module doesn't work without 'use server' in Next.js 14 app router although default rendering is 'use server' and fetch works without use serve

This code works perfectly 'use server'; import { promises as fs } from 'fs'; import Dasboard from "./_components/dashboard"; export async function getUser() { let response = await fetch(&...
Nihat Abdullazade's user avatar
0 votes
2 answers
80 views

Why does my 'if' statement only work on the second trigger of the function?

Using Node JS, Electron and the FS module I have created a function within a seperate .js file that is called into my HTML as a script and triggered from a button with onclick="ReadSerials()"...
CB700's user avatar
  • 23
-2 votes
1 answer
34 views

I'm having troubles with the node module "fs" [closed]

I created a local server using Node, and my objective would be to use the 'fs' module to be able to open my .exe file. However, when I run my code it gives the following error "Uncaught ...
Gabriel Correia's user avatar
0 votes
1 answer
294 views

Node 20 error: `EACCES: permission denied` on `fs.writeFileSync` to file in TMPDIR

The bug.mjs: open /tmp/test/foo.json, read and append k-v to save. Update: It works with Node 18, but failed with Node 20/21: import fs from 'fs' import path from 'path' import os from 'os' function ...
fannheyward's user avatar
  • 19.1k
0 votes
1 answer
25 views

Issue with res.download()

I've problems trying to apply res.download(filePath, originalName) with Multer, since it saves/copies a file from the /uploads folder to /downloads with fs.copyFile() when I apply my logic to it but, ...
Abel Prieto Martín's user avatar
1 vote
1 answer
486 views

"Error. EPERM: operation not permitted, stat" Electron application

I'm getting the below error when getting files from the path on the client's machine: I've function in my electron main process in which all the files are read from the path and uploaded to the ...
Faizan Saiyed's user avatar
1 vote
0 answers
191 views

How to get files from google drive in nodejs (typescript)

I am trying to download html, css, js, etc files from google drive using its api and I am getting error regarding saving file to local storage. Typescript code: const destinationFile = fs....
rutujp78's user avatar
0 votes
0 answers
31 views

How to get the file out of a buffer in nodejs/express?

Okay so i am using multer to upload my pictures and then save it to cloudinary. Since i am deploying the application, i am trying to use multer memory storage to upload the file however it has been ...
gerard's user avatar
  • 421

1
2 3 4 5 6