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

place downloads in subdirectory #1

Open
travisirby opened this issue Feb 9, 2015 · 3 comments
Open

place downloads in subdirectory #1

travisirby opened this issue Feb 9, 2015 · 3 comments

Comments

@travisirby
Copy link

Can you tell me how to download files to a subfolder? I'm probably missing something obvious. I've tried using rootpath 'foldername' and several other variations, but can't get it working.

This is a handy utility btw thanks!

@douzi8
Copy link
Owner

douzi8 commented Feb 9, 2015

How do you write your code ?
This code may be help you.

request.download({ 
  url: 'http://www.baidu.com/img/bd_logo1.png',
  rootPath: 'dest'
}, function(err, res, body, filepath) {
  console.log(filepath);
});

The logo image will download in dest/img/bd_logo1.png, Now the request cannot support https, i wil supoort next time

@travisirby
Copy link
Author

Thanks for the reply! Your provided code helped me get it working.

@GrandadEvans
Copy link

For future reference & anybody else that comes across this issue: I found that leaving the rootPath off and then just adding the directory tree to the destPath worked for me.

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

3 participants