From 7879a32dc16fc690bc988a0f94c21ed61cec891c Mon Sep 17 00:00:00 2001 From: Alexander Cerutti Date: Thu, 14 Oct 2021 18:20:43 +0200 Subject: [PATCH] Renamed parserFile to getModelFolderContents --- src/PKPass.ts | 2 +- src/{parser.ts => getModelFolderContents.ts} | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) rename src/{parser.ts => getModelFolderContents.ts} (92%) diff --git a/src/PKPass.ts b/src/PKPass.ts index 3bd1069..0759387 100644 --- a/src/PKPass.ts +++ b/src/PKPass.ts @@ -1,9 +1,9 @@ import FieldsArray from "./FieldsArray"; import Bundle, { filesSymbol } from "./Bundle"; +import getModelFolderContents from "./getModelFolderContents"; import * as Schemas from "./schemas"; import * as Signature from "./Signature"; import * as Strings from "./StringsUtils"; -import { getModelFolderContents } from "./parser"; import { Stream } from "stream"; import { processDate } from "./utils"; diff --git a/src/parser.ts b/src/getModelFolderContents.ts similarity index 92% rename from src/parser.ts rename to src/getModelFolderContents.ts index 085a23e..4186325 100644 --- a/src/parser.ts +++ b/src/getModelFolderContents.ts @@ -11,7 +11,7 @@ import { promises as fs } from "fs"; * filePaths and the relative buffer */ -export async function getModelFolderContents( +export default async function getModelFolderContents( model: string, ): Promise<{ [filePath: string]: Buffer }> { try { @@ -58,12 +58,8 @@ export async function getModelFolderContents( ); } else if (err.syscall === "scandir") { // directory reading failed - const pathContents = (err.path as string).split(/(\/|\\\?)/); throw new Error( - formatMessage( - ERROR.MODELF_FILE_NOT_FOUND, - pathContents[pathContents.length - 1], - ), + formatMessage(ERROR.MODELF_FILE_NOT_FOUND, err.path), ); } }