From 1fb6400e306dad0c0621e529ba42273b9a95d296 Mon Sep 17 00:00:00 2001 From: shogerr Date: Wed, 10 Jun 2020 08:06:21 -0700 Subject: [PATCH] closes #6: corrupt pdfs --- src/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server.js b/src/server.js index 0629914..e29a440 100644 --- a/src/server.js +++ b/src/server.js @@ -71,7 +71,7 @@ function downloadResources(resources, path) { let filename = `${path}/resources/${resource.title}.${filetype}`; filename = filename.replace(/"/g, ''); log(green ('[downloaded]'), '(resource)', filename); - fs.writeFileSync(filename, response.data); + fs.writeFileSync(filename, response.data, 'binary'); }) .catch(err => { console.error(err);