Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free.

I want to copy a file from server to another server in node.js using webdav protocol. or directly upload a file via node.js to MAC server using webdav protocol..

Suggest some modules for node.js that support webdav protocl.. I have tried webdav-sync and replicate-http.. plz share some sample code..

share|improve this question

1 Answer 1

You can try with node module - poster for directly upload to server

Stream local file

var poster = require('poster');

var options = {
  uploadUrl: 'http://mysite.com/upload',
  method: 'POST',
  fileId: 'file',
  fields: {
    'myfield': 'value',
    'myfield2': 'value2'
  }
};

poster.post('file.jpg', options, function(err, data) {
  if (!err) {
    console.log(data);
  }
});

Stream remote file

var poster = require('poster');

var options = {
  uploadUrl: 'http://mysite.com/upload',
  method: 'POST',
  fileId: 'file',
  fields: {
    'myfield': 'value',
    'myfield2': 'value2'
  }
};

poster.post('https://www.google.com/logos/2012/addams11-hp.jpg', options, function(err, data) {
 if (!err) {
console.log(data);
  }
});
share|improve this answer
    
Does this work with webdav? How do you use a username/password? –  Jake Wilson Jun 24 at 18:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.