npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wanco

v0.1.1

Published

wanco stands for WAsm text eNCOder.

Downloads

4

Readme

wanco

wanco stands for WAsm text eNCOder.

これなに / About

ブラウザ上で文字を別のエンコーディングに変換するやつ。

The one converting strings to other text encoding.

サポートしているエンコーディング / Supported Encoding

  • UTF-8
  • Shift_JIS
  • EUC-JP

コンセプト / Concept

CSV の作成など、Web ブラウザ上のみで巨大な UTF-8 形式の文字列を Shift_JIS に変換することを想定。

This assumed to converting huge UTF-8 format strings to Shift_JIS in the Web browser alone, e.g., for creating CSV files.

との比較は下記

Comparation bellow

| | encoding.js | Encoding API | wanco🐶 | | -------------- | :--------------------------: | :--------------------------: | :----------------------: | | Implementation | JavaScript | Native | WebAssembly | | Encode To | UTF-8, Shift_JIS, EUC-JP ... | UTF-8 | UTF-8, Shift_JIS, EUC-JP | | Decode From | UTF-8, Shift_JIS, EUC-JP ... | UTF-8, Shift_JIS, EUC-JP ... | ー |

インストール / Install

npm install --save wanco

使い方 / How to Use

import init, { encode } from "wanco";
init().then(() => {
  const encoded = encode(content, "shift_jis");
  // Encoded bytes.(number[])
  console.log(encoded.bytes);
  // Text encoding name.(string)
  console.log(encoded.encoding);
  // Whether having any unmappable characters.(bool)
  console.log(encoded.has_unmappable);
});

例 / Example

import init, { encode } from "wanco";
export const downloadAsCSV = (content: string): void => {
  init().then(() => {
    // Specify text encoding.
    const encoded = encode(content, "shift_jis");
    // "bytes" property has encoded codes.
    // Use new Uint8Array() to save through Blob.
    const data = new Uint8Array(encoded.bytes);
    const blob = new Blob([data], { type: "text/csv" });
    const anchor = document.createElement("a");
    const blobURL = URL.createObjectURL(blob);
    anchor.href = blobURL;
    anchor.click();
    URL.revokeObjectURL(blobURL);
  });
};

開発 / Development

wanco はwasm-packを利用して作成されています。

wanco is build using wasm-pack.

ローカルでの実行 / Run locally

wasm-pack build --target web
python3 -m http.server 8080

http://localhost:8080/へアクセスし、デモページであるindex.htmlを開く

Access http://localhost:8080/ to open index.html. (demo page file)

ビルド / Build

wasm-pack build --target web

パッケージ / Packaging

wasm-pack pack

テスト / Test

wasm-pack test --firefox --headless