{"action":"created","issue":{"url":"https://api.github.com/repos/rico345100/socket.io-file/issues/1","repository_url":"https://api.github.com/repos/rico345100/socket.io-file","labels_url":"https://api.github.com/repos/rico345100/socket.io-file/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/rico345100/socket.io-file/issues/1/comments","events_url":"https://api.github.com/repos/rico345100/socket.io-file/issues/1/events","html_url":"https://github.com/rico345100/socket.io-file/issues/1","id":198199242,"number":1,"title":"How to change filename before upload starts?","user":{"login":"Obvio","id":300232,"avatar_url":"https://avatars.githubusercontent.com/u/300232?v=3","gravatar_id":"","url":"https://api.github.com/users/Obvio","html_url":"https://github.com/Obvio","followers_url":"https://api.github.com/users/Obvio/followers","following_url":"https://api.github.com/users/Obvio/following{/other_user}","gists_url":"https://api.github.com/users/Obvio/gists{/gist_id}","starred_url":"https://api.github.com/users/Obvio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Obvio/subscriptions","organizations_url":"https://api.github.com/users/Obvio/orgs","repos_url":"https://api.github.com/users/Obvio/repos","events_url":"https://api.github.com/users/Obvio/events{/privacy}","received_events_url":"https://api.github.com/users/Obvio/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-30T22:00:49Z","updated_at":"2016-12-31T05:23:15Z","closed_at":null,"body":"Thanks for this!\r\n\r\nI wanted to know if it's possible to change the uploaded file name before it writes to the server, i want to always allow uploads with `{overwrite:false}`.\r\n\r\nThanks again!"},"comment":{"url":"https://api.github.com/repos/rico345100/socket.io-file/issues/comments/269850338","html_url":"https://github.com/rico345100/socket.io-file/issues/1#issuecomment-269850338","issue_url":"https://api.github.com/repos/rico345100/socket.io-file/issues/1","id":269850338,"user":{"login":"rico345100","id":10347098,"avatar_url":"https://avatars.githubusercontent.com/u/10347098?v=3","gravatar_id":"","url":"https://api.github.com/users/rico345100","html_url":"https://github.com/rico345100","followers_url":"https://api.github.com/users/rico345100/followers","following_url":"https://api.github.com/users/rico345100/following{/other_user}","gists_url":"https://api.github.com/users/rico345100/gists{/gist_id}","starred_url":"https://api.github.com/users/rico345100/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rico345100/subscriptions","organizations_url":"https://api.github.com/users/rico345100/orgs","repos_url":"https://api.github.com/users/rico345100/repos","events_url":"https://api.github.com/users/rico345100/events{/privacy}","received_events_url":"https://api.github.com/users/rico345100/received_events","type":"User","site_admin":false},"created_at":"2016-12-31T05:23:15Z","updated_at":"2016-12-31T05:23:15Z","body":"Hello, @Obvio!\r\nI just added new option \"rename\" which can change the file name before upload starts!\r\n\r\n```javascript\r\nvar count = 0;\r\nvar uploader = new SocketIOFile(socket, {\r\n\toverwrite: false\r\n\trename: function(filename) {\r\n\t\tvar split = filename.split('.');\t// split filename by .(extension)\r\n\t\tvar fname = split[0];\t// filename without extension\r\n\t\tvar ext = split[1];\r\n\r\n\t\treturn `${fname}_${count++}.${ext}`;\r\n\t}\r\n});\r\n```\r\n\r\nYou can now change the file name using 'rename' option, returning value will be the name of a file. Enjoy ;)\r\n\r\nOh, don't forget to update socket.io-file to 2.0.1 !"}}
{"actor":{"display_login":"rico345100"}}