0.1.0 • Published 6 years ago

inline-js-default-resources v0.1.0

Weekly downloads
6
License
MIT
Repository
github
Last release
6 years ago

inline-js-default-resources

Build Status codecov install size

This repository contains the builtin resources for inline-js

Installation

npm install inline-js-default-resources

Usage

const {createInliner} = require("inline-js-core");
const {RESOURCES} = require("inline-js-default-resources");

const inliner = createInliner();
RESOURCES.forEach(inliner.resource.add);

RESOURCES

This repository contains following resources:

  • file: It reads the content from a file path, which may be relative to the file which requires the resource.

    The result could be a utf8 string or a Buffer, depending on the extension of the file (see is-binary-path).

  • text: Like file, but the result is always a utf8 string.

  • raw: Like file, but the result is always a Buffer.
  • cmd: Execute a command and read the stdout as a utf8 string. You may pass the second argument which represent the encoding (default: utf8). Passing buffer to get raw Buffer object.

    Current date: $inline("cmd:date /t")

PATH_LIKE

A set of resource type. These resources use a filepath as their first argument, including file, text, and raw.

Changelog

  • 0.1.0 (Jun 27, 2018)

    • First release.