温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/node/zlib/ZstdDecompress/setEncoding
点击访问原文链接

ZstdDecompress.setEncoding method | Node.js zlib module | Bun

ZstdDecompress.setEncoding method | Node.js zlib module | BunBuildDocsReferenceGuidesBlogDiscord/node:zlib/ZstdDecompress/setEncodingMsetEncoding

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/node:zlib/ZstdDecompress/setEncodingMsetEncoding

method

zlib.ZstdDecompress.setEncoding { assert.equal(typeof chunk, 'string'); console.log('Got %d characters of string data:', chunk.length); }); ```" data-algolia-static="false" data-algolia-merged="false" data-type="Method">setEncoding(encoding: BufferEncoding): this;The readable.setEncoding() method sets the character encoding for data read from the Readable stream.

By default, no encoding is assigned and stream data will be returned as Buffer objects. Setting an encoding causes the stream data to be returned as strings of the specified encoding rather than as Buffer objects. For instance, calling readable.setEncoding('utf8') will cause the output data to be interpreted as UTF-8 data, and passed as strings. Calling readable.setEncoding('hex') will cause the data to be encoded in hexadecimal string format.

The Readable stream will properly handle multi-byte characters delivered through the stream that would otherwise become improperly decoded if simply pulled from the stream as Buffer objects.

const readable = getReadableStreamSomehow(); readable.setEncoding('utf8'); readable.on('data', (chunk) => { assert.equal(typeof chunk, 'string'); console.log('Got %d characters of string data:', chunk.length); }); @param encodingThe encoding to use.

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San Francisco

We're hiring →

智能索引记录