{"action":"opened","issue":{"url":"https://api.github.com/repos/open-xml-templating/docxtemplater/issues/248","repository_url":"https://api.github.com/repos/open-xml-templating/docxtemplater","labels_url":"https://api.github.com/repos/open-xml-templating/docxtemplater/issues/248/labels{/name}","comments_url":"https://api.github.com/repos/open-xml-templating/docxtemplater/issues/248/comments","events_url":"https://api.github.com/repos/open-xml-templating/docxtemplater/issues/248/events","html_url":"https://github.com/open-xml-templating/docxtemplater/issues/248","id":175228941,"number":248,"title":"nodebuffer write produce corrupted files","user":{"login":"smolleyes","id":200256,"avatar_url":"https://avatars.githubusercontent.com/u/200256?v=3","gravatar_id":"","url":"https://api.github.com/users/smolleyes","html_url":"https://github.com/smolleyes","followers_url":"https://api.github.com/users/smolleyes/followers","following_url":"https://api.github.com/users/smolleyes/following{/other_user}","gists_url":"https://api.github.com/users/smolleyes/gists{/gist_id}","starred_url":"https://api.github.com/users/smolleyes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smolleyes/subscriptions","organizations_url":"https://api.github.com/users/smolleyes/orgs","repos_url":"https://api.github.com/users/smolleyes/repos","events_url":"https://api.github.com/users/smolleyes/events{/privacy}","received_events_url":"https://api.github.com/users/smolleyes/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-06T11:57:56Z","updated_at":"2016-09-06T11:57:56Z","closed_at":null,"body":"hello\r\n\r\ni can t get working docx when saving as nodebuffer\r\n\r\n```\r\nvar fs = require('fs');\r\ndoc=new Docxgen(content);\r\ndoc.setData(data) //set the templateVariables\r\ndoc.render() //apply them (replace all occurences of {first_name} by Hipp, ...)\r\nvar buf = doc.getZip().generate({type:\"nodebuffer\"});\r\nvar storageDir = analyseObject.conformite.affaire.affairePath;\r\nfs.writeFileSync(storageDir+\"/offre_affaire_\"+affaire.ref+\".docx\",buf);\r\n```\r\n\r\nfile is generated but corrupted, any idear ? \r\n\r\n(same file ok and readable thru blob / saveAs)\r\n\r\nEnvironment\r\n===========\r\n\r\n-\tVersion of docxtemplater :\r\n-\tUsed docxtemplater-modules :\r\n-\tRunner : Browser/Node.JS/...\r\n\r\nHow to reproduce my problem :\r\n=============================\r\n\r\nMy template is the following : (Upload the docx file here inside github, which you have to name template.zip (github doesn't accept the docx extension))\r\n\r\nWith the following js file :\r\n\r\n```js\r\nvar fs = require('fs');\r\nvar Docxtemplater = require('docxtemplater');\r\n\r\n//Load the docx file as a binary\r\nvar content = fs\r\n    .readFileSync(__dirname + \"/template.zip\", \"binary\");\r\n\r\nvar doc = new Docxtemplater(content);\r\n\r\n//set the templateVariables\r\ndoc.setData({\r\n\t( INSERT YOUR DATA HERE )\r\n});\r\n\r\n//apply them (replace all occurences of {first_name} by Hipp, ...)\r\ndoc.render();\r\n\r\nvar buf = doc.getZip()\r\n             .generate({type:\"nodebuffer\"});\r\n\r\nfs.writeFileSync(__dirname+\"/output.docx\",buf);\r\n```\r\n\r\nI would expect it to return the following template (upload your expected document if necessary), but it fails instead (include error message) / returns the following instead (upload your result here);\r\n"}}
{"actor":{"display_login":"smolleyes"}}