{"action":"created","issue":{"url":"https://api.github.com/repos/sstur/nodeftpd/issues/76","labels_url":"https://api.github.com/repos/sstur/nodeftpd/issues/76/labels{/name}","comments_url":"https://api.github.com/repos/sstur/nodeftpd/issues/76/comments","events_url":"https://api.github.com/repos/sstur/nodeftpd/issues/76/events","html_url":"https://github.com/sstur/nodeftpd/issues/76","id":126477734,"number":76,"title":"Rely on `close` event and not on `finish` for WriteStream","user":{"login":"oleksiyk","id":2870352,"avatar_url":"https://avatars.githubusercontent.com/u/2870352?v=3","gravatar_id":"","url":"https://api.github.com/users/oleksiyk","html_url":"https://github.com/oleksiyk","followers_url":"https://api.github.com/users/oleksiyk/followers","following_url":"https://api.github.com/users/oleksiyk/following{/other_user}","gists_url":"https://api.github.com/users/oleksiyk/gists{/gist_id}","starred_url":"https://api.github.com/users/oleksiyk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oleksiyk/subscriptions","organizations_url":"https://api.github.com/users/oleksiyk/orgs","repos_url":"https://api.github.com/users/oleksiyk/repos","events_url":"https://api.github.com/users/oleksiyk/events{/privacy}","received_events_url":"https://api.github.com/users/oleksiyk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-01-13T18:03:58Z","updated_at":"2016-01-15T01:08:37Z","closed_at":null,"body":"https://github.com/sstur/nodeftpd/blob/master/lib/ftpd.js#L1397\r\n\r\nI know that `close` event is not documented but the problem with `finish` event is that it is emitted *before* the stream has actually closed its descriptors and finished cleanup:\r\n\r\nhttps://github.com/nodejs/node/blob/master/lib/fs.js#L1924\r\n\r\nFor custom filesystem that implements `fs` module functionality it means it has no chance to do final commits to whatever backend it uses before `file:store` event is emitted or even before Ftp client receives `226 Closing data connection`."},"comment":{"url":"https://api.github.com/repos/sstur/nodeftpd/issues/comments/171834391","html_url":"https://github.com/sstur/nodeftpd/issues/76#issuecomment-171834391","issue_url":"https://api.github.com/repos/sstur/nodeftpd/issues/76","id":171834391,"user":{"login":"sstur","id":369384,"avatar_url":"https://avatars.githubusercontent.com/u/369384?v=3","gravatar_id":"","url":"https://api.github.com/users/sstur","html_url":"https://github.com/sstur","followers_url":"https://api.github.com/users/sstur/followers","following_url":"https://api.github.com/users/sstur/following{/other_user}","gists_url":"https://api.github.com/users/sstur/gists{/gist_id}","starred_url":"https://api.github.com/users/sstur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sstur/subscriptions","organizations_url":"https://api.github.com/users/sstur/orgs","repos_url":"https://api.github.com/users/sstur/repos","events_url":"https://api.github.com/users/sstur/events{/privacy}","received_events_url":"https://api.github.com/users/sstur/received_events","type":"User","site_admin":false},"created_at":"2016-01-15T01:08:37Z","updated_at":"2016-01-15T01:08:37Z","body":"Ahhh! I totally didn't get that your \"custom filesystem that implements fs module functionality\" *inherits* from Node's `Writable` class. I've implemented a custom filesystem module before and simply conformed to the subset of fs API that nodeftpd uses. I assume other people might have done the same.\r\n\r\nI'll take a closer look at the links you mentioned and try to wrap my head around this issue. Thanks!\r\n\r\n"}}