Questions tagged [fs-extra]
73 questions
30
votes
12 answers
Vite 'global is not defined'
I'm creating a project using Vite with vanilla-ts, at one point I had to use the readdir method from the fs-extra package, but it created an error saying process is not defined, some suggested I place this code in my vite-config.ts file:
import {…

8BitSoda
- 368
- 1
- 4
- 9
17
votes
3 answers
Copy a source file to another destination in Nodejs
I'm trying to copy an image from a folder to another using fs-extra module .
var fse = require('fs-extra');
function copyimage() {
fse.copy('mainisp.jpg', './test', function (err) {
if (err)
return console.error(err)
});
}
This…

Hammas
- 1,126
- 1
- 12
- 37
7
votes
0 answers
EACCES: permission denied with fs-extra only using nodemon
I am attempting to use the move method from the fs-extra npm module. It works for moving files and empty directories, but every time I try to move a non-empty directory while using nodemon, I get this error:
[Error: EACCES: permission denied, rename…

Jacolack
- 1,365
- 2
- 11
- 25
6
votes
4 answers
create-react-app error - Cannot find module 'fs-extra'
When I run create-react-app in the CLI I get the following error message back:
$ create-react-app udacity-goals-todo
internal/modules/cjs/loader.js:573
throw err;
^
Error: Cannot find module 'fs-extra'
at…

Mike Bauer
- 61
- 1
- 2
6
votes
0 answers
how to use file system (fs) in angular 2
In my angular 2 application, need to use file system for uploading large files to Amazon S3 server. But, I have problem in importing file system in my application. Please help to implement file system in my application.
My component.ts file
import…

Manush
- 1,852
- 7
- 26
- 39
5
votes
1 answer
Can Fs-Extra delete only files in a directory?
Can I do delete all files in apples directory without deleting the directory itself? fs-extra API does not describe if it is possible.
fsExtra.remove 'apples/*', ->
if !err
# Do stuff

Stephan Kristyn
- 15,015
- 14
- 88
- 147
4
votes
1 answer
How to mock file system with memfs in NodeJS
I want to test the following function with the memfs package
import fs from 'fs-extra'
import path from 'path'
async function ensureParent(filepath: string) {
const absolutePath = path.resolve(filepath)
const parentDir =…

DavNej
- 176
- 3
- 10
4
votes
1 answer
'fs-extra' symlink not permitted when running as administrator and with the policy added, running mklink myself works?
I'm trying to use this plugin together with serverless to bundle my dependencies using symlinks. Under the hood it uses fs.symlink from fs-extra as follows:
async function link (target, f) {
await fs.ensureDir(path.dirname(f))
await…

SebastianG
- 8,563
- 8
- 47
- 111
3
votes
1 answer
Return a File object from a local filepath in NodeJS
I am trying to write a function that returns me a Blob or File object, blob_object, while taking in the local filepath of an object, tmpFilePath, and I have to use NodeJS to do it as the function is used as part of a Firebase cloud function. I have…

Prashin Jeevaganth
- 1,223
- 1
- 18
- 42
3
votes
3 answers
Getting empty string from fs.readFile inside chokidar.watch(path_file).on('change', ...)
I have the following very simple Node project:
https://github.com/tlg-265/chokidar-issue
$ git clone https://github.com/tlg-265/chokidar-issue
$ cd chokidar-issue
$ npm i
$ npm run watch-changes
which basically takes care of detecting changes on…

Viewsonic
- 827
- 2
- 15
- 34
3
votes
1 answer
What is the difference between fsExtra.pathExists and fsExtra.exists?
I know exists is deprecated in fs but it is able in fs-extra.
I used both fsExtra.pathExists and fsExtra.exists.
But I could not find the difference.
They performe same.

Kuru
- 1,417
- 2
- 13
- 20
3
votes
4 answers
fs-extra: source and destination must not be the same. (cordova)
I get an error while building with cordova.
Error: Source and destination must not be the same.
Build-System:
Ionic:
ionic (cli): 4.10.1
ionic framework: ionic-angular 3.9.2
@ionic/app-scripts: 3.1.11
Cordova:
cordova (cli): …

Domske
- 4,795
- 2
- 20
- 35
3
votes
1 answer
Creating Directories using NPM Module fs-extra
I need some help.
I need to be able to create a directory structure which looks like the following:
parent
child1
folder1
folder2
child2
folder1
folder2
I'm currently using fs-extra (npm module). My issue is that the folder…

sudodashell
- 121
- 4
- 12
3
votes
2 answers
Angular JS console logs correct but no output
I have an electron app that is suppose to walk a directory and list the contents of the dir into side bar nav
I am using this library to walk the dir. I get the correct console output as shown below but I guess I am doing something wrong that I can…

0xtvarun
- 698
- 6
- 18
2
votes
0 answers
MODULE_NOT_FOUND: Error: Cannot find module 'fs-extra'
I'm getting the following error when running npm start. I have installed fs-extra before so I don't understand why this is happening. How can I resolve this issue?
Error: Cannot find module 'fs-extra'
Require stack:
-…

chackerian
- 1,301
- 2
- 15
- 29