JSPM

stringencoding

0.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q32011F
  • License Apache License 2.0

Encode to/from Typed Array buffers

Package Exports

  • stringencoding

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (stringencoding) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

stringencoding

basic usage

// encode a string into a typed array given an encoding
var uint8array = TextEncoder(encoding).encode(string);

// decode typed array into a string
var string = TextDecoder(encoding).decode(uint8array);

streaming decode

var string = '';
var decoder = TextDecoder(encoding), buffer;

while (buffer = next_chunk()) {
    string += decoder.decode(buffer, { stream:true });
}

string += decoder.decode(); // finish the stream

install

npm install stringencoding