Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createWriteStream is uploading my images with smaller size or 0kb #271

Closed
melcarniel opened this issue Aug 30, 2021 · 1 comment
Closed

Comments

@melcarniel
Copy link

melcarniel commented Aug 30, 2021

I am using webdav-client to upload images to webdav, I am downloading the images and saving in a root directory, then uploading to webdav, maybe I am implementing wrong. Can someone help?

const pathString = Path.join(__dirname, 'images', `${name}.jpg`);

// save the image 
await this.serviceSocialMedia.downloadImages(url, writer);
 const readStream = Fs.createReadStream(pathString);
    const writeStream = await client.createWriteStream(`/product_images/${name}.jpg`);
    readStream.pipe(writeStream);

    endOfStream(writeStream, err => {
	    if (err) {
		    console.error(err);
		  return;
	  }
	  console.log("Done +++");
    });
@perry-mitchell
Copy link
Owner

This is a dupe of #181

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants