Questions tagged [fs-extra]

73 questions
0
votes
1 answer

fs-extra throwing ERROR: EBUSY: resource busy or locked

I am trying to delete one file and one folder asynchronously by using fs-extra. But it is throwing the following error. import fse from 'fs-extra'; function deleteMethod (foldername){ fse.remove(`${foldername}-tar.gz`) .then(() =>…
0
votes
1 answer

An better way to include head/footer with node/express?

On the occasion when we are using fs.write rather than fs.render and want to include a header and a footer with our output. I tried using include and it gives an error. Lines like this do not work -> const head =…
Michael Nelles
  • 5,426
  • 8
  • 41
  • 57
0
votes
0 answers

How to iterate over files with Promises in Node.js

I have a folder with a bunch of JSON files that looks like this: | |-foo.json |-bar.json |-qux.json |-baz.json |-zot.json Each JSON file has a property children that points to some of the other JSON files, so that they all describe a tree. Now, say…
Mig82
  • 4,856
  • 4
  • 40
  • 63
0
votes
2 answers

Do not see the reason I am getting a NOENT returned when I can see the file at the exact spot I am calling for it to be

I know this is very similar to other questions that have been asked on the same error. In the case I have seen though, the file name had been left off of the url. In my case (as far as I know) the url is specified as it should be and I can see the…
doug5solas
  • 77
  • 10
0
votes
1 answer

Mongo/Mongoose/Multer/FS to delete an image

In the code given below:- var Image = mongoose.model("Image", imageSchema); //Assuming all the configuration of packages are done app.delete("/element/:id", function(req, res) { Image.findByIdAndRemove(req.params.id, function(err) { …
0
votes
1 answer

node express: Issue with res.render() after writing file to disk

I'm writing a method that uses async/await and promises to write some JSON to a file and then render a pug template. But for some reason the code that writes the JSON conflicts with the res.render() method resulting in the browser not being able to…
Malibur
  • 1,695
  • 5
  • 22
  • 31
0
votes
0 answers

NodeJs application stopping abrubtly while async file copy

I am trying to write a file copy code in Node.js: function archiveFolder(site, callback) { //console.log("Processing Site2 " + site ); var path = srcDir + '/' + site; var startDate = moment(new Date(),…
Sravan
  • 596
  • 1
  • 9
  • 19
0
votes
0 answers

nodejs - fs_extra.copy - writing file to network drive -- creates file but 0 bytes

I am trying to write a file to a network drive with nodejs. I have a network drive mounted. I can read it and write to the network drive from shell. I am using this to copy a file: fs_extra.copy('tempFileLocation', 'networkDrive' +…
philipfwilson
  • 757
  • 2
  • 9
  • 21
0
votes
1 answer

node js fs-extra outputFile data parameter as variable?

I delcare a function to create a file with path, and data as variable. here my code const fse = require("fs-extra"); function createFile(name, contents) { fse.outputFile(name, contents, function(err) { } }; than var name =…
Ngô Hữu Nam
  • 563
  • 6
  • 12
0
votes
1 answer

Copying file using node.js with the possibility of cancellation

I am implementing a node.js application which copies an array of file paths, into an specific destination. The method is simple, Let's say I have 10 file paths at the Origin paths, and 1 path as the destination path. so Each From path will be copied…
Benjamin
  • 3,499
  • 8
  • 44
  • 77
0
votes
2 answers

Using fs.extra copyRecursive gives a "TypeError: forEachAsync is not a function" error and I can't fix it

My code is : http://pastebin.com/rCy4wSUK As soon as this function is called by router it prints "done copying contents of clean base into temp" and then error which is here: http://pastebin.com/UxEu4PaS So at least it is not giving an error in…
Udarr
  • 13
  • 5
-1
votes
2 answers

Failling when installing fs-extra - react-native

~I'm creating a new app for android and when I command react-native run-android and this error comes up: error: bundling failed: Error: Unable to resolve module fs from…
-1
votes
1 answer

Execute after FOR loop with FS action

I have a for loop that calls an action fs.copy after. After that for loop is complete I need to execute a command. I think I need to do a callback once the for is complete. The issue that I think I'm running into is the fs.copy is run async so the…
Jason Small
  • 1,064
  • 1
  • 13
  • 29
1 2 3 4
5