Skip to content

Commit

Permalink
npm info
Browse files Browse the repository at this point in the history
  • Loading branch information
samthor committed Sep 1, 2017
1 parent ffaa502 commit 51dff6f
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
<script src="node_modules/fast-text-encoding/text.min.js"></script>
<script type="module">
import './node_modules/fast-text-encoding/text.min.js';
// do something with TextEncoder
</script>

**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
```
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": "[email protected]:samthor/text.git",
"author": "Sam Thorogood <[email protected]>",
"license": "Apache-2"
}

0 comments on commit 51dff6f

Please sign in to comment.