fs Questions
3
Solved
I have such a function, which create a write stream and then write the string array into the file. I want to make it return a Promise once the writing is finished. But I don't know how I can make t...
Metropolitan asked 5/10, 2016 at 18:2
2
I'm using nodemailer, and pdfmake to create a pdf, and send it in the email's attachments. I don't have too much experience with file handling in NodeJS, and I can't make it work.
See example where...
5
I have
import fs from 'fs'
and in my package.json I have
Then I run the command
> npm i fs
> [email protected] node_modules/fs
next in my React store I import 'fs' modu...
4
Solved
Question
Is there a simple way to move all the files in a directory up to its parent directory then delete the directory?
Use Case
I'm doing a zip extraction and the source zip contains a root f...
4
Solved
I am writing an application where I have an CVS file upload. I have an CVS parser so from my frontend I can upload the CSV to backend, process it and save it to database. After that I am deleting t...
15
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 func...
3
Solved
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 t...
Neils asked 31/3, 2022 at 20:35
12
Solved
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(/.+\//, ''),
b...
4
Solved
Why do I get errors like these when I try to use the new Node.js support for ES6 modules (e.g. with node --experimental-modules script.mjs)?
// script.mjs
import * as fs from 'fs';
// TypeError: ...
Lycanthropy asked 2/6, 2018 at 21:59
33
Solved
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.
Malacca asked 14/8, 2012 at 2:21
5
Solved
I want to use Node.js to create a simple logging system which prints a line before the past line into a .txt file. However, I don't know how the file system functionality from Node.js works.
Can so...
20
Solved
Unable to identify what's happening in my next.js app. As fs is a default file system module of nodejs. It is giving the error of module not found.
Ourself asked 20/11, 2020 at 8:34
3
Solved
Trying to write to a file using fs.writeFile into a sibling directory. This works fine when using Sitemap.xml into the same directory, but not with the relative path. The public directory exists an...
19
Solved
How can I synchronously check, using node.js, if a file or directory exists?
5
Solved
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 '<M...
3
Solved
I have a file in Windows-1255 (Hebrew) encoding, and i'd like to be able to access it in Node.js.
I tried opening the file with fs.readFile, and it gives me a Buffer that i can't do anything with....
Exocrine asked 29/10, 2014 at 9:21
3
Solved
I am trying to use file creation and deletion as a method of data transfer (not the best way, I know.) between python and nodejs. The python side of the program works fine, as I am quite familiar w...
2
Solved
I would like add string on the top of my js file. Actuly, it's on the end :
var file = './public/js/app.bundleES6.js',
string = '// My string';
fs.appendFileSync(file, string);
Do you have id...
4
Solved
I am trying to serve a PDF file that my SvelteKit app generates and allow a user to download it from an endpoint.
My project structure looks like this:
---------------------
/src/routes/downloads
-...
6
Solved
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 inte...
23
Solved
How do I check for the existence of a file?
31
Solved
Is there an easier way to copy a folder and all its content without manually doing a sequence of fs.readir, fs.readfile, fs.writefile recursively?
I am just wondering if I'm missing a function whic...
Foxtrot asked 9/12, 2012 at 9:17
7
Solved
I'm writing an application which downloads images from a url and then uploads it to an S3 bucket using the aws-sdk.
Perviously I was just downloading images and saving them to disk like this.
re...
Cimmerian asked 5/3, 2014 at 1:55
6
Solved
I have:
fs.readFile('../services/Prescipcion.xml', "utf8", function (err, data) {
console.log("err->", err);
console.log("data", data);
});
And it logs:
err-> {
[Error: ENOENT: no ...
2
Here is the code:
const dest = fs.createWriteStream('./src/Pages/downloads/' + fileName + '.' + type)
await drive.files.export({
fileId: fileId, mimeType: newType},
{responseType: 'stream'},
...
Gravitative asked 24/2, 2021 at 1:20
1 Next >
© 2022 - 2025 — McMap. All rights reserved.