How to use the datauri.sync function in datauri

To help you get started, we’ve selected a few datauri examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ghosh / Crimp / src / main / ipc / FilesHandler.js View on Github external
async optimizeFile(path) {
    try {
      const dataUri = await DataURI(path);

      const originalBuffer = await fs.readFile(path);
      const optimizedBuffer = await imagemin.buffer(originalBuffer, { plugins: imageMinPlugins });
      await fs.writeFile(path, optimizedBuffer);

      return {
        dataUri: dataUri,
        originalSize: originalBuffer.length,
        optimizedSize: optimizedBuffer.length
      }

    } catch (error) {
      return { status: false, originalSize: null, optimizedSize: null }
      console.error('Error: ', error);
    }
  }
github limedocs / limedocs-wiki-converter / src / markdown.js View on Github external
this.mainRenderer.image = function(href, title, text) {
      if (!href.match(/^https?:\/\//)) {
        href = path.resolve(self.wikiPath, href)
        return util.format('<img src="%s">', datauri(href))
      } else {
        return util.format('<img src="%s">', href)
      }
    }
    return this
github limedocs / limedocs-wiki-converter / dist / markdown.js View on Github external
this.mainRenderer.image = function (href, title, text) {
        if (!href.match(/^https?:\/\//)) {
          href = path.resolve(self.wikiPath, href);
          return util.format('<img src="%s">', datauri(href));
        } else {
          return util.format('<img src="%s">', href);
        }
      };
      return this;
github limedocs / limedocs-wiki-converter / src / base-writer.js View on Github external
getLimedocsGeneratedImgData() {
    return datauri(path.resolve(__dirname, '../assets/images/Limedocs-generated.png'))
  }
github fevrcoding / wok / build / gulp-tasks / lib / sass-functions.js View on Github external
'inline-image($path)': function inlineImage(filepath) {
            const imagePath = getFilePath(filepath);
            if (imagePath) {
                return new types.String('url(\'' + datauri(imagePath) + '\')');
            }
            return null;
        }
    };
github limedocs / limedocs-wiki-converter / dist / base-writer.js View on Github external
value: function getLimedocsGeneratedImgData() {
      return datauri(path.resolve(__dirname, '../assets/images/Limedocs-generated.png'));
    }
  }, {

datauri

Create DataURI scheme easily

MIT
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis

Popular datauri functions