text-encoding
Advanced tools
Comparing version 0.5.2 to 0.5.5
15
index.js
@@ -1,14 +0,3 @@ | ||
// Copyright 2014 Joshua Bell. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// This is free and unencumbered software released into the public domain. | ||
// See LICENSE.md for more information. | ||
@@ -15,0 +4,0 @@ var encoding = require("./lib/encoding.js"); |
@@ -5,5 +5,13 @@ { | ||
"contributors": [ | ||
"Rick Eyre <rick.eyre@outlook.com>" | ||
"Joshua Bell <inexorabletash@gmail.com>", | ||
"Rick Eyre <rick.eyre@outlook.com>", | ||
"Eugen Podaru <eugen.podaru@live.com>", | ||
"Filip Dupanović <filip.dupanovic@gmail.com>", | ||
"Anne van Kesteren <annevk@annevk.nl>", | ||
"Author: Francis Avila <francisga@gmail.com>", | ||
"Michael J. Ryan <tracker1@gmail.com>", | ||
"Pierre Queinnec <pierre@queinnec.org>", | ||
"Zack Weinberg <zackw@panix.com>" | ||
], | ||
"version": "0.5.2", | ||
"version": "0.5.5", | ||
"description": "Polyfill for the Encoding Living Standard's API.", | ||
@@ -28,3 +36,4 @@ "main": "index.js", | ||
}, | ||
"homepage": "https://github.com/inexorabletash/text-encoding" | ||
"homepage": "https://github.com/inexorabletash/text-encoding", | ||
"license": "Unlicense" | ||
} |
text-encoding | ||
============== | ||
This is a polyfill for the [Encoding Living Standard](http://encoding.spec.whatwg.org/) | ||
This is a polyfill for the [Encoding Living Standard](https://encoding.spec.whatwg.org/) | ||
API for the Web, allowing encoding and decoding of textual data to and from Typed Array | ||
@@ -60,3 +60,3 @@ buffers for binary data in JavaScript. | ||
var string = "", decoder = TextDecoder(encoding), buffer; | ||
while (buffer = next_chunk()) { | ||
while (buffer = next_chunk()) { | ||
string += decoder.decode(buffer, {stream:true}); | ||
@@ -74,7 +74,7 @@ } | ||
(Some encodings may be supported under other names, e.g. ascii, iso-8859-1, etc. | ||
See [Encoding](http://encoding.spec.whatwg.org/) for additional labels for each encoding.) | ||
See [Encoding](https://encoding.spec.whatwg.org/) for additional labels for each encoding.) | ||
Encodings other than **utf-8**, **utf-16le** and **utf-16be** require an additional | ||
`encoding-indexes.js` file to be included. It is rather large | ||
(596kB uncompressed, 188kB gzipped); portions may be deleted if | ||
Encodings other than **utf-8**, **utf-16le** and **utf-16be** require an additional | ||
`encoding-indexes.js` file to be included. It is rather large | ||
(596kB uncompressed, 188kB gzipped); portions may be deleted if | ||
support for some encodings is not required. | ||
@@ -96,11 +96,14 @@ | ||
natively supports the TextEncoder API natively, since the polyfill won't be used! | ||
You'd need to fork and modify the polyfill to... not be a polyfill. | ||
You can force the polyfill to be used by using this before the polyfill: | ||
```html | ||
<script> | ||
window.TextEncoder = window.TextDecoder = null; | ||
</script> | ||
``` | ||
To support the legacy encodings (which may be stateful), the TextEncoder `encode()` | ||
method accepts an optional dictionary and `stream` option, | ||
method accepts an optional dictionary and `stream` option, | ||
e.g. `encoder.encode(string, {stream: true});` This is not needed for the | ||
stateless UTF encodings since the input is always in complete code points. | ||
The polyfill also allows construction of encoder/decoder objects without the | ||
`new` keyword. (This non-standard behavior is supported for constructing DOM | ||
objects in Firefox but not other browsers.) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
637111
6
4979
107