diff --git a/README.md b/README.md new file mode 100644 index 0000000..4877484 --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ +This is a fast polyfill for `[TextEncoder][1]` and `TextDecoder[2]`. + +It is fast partially as it does not support any encodings aside UTF-8 (and note that natively, only `TextDecoder` supports alternative encodings). + +[1]: https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder +[2]: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder + +# Usage + +Include the minified inside a `script` tag or as an ES6 Module for its side-effects. +It will create `TextEncoder` and `TextDecoder` if the symbols are missing on `window`. + +```html + + + +**Note**: Always include `text.min.js`, as it's compiled to ES5 for older environments. + +## Node + +Install via NPM or Yarn: + +```bash +yarn add fast-text-encoding +``` + +And then import purely for side effects: + +```js +require('fast-text-encoding'); +``` + +# Supports + +Built for IE11, Edge and Node environments. +Not required for Chrome, Firefox etc, which have native implementations. + +# Release + +Compile code with [Closure Compiler](https://closure-compiler.appspot.com/home). + +``` +// ==ClosureCompiler== +// @compilation_level ADVANCED_OPTIMIZATIONS +// @output_file_name text.min.js +// ==/ClosureCompiler== + +// code here +``` \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..14bfec4 --- /dev/null +++ b/package.json @@ -0,0 +1,9 @@ +{ + "name": "fast-text-encoding", + "version": "1.0.0", + "description": "Fast polyfill for TextEncoder and TextDecoder, only supports utf-8 Edit", + "main": "text.min.js", + "repository": "git@github.com:samthor/text.git", + "author": "Sam Thorogood ", + "license": "Apache-2" +}