0.4.2 • Published 3 years ago

@asset-toolkit/video-compression v0.4.2

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

@asset-toolkit/video-compression / Exports

@asset-toolkit/video-compression

Table of contents

Type aliases

Functions

Type aliases

options

Ƭ options: Object

Type declaration

NameType
presetstring
rotatenumber

Defined in

index.d.ts:1


props

Ƭ props: Object

Type declaration

NameType
pathIn?string
pathOutstring

Defined in

index.d.ts:5


returns

Ƭ returns: Object

Type declaration

NameType
pathOutstring

Defined in

index.d.ts:9

Functions

default

Const default(_props, _options?): Promise<returns>

Parameters

NameType
_propsprops
_options?options

Returns

Promise<returns>

Defined in

index.d.ts:12

Asset ToolKits

Node.js toolkits to optimize media assets.

List of toolkits

@asset-toolkit/audio-sprite @asset-toolkit/exif-extractor @asset-toolkit/gltf-transform @asset-toolkit/image-compression @asset-toolkit/image-sprite @asset-toolkit/image-supercompression @asset-toolkit/tilemap-optimize @asset-toolkit/video-compression @asset-toolkit/json-minify @asset-toolkit/utils

Use a pipeline

A pipe function to concatenate toolkits.

const { pipeline } = require("@asset-toolkit/core");

const pipelineExample = pipeline(...fn);

pipelineExample({
  pathIn: "./exampleIn/",
  pathOut: "../../exampleOut/",
});

Example with pipeline

With audio-sprite and json-minify tools. Use the function returned from pipeline to pass props and options.

The options is an array of object. Every object is linked to tools function passed to pipeline by our order.

npm i
@asset-toolkit/core
@asset-toolkit/audio-sprite
@asset-toolkit/json-minify
const { pipeline } = require("@asset-toolkit/core");
const audioSprite = require("@asset-toolkit/audio-sprite");
const jsonMinify = require("@asset-toolkit/json-minify");
const options = [
  {
    output: "spriteTrack",
    export: "mp3, m4a",
  },
]; // first argument for first tool in pipeline

const pipelineAudio = pipeline(audioSprite, jsonMinify);

pipelineAudio(
  {
    pathIn: "./audio/",
    pathOut: "../public/audio",
  },
  options
);

Example with watcher

For relaunch automatically your pipeline everytime you add or modify the files in input folder.

const { pipeline, watchPipeline } = require("@asset-toolkit/core");
const jsonMinify = require("@asset-toolkit/json-minify");
const options = [
  {
    output: "spriteTrack",
    export: "mp3, m4a",
  },
]; // first argument for first tool in pipeline

const pipelineJSON = pipeline(jsonMinify);

watchPipeline(pipelineJSON, {
  pathIn: "./json/",
  pathOut: "../public/json",
});

How to use

Create a js file "example.js", with your code (import and configure the pipelines like examples).

Run your code with node: node example.js

License

MIT

0.4.1

3 years ago

0.4.2

3 years ago

0.3.3

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.2-alpha.0

3 years ago

0.2.1-alpha.0

3 years ago