fix: replace require('crypto') with ESM import in SSTable
SSTable.calculateChecksum() used require('crypto') which breaks in ESM
environments and Bun. Replace with top-level import { createHash } from
'node:crypto' — SSTable is Node-only (LSM-tree filesystem storage) so
a direct node:crypto import is appropriate.
This commit is contained in:
parent
027607688f
commit
239a4da835
1 changed files with 2 additions and 2 deletions
|
|
@ -14,6 +14,7 @@
|
|||
* - Footer: checksum, stats
|
||||
*/
|
||||
|
||||
import { createHash } from 'node:crypto'
|
||||
import { encode as defaultEncode, decode as defaultDecode } from '@msgpack/msgpack'
|
||||
import { BloomFilter, SerializedBloomFilter } from './BloomFilter.js'
|
||||
|
||||
|
|
@ -326,8 +327,7 @@ export class SSTable {
|
|||
* Simple but effective: hash of all sourceIds concatenated
|
||||
*/
|
||||
private calculateChecksum(entries: SSTableEntry[]): string {
|
||||
const crypto = require('crypto')
|
||||
const hash = crypto.createHash('sha256')
|
||||
const hash = createHash('sha256')
|
||||
|
||||
for (const entry of entries) {
|
||||
hash.update(entry.sourceId)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue