Questions tagged [node.js-fs]

203 questions
1
vote
0 answers

node node-tesseract-ocr in windows : Error: node:events ... write EOF

I run a node script on windows 11 and I am usig node-tesseract-ocr for reading text content of a png file const tesseract = require("node-tesseract-ocr"); const fs = require("fs/promises"); async function main() { const img = await…
Lemec Cinq
  • 281
  • 2
  • 15
1
vote
2 answers

How to delete a specific file inside a nested folder

I have been trying to delete a specific file in a nested directory. import Express from 'express'; import { baseURL } from '..'; import fs from 'fs'; import path from 'path'; import { GuestFile } from '../models/guest-file'; export const…
1
vote
2 answers

create file on folder if not exists on node js

I want to creat directory if not exist and then save the file that I got from Front-end This is my code and it only does the part of creating folders, but my main problem is saving the file in this path let directory = await…
1
vote
2 answers

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 stuck trying to figure it out. I am able to read…
david
  • 243
  • 3
  • 17
1
vote
0 answers

I have a problem with chaining functions while resizing an image and displaying it in the browser according to the URL params

I'm a total beginner with backend, node and express I'm trying to build an api that resize the image according to the entered params in the URL and render it in the browser using typeScript, so I'm using sharp to resize the image, express to build…
1
vote
1 answer

Importing fs in react-native

I'm trying to import TinyDB in an expo project but I need help with fs, because expo doen't allow fs as it is a third-party file system. I try using react-native-fs but I don´t kow how to use it. Can someone help me? This is my Code: var TinyDB =…
1
vote
0 answers

Nest, serverless: ENOENT: no such file or directory, open

My project has above project structure src ---- Clone(empty folder) ---- app.module.ts ---- app.service.ts serverless functions: main: timeout: 60 handler: src/main.handler events: - schedule:…
JaNith RathNayaka
  • 101
  • 1
  • 2
  • 10
1
vote
1 answer

fs.readdirSync(__dirname) showing .js file extension instead of .ts

I have the following code: console.log(fs.readdirSync(__dirname)); Which prints out the following: [ 'index.js', 'objective.js', 'quest.js', 'user_objective.js' ] However, my file directory setup is as follows: Why would it think the .ts…
Snoopy
  • 1,257
  • 2
  • 19
  • 32
1
vote
0 answers

Error: Cannot find module './src/handlers/buttons.js' after migrating all files to a ./src folder

I'm working on a Discord bot using the popular Discord.js library I've recently moved all my non config files to a folder called 'src' In my 'index.js' file I have an fs statement that reads all the files in a directory called './src/handlers'Here…
bradys dev
  • 50
  • 7
1
vote
0 answers

Node FS Access not throwing EACCESS error when testing against READ/WRITE in C:\Program FIles

The project I'm working on allows the user to choose where they want to locate the files we use and by default on Windows we set the main file in a folder in C:\Program Files. Well when wanting to test for RW perms in their selected location or…
1
vote
0 answers

reading a big file in chunks and adding to object

I am trying to read a big file in chunks instead of loading it directly to memory using nodejs. My goal is to read the file but cannot load it into memory as the file is big and then group the anagrams and then output them. I started following the…
hulike2286
  • 61
  • 5
1
vote
1 answer

Web pack: require is note defined (query string)?

I made a webpack project and include some web3js and file-system module in it. And I got this error when I run the localhost. In Console Uncaught ReferenceError: require is not defined at Object.querystring (external "querystring":1) at…
yehia tarek
  • 65
  • 2
  • 12
0
votes
1 answer

Superagent not rendering read file data in .get function correctly

I am going through a Node.JS course on Udemy and as one of the examples for using an API call we are being told to use Superagent and call the Dogs CEO API. I have my code exactly like his in the tutorial and for some odd reason the "data" variable…
0
votes
0 answers

fs problem when using google-apis in Astro project

In my astro project, I'm trying to build an api end point in order to make a POST request to the google sheets api. To achieve this, I've installed the google-apis package. The problem in question is when the localhost is initialised, the following…
0
votes
0 answers

Wrong error printing While creating a file in Node.js dir/fileName

This all my code: lib.create = (dir, file, data, callback) => { fs.open(`${lib.basedir + dir}/${file}.json`, 'wx', (err, fileDescriptor) => { if (!err && fileDescriptor) { const stringData = JSON.stringify(data); …
1 2
3
13 14