Renamed parserFile to getModelFolderContents

This commit is contained in:
Alexander Cerutti
2021-10-14 18:20:43 +02:00
parent 5ce12fda91
commit 7879a32dc1
2 changed files with 3 additions and 7 deletions

View File

@@ -1,9 +1,9 @@
import FieldsArray from "./FieldsArray"; import FieldsArray from "./FieldsArray";
import Bundle, { filesSymbol } from "./Bundle"; import Bundle, { filesSymbol } from "./Bundle";
import getModelFolderContents from "./getModelFolderContents";
import * as Schemas from "./schemas"; import * as Schemas from "./schemas";
import * as Signature from "./Signature"; import * as Signature from "./Signature";
import * as Strings from "./StringsUtils"; import * as Strings from "./StringsUtils";
import { getModelFolderContents } from "./parser";
import { Stream } from "stream"; import { Stream } from "stream";
import { processDate } from "./utils"; import { processDate } from "./utils";

View File

@@ -11,7 +11,7 @@ import { promises as fs } from "fs";
* filePaths and the relative buffer * filePaths and the relative buffer
*/ */
export async function getModelFolderContents( export default async function getModelFolderContents(
model: string, model: string,
): Promise<{ [filePath: string]: Buffer }> { ): Promise<{ [filePath: string]: Buffer }> {
try { try {
@@ -58,12 +58,8 @@ export async function getModelFolderContents(
); );
} else if (err.syscall === "scandir") { } else if (err.syscall === "scandir") {
// directory reading failed // directory reading failed
const pathContents = (err.path as string).split(/(\/|\\\?)/);
throw new Error( throw new Error(
formatMessage( formatMessage(ERROR.MODELF_FILE_NOT_FOUND, err.path),
ERROR.MODELF_FILE_NOT_FOUND,
pathContents[pathContents.length - 1],
),
); );
} }
} }