Socket
Socket
Sign inDemoInstall

@stardazed/streams-text-encoding

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stardazed/streams-text-encoding

Implementation of text encoder and decoder streams


Version published
Weekly downloads
636
increased by2.42%
Maintainers
1
Weekly downloads
 
Created
Source

@stardazed/streams-text-encoding

This package provides an implementation of the TextEncoderStream and TextDecoderStream types from the Encoding Standard.

⚠️ Important: this is NOT a polyfill. The classes are just normal exports.

👉 If you want an all-in-one polyfill for streams, fetch interop and text encoding streams, use the ⭐️Stardazed streams polyfill⭐️!

Installation

npm install @stardazed/streams-text-encoding
pnpm install @stardazed/streams-text-encoding
yarn add @stardazed/streams-text-encoding

Usage

import { TextEncoderStream, TextDecoderStream } from "@stardazed/streams-text-encoding";

// encode
const textReadable = /* Get a readable stream that produces string chunks */;
textReadable
    .pipeThrough(new TextEncoderStream()) // no options available
    .pipeTo(byteWritable);

// decode
const byteReadable = /* Get a readable stream that produces binary chunks */;
const decoder = new TextDecoderStream(encoding, options);
byteReadable
    .pipeThrough(decoder)
    .pipeTo(textWritable);

The options passed to the TextDecoderStream are identical to those passed to the TextDecoder class. See MDN's docs for more.

© 2018 by Arthur Langereis - @zenmumbler

License

MIT

FAQs

Package last updated on 18 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc