Skip to content

Deprecate JSZip.defaults #972

Description

@jonkoops

JSZip.defaults is a static property on the exported JSZip function. It has been there since before v1.0. When it was restored in f99696f, the commit message said it was undocumented and kept only because people might rely on it. It is part of the public API (#927 added TypeScript types), but it was never documented or presented as the supported way to configure JSZip.

Why people use it

People mutate it as a workaround (#690, #369), almost always JSZip.defaults.date. The usual pattern from #369 is a timezone-adjusted Date set once so that files and auto-created folders get consistent modification times when archives are extracted. Per-file { date } does not cover folders.

Changes apply to every JSZip instance in the process, not just the one being built. That is easy to leave in place by accident and does not match the rest of the API, which is scoped per zip and per call.

Proposal

Deprecate JSZip.defaults without removing it. Deprecation should include documenting it as deprecated, a @deprecated annotation in TypeScript, and a runtime warning when it is accessed or mutated.

Removal is out of scope for this issue and should be tracked separately once deprecation has had time to land.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    deprecationAPI or behavior marked for future removal

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions