Created
January 10, 2020 09:48
-
-
Save HariantoAtWork/3cb4e19552e3d214af78c61dc2ca4331 to your computer and use it in GitHub Desktop.
Node buffer example
This file contains 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
const options = { | |
url: 'https://url/for/png/file', | |
encoding: null | |
}; | |
request.get(options) | |
.then(function (res) { | |
const buffer = Buffer.from(res, 'utf8'); | |
fs.writeFileSync('/some/path', buffer); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment