INNER CODE UNIT · JavaScript

getSrcBase64

danmindru/responsive-html-email-signature · tasks/check-for-image-url.js:131

function getSrcBase64(base, getHTTP, src, callback) {
  // TODO: @deprecated — since v11.0.0 url.parse should be replaced with url.URL() ctor
  if (!url.parse(src).hostname) {
    // Get local file
    const filePath = path.join(base, src);
    if (fs.existsSync(filePath)) {
      fs.readFile(filePath, 'base64', callback);
    } else {
      callback(null);
    }
  } else {
    // Get remote file
    if (getHTTP) {
      return getHTTPBase64(src, callback);
    } else {
      callback(null, src, null, true);
    }
  }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…