Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions nbt.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,9 @@ const hasBedrockLevelHeader = (data) =>
async function parseAs (data, type, options = {}) {
if (!(data instanceof Buffer)) throw new Error('Invalid argument: `data` must be a Buffer object')
if (hasGzipHeader(data)) {
data = await new Promise((resolve, reject) => {
zlib.gunzip(data, (error, uncompressed) => {
if (error) reject(error)
else resolve(uncompressed)
})
})
// Use sync to avoid uncaught async zlib errors from Node's C++ binding
// race condition during teardown. See nodejs/node#62325, nodejs/node#61202
data = zlib.gunzipSync(data)
}

protos[type].setVariable('noArraySizeCheck', options.noArraySizeCheck)
Expand Down
Loading