utf16le-encoding
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

UTF16le

UTF16-le encoding, a.k.a. UCS2 encoding, an encoding you probably should never use.

Install

npm install --save utf16le-encoding

Usage

import UTF16le from 'utf16le-encoding';

// Uint8Array encoding & decoding

{
  const raw = 'Hello 😃';
  const uint8 = new TextEncoder ().encode ( raw );
  console.log ( uint8 ); // => Uint8Array(10) [ 72, 101, 108, 108, 111,  32, 240, 159, 152, 131 ]

  const encoded = UTF16le.encode ( uint8 );
  console.log ( encoded ); // => '效汬鿰莘'

  const decoded = UTF16le.decode ( encoded );
  console.log ( decoded ); // => // => Uint8Array(10) [ 72, 101, 108, 108, 111,  32, 240, 159, 152, 131 ]
}

License

MIT © Fabio Spampinato

Package Sidebar

Install

npm i utf16le-encoding

Weekly Downloads

15

Version

2.0.1

License

none

Unpacked Size

7.74 kB

Total Files

13

Last publish

Collaborators

  • fabiospampinato