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), ); } }