Skip to content

Bun cannot zip data larger than 160,000 bytes #253

@nakasyou

Description

@nakasyou

How to reproduce

  1. clone https://github.com/nakasyou/bun-fflate-160000
  2. run bun i
  3. run bun run index.ts

The problem

When executing the zip function in Bun, it fails with the following log message when its length is 160,000 or more:

294 |       newDat.set(dat, dict.length);
295 |       dat = newDat;
296 |       st.w = dict.length;
297 |     }
298 |   }
299 |   return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20 : 12 + opt.mem, pre, post, st);
                                                                                                                                 ^
TypeError: undefined is not an object (evaluating 'dat.length')
      at dopt (blob:a2b1f5c8-43da-413b-86ed-bbfba16ce28f:299:124)
      at deflateSync (blob:a2b1f5c8-43da-413b-86ed-bbfba16ce28f:301:10)
      at onmessage (blob:a2b1f5c8-43da-413b-86ed-bbfba16ce28f:305:16)
      at blob:a2b1f5c8-43da-413b-86ed-bbfba16ce28f:306:80

The zipSync function and Node.js do not produce an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions