{"action":"opened","issue":{"url":"https://api.github.com/repos/bruce/node-temp/issues/42","labels_url":"https://api.github.com/repos/bruce/node-temp/issues/42/labels{/name}","comments_url":"https://api.github.com/repos/bruce/node-temp/issues/42/comments","events_url":"https://api.github.com/repos/bruce/node-temp/issues/42/events","html_url":"https://github.com/bruce/node-temp/issues/42","id":93455759,"number":42,"title":"Error: ENOTDIR","user":{"login":"zimt28","id":1764689,"avatar_url":"https://avatars.githubusercontent.com/u/1764689?v=3","gravatar_id":"","url":"https://api.github.com/users/zimt28","html_url":"https://github.com/zimt28","followers_url":"https://api.github.com/users/zimt28/followers","following_url":"https://api.github.com/users/zimt28/following{/other_user}","gists_url":"https://api.github.com/users/zimt28/gists{/gist_id}","starred_url":"https://api.github.com/users/zimt28/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zimt28/subscriptions","organizations_url":"https://api.github.com/users/zimt28/orgs","repos_url":"https://api.github.com/users/zimt28/repos","events_url":"https://api.github.com/users/zimt28/events{/privacy}","received_events_url":"https://api.github.com/users/zimt28/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-07T07:01:17Z","updated_at":"2015-07-07T07:01:17Z","closed_at":null,"body":"Hey there :)\r\nI want to get some PDFs from a server, merge them and then save the result to the server again.\r\nAs the library for merging the files doesn't support input streams, I have to save the files first. So I thought I'd do something like this:\r\n\r\n```\r\nvar readStream = share.airwayBills.findOne().createReadStream();\r\n\r\ntemp.open('pdfgen', function(err, info) {\r\n  var writeStream = fs.createWriteStream(info.path + '/out.pdf');\r\n  \r\n  readStream.pipe(writeStream);\r\n  \r\n  writeStream.on('finish', function() {\r\n    console.log('Finished');\r\n    temp.cleanupSync();\r\n  });\r\n});\r\n```\r\nWhen not using `temp` here the code works, but using it I get this error:\r\n> Error: ENOTDIR, open '/var/folders/6y/vpzbkb0j0r366j_98dn42d380000gn/T/pdfgen11567-4723-am1ga0/out.pdf'\r\n\r\nWhen I go into `/var/folders/6y/vpzbkb0j0r366j_98dn42d380000gn/T`, `pdfgen11567-4723-am1ga0` is not a folder, but an empty file. I think that a) I should get a directory, not a file and that b) it should be deleted using `cleanupSync()` (might just not get called here).\r\n\r\nWhat am I doing wrong here? (I'm on a Mac btw)\r\nThanks!"}}