Skip to content

Commit 085d7e7

Browse files
committed
7.4.0
1 parent cb0f071 commit 085d7e7

8 files changed

Lines changed: 263 additions & 330 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# [7.4.0](https://github.com/Brooooooklyn/snappy/compare/v7.3.3...v7.4.0) (2026-08-12)
2+
3+
4+
### Features
5+
6+
* add framed Snappy streaming APIs ([#351](https://github.com/Brooooooklyn/snappy/issues/351)) ([9d1dcdc](https://github.com/Brooooooklyn/snappy/commit/9d1dcdc3b36274adc5fe4f474ebe3952d464be2c))
17
## [7.3.3](https://github.com/Brooooooklyn/snappy/compare/v7.3.2...v7.3.3) (2025-09-11)
28

39
### Bug Fixes

index.d.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,7 @@ export declare class Decompressor {
4747
finish(): Promise<Buffer>
4848
}
4949

50-
export declare function compress(
51-
input: string | Uint8Array,
52-
options?: EncOptions | undefined | null,
53-
signal?: AbortSignal | undefined | null,
54-
): Promise<Buffer>
50+
export declare function compress(input: string | Uint8Array, options?: EncOptions | undefined | null, signal?: AbortSignal | undefined | null): Promise<Buffer>
5551

5652
/**
5753
* Compress a `ReadableStream<Uint8Array>` into a framed Snappy byte stream.
@@ -85,11 +81,7 @@ export interface EncOptions {
8581
copyOutputData?: boolean
8682
}
8783

88-
export declare function uncompress(
89-
input: string | Uint8Array,
90-
options?: DecOptions | undefined | null,
91-
signal?: AbortSignal | undefined | null,
92-
): Promise<string | Buffer>
84+
export declare function uncompress(input: string | Uint8Array, options?: DecOptions | undefined | null, signal?: AbortSignal | undefined | null): Promise<string | Buffer>
9385

9486
/**
9587
* Decompress a framed Snappy `ReadableStream<Uint8Array>` into plaintext.
@@ -100,7 +92,4 @@ export declare function uncompress(
10092
*/
10193
export declare function uncompressStream(input: ReadableStream<Uint8Array>): ReadableStream<Buffer>
10294

103-
export declare function uncompressSync(
104-
input: string | Uint8Array,
105-
options?: DecOptions | undefined | null,
106-
): string | Buffer
95+
export declare function uncompressSync(input: string | Uint8Array, options?: DecOptions | undefined | null): string | Buffer

index.js

Lines changed: 106 additions & 252 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "snappy",
3-
"version": "7.3.3",
3+
"version": "7.4.0",
44
"description": "Fastest Snappy compression library in Node.js",
55
"main": "main.js",
66
"types": "main.d.ts",

snappy.wasi-browser.js

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import {
77
} from '@napi-rs/wasm-runtime'
88
import { createContext as __emnapiCreateContext } from '@emnapi/runtime'
99

10+
11+
1012
const __wasi = new __WASI({
1113
version: 'preview1',
1214
})
@@ -31,7 +33,10 @@ const __sharedMemory = new WebAssembly.Memory({
3133
shared: true,
3234
})
3335
const __asyncWorkPoolSize = 4
34-
const __workerPoolSize = Math.max(2, globalThis.navigator?.hardwareConcurrency ?? 4)
36+
const __workerPoolSize = Math.max(
37+
2,
38+
globalThis.navigator?.hardwareConcurrency ?? 4,
39+
)
3540

3641
let __emnapiContext
3742

@@ -46,15 +51,17 @@ let __emnapiWasmEnvCleanupDrained = false
4651
let __emnapiWasmEnvCleanupDrainPromise
4752
let __wasiDisposed = false
4853
let __wasiDisposePromise
49-
let __completeWasiDisposal = function () {}
54+
let __completeWasiDisposal = function() {}
5055
// Overridden by loader flavors that have a last-resort reclaim for a rollback
5156
// that stopped short of destroying the context. See
5257
// `__rollbackWasiInitialization`.
53-
let __retainWasiRollbackForRetry = function () {}
58+
let __retainWasiRollbackForRetry = function() {}
5459

5560
function __isThenable(value) {
5661
return (
57-
value !== null && (typeof value === 'object' || typeof value === 'function') && typeof value.then === 'function'
62+
value !== null &&
63+
(typeof value === 'object' || typeof value === 'function') &&
64+
typeof value.then === 'function'
5865
)
5966
}
6067

@@ -75,9 +82,15 @@ function __attachCleanupErrors(error, cleanupErrors) {
7582
if (cleanupErrors.length === 0) {
7683
return error
7784
}
78-
const cleanupError = __createCleanupError(cleanupErrors, 'WASI binding cleanup failed')
85+
const cleanupError = __createCleanupError(
86+
cleanupErrors,
87+
'WASI binding cleanup failed',
88+
)
7989
try {
80-
if (error && (typeof error === 'object' || typeof error === 'function')) {
90+
if (
91+
error &&
92+
(typeof error === 'object' || typeof error === 'function')
93+
) {
8194
if (error.cause === undefined) {
8295
error.cause = cleanupError
8396
if (error.cause === cleanupError) {
@@ -96,7 +109,10 @@ function __attachCleanupErrors(error, cleanupErrors) {
96109
}
97110
}
98111
} catch {}
99-
const aggregate = __createCleanupError([error, cleanupError], 'WASI binding initialization and cleanup failed')
112+
const aggregate = __createCleanupError(
113+
[error, cleanupError],
114+
'WASI binding initialization and cleanup failed',
115+
)
100116
try {
101117
aggregate.cause = error
102118
} catch {}
@@ -207,7 +223,9 @@ function __drainWasmEnvCleanup() {
207223
return
208224
}
209225
}
210-
const limit = observable ? __WASM_ENV_CLEANUP_DRAIN_TURNS : __WASM_ENV_CLEANUP_BLIND_DRAIN_TURNS
226+
const limit = observable
227+
? __WASM_ENV_CLEANUP_DRAIN_TURNS
228+
: __WASM_ENV_CLEANUP_BLIND_DRAIN_TURNS
211229
const drainPromise = (async () => {
212230
let queued = 0
213231
for (let turn = 0; turn < limit; turn++) {
@@ -330,7 +348,10 @@ function __terminateWasiWorkers() {
330348

331349
const finish = () => {
332350
if (cleanupErrors.length > 0) {
333-
throw __createCleanupError(cleanupErrors, 'Failed to terminate WASI workers')
351+
throw __createCleanupError(
352+
cleanupErrors,
353+
'Failed to terminate WASI workers',
354+
)
334355
}
335356
}
336357
return pending.length > 0 ? Promise.all(pending).then(finish) : finish()
@@ -536,7 +557,7 @@ let __napiModule
536557
try {
537558
__emnapiContext = __emnapiCreateContext({ autoDestroy: false })
538559
__emnapiContext.suppressDestroy()
539-
560+
540561
;({
541562
instance: __napiInstance,
542563
module: __wasiModule,
@@ -553,6 +574,7 @@ try {
553574
})
554575
__wasiWorkers.add(worker)
555576

577+
556578
return worker
557579
},
558580
overwriteImports(importObject) {

0 commit comments

Comments
 (0)