How to use the datauri.promise 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 SAP / yeoman-ui / backend / src / yeomanui.ts View on Github external
private async createGeneratorChoice(genName: string, genPackagePath: string, packageJson: any): Promise {
    let genImageUrl;

    try {
      genImageUrl = await datauri.promise(path.join(genPackagePath, YeomanUI.YEOMAN_PNG));
    } catch (error) {
      genImageUrl = defaultImage.default;
    }

    const genMessage = _.get(packageJson, "description", YeomanUI.defaultMessage);
    const genPrettyName = titleize(humanizeString(genName));
    const genHomepage = _.get(packageJson, "homepage", '');

    return {
      name: genName,
      prettyName: genPrettyName,
      message: genMessage,
      homepage: genHomepage,
      imageUrl: genImageUrl
    };
  }

datauri

Create DataURI scheme easily

MIT
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis

Popular datauri functions