packages/Chatdown/lib/index.js
async function readAttachmentFile(fileLocation, contentType) {
    let resolvedFileLocation = path.join(workingDirectory, fileLocation);
    let exists = fs.pathExistsSync(resolvedFileLocation);

    // fallback to cwd
    if (!exists) {
        resolvedFileLocation = path.resolve(fileLocation);
    }
    // Throws if the fallback does not exist.
    if (contentType.includes('json') || isCard(contentType)) {
        return fs.readJsonSync(resolvedFileLocation);
    } else {
        return fs.readFileSync(resolvedFileLocation);
    }
}
async function readAttachmentFile(fileLocation, contentType) {
    let resolvedFileLocation = path.join(workingDirectory, fileLocation);
    let exists = fs.pathExistsSync(resolvedFileLocation);

    // fallback to cwd
    if (!exists) {
        resolvedFileLocation = path.resolve(fileLocation);
    }
    // Throws if the fallback does not exist.
    if (contentType.includes('json') || isCard(contentType)) {
        return fs.readJsonSync(resolvedFileLocation);
    } else {
        return fs.readFileSync(resolvedFileLocation);
    }
}
async function readAttachmentFile ( fileLocation , contentType ) { let resolvedFileLocation = path . join ( workingDirectory , fileLocation ) ; let exists = fs . pathExistsSync ( resolvedFileLocation ) ; // fallback to cwd if ( ! exists ) { resolvedFileLocation = path . resolve ( fileLocation ) ; } // Throws if the fallback does not exist. if ( contentType . includes ( 'json' ) || isCard ( contentType ) ) { return fs . readJsonSync ( resolvedFileLocation ) ; } else { return fs . readFileSync ( resolvedFileLocation ) ; } }
Utility function for reading the attachment

@param fileLocation
@param contentType
@returns {*}
Utility function for reading the attachment