SpiderMan.Pipeline.SaveToFile (spider_man v0.3.4)
A post_pipeline what is use to download file directly for downloader component
Usage
settings = [
downloader_options: [
post_pipeline: [SpiderMan.Pipeline.SaveToFile | {SpiderMan.Pipeline.SaveToFile, dir | [dir: dir]}]
],
...
]
The file name is equal to request.key
.
If didn't set dir for this pipeline, the default is current dir.
Set the flag for download a request:
request = build_request("https://www.example.com/download/file")
|> set_key("file_name.txt")
|> set_flag(:save2file)
Supports Flag
:save2file
: Save the request.body to file and continue go to next component.:save2file_and_skip
: Just save the request.body to file and break.