├── CONTRIBUTING.md ├── DESIGN.md ├── LICENSE ├── README.md └── text-encode-transform.js /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribute 2 | 3 | We'd love to accept your patches and contributions to this project. If your 4 | patch fixes bugs or changes behaviour, please include a test for the change. 5 | 6 | Code style broadly follows the [Google JavaScript Style 7 | Guide](https://google.github.io/styleguide/javascriptguide.xml). Javascript 8 | dialect is ES6. Lines are 80 columns, indents are 2 spaces. Use single-quotes 9 | for strings. 10 | 11 | ## Contributor License Agreement 12 | 13 | Contributions to this project must be accompanied by a Contributor License 14 | Agreement. You (or your employer) retain the copyright to your contribution, 15 | this simply gives us permission to use and redistribute your contributions as 16 | part of the project. Head over to to see 17 | your current agreements on file or to sign a new one. 18 | 19 | You generally only need to submit a CLA once, so if you've already submitted one 20 | (even if it was for a different project), you probably don't need to do it 21 | again. 22 | 23 | ## Code reviews 24 | 25 | All submissions, including submissions by project members, require review. We 26 | use GitHub pull requests for this purpose. Consult [GitHub Help] for more 27 | information on using pull requests. 28 | 29 | [GitHub Help]: https://help.github.com/articles/about-pull-requests/ 30 | -------------------------------------------------------------------------------- /DESIGN.md: -------------------------------------------------------------------------------- 1 | # Text Encoder Streaming Polyfill 2 | ricea@chromium.org - last updated 31 October 2018 3 | 4 | The existing TextEncoder and TextDecoder APIs provide conversions between bytes 5 | and strings for Javascript in the browser. The Streams API is an API for 6 | processing streams of data in the browser. It is proposed to create new 7 | TextEncoderStream and TextDecoderStream APIs so that text encoding and decoding 8 | can be done with the Streams API. 9 | 10 | ## Motivation 11 | 12 | Integration between the Streams API and the Encoding API is useful, however it 13 | is not implemented in browsers yet. This polyfill provides a bridge to allow 14 | using the new APIs in the meantime. 15 | 16 | ## Requirements & Scope 17 | 18 | ### Requirements 19 | - The polyfill must work in browsers that have implementations of the 20 | prerequisite APIs. 21 | - The polyfill should implement the expected API with the expected semantics. 22 | - The polyfill should provide acceptable performance. 23 | - The polyfill should be convenient to use. 24 | - The polyfill should function within Workers as well as document 25 | environments. 26 | - The polyfill should be close enough to the intended standard to function 27 | identically in non-pathological cases. 28 | 29 | ### Non-requirements 30 | - The polyfill doesn't need to support environments that do not have the 31 | TextEncoder and TextDecoder APIs. 32 | - The polyfill doesn't need to support environments that do not support 33 | ReadableStream and WritableStream. 34 | - The polyfill doesn't need to provide the maximum possible performance. 35 | - The polyfill doesn't need to support versions of JavaScript prior to ES6. 36 | - The polyfill doesn't need to have perfect fidelity to the standard. 37 | 38 | ## Assumptions 39 | 40 | - All the browsers that meet the other requirements will support ES6. 41 | - The polyfill can be modified as standardisation proceeds. 42 | 43 | ## Detailed Design 44 | 45 | ### Interface 46 | 47 | The polyfill will be used by importing it into the page using a `