Questions tagged [node.js-fs]

203 questions
0
votes
0 answers

Log4js issue: Cannot read property 'native' of undefined

Am using Log4js in my Reactjs app. I have downloaded log4js (v@6.8.0) with Node(v@16.14.0). After importing getting following error. Any issue with current version of Log4js?
Shankar Nanda
  • 129
  • 4
  • 11
0
votes
0 answers

Need to get folder path input from user in a CLI tool

I am working on a beginner CLI tool in Node.js. I want to get a file/folder/path from the user to save a particular file. I want to ask the user to specify where they'd like their file to be saved using Node.js. How can I achieve this? I know I get…
0
votes
0 answers

When using Unity WebGL, how do I download large file from a ubuntu server in an ec2 instance?

I have to download large file(~5GB) from ubuntu server in an ec2 instance to Unity WebGl(Web Browser). In Ubuntu server, I use NodeJS, express. I was able to access files on the server through restapi (unity web request) and read file data…
MayQuartet
  • 41
  • 4
0
votes
1 answer

How to append a line to a specific block in a file with fs

I need to append a line to a block inside a file with fs. I have a file that has a block: dependencies { ... } I would like to add a line to this block with fs so it prints: dependencies { ... implementation…
Ben
  • 2,957
  • 2
  • 27
  • 55
0
votes
1 answer

How to replace multiple variable from file.txt

Inside file form.txt Name : $name Gender : $gender Age : $age is my code to replace variable in form.txt const fs = require('fs').promises; var rForm = await fs.readFile(__dirname + '/form.txt', 'utf8'); var name = 'maman'; var gender =…
I N A
  • 3
  • 2
0
votes
0 answers

Cannot find node module 'node:fs'' in the node_modules

Node version is 12.18 npm 6.14 npm install work fine, but while running npm run build I got error Cannot find module 'node:fs' Require…
Bipa
  • 271
  • 1
  • 3
  • 10
0
votes
0 answers

NodeJS csv-parser is missing data on createReadStream?

I have a function where I'm trying to take an existing txt file that is delimited by tabs and transform it into a CSV. I'm using the "csv-parser" library as a transformer. Using this method I have a file that's a little over 6 MB in size, with about…
Hybrid
  • 1
0
votes
0 answers

When I try to run the command "nest new project name" I got this message error: Error not found node:fs

I'm creating a new NestJS project, but when I try to run the NestJS command "nest new project name" I'm facing the following problem: image error I tryied to update my versions of node, npm, angular-devkit, and uninstall the NestJS and install…
Tayene
  • 1
  • 2
0
votes
1 answer

Tests randomly return bad XRef Entry after readFileSync

This is probably too specific but I can't find what is wrong with this. I'm using cypress test tool and I need to verify the contents of a PDF. For this I've created a task: const pdf = require('pdf-parse'); getPdfContent(pdfName) { return…
Matias Diez
  • 1,237
  • 2
  • 17
  • 26
0
votes
1 answer

node:_http_outgoing:862 issue in node js... fs not working

the terminal is showing >>> node:_http_outgoing:862 throw new ERR_INVALID_ARG_TYPE( ^ TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received undefined at new NodeError…
0
votes
2 answers

How to get all subdirectories and return their paths?

Assume there is the following folder structure: /apps |- /group1 | |- /project1 | |- /project2 |- /group2 | |- /project3 | |- /project4 I need to get the path of all projects - which are all two level deep (group folder and then project…
user3142695
  • 15,844
  • 47
  • 176
  • 332
0
votes
0 answers

heroku doesn't let me create a file even temporarly

i just discovered that Heroku uses an Ephemeral File System, so i opted to use AWS S3 to store images and upload them. the problem i encountered is creating the file to upload it. my app is built with NextJS and my app is hosted on a basic dyno in…
0
votes
1 answer

next js api returns no response after deployment

while working on the local host, api and the posts.jaon file also works fine. was able to perform CRUD.But after I deploy it to vercel, the api does not loads. error in the log is something like this: [GET] /api/insta 11:39:32:83 [Error: ENOENT: no…
0
votes
0 answers

How to remove empty lines from end of file with node.js fs?

In Node.js, using fs.createReadStream() to stream a .csv file into PapaParse (a parser to convert csv into json), I would like to get the following: INPUT A;B;C ;; 1;2;3 ;; 1;2;3 OUTPUT (empty lines are kept) { 'A': '', B: '', C: '' }, { 'A': '1',…
Luis Felipe
  • 13
  • 1
  • 4
0
votes
0 answers

writefilesync not writing all variables to a json file

I have this code: circular = () => { //fix circular stuff for json.stringify seen = new WeakSet(); return (key, value) => { if (typeof value === 'object' && value !== null) { if (seen.has(value)) { return; } …
Cain Nuke
  • 2,843
  • 5
  • 42
  • 65