0

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 new copied file size is about half of the original file. but the file size changes each time i do it. it is the largest file being copied at about 30MB. So it seems like the file copy is being cut short for some reason. is there a size limitation? There are no error messages. Just an incomplete file is created on the other side.

can anyone help me with this? it is driving me nuts.

here is the actual line of code:

fs.copy("./content/file.mp4",./../Player/content/file.pm4).then(console.log("File copied successfully")).catch(err => { console.log(err)});

Original fileize: 31.3MB New filesize: 18.7MB (or how ever much actually copied. )

user2672332
  • 55
  • 1
  • 8
  • have you tried to see if `copySync` shows the same behavior? - https://github.com/jprichardson/node-fs-extra/blob/HEAD/docs/copy-sync.md – Ashish Modi Jan 02 '20 at 20:09
  • @ashish i did try copySync and it had the same problem. i tried a couple of other larger files > 20MB and they all had the same problem. i am also using await to ensure this completes before moving on. is there some sort of timeout for the promise maybe? – user2672332 Jan 02 '20 at 20:21
  • if the problrm is coming with `copySync` as well then it can not be a promise related issue. let me try something on my end – Ashish Modi Jan 02 '20 at 20:59
  • I've had a similar issue. Can you ensure that the source file is complete and fully written before attempting to copy it? – prohit Apr 25 '22 at 18:05

0 Answers0