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.
JSZip.defaultsis a static property on the exportedJSZipfunction. 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-adjustedDateset 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
JSZipinstance 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.defaultswithout removing it. Deprecation should include documenting it as deprecated, a@deprecatedannotation 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.