Skip to content

Commit b29231e

Browse files
BYKCopilot
andauthored
much better readable.from() usage
Co-authored-by: Copilot <[email protected]>
1 parent 3fb2422 commit b29231e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/mdx.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,15 @@ async function readCacheFile<T>(file: string): Promise<T> {
7272
}
7373

7474
async function writeCacheFile(file: string, data: string) {
75+
const bufferData = Buffer.from(data);
7576
await pipeline(
76-
Readable.from(data),
77+
Readable.from(bufferData),
7778
createBrotliCompress({
7879
chunkSize: 32 * 1024,
7980
params: {
8081
[zlibConstants.BROTLI_PARAM_MODE]: zlibConstants.BROTLI_MODE_TEXT,
8182
[zlibConstants.BROTLI_PARAM_QUALITY]: CACHE_COMPRESS_LEVEL,
82-
[zlibConstants.BROTLI_PARAM_SIZE_HINT]: data.length,
83+
[zlibConstants.BROTLI_PARAM_SIZE_HINT]: bufferData.length,
8384
},
8485
}),
8586
createWriteStream(file)

0 commit comments

Comments
 (0)