diff --git a/package.json b/package.json index ec07fb5..0cbcaef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@saucer-dev/cli", - "version": "6.1.0", + "version": "6.1.1", "license": "MIT", "description": "🛸 A command-line utility for saucer", "author": "Curve (https://github.com/Curve)", @@ -28,7 +28,7 @@ "build" ], "dependencies": { - "base62": "^2.0.2", + "base-x": "^5.0.0", "commander": "^12.1.0", "eslint-plugin-neverthrow": "^1.1.4", "eta": "^3.5.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e31cdfa..6c6c42f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,9 +8,9 @@ importers: .: dependencies: - base62: - specifier: ^2.0.2 - version: 2.0.2 + base-x: + specifier: ^5.0.0 + version: 5.0.0 commander: specifier: ^12.1.0 version: 12.1.0 @@ -247,9 +247,8 @@ packages: balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} - base62@2.0.2: - resolution: {integrity: sha512-FLoAQzMpmdDBei0u7fUAQzVCxoH6g4pueCIuGDoCZVZCiCeW4qTKpEGB79jkS15VB8b/5EIHc4R+WSKTByM+dw==} - engines: {node: '>=6.0.0'} + base-x@5.0.0: + resolution: {integrity: sha512-sMW3VGSX1QWVFA6l8U62MLKz29rRfpTlYdCqLdpLo1/Yd4zZwSbnUaDfciIAowAqvq7YFnWq9hrhdg1KYgc1lQ==} brace-expansion@1.1.11: resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} @@ -914,7 +913,7 @@ snapshots: balanced-match@1.0.2: {} - base62@2.0.2: {} + base-x@5.0.0: {} brace-expansion@1.1.11: dependencies: diff --git a/src/file.ts b/src/file.ts index e093649..e0195ed 100644 --- a/src/file.ts +++ b/src/file.ts @@ -1,4 +1,4 @@ -import base62 from "base62"; +import basex from "base-x"; import { exists } from "fs-extra"; import { lstat, readFile } from "fs/promises"; import mimes from "mime-types"; @@ -13,6 +13,8 @@ export interface File size: number; } +const base62 = basex("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); + export async function parse(absolute: string, relative: string): Promise> { if (!await exists(absolute)) @@ -40,7 +42,7 @@ export async function parse(absolute: string, relative: string): Promise x.charCodeAt(0)).join("")))}`; + const name = `f${base62.encode(Buffer.from(absolute))}`; const size = stream.value.byteLength; const data = [...stream.value].map(b => `0x${b.toString(16)}`).join(", ");