{"action":"created","issue":{"url":"https://api.github.com/repos/slightlyoff/ServiceWorker/issues/452","labels_url":"https://api.github.com/repos/slightlyoff/ServiceWorker/issues/452/labels{/name}","comments_url":"https://api.github.com/repos/slightlyoff/ServiceWorker/issues/452/comments","events_url":"https://api.github.com/repos/slightlyoff/ServiceWorker/issues/452/events","html_url":"https://github.com/slightlyoff/ServiceWorker/issues/452","id":42370503,"number":452,"title":"Backpressure on fetch integrated with Streams","user":{"login":"yutakahirano","id":5187874,"avatar_url":"https://avatars.githubusercontent.com/u/5187874?v=3","gravatar_id":"","url":"https://api.github.com/users/yutakahirano","html_url":"https://github.com/yutakahirano","followers_url":"https://api.github.com/users/yutakahirano/followers","following_url":"https://api.github.com/users/yutakahirano/following{/other_user}","gists_url":"https://api.github.com/users/yutakahirano/gists{/gist_id}","starred_url":"https://api.github.com/users/yutakahirano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yutakahirano/subscriptions","organizations_url":"https://api.github.com/users/yutakahirano/orgs","repos_url":"https://api.github.com/users/yutakahirano/repos","events_url":"https://api.github.com/users/yutakahirano/events{/privacy}","received_events_url":"https://api.github.com/users/yutakahirano/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/slightlyoff/ServiceWorker/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/slightlyoff/ServiceWorker/labels/fetch","name":"fetch","color":"bfd4f2"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":101,"created_at":"2014-09-10T01:54:02Z","updated_at":"2015-01-30T07:10:44Z","closed_at":null,"body":"Imagine ReadaleStream is integrated with fetch. The most naive way is to add stream() method to Body interface.\r\n\r\n    interface Body {\r\n        ...\r\n      Promise<ReadableStream> stream();\r\n    };\r\n\r\nStreams is an API that enables the data producer to know that the consumer doesn't want the data and stop producing data. On the other hand, other data types (text, blob, ...) don't have such feature.\r\nMy question is, should the loader start loading body while the Body representation is undetermined?\r\n\r\n    fetch(request).then(function(res) {\r\n      return wait(longtime).then(function() {\r\n        return res.stream();\r\n      });\r\n    }).then(function(stream) {\r\n      // Here we have a readable stream.\r\n    });\r\n\r\nThe above code waits *longtime* and then demonstrates that it wants to get the body data via ReadableStream interface. Should the loader load the body data while waiting and use the internal buffer unlimitedly, or stop loading while the representation is undetermined?\r\n\r\nWe can provide that information explicitly when calling *fetch*, but I don't know if it's a good API."},"comment":{"url":"https://api.github.com/repos/slightlyoff/ServiceWorker/issues/comments/72162842","html_url":"https://github.com/slightlyoff/ServiceWorker/issues/452#issuecomment-72162842","issue_url":"https://api.github.com/repos/slightlyoff/ServiceWorker/issues/452","id":72162842,"user":{"login":"tyoshino","id":4511440,"avatar_url":"https://avatars.githubusercontent.com/u/4511440?v=3","gravatar_id":"","url":"https://api.github.com/users/tyoshino","html_url":"https://github.com/tyoshino","followers_url":"https://api.github.com/users/tyoshino/followers","following_url":"https://api.github.com/users/tyoshino/following{/other_user}","gists_url":"https://api.github.com/users/tyoshino/gists{/gist_id}","starred_url":"https://api.github.com/users/tyoshino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tyoshino/subscriptions","organizations_url":"https://api.github.com/users/tyoshino/orgs","repos_url":"https://api.github.com/users/tyoshino/repos","events_url":"https://api.github.com/users/tyoshino/events{/privacy}","received_events_url":"https://api.github.com/users/tyoshino/received_events","type":"User","site_admin":false},"created_at":"2015-01-30T07:10:44Z","updated_at":"2015-01-30T07:10:44Z","body":"I'd like to confirm if your opinion is the same as Anne regarding the following question:\r\n\r\n`fetch(req)`, `new Request(req)` and `cache.put(req, res)` fails if any of `fetch(req)`, `new Request(req)` and `cache.put(req, res)` has happened even after the operation is finished."}}