All Questions
Tagged with node.js-fs async-await
66 questions
0
votes
1
answer
117
views
Wait for renaming file, then open it in node
I try to rename a file in node, then open it in a child process and rename it back when the child process closed by the user. But somehow I do not get the idea of promises into my head. The script ...
0
votes
1
answer
55
views
fs.readDirSync doesn't return the files in a folder
I have this small class that consists of a few methods.
export class imageHandler {
id: string;
imageFolder: string;
jobFolder: string;
bucket: Bucket;
constructor(id: string, imageFolder: ...
0
votes
1
answer
581
views
fs.readFileSync not working in node.js create server
I know that this question is many.But mine is a little hard. I'm new to fs and i wanna read a file from txt and send it to client when it gives me a GET request and when it gives me a POST request. ...
0
votes
0
answers
41
views
fs: Best way of mutual/asynchronous read/write to single file
Consider some kind of API scenario where I have one file that different HTTP requests cause reading/writing to. The requests occur synchronously. To avoid data or file access conflicts, I implemented ...
2
votes
1
answer
46
views
Value undefined after being resolved from Promise
I think the problem here might be wrong awaits, or the fact that I have a wrapped up callback inside the promise and I'm trying to resolve the promise inside that callback. Not sure how to fix this. ...
1
vote
2
answers
7k
views
Read multiple files from directory with Node.js using Promises/Async/Await
I'm trying to scan a local directory for all of the text files within it, then read each of those files. I want to do it properly using promises, async, and await, but something is going wrong and am ...
0
votes
1
answer
224
views
Substitute a Value in a Json file with value from another Json
I have two JSON files data.json and values.json. I want to read whatever the values of aws and bucket in values.json are, and use them in data.json. How can I achieve this with node js?
I have written ...
0
votes
1
answer
237
views
Using await with fs/promises function just exits code with no error
I am at a loss as to why I cannot read files inside a directory. I have tried every implementation of fs (both standard and promise-based). With the code below, the main function is called, logs "...
0
votes
0
answers
105
views
does running a synchronous function inside an async function make the function still run synchronously or will it make it run asynchronously? node.js
specfically when using fs.copyFilesync() and running it in an async function, will fs.copyFilesync() still run synchronously or will it run in an asynchronous manner like the fs.copyfile() function. ...
0
votes
1
answer
151
views
Limiting concurrence when processing a file line-by-line
I'm new to node.js, and trying to do the following:
read csv file
perform operation on the data in each line (handled by an API)
write outcome to new file
I want to avoid loading the whole input ...
2
votes
0
answers
2k
views
Get Full Object From Oracle Object Storage using Node.js
I am working on an nodejs image server to read and write images on Oracle Object Storage.
The issue I am having is not getting the full image when using the function getObject using the Javascript api ...
0
votes
0
answers
15
views
How to wait for the callback to be finished with fs.readdir? [duplicate]
I'm using fs.readdir callback function to do stuff in a path file but i want to wait for the callback to be finished to continue on with the rest of my code.
const get = async(path_files) => {
...
1
vote
1
answer
3k
views
Get all files within a folder containing string, push filenames to array and return array using Node FS
As the title describes, I would like to read all files from a specific directory and return the names of all the files that have a specific string in its contents.
Here is how my code looks so far:
...
10
votes
3
answers
2k
views
Stack trace with fs/promises and async..await
I have a problem that is similar to this one and described in this issue. There are no stack traces in errors that come from fs/promises when used with async..await, and no way to determine where the ...
0
votes
1
answer
13k
views
Node JS - createWriteStream
I am going crazy trying to fix this bug so please help :-)
I am using https://pdfkit.org/
This creates a stream that when finished is piped to fs.createWriteStream
My issue is the first time the code ...