Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
25 views

Why Can This Not Write To Directory 'Output'?

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' ...
Varelion's user avatar
4 votes
1 answer
125 views

Error packaging electron app that uses local files

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
  • 43
0 votes
1 answer
58 views

fs.writeFile adds extra brackets to json of key=>values object in node.js

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

Is there a way to open, save and close an excel file (.xlsx)?

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

Can Nodejs fluent-ffmpeg process opus file stream in async way?

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

How do I send big files in nodejs from the client to the server without an "Uncaught out of memory" error?

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

Why does fs.link() fail with EPERM whre fs.rename() succeeds?

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
  • 375
0 votes
0 answers
23 views

Reset all the settings of an Electron-based app

My Electron app has a menu to Reset All of its settings. I do this by calling fs.rmSync(app.getPath('userData'), { recursive: true }) and it's working fine when it comes to, for instance, the position ...
Alan Garny's user avatar
0 votes
2 answers
40 views

Use npm library in React Native, when it imports fs

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

fs.watch doesn't return an FSWatcher instance in Electron

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
  • 913
0 votes
0 answers
35 views

Using webpack + firebase, fs.js is creating paths to a directory rather than a file

I am trying to get a very basic project running using both webpack and firebase. However, I am running into issues when using firebase serve to locally host my site. The site should simply load ...
Albie Vanags's user avatar
1 vote
1 answer
77 views

Convert file of consts to string and save it in fs

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

Error: Unable to resolve module fs from {Root Floder}\node_modules\firebase-admin\lib\app\lifecycle.js:

{Root Floder}\node_modules\firebase-admin\lib\app\lifecycle.js: 19 | Object.defineProperty(exports, "__esModule", { value: true }); 20 | exports.FIREBASE_CONFIG_VAR = exports.deleteApp =...
Abhishek Deshmukh's user avatar
0 votes
0 answers
30 views

How to read a file in hex in node.js?

I have this function to read the first bytes of a file and return the result, but it never work with asar files: function readAsarHeader(filePath) { try { // Asegurarse de que la ruta del ...
luiggi batista dilones's user avatar
1 vote
1 answer
232 views

How to get rid of warning "lint TP1004 fs.existsSync(???*0*) is very dynamic" in nextjs 14.2.5 server

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
  • 461
0 votes
0 answers
51 views

How to create file in AWS codecommit?

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
  • 109
1 vote
1 answer
41 views

Why don't folders delete in gulp tasks? [duplicate]

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

Discord.js fs.writeFile not updating the correct json

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

Is there a standard way for unique file content per user in Javascript

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

Issues saving S3 base64 PDF file locally in NodeJS

Currently, I need to save a PDF hosted on S3 locally in NodeJS. I'm able to get the base64 fine from AWS, but the issue is when I convert the base64 to binary and write to file stream, the resulting ...
Anthony's user avatar
0 votes
0 answers
30 views

TypeError: Cannot call a class as a function.....In Node.js

I'm working with node.js and got an error. An unexpected error occurred: Error: ERROR processing skip func of /root/hardhat-nft-fcc/deploy/02-deploy-random-ipfs-nft.js: TypeError: Cannot call a class ...
Abdul Basit's user avatar
0 votes
0 answers
39 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,352
1 vote
1 answer
222 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
17 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
1 answer
65 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.6k
0 votes
1 answer
869 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
  • 141
1 vote
0 answers
159 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
39 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
  • 555
0 votes
0 answers
44 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,773
2 votes
1 answer
629 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
67 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
1 answer
1k 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
25 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
0 votes
0 answers
57 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
51 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,773
-1 votes
1 answer
32 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
73 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
213 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
44 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
  • 63
0 votes
1 answer
59 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
1 answer
649 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
71 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
56 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
101 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,773
0 votes
1 answer
148 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,168
0 votes
1 answer
45 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
  • 39
0 votes
1 answer
44 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
35 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
115 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
113 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

1
2 3 4 5 6