[@asset-toolkit/audio-sprite](README.md) / Exports

# @asset-toolkit/audio-sprite

## Table of contents

### Type aliases

- [TypeProps](modules.md#typeprops)

### Functions

- [default](modules.md#default)

## Type aliases

### TypeProps

Ƭ **TypeProps**: `Object`

#### Type declaration

| Name          | Type               |
| :------------ | :----------------- |
| `autoplay?`   | `string` \| `null` |
| `bitrate?`    | `number`           |
| `channels?`   | `Channels`         |
| `export?`     | `string`           |
| `format?`     | `ExportType`       |
| `gap?`        | `number`           |
| `log?`        | `LogLevel`         |
| `logger?`     | `Logger`           |
| `loop?`       | `string`[]         |
| `minlength?`  | `number`           |
| `output?`     | `string`           |
| `path?`       | `string`           |
| `rawparts?`   | `string`           |
| `samplerate?` | `number`           |
| `silence?`    | `number`           |
| `vbr?`        | `VBR`              |
| `vbr:vorbis?` | `VBR_Vorbis`       |

#### Defined in

index.d.ts:3

## Functions

### default

▸ `Const` **default**(`_props`, `options?`): `Promise`<`unknown`\>

#### Parameters

| Name       | Type                                |
| :--------- | :---------------------------------- |
| `_props`   | `TypeToolProp`                      |
| `options?` | [`TypeProps`](modules.md#typeprops) |

#### Returns

`Promise`<`unknown`\>

#### Defined in

index.d.ts:22

[@asset-toolkit/audio-sprite](README.md) / Exports

# @asset-toolkit/audio-sprite

## Table of contents

### Type aliases

- [TypeProps](modules.md#typeprops)

### Functions

- [default](modules.md#default)

## Type aliases

### TypeProps

Ƭ **TypeProps**: `audiosprite.Option`

#### Defined in

index.d.ts:3

## Functions

### default

▸ `Const` **default**(`_props`, `options?`): `Promise`<`unknown`\>

#### Parameters

| Name       | Type           |
| :--------- | :------------- |
| `_props`   | `TypeToolProp` |
| `options?` | `Option`       |

#### Returns

`Promise`<`unknown`\>

#### Defined in

index.d.ts:4

# Asset ToolKits

Node.js toolkits to optimize media assets.

## Use a pipeline

A pipe function to concatenate toolkits.

```js
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.

```bash
npm i
@asset-toolkit/core
@asset-toolkit/audio-sprite
@asset-toolkit/json-minify
```

```js
const { pipeline } = require('@asset-toolkit/core')
const audioSprite = require('@asset-toolkit/audio-sprite')
const jsonMinify = require('@asset-toolkit/json-minify')
```

```js
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.

```js
const { pipeline, watchPipeline } = require('@asset-toolkit/core')
const jsonMinify = require('@asset-toolkit/json-minify')
```

```js
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](LICENSE.md)
