OS independent way to convert file contents to a datauri. Used to convert icon files to datauris that can be embedded within metadata specifications.
# set registry config
npm config set @tufan-io:registry https://npm.pkg.github.com/tufan-io
# install the package
npm install @tufan-io/datauri
/**
* 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
This project is released with a Contributor Code of Conduct. By participating, you agree to abide by its terms.
Bugs, PRs, comments, suggestions welcomed!