1

I just want to be able to upload and download binary files to Strato Hidrive using node.js with webdav. I tested uploading a jpg-image with the following code:

const createClient = require("webdav");

const fs = require("fs");

let client = createClient(
  "https://myusername.webdav.hidrive.strato.com",
  "myusername",
  "mypassword"
);

let data = fs.readFileSync("./localfolder/logo.jpg", {encoding: "binary"});

client.putFileContents("/myfolder/logo.jpg", data, { "format": "binary", });

However when I check the uploaded file by downloading it through their web-client, it can't be opened and it seems to be corrupted.

Is there solution to this? Either by changing the code or by suggesting a free webdav space (other than Strato Hidrive) where it might be working? Thanks a lot!

printminion
  • 2,988
  • 1
  • 26
  • 30
mjm
  • 11
  • 1

0 Answers0