From 6be6d9099c7b37e1b510b3730ec2cac3563e4c6c Mon Sep 17 00:00:00 2001 From: Refringe Date: Thu, 9 Jan 2025 15:28:33 -0500 Subject: [PATCH] Removes buffer-crc32 (#1058) Remove `buffer-crc32` dependency and use `crc32` from `node:zlib`. Co-authored-by: Chomp <27521899+chompDev@users.noreply.github.com> --- project/package.json | 1 - project/src/utils/HashUtil.ts | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/project/package.json b/project/package.json index 30148481..bd3debaa 100644 --- a/project/package.json +++ b/project/package.json @@ -36,7 +36,6 @@ }, "dependencies": { "atomically": "2.0.3", - "buffer-crc32": "~1.0", "date-fns": "~3.6", "date-fns-tz": "~3.1", "fs-extra": "11.2.0", diff --git a/project/src/utils/HashUtil.ts b/project/src/utils/HashUtil.ts index a9e3deb0..9342cf35 100644 --- a/project/src/utils/HashUtil.ts +++ b/project/src/utils/HashUtil.ts @@ -1,6 +1,6 @@ import crypto, { webcrypto } from "node:crypto"; +import { crc32 } from "node:zlib"; import { TimeUtil } from "@spt/utils/TimeUtil"; -import crc32 from "buffer-crc32"; import { mongoid } from "mongoid-js"; import { inject, injectable } from "tsyringe"; import { FileSystemSync } from "./FileSystemSync"; @@ -38,7 +38,7 @@ export class HashUtil { } public generateCRC32ForFile(filePath: string): number { - return crc32.unsigned(this.fileSystemSync.read(filePath)); + return crc32(this.fileSystemSync.read(filePath)); } /** * Create a hash for the data parameter