This package has been deprecated

Author message:

Package no longer supported. Contact support@npmjs.com for more info.

encode-site

1.0.1 • Public • Published

encode-site

CLI tool for encoding files for inline embedding in HTML pages

Installation

npm install encode-site -g

Usage

List available encoding types

Before encoding files, you check what encoding types are available. Luckily, using the list action will do this.

encode list

Encoding a file

Encoding a file is pretty simple. Specify what encoding type you wish to use as the action and follow with the path to the file. This command will result in the encoding outputted to the terminal.

encode base64 index.html

Saving an encoded file

Encoding a file and then saving it to a file is also rather simple. Use the output flag (-o or --output) followed by the location of the new file you wish to save. This will save the encoded data to the file index.html.base64 in the current directory.

encode base64 index.html -o index.html.base64

Wrapping

The wrapping is the information that is inserted at the start of the encoded data, for example data:text/html;base64,. If you simply want to encode a file without the wrapping, use the minmal flag (-m or --minimal). Like all flags, it can be used with other flags.

encode base64 index.html -mo index.html.base64

Specifying information for wrapping

encode-site assumes a lot of information about the file for wrapping. By default, encode-site will use the text type and use the found extension of the specified file (an error will be given if no extension is found).

Specifying the type, used for encoding images (and much more)

In the example, data:[type]/html;base64,, [type] is where the type information is inserted. To specify a custom type (needed for images) simply the use type flag (-t or --type).

encode base64 image.png -t image

Specifying the extension

In the example, data:text/[extension];base64,, [extension] is where the extension information is inserted. To specify a custom extension simply the use extension flag (-e or --extension).

encode base64 image -t image -e png

Readme

Keywords

none

Package Sidebar

Install

npm i encode-site

Weekly Downloads

1

Version

1.0.1

License

ISC

Last publish

Collaborators

  • npm