Questions tagged [fs-extra]
73 questions
0
votes
0 answers
Trying to read the contents of a directory with fs-extra
I am trying to map the max value of a slider to the number of pictures in a directory. I am trying to do that using fs-extra but I am not sure what I am doing wrong. I am getting errors when trying to import the function. I cannot download it…

Wx_Trader
- 77
- 7
0
votes
0 answers
Import declaration conflicts with local declaration of 'fs'
I'm getting this error:
Import declaration conflicts with local declaration of 'fs'
in main :
import fs from 'fs-extra'
fs.ensureDir(settingsUserDataFolder, err => {
console.log(err)
})
If I comment this…

Raphael10
- 2,508
- 7
- 22
- 50
0
votes
0 answers
VSCode extension can not find the file path on windows. "ENOENT: no such file or directory"
I try to get file in the VSCode extension project on Windows, but it return wrong path and error message:
Error: ENOENT: no such file or directory, lstat 'C:\F:\...'
I try to change path but it is not working.
// src\utils\index.ts
const isFile =…

Reginna
- 219
- 4
- 15
0
votes
0 answers
Zip file generated by archiver got corrupted after copy with fs-extra
const fs = require("fs-extra");
const archiver = require("archiver");
const targetPath = __dirname + "/original.zip"
const output = fs.createWriteStream(targetPath);
const archive = archiver("zip", {
zlib: { level: 9 }, // Sets the compression…

ddeark
- 13
- 3
0
votes
2 answers
JavaScript, Node.JS : Wait until copying a folder, then edit files in it (async, await)
I am building a node.js program that copies a directory then edits the files in it. However, my code tries to edit the files before copying is done. I have tried adding await to the code, but could not solve the problem. The following is my code.
…

ambb
- 41
- 6
0
votes
0 answers
Does writeJSON method of fs-extra module maintain the order of Object?
I am new to nodejs, I have an object of enumerable objects which has data like below:
const obj = {
"id3" : {
"userName":"name3",
"age":"age3"
},
"id2" : {
"userName":"name2",
"age":"age2"
},
"id1" :…

lakshmiravali rimmalapudi
- 355
- 6
- 19
0
votes
2 answers
fs-extra not removing files inside directory
I'm using fs-extra library to delete some image files on post request in my node js app. every time I call /deleteproduct route everything works fine. my product is removed from database and fs-extra callback doesn't throw any error even though…

Parham Moieni
- 71
- 3
- 11
0
votes
2 answers
Best way to copy a directory from an external drive to a local folder with electronjs?
Just wondering if anyone has ever attempted to copy a directory from an external drive (connected via USB) to a local folder.
I am using ElectronJS so I can use my JavaScript, HTML/CSS skills to create a desktop application without utilising a C…

Patrick Lafferty
- 337
- 1
- 7
- 20
0
votes
0 answers
How to copy files and folders using fs-extra in Nuxt
i'm on Nuxtjs 2.15.4 and I'm trying to create multi themes for my app.
The flow is very simple: I have a themes folder with my themes folder within. At nuxt build/dev a module will be called:
const path = require('path')
const chokidar =…

Mojtaba Barari
- 1,127
- 1
- 15
- 49
0
votes
0 answers
Browserify with require('fs-extra') and upon loading bundle.js throws Uncaught TypeError: Object prototype may only be an Object or null: undefined
This issue is only specific to fs-extra module.
When i try to load browserified bundle.js in html, the error shows up.
bundle.js:2483 Uncaught TypeError: Object prototype may only be an Object or null: undefined
at Function.setPrototypeOf…

Jayanth R
- 11
- 1
0
votes
1 answer
How to convert a website to pdf with cheerio and fs
I'm trying to get a pdf document from a website but I keep getting the code on the pdf instead of pictures or "screenshots" of it. I want to stick to cheerio and fs.
this is where it saves.
const pdf_completo =…

berry_malicious
- 35
- 6
0
votes
0 answers
read a file content to json in react
I have created a small functionality in react, wherein I am able to upload a file successfully and save it inside a state. I am trying to parse the file contents using the "fs-extra" npm library and print it on a console. But, I am not able to do it…

Aishwary Shukla
- 450
- 1
- 7
- 21
0
votes
1 answer
Node.js: fs unlink vs. fs-extra remove to delete files. When to choose which one and why?
When using Node.js, I can choose between fs unlink method and fs-extra remove method to delete files and folders. Are there any specific use cases when to use which one or did anyone experience any performance benefits from using one over the other?…

Igor P.
- 1,407
- 2
- 20
- 34
0
votes
0 answers
Node.js fs-extra copying only part of file copying
I am using the fs-extra module to extend the native fs. When using fs.copy() to copy files from one location to another, one mp4 file particularly will not copy the entire file. all other files copy successfully. if i check the file properties the…

user2672332
- 55
- 1
- 8
0
votes
2 answers
how to avoid copying .txt and .xml file types using fs-extra.copySync method
I am working on a small assignment in typescript, currently I'm facing below mentioned issue and I was not able to figure out a way of achieving this.Any guidance or advises of below mentioned issue will be highly appreciated.
I have small task to…

siyumi_amarasinghe
- 193
- 1
- 1
- 13