2

I had a question reg. moving a file using Node.

In the end - I have a local file on M drive (Mapped) and want to move/copy it to N drive.

Using fsStream I was able to move it locally, but I'm concerned how it will react once I put it onto a website due to file manipulation. I'm curious if anyone has any solutions - I originally was using File API, which was beautiful but I noticed all it can do is load the data, I was unable to 'save' it anywhere.

Script is very simple - Mostly I'll be using variables to assign the write-to/read to path. I'm struggling to find info on how to write from server to PC, just a lot of reasons why it can't be done due to violation.

My other option is possibly just using a Powershell script?

var fs = require('fs'),
    util = require('util');
    var origFile = '~origPath~'
    var destFile = '~destPath'
var is = fs.createReadStream(origFile)
var os = fs.createWriteStream(destFile);

util.pump(is, os, function() {
    fs.unlinkSync(origFile);
});

Thanks ahead of time. Sorry if my post lacks needed details. I'll edit once I know.

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
  • Possible duplicate of [How I move files on node.js?](http://stackoverflow.com/questions/8579055/how-i-move-files-on-node-js) On a webserver the code should be able to do anything the webserver account is able to do. Changing the language shouldn't change anything about that. – Ansgar Wiechers Mar 05 '16 at 23:45

0 Answers0