@opengis/fastify-table
Version:
core-plugins
14 lines (13 loc) • 556 B
JavaScript
import path from "node:path";
import providers from "./providers/index.js";
async function isFileExists(filePath, options = {}) {
const filename = path.basename(filePath);
// prefix
const prefix = (options.prefix === "date"
? new Date().toISOString().split("T")[0]
: null) || (options.prefix === "3s" ? filename.substring(0, 3) : "");
const relativePath = path.join(path.dirname(filePath), prefix, filename);
const fp = providers(options);
return fp.fileExists(relativePath, options);
}
export default isFileExists;