UNPKG

fetch-base64

Version:

A node package to retrieve fetch local or remote files in base64 encoding.

18 lines (14 loc) 284 B
const remoteRegex = /(https?:\/\/[^\s]+)/g; function isRemote(path) { if (!path) { throw new Error('Required parameter path missing'); } return !!path.match(remoteRegex); } function isLocal(path) { return !isRemote(path); } module.exports = { isRemote, isLocal, };