fansenze / snowpack-plugin-inliner

A plugin for snowpack which transforms files into base64 URIs.
MIT License
1 stars 2 forks source link

Are any other encodings actually useful? #1

Closed canadaduane closed 4 years ago

canadaduane commented 4 years ago

The default encoding option is set to base64. I'm curious if any other node-supported buffer.toString encodings are useful in this plugin?

For example, hex, latin1, or ascii don't seem to be reasonable options to me.

https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings

Maybe I'm missing some use cases?

fansenze commented 4 years ago

you can specify encoding which you want, like utf8, utf16le, latin1, base64, hex, ascii, binary, ucs2.

{
  "plugins": [
    ["snowpack-plugin-inliner", {
       "encoding": "hex"
    }],
  ],
}

but maybe not work in browser without use base64 to encode for data-urls

canadaduane commented 4 years ago

Yeah, I don't think that would work in a browser. Thanks for clarifying though.