Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
50 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
2127 votes
19 answers
2.2m views

I've been trying to find a way to write to a file when using Node.js, but with no success. How can I do that?
Gjorgji's user avatar
  • 23.2k
682 votes
34 answers
923k views

How do I download a file with Node.js without using third-party libraries? I don't need anything special. I only want to download a file from a given URL, and then save it to a given directory.
greepow's user avatar
  • 7,363
-5 votes
1 answer
119 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
797 votes
18 answers
871k views

I am trying to append a string to a log file. However writeFile will erase the content each time before writing the string. fs.writeFile('log.txt', 'Hello Node', function (err) { if (err) throw err;...
supercobra's user avatar
  • 16.4k
3 votes
2 answers
339 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
480 votes
12 answers
356k views

How can I get the file name from an absolute path in Nodejs? e.g. "foo.txt" from "/var/www/foo.txt" I know it works with a string operation, like fullpath.replace(/.+\//, ''), but ...
fxp's user avatar
  • 7,092
235 votes
12 answers
309k views

I would like to use async/await with some filesystem operations. Normally async/await works fine because I use babel-plugin-syntax-async-functions. But with this code I run into the if case where ...
Quellenangeber's user avatar
87 votes
24 answers
139k views

I have a little problem with my function. I would like to get all files in many directories. Currently, I can retrieve the files in the file passed in parameters. I would like to retrieve the html ...
user avatar
0 votes
1 answer
65 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
0 votes
0 answers
42 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
4 votes
1 answer
328 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
  • 43
44 votes
9 answers
69k views

I am building a CLI tool with node, and want to use the fs.promise API. However, when the app is launched, there's always an ExperimentalWarning, which is super annoying and messes up with the ...
Blazing Fast's user avatar
0 votes
1 answer
58 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' ...
Varelion's user avatar
1 vote
1 answer
78 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
151 votes
5 answers
191k views

I am trying to write a JSON object to a JSON file. The code executes without errors, but instead of the content of the object been written, all that gets written into the JSON file is: [object Object]...
Romulus3799's user avatar
  • 1,907
2 votes
1 answer
3k views

So this is my problem: import * as fs from 'fs'; var downloads = 0; const fs = require('fs') fs.readFile('tp.txt', (err, inputD) => { if (err) throw err; downloads = inputD.toString(); })...
Sadra's user avatar
  • 41
14 votes
2 answers
8k views

I try downloading files with the fetch() function from github. Then i try to save the fetched file Stream as a file with the fs-module. When doing it, i get this error: TypeError [...
CuzImBisonratte's user avatar
25 votes
5 answers
101k views

I want to implement a SASS compiler for my online editor, for this I want to use the npm package "node-sass". However I get the error Module not found: Error: Can't resolve 'fs' in '<...
DeadApe's user avatar
  • 525
47 votes
15 answers
136k views

I get this error in my app: Error: EPERM: operation not permitted, open 'C:\Program Files (x86)\Full Menu\db\main.json' The app I have is built with electron-boilerplate. I am using this function ...
Sergiu's user avatar
  • 481
2 votes
1 answer
338 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
1 answer
1k 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
1 vote
0 answers
59 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
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
  • 75
0 votes
1 answer
85 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

1
2 3 4 5
64