{"action":"created","issue":{"url":"https://api.github.com/repos/18F/urlsize/issues/5","labels_url":"https://api.github.com/repos/18F/urlsize/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/18F/urlsize/issues/5/comments","events_url":"https://api.github.com/repos/18F/urlsize/issues/5/events","html_url":"https://github.com/18F/urlsize/pull/5","id":59024443,"number":5,"title":"Make it modular","user":{"login":"shawnbot","id":113896,"avatar_url":"https://avatars.githubusercontent.com/u/113896?v=3","gravatar_id":"","url":"https://api.github.com/users/shawnbot","html_url":"https://github.com/shawnbot","followers_url":"https://api.github.com/users/shawnbot/followers","following_url":"https://api.github.com/users/shawnbot/following{/other_user}","gists_url":"https://api.github.com/users/shawnbot/gists{/gist_id}","starred_url":"https://api.github.com/users/shawnbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shawnbot/subscriptions","organizations_url":"https://api.github.com/users/shawnbot/orgs","repos_url":"https://api.github.com/users/shawnbot/repos","events_url":"https://api.github.com/users/shawnbot/events{/privacy}","received_events_url":"https://api.github.com/users/shawnbot/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-26T06:04:20Z","updated_at":"2015-02-26T06:20:56Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/18F/urlsize/pulls/5","html_url":"https://github.com/18F/urlsize/pull/5","diff_url":"https://github.com/18F/urlsize/pull/5.diff","patch_url":"https://github.com/18F/urlsize/pull/5.patch"},"body":"This is pretty much a complete rewrite of the whole shebang, now organized into a JS API in `index.js` and a CLI in `bin/urlsize.js`. The JS API looks like:\r\n\r\n* `urlsize(url, [options,] callback)` gets the size of `url` and calls the callback with an object with `url`, `size` (human-readable) and `length` (number of bytes) keys.\r\n* `urlsize.batch(urls, [options,] callback)` asynchronously gets the size of each URL in the Array `urls` and calls the callback with an array of URL objects as in `urlsize()`.\r\n* `urlsize.createReadStream([options])` returns a stream that runs each written chunk through `urlsize()`, asynchronously using `through2`.\r\n* `urlsize.createWriteStream([format])` returns a stream that formats URL objects as strings. The default format is `{size}\\t{url}`.\r\n\r\nI also reworked the CLI so that now `--stream` and providing `-` as the only positional argument have the same effect, and all combinations of input and output are compatible with the `--csv` and `--tsv` options. The tests all pass for me in node 0.12.0.\r\n\r\n@maxogden, I'd love your input. Thanks for the streams help!"},"comment":{"url":"https://api.github.com/repos/18F/urlsize/issues/comments/76128295","html_url":"https://github.com/18F/urlsize/pull/5#issuecomment-76128295","issue_url":"https://api.github.com/repos/18F/urlsize/issues/5","id":76128295,"user":{"login":"maxogden","id":39759,"avatar_url":"https://avatars.githubusercontent.com/u/39759?v=3","gravatar_id":"","url":"https://api.github.com/users/maxogden","html_url":"https://github.com/maxogden","followers_url":"https://api.github.com/users/maxogden/followers","following_url":"https://api.github.com/users/maxogden/following{/other_user}","gists_url":"https://api.github.com/users/maxogden/gists{/gist_id}","starred_url":"https://api.github.com/users/maxogden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxogden/subscriptions","organizations_url":"https://api.github.com/users/maxogden/orgs","repos_url":"https://api.github.com/users/maxogden/repos","events_url":"https://api.github.com/users/maxogden/events{/privacy}","received_events_url":"https://api.github.com/users/maxogden/received_events","type":"User","site_admin":false},"created_at":"2015-02-26T06:20:56Z","updated_at":"2015-02-26T06:20:56Z","body":"@mafintosh any other streams feedback you have on this?"}}