Skip to content

tufan-io/tufan-datauri

@tufan/datauri

action-ci

OS independent way to convert file contents to a datauri. Used to convert icon files to datauris that can be embedded within metadata specifications.

Usage

# set registry config
npm config set @tufan-io:registry https://npm.pkg.github.com/tufan-io

# install the package
npm install @tufan-io/datauri

API

/**
 *  Returns a platform agnostic datauri, from a filename.
 *  Converts file contents to `lf` (unix) encoding before computing the data-uri.
 *  This makes our dataUri independent of file-encoding configuration on disk.
 *  Synchronous, so it can be used on import of metadata.
 */
dataUri(fpath: string): string

Development Tooling

License

Apache-2.0

Code of Conduct

This project is released with a Contributor Code of Conduct. By participating, you agree to abide by its terms.

Support

Bugs, PRs, comments, suggestions welcomed!