Skip to content

非公式 / UnofficialCloudflare, Inc. 非提携。アカウント情報は入力しないでください。Not affiliated with Cloudflare, Inc. Do not enter Cloudflare credentials here.Official docsこのサイトについてプライバシー

StringDecoder

最終更新 Markdown で表示Agent セットアップ

node:string_decoder ↗ は、WHATWG 標準の TextEncoder および TextDecoder API より前に作られたレガシーなユーティリティモジュールです。多くの場合は、代わりに TextEncoder と TextDecoder を使ってください。StringDecoder が Workers ランタイムで使えるのは、主にこれに依存する既存の npm パッケージとの互換性のためです。StringDecoder には次のようにアクセスできます。

const { StringDecoder } = require("node:string_decoder");
const decoder = new StringDecoder("utf8");

const cent = Buffer.from([0xc2, 0xa2]);
console.log(decoder.write(cent));

const euro = Buffer.from([0xe2, 0x82, 0xac]);
console.log(decoder.write(euro));

詳細は Node.js の string_decoder ドキュメント ↗ を参照してください。

役に立ちましたか?