Skip to content

Commit

Permalink
Enhanced transform functionality to include compression
Browse files Browse the repository at this point in the history
  • Loading branch information
mindflowgo committed Nov 4, 2024
1 parent fed8bf2 commit 3575b77
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,13 @@ async function getCompressedContent(
const content = await fs.readFile(file)

const data = await new Promise<Buffer>((resolve, reject) => {
zlib[transform.compress](content, (err: Error | null, result: Buffer) => {
if (err) reject(err)
else resolve(result)
})
zlib[transform.compress || 'gzip'](
content,
(err: Error | null, result: Buffer) => {
if (err) reject(err)
else resolve(result)
}
)
})

return { destExt, data }
Expand Down

0 comments on commit 3575b77

Please sign in to comment.