ezshare-cli 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,7 +16,14 @@
16
16
  import { Transform } from 'node:stream';
17
17
  import { extname } from 'node:path';
18
18
  import { execSync } from 'node:child_process';
19
- import { compress, decompress } from 'simple-zstd';
19
+ // Dynamic import to handle CommonJS module from ES module context
20
+ let zstdModule = null;
21
+ async function getZstdModule() {
22
+ if (!zstdModule) {
23
+ zstdModule = await import('simple-zstd');
24
+ }
25
+ return zstdModule;
26
+ }
20
27
  // Protocol flags
21
28
  const FLAG_RAW = 0x00;
22
29
  const FLAG_COMPRESSED = 0x01;
@@ -150,6 +157,7 @@ export async function createCompressStream(shouldCompress = true) {
150
157
  ' Windows: choco install zstd');
151
158
  }
152
159
  // Get zstd compression stream
160
+ const { compress } = await getZstdModule();
153
161
  const zstdStream = await compress(COMPRESSION_LEVEL);
154
162
  // Track state
155
163
  let flagSent = false;
@@ -257,7 +265,8 @@ export async function createDecompressStream() {
257
265
  return callback(new Error('zstd is not installed but data is compressed'));
258
266
  }
259
267
  // Synchronously set up - decompress() returns Promise but we handle async carefully
260
- decompress()
268
+ getZstdModule()
269
+ .then(({ decompress }) => decompress())
261
270
  .then((stream) => {
262
271
  if (destroyed) {
263
272
  stream.destroy();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ezshare-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Secure P2P file transfer CLI with end-to-end encryption - No servers, no signups, just share",
5
5
  "type": "module",
6
6
  "bin": {