Created
March 12, 2013 06:18
-
-
Save mikermcneil/5140740 to your computer and use it in GitHub Desktop.
stream from a url to a file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var fs = require('fs'); | |
| var knox = require('knox'); | |
| var request = require('request'); | |
| var uri = "https://lh4.ggpht.com/N5f6FA5zPjrTH-UggaFLstYSO1za-01CbsO17ZwkghtF0k9TSzWcnCn4bybCDeIOP4cu=w124"; | |
| // Open download stream from google | |
| var downStream = request(uri); | |
| // Open temp file ("upload" stream) | |
| var tempFile = fs.createWriteStream('stupidTempFile.png'); | |
| // Pipe downstream to upstream | |
| downStream.pipe(tempFile); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment