diff --git a/.gitignore b/.gitignore index 88c00e2..eb98165 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ Thumbs.db # IDE .vscode/* +.idea/* diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..7c32099 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,3 @@ +{ + "tabWidth": 4 +} diff --git a/README.md b/README.md index 7ad1094..ec9c3bf 100644 --- a/README.md +++ b/README.md @@ -1,85 +1,89 @@ -node-lame -=========== +# node-lame LAME is an open-source encoder that encodes and decodes audio to the MP3 file format. For all MP3 needs a Node.js wrapper of the full [LAME](http://lame.sourceforge.net/) command line. The encoder reads WAV-, MP1-, MP2- and MP3-format and encodes it into an MP3 file. The decoder reads MP3-format and decodes it into WAV. -Requirements ------------- +## Requirements -* Linux or Mac OS (This package is NOT tested on Windows.) -* Lame Installed (View instructions below.) -* Node 8.11.* or newer +- Linux or MacOS (This package is NOT tested on Windows) +- Lame Installed (View instructions below) +- Node 10.13.\* or newer -Installation ------------- +## Installation You can install it with `npm`: -``` bash -$ npm install --save node-lame +```bash +$ npm install node-lame ``` If you have not installed [LAME](http://lame.sourceforge.net/) yet, please use the following instruction. ### Install on Debian -``` bash + +```bash $ sudo apt-get install lame ``` -### Install on Mac OS with brew -``` bash +### Install on MacOS with brew + +```bash $ brew install lame ``` ### Install on Windows + 1. Go to the the [Lame Download Page](https://lame.buanzo.org/#lamewindl) and download the EXE or ZIP file. 2. Navigate to the directory Lame was installed in (most commonly `C:\Program Files (x86)\Lame For Audacity`). 3. Add the directory to your [Environment Variables](https://www.java.com/en/download/help/path.xml). -Examples --------- +## Examples ### Encode from file to file -``` node + +```node const Lame = require("node-lame").Lame; const encoder = new Lame({ - "output": "./audio-files/demo.mp3", - "bitrate": 192 + output: "./audio-files/demo.mp3", + bitrate: 192 }).setFile("./audio-files/demo.wav"); -encoder.encode() +encoder + .encode() .then(() => { // Encoding finished }) - .catch((error) => { + .catch(error => { // Something went wrong }); ``` ### Encode from file to buffer -``` node + +```node const Lame = require("node-lame").Lame; const encoder = new Lame({ - "output": "buffer", - "bitrate": 192 + output: "buffer", + bitrate: 192 }).setFile("./audio-files/demo.wav"); -encoder.encode() +encoder + .encode() .then(() => { // Encoding finished const buffer = encoder.getBuffer(); }) - .catch((error) => { + .catch(error => { // Something went wrong }); ``` ### Encode from buffer to file -``` node + +```node [...] const Lame = require("node-lame").Lame; @@ -99,7 +103,8 @@ encoder.encode() ``` ### Encode from buffer to buffer -``` node + +```node [...] const Lame = require("node-lame").Lame; @@ -120,19 +125,21 @@ encoder.encode() ``` ### Get status of encoder as object -``` node + +```node const Lame = require("node-lame").Lame; const encoder = new Lame({ - "output": "buffer", - "bitrate": 192 + output: "buffer", + bitrate: 192 }).setFile("./audio-files/demo.wav"); -encoder.encode() +encoder + .encode() .then(() => { // Encoding finished }) - .catch((error) => { + .catch(error => { // Something went wrong }); @@ -140,12 +147,13 @@ const status = encoder.getStatus(); ``` ### Get status of encoder as EventEmitter -``` node + +```node const Lame = require("node-lame").Lame; const encoder = new Lame({ - "output": "buffer", - "bitrate": 192 + output: "buffer", + bitrate: 192 }).setFile("./audio-files/demo.wav"); const emitter = encoder.getEmitter(); @@ -158,56 +166,62 @@ emitter.on("finish", () => { // On finish }); -emitter.on("error", (error) => { +emitter.on("error", error => { // On error }); -encoder.encode() +encoder + .encode() .then(() => { // Encoding finished }) - .catch((error) => { + .catch(error => { // Something went wrong }); ``` ### Decode from file to file -``` node + +```node const Lame = require("node-lame").Lame; const decoder = new Lame({ - "output": "./audio-files/demo.wav" + output: "./audio-files/demo.wav" }).setFile("./audio-files/demo.mp3"); -decoder.decode() +decoder + .decode() .then(() => { // Decoding finished }) - .catch((error) => { + .catch(error => { // Something went wrong }); ``` ### Decode from file to buffer -``` node + +```node const Lame = require("node-lame").Lame; const decoder = new Lame({ - "output": "buffer" + output: "buffer" }).setFile("./audio-files/demo.mp3"); -decoder.decode() +decoder + .decode() .then(() => { // Decoding finished const buffer = decoder.getBuffer(); }) - .catch((error) => { + .catch(error => { // Something went wrong }); ``` ### Decode from buffer to file -``` node + +```node [...] const Lame = require("node-lame").Lame; @@ -226,7 +240,8 @@ decoder.decode() ``` ### Decode from buffer to buffer -``` node + +```node [...] const Lame = require("node-lame").Lame; @@ -246,18 +261,20 @@ decoder.decode() ``` ### Get status of decoder as object -``` node + +```node const Lame = require("node-lame").Lame; const decoder = new Lame({ - "output": "buffer" + output: "buffer" }).setFile("./audio-files/demo.mp3"); -decoder.encode() +decoder + .encode() .then(() => { // Decoding finished }) - .catch((error) => { + .catch(error => { // Something went wrong }); @@ -265,11 +282,12 @@ const status = decoder.getStatus(); ``` ### Get status of decoder as EventEmitter -``` node + +```node const Lame = require("node-lame").Lame; const decoder = new Lame({ - "output": "buffer" + output: "buffer" }).setFile("./audio-files/demo.mp3"); const emitter = decoder.getEmitter(); @@ -282,93 +300,92 @@ emitter.on("finish", () => { // On finish }); -emitter.on("error", (error) => { +emitter.on("error", error => { // On error }); -decoder.decode() +decoder + .decode() .then(() => { // Decoding finished }) - .catch((error) => { + .catch(error => { // Something went wrong }); ``` - -All options ------------ - -Option | Description | Values | Default ---- | --- | --- | --- -output | Output filename | Path | -raw | Assume the input file is raw pcm. Sampling rate and mono/stereo/jstereo must be specified. For each stereo sample, LAME expects the input data to be ordered left channel first, then right channel. By default, LAME expects them to be signed integers with a bitwidth of 16. | boolean | `false` -swap-bytes | Swap bytes in the input file or output file when using decoding. For sorting out little endian/big endian type problems. | boolean | `false` -sfreq | Required only for raw PCM input files. Otherwise it will be determined from the header of the input file. LAME will automatically resample the input file to one of the supported MP3 samplerates if necessary. | `8`, `11.025`, `12`, `16`, `22.05`, `24`, `32`, `44.1`, `48` | `undefined` -bitwidth | Required only for raw PCM input files. Otherwise it will be determined from the header of the input file. | `8`, `16`, `24`, `32` | `16` -signed | Required only for raw PCM input files. Instructs LAME that the samples from the input are signed. | boolean | `false`; `true` for 16, 24 and 32 bits raw pcm data -unsigned | Required only for raw PCM input files and only available at bitwidth 8. Instructs LAME that the samples from the input are unsigned (the default for 8 bits raw pcm data, where 0x80 is zero). | boolean | `undefined` -little-endian | Required only for raw PCM input files. Instructs LAME that the samples from the input are in little-endian form. | boolean | `undefined` -big-endian | Required only for raw PCM input files. Instructs LAME that the samples from the input are in big-endian form. | boolean | `undefined` -mp2Input | Assume the input file is a MPEG Layer II (ie MP2) file. If the filename ends in ".mp2" LAME will assume it is a MPEG Layer II file. | boolean | `undefined` -mp3Input | Assume the input file is a MP3 file. Useful for downsampling from one mp3 to another. | boolean | `undefined` -mode | Details see [LAME man page](https://linux.die.net/man/1/lame). | `s` simple stereo, `j` joint stereo, `f` forced MS stereo, `d` dual mono, `m` mono, `l` left channel only, `r` right channel only | `j` or `s` (see details) -to-mono | Mix the stereo input file to mono and encode as mono. The downmix is calculated as the sum of the left and right channel, attenuated by 6 dB. | boolean | `false` -channel-different-block-sizes | Allows the left and right channels to use different block size types. | boolean | `false` -freeformat | Produces a free format bitstream. With this option, you can use `bitrate` with any bitrate higher than 8 kbps. | `FreeAmp` up to 440 kbps, `in_mpg123` up to 560 kbps, `l3dec` up to 310 kbps, `LAME` up to 560 kbps, `MAD` up to 640 kbps | `undefined` -disable-info-tag | Disable writing of the INFO Tag on encoding. | boolean | `false` -comp | Instead of choosing bitrate, using this option, user can choose compression ratio to achieve. | number | `undefined` -scale | Scales input volume by n. This just multiplies the PCM data (after it has been converted to floating point) by n. | number | `1` -scale-l | Same as `scale`, but for left channel only. | number | `undefined` -scale-r | Same as `scale`, but for right channel only. | number | `undefined` -replaygain-fast | Compute ReplayGain fast but slightly inaccurately. Details see [LAME man page](https://linux.die.net/man/1/lame). | boolean | `false` -replaygain-accurate | Compute ReplayGain more accurately and find the peak sample. Details see [LAME man page](https://linux.die.net/man/1/lame). | boolean | `false` -no-replaygain | Disable ReplayGain analysis. By default ReplayGain analysis is enabled. Details see [LAME man page](https://linux.die.net/man/1/lame). | boolean | `false` -clip-detect | Clipping detection. | boolean | `false` -preset | Use one of the built-in presets. Details see [LAME man page](https://linux.die.net/man/1/lame). | `medium`, `standard`, `extreme` or `insane` | `undefined` -noasm | Disable specific assembly optimizations. Quality will not increase, only speed will be reduced. | `mmx`, `3dnow` or `sse` | `undefined` (probably depending on OS) -quality | Bitrate is of course the main influence on quality. The higher the bitrate, the higher the quality. But for a given bitrate, we have a choice of algorithms to determine the best scalefactors and Huffman encoding (noise shaping). | `0` (best) to `9` (worst) | `5` -bitrate | For MPEG-1 (sampling frequencies of 32, 44.1 and 48 kHz): n = `32`, `40`, `48`, `56`, `64`, `80`, `96`, `112`, `128`, `160`, `192`, `224`, `256`, `320`; For MPEG-2 (sampling frequencies of 16, 22.05 and 24 kHz): n = `8`, `16`, `24`, `32`, `40`, `48`, `56`, `64`, `80`, `96`, `112`, `128`, `144`, `160`; For MPEG-2.5 (sampling frequencies of 8, 11.025 and 12 kHz): n = `8`, `16`, `24`, `32`, `40`, `48`, `56`, `64` | See description | `128` for MPEG1 and `64` for MPEG2 -force-bitrate | Strictly enforce the `bitrate` option. This is mainly for use with hardware players that do not support low bitrate mp3. | boolean | `false` -cbr | Enforce use of constant bitrate. | boolean | `false` -abr | ABR (average bitrate) options. Turns on encoding with a targeted average bitrate of n kbits, allowing to use frames of different sizes. | `8` to `310` | `undefined` -vbr | Use variable bitrate. | boolean | `false` -vbr-quality | Enable `vbr` and specifies the value of VBR quality. | `0` (best) to `9` (worst) | `4` -ignore-noise-in-sfb21 | LAME ignore noise in sfb21, like in CBR. | boolean | `false` -emp | All this does is set a flag in the MP3 header bitstream. If you have a PCM input file where one of the above types of (obsolete) emphasis has been applied, you can set this flag in LAME. Then the mp3 decoder should de-emphasize the output during playback, although most decoders ignore this flag. | `n` none, `5` 0/15 microseconds, `c` citt j.17 | `n` -mark-as-copyrighted | Mark the encoded file as being copyrighted. | boolean | `false` -mark-as-copy | Mark the encoded file as being a copy. | boolean | `false` -crc-error-protection | Turn on CRC error protection.It will add a cyclic redundancy check (CRC) code in each frame, allowing to detect transmission errors that could occur on the MP3 stream. | boolean | `false` -nores | Disable the bit reservoir. Each frame will then become independent from previous ones, but the quality will be lower. | boolean | `false` -strictly-enforce-ISO | With this option, LAME will enforce the 7680 bit limitation on total frame size. | boolean | `false` -lowpass | Set a lowpass filtering frequency in kHz. Frequencies specified one will be cutoff. | number | `undefined` -lowpass-width | Set the width of the lowpass filter in percent. | number | `15` -highpass | Set an highpass filtering frequency in kHz. | number | `undefined` -highpass-width | Set the width of the highpass filter in percent. | number | `15` -resample | Output sampling frequency (for encoding). If not specified, LAME will automatically resample the input when using high compression ratios. | `8`, `11.025`, `12`, `16`, `22.05`, `24`, `32`, `44.1`, `48` | `undefined` -meta | Meta data for MP3. | Object | `undefined` - -*Meta options* - -Option | Description | Values | Default ---- | --- | --- | --- -title | Set title tag (max 30 chars for version 1 tag). | String | `undefined` -artist | Set artist tag (max 30 chars for version 1 tag). | String | `undefined` -album | Set album tag (max 30 chars for version 1 tag). | String | `undefined` -year | Set year tag. | String | `undefined` -comment | Set user-defined text (max 30 chars for v1 tag, 28 for v1.1). | String | `undefined` -track | Set track tag, with or without number of total tracks. | String | `undefined` -genre | Set genre tag (max 30 chars for version 1 tag). | String | `undefined` -artwork | Set album artwork image (path to jpeg/png/gif file, v2.3 tag). | String | `undefined` -add-id3v2 | Force addition of version 2 tag. | boolean | `false` -id3v1-only | Add only a version 1 tag. | boolean | `false` -id3v2-only | Add only a version 2 tag. | boolean | `false` -id3v2-latin1 | Add meta options in ISO-8859-1 text encoding. | boolean | `false` -id3v2-utf16 | Add meta options in unicode text encoding. | boolean | `false` -space-id3v1 | Pad version 1 tag with spaces instead of nulls. | boolean | `false` -pad-id3v2 | Same as `pad-id3v2-size` value `128` | boolean | `false` -pad-id3v2-size | Adds version 2 tag, pad with extra "num" bytes. | number | `undefined` -ignore-tag-errors | Ignore errors in values passed for tags, use defaults in case an error occurs | boolean | `false` -genre-list | Print alphabetically sorted ID3 genre list and exit | string | `undefined` +## All options + +| Option | Description | Values | Default | +| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | +| output | Output filename | Path | +| raw | Assume the input file is raw pcm. Sampling rate and mono/stereo/jstereo must be specified. For each stereo sample, LAME expects the input data to be ordered left channel first, then right channel. By default, LAME expects them to be signed integers with a bitwidth of 16. | boolean | `false` | +| swap-bytes | Swap bytes in the input file or output file when using decoding. For sorting out little endian/big endian type problems. | boolean | `false` | +| sfreq | Required only for raw PCM input files. Otherwise it will be determined from the header of the input file. LAME will automatically resample the input file to one of the supported MP3 samplerates if necessary. | `8`, `11.025`, `12`, `16`, `22.05`, `24`, `32`, `44.1`, `48` | `undefined` | +| bitwidth | Required only for raw PCM input files. Otherwise it will be determined from the header of the input file. | `8`, `16`, `24`, `32` | `16` | +| signed | Required only for raw PCM input files. Instructs LAME that the samples from the input are signed. | boolean | `false`; `true` for 16, 24 and 32 bits raw pcm data | +| unsigned | Required only for raw PCM input files and only available at bitwidth 8. Instructs LAME that the samples from the input are unsigned (the default for 8 bits raw pcm data, where 0x80 is zero). | boolean | `undefined` | +| little-endian | Required only for raw PCM input files. Instructs LAME that the samples from the input are in little-endian form. | boolean | `undefined` | +| big-endian | Required only for raw PCM input files. Instructs LAME that the samples from the input are in big-endian form. | boolean | `undefined` | +| mp2Input | Assume the input file is a MPEG Layer II (ie MP2) file. If the filename ends in ".mp2" LAME will assume it is a MPEG Layer II file. | boolean | `undefined` | +| mp3Input | Assume the input file is a MP3 file. Useful for downsampling from one mp3 to another. | boolean | `undefined` | +| mode | Details see [LAME man page](https://linux.die.net/man/1/lame). | `s` simple stereo, `j` joint stereo, `f` forced MS stereo, `d` dual mono, `m` mono, `l` left channel only, `r` right channel only | `j` or `s` (see details) | +| to-mono | Mix the stereo input file to mono and encode as mono. The downmix is calculated as the sum of the left and right channel, attenuated by 6 dB. | boolean | `false` | +| channel-different-block-sizes | Allows the left and right channels to use different block size types. | boolean | `false` | +| freeformat | Produces a free format bitstream. With this option, you can use `bitrate` with any bitrate higher than 8 kbps. | `FreeAmp` up to 440 kbps, `in_mpg123` up to 560 kbps, `l3dec` up to 310 kbps, `LAME` up to 560 kbps, `MAD` up to 640 kbps | `undefined` | +| disable-info-tag | Disable writing of the INFO Tag on encoding. | boolean | `false` | +| comp | Instead of choosing bitrate, using this option, user can choose compression ratio to achieve. | number | `undefined` | +| scale | Scales input volume by n. This just multiplies the PCM data (after it has been converted to floating point) by n. | number | `1` | +| scale-l | Same as `scale`, but for left channel only. | number | `undefined` | +| scale-r | Same as `scale`, but for right channel only. | number | `undefined` | +| replaygain-fast | Compute ReplayGain fast but slightly inaccurately. Details see [LAME man page](https://linux.die.net/man/1/lame). | boolean | `false` | +| replaygain-accurate | Compute ReplayGain more accurately and find the peak sample. Details see [LAME man page](https://linux.die.net/man/1/lame). | boolean | `false` | +| no-replaygain | Disable ReplayGain analysis. By default ReplayGain analysis is enabled. Details see [LAME man page](https://linux.die.net/man/1/lame). | boolean | `false` | +| clip-detect | Clipping detection. | boolean | `false` | +| preset | Use one of the built-in presets. Details see [LAME man page](https://linux.die.net/man/1/lame). | `medium`, `standard`, `extreme` or `insane` | `undefined` | +| noasm | Disable specific assembly optimizations. Quality will not increase, only speed will be reduced. | `mmx`, `3dnow` or `sse` | `undefined` (probably depending on OS) | +| quality | Bitrate is of course the main influence on quality. The higher the bitrate, the higher the quality. But for a given bitrate, we have a choice of algorithms to determine the best scalefactors and Huffman encoding (noise shaping). | `0` (best) to `9` (worst) | `5` | +| bitrate | For MPEG-1 (sampling frequencies of 32, 44.1 and 48 kHz): n = `32`, `40`, `48`, `56`, `64`, `80`, `96`, `112`, `128`, `160`, `192`, `224`, `256`, `320`; For MPEG-2 (sampling frequencies of 16, 22.05 and 24 kHz): n = `8`, `16`, `24`, `32`, `40`, `48`, `56`, `64`, `80`, `96`, `112`, `128`, `144`, `160`; For MPEG-2.5 (sampling frequencies of 8, 11.025 and 12 kHz): n = `8`, `16`, `24`, `32`, `40`, `48`, `56`, `64` | See description | `128` for MPEG1 and `64` for MPEG2 | +| force-bitrate | Strictly enforce the `bitrate` option. This is mainly for use with hardware players that do not support low bitrate mp3. | boolean | `false` | +| cbr | Enforce use of constant bitrate. | boolean | `false` | +| abr | ABR (average bitrate) options. Turns on encoding with a targeted average bitrate of n kbits, allowing to use frames of different sizes. | `8` to `310` | `undefined` | +| vbr | Use variable bitrate. | boolean | `false` | +| vbr-quality | Enable `vbr` and specifies the value of VBR quality. | `0` (best) to `9` (worst) | `4` | +| ignore-noise-in-sfb21 | LAME ignore noise in sfb21, like in CBR. | boolean | `false` | +| emp | All this does is set a flag in the MP3 header bitstream. If you have a PCM input file where one of the above types of (obsolete) emphasis has been applied, you can set this flag in LAME. Then the mp3 decoder should de-emphasize the output during playback, although most decoders ignore this flag. | `n` none, `5` 0/15 microseconds, `c` citt j.17 | `n` | +| mark-as-copyrighted | Mark the encoded file as being copyrighted. | boolean | `false` | +| mark-as-copy | Mark the encoded file as being a copy. | boolean | `false` | +| crc-error-protection | Turn on CRC error protection.It will add a cyclic redundancy check (CRC) code in each frame, allowing to detect transmission errors that could occur on the MP3 stream. | boolean | `false` | +| nores | Disable the bit reservoir. Each frame will then become independent from previous ones, but the quality will be lower. | boolean | `false` | +| strictly-enforce-ISO | With this option, LAME will enforce the 7680 bit limitation on total frame size. | boolean | `false` | +| lowpass | Set a lowpass filtering frequency in kHz. Frequencies specified one will be cutoff. | number | `undefined` | +| lowpass-width | Set the width of the lowpass filter in percent. | number | `15` | +| highpass | Set an highpass filtering frequency in kHz. | number | `undefined` | +| highpass-width | Set the width of the highpass filter in percent. | number | `15` | +| resample | Output sampling frequency (for encoding). If not specified, LAME will automatically resample the input when using high compression ratios. | `8`, `11.025`, `12`, `16`, `22.05`, `24`, `32`, `44.1`, `48` | `undefined` | +| meta | Meta data for MP3. | Object | `undefined` | + +_Meta options_ + +| Option | Description | Values | Default | +| ----------------- | ----------------------------------------------------------------------------- | ------- | ----------- | +| title | Set title tag (max 30 chars for version 1 tag). | String | `undefined` | +| artist | Set artist tag (max 30 chars for version 1 tag). | String | `undefined` | +| album | Set album tag (max 30 chars for version 1 tag). | String | `undefined` | +| year | Set year tag. | String | `undefined` | +| comment | Set user-defined text (max 30 chars for v1 tag, 28 for v1.1). | String | `undefined` | +| track | Set track tag, with or without number of total tracks. | String | `undefined` | +| genre | Set genre tag (max 30 chars for version 1 tag). | String | `undefined` | +| artwork | Set album artwork image (path to jpeg/png/gif file, v2.3 tag). | String | `undefined` | +| add-id3v2 | Force addition of version 2 tag. | boolean | `false` | +| id3v1-only | Add only a version 1 tag. | boolean | `false` | +| id3v2-only | Add only a version 2 tag. | boolean | `false` | +| id3v2-latin1 | Add meta options in ISO-8859-1 text encoding. | boolean | `false` | +| id3v2-utf16 | Add meta options in unicode text encoding. | boolean | `false` | +| space-id3v1 | Pad version 1 tag with spaces instead of nulls. | boolean | `false` | +| pad-id3v2 | Same as `pad-id3v2-size` value `128` | boolean | `false` | +| pad-id3v2-size | Adds version 2 tag, pad with extra "num" bytes. | number | `undefined` | +| ignore-tag-errors | Ignore errors in values passed for tags, use defaults in case an error occurs | boolean | `false` | +| genre-list | Print alphabetically sorted ID3 genre list and exit | string | `undefined` | Option description text from [LAME man page](https://linux.die.net/man/1/lame). Based on LAME version [3.99.5](https://sourceforge.net/projects/lame/files/lame/3.99/) from Feb 28, 2012. diff --git a/index.d.ts b/index.d.ts old mode 100755 new mode 100644 index a192f0c..fb47547 --- a/index.d.ts +++ b/index.d.ts @@ -1,115 +1,132 @@ -// Type definitions for node-lame v1.0.4 -// Project: https://github.com/jankarres/node-lame -// Definitions by: Jan Karres -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -import { EventEmitter } from "events"; - -declare namespace Options { - type sfreq = 8 | 11.025 | 12 | 16 | 22.05 | 24 | 32 | 44.1 | 48; - type bitwidth = 8 | 16 | 24 | 32; - type mode = "s" | "j" | "f" | "d" | "m" | "l" | "r"; - type freeformat = "FreeAmp" | "in_mpg123" | "l3dec" | "LAME" | "MAD"; - type preset = "medium" | "standard" | "extreme" | "insane"; - type noasm = "mmx" | "3dnow" | "sse"; - type quality = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9; - type bitrate = 8 | 16 | 24 | 32 | 40 | 48 | 56 | 64 | 80 | 96 | 112 | 128 | 144 | 160 | 192 | 224 | 256 | 320; - type emp = "n" | 5 | "c"; - type resample = 8 | 11.025 | 12 | 16 | 22.05 | 24 | 32 | 44.1 | 48; - - interface meta { - "title"?: string; - "artist"?: string; - "album"?: string; - "year"?: string; - "comment"?: string; - "track"?: string; - "genre"?: string; - - "add-id3v2"?: boolean; - "id3v1-only"?: boolean; - "id3v2-only"?: boolean; - "id3v2-latin1"?: boolean; - "id3v2-utf16"?: boolean; - "space-id3v1"?: boolean; - "pad-id3v2-size"?: number; - "genre-list"?: string; - "ignore-tag-errors"?: boolean; - } -} - -declare interface Options { - "output": string | "buffer"; - "raw"?: boolean; - "swap-bytes"?: boolean; - "sfreq"?: Options.sfreq; - "bitwidth"?: Options.bitwidth; - "signed"?: boolean; - "unsigned"?: boolean; - "little-endian"?: boolean; - "big-endian"?: boolean; - "mp2Input"?: boolean; - "mp3Input"?: boolean; - "mode"?: Options.mode; - "to-mono"?: boolean; - "channel-different-block-sizes"?: boolean; - "freeformat"?: Options.freeformat; - "disable-info-tag"?: boolean; - "comp"?: number; - "scale"?: number; - "scale-l"?: number; - "scale-r"?: number; - "replaygain-fast"?: boolean; - "replaygain-accurate"?: boolean; - "no-replaygain"?: boolean; - "clip-detect"?: boolean; - "preset"?: Options.preset; - "noasm"?: Options.noasm; - "quality"?: Options.quality; - "bitrate"?: Options.bitrate; - "force-bitrate"?: boolean; - "cbr"?: boolean; - "abr"?: number; - "vbr"?: boolean; - "vbr-quality"?: number; - "ignore-noise-in-sfb21"?: boolean; - "emp"?: Options.emp; - "mark-as-copyrighted"?: boolean; - "mark-as-copy"?: boolean; - "crc-error-protection"?: boolean; - "nores"?: boolean; - "strictly-enforce-ISO"?: boolean; - "lowpass"?: number; - "lowpass-width"?: number; - "highpass"?: number; - "highpass-width"?: number; - "resample"?: Options.resample; - "meta"?: Options.meta; -} - -declare interface LameStatus { - "started": boolean; - "finished": boolean; - "progress": number; - "eta": string; -} - -declare class Lame { - constructor(options: Options); - - public setFile(path: string): Lame; - public setBuffer(file: Buffer): Lame; - public getFile(): string; - public getBuffer(): Buffer; - public getEmitter(): EventEmitter; - public getStatus(): LameStatus; - - public encode(): Promise; - public decode(): Promise; - private progress(type: "encode" | "decode"): Promise; - private execProgress(inputFilePath: string, args: string[], type: "encode" | "decode"); - private tempFilePathGenerator(type: "raw" | "encoded"): string; - private removeTempFilesOnError(); -} - -export { Lame }; +import { EventEmitter } from "events"; + +declare namespace Options { + type sfreq = 8 | 11.025 | 12 | 16 | 22.05 | 24 | 32 | 44.1 | 48; + type bitwidth = 8 | 16 | 24 | 32; + type mode = "s" | "j" | "f" | "d" | "m" | "l" | "r"; + type freeformat = "FreeAmp" | "in_mpg123" | "l3dec" | "LAME" | "MAD"; + type preset = "medium" | "standard" | "extreme" | "insane"; + type noasm = "mmx" | "3dnow" | "sse"; + type quality = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9; + type bitrate = + | 8 + | 16 + | 24 + | 32 + | 40 + | 48 + | 56 + | 64 + | 80 + | 96 + | 112 + | 128 + | 144 + | 160 + | 192 + | 224 + | 256 + | 320; + type emp = "n" | 5 | "c"; + type resample = 8 | 11.025 | 12 | 16 | 22.05 | 24 | 32 | 44.1 | 48; + + interface meta { + title?: string; + artist?: string; + album?: string; + year?: string; + comment?: string; + track?: string; + genre?: string; + + "add-id3v2"?: boolean; + "id3v1-only"?: boolean; + "id3v2-only"?: boolean; + "id3v2-latin1"?: boolean; + "id3v2-utf16"?: boolean; + "space-id3v1"?: boolean; + "pad-id3v2-size"?: number; + "genre-list"?: string; + "ignore-tag-errors"?: boolean; + } +} + +declare interface Options { + output: string | "buffer"; + raw?: boolean; + "swap-bytes"?: boolean; + sfreq?: Options.sfreq; + bitwidth?: Options.bitwidth; + signed?: boolean; + unsigned?: boolean; + "little-endian"?: boolean; + "big-endian"?: boolean; + mp2Input?: boolean; + mp3Input?: boolean; + mode?: Options.mode; + "to-mono"?: boolean; + "channel-different-block-sizes"?: boolean; + freeformat?: Options.freeformat; + "disable-info-tag"?: boolean; + comp?: number; + scale?: number; + "scale-l"?: number; + "scale-r"?: number; + "replaygain-fast"?: boolean; + "replaygain-accurate"?: boolean; + "no-replaygain"?: boolean; + "clip-detect"?: boolean; + preset?: Options.preset; + noasm?: Options.noasm; + quality?: Options.quality; + bitrate?: Options.bitrate; + "force-bitrate"?: boolean; + cbr?: boolean; + abr?: number; + vbr?: boolean; + "vbr-quality"?: number; + "ignore-noise-in-sfb21"?: boolean; + emp?: Options.emp; + "mark-as-copyrighted"?: boolean; + "mark-as-copy"?: boolean; + "crc-error-protection"?: boolean; + nores?: boolean; + "strictly-enforce-ISO"?: boolean; + lowpass?: number; + "lowpass-width"?: number; + highpass?: number; + "highpass-width"?: number; + resample?: Options.resample; + meta?: Options.meta; +} + +declare interface LameStatus { + started: boolean; + finished: boolean; + progress: number; + eta: string; +} + +declare class Lame { + constructor(options: Options); + + public setFile(path: string): Lame; + public setBuffer(file: Buffer): Lame; + public getFile(): string; + public getBuffer(): Buffer; + public getEmitter(): EventEmitter; + public getStatus(): LameStatus; + + public encode(): Promise; + public decode(): Promise; + private progress(type: "encode" | "decode"): Promise; + private execProgress( + inputFilePath: string, + args: string[], + type: "encode" | "decode" + ); + private tempFilePathGenerator(type: "raw" | "encoded"): string; + private removeTempFilesOnError(); +} + +export { Lame }; diff --git a/lib/build/Lame.js b/lib/build/Lame.js index dee8e07..e8ee262 100644 --- a/lib/build/Lame.js +++ b/lib/build/Lame.js @@ -17,10 +17,10 @@ class Lame { */ constructor(options) { this.status = { - "started": false, - "finished": false, - "progress": undefined, - "eta": undefined + started: false, + finished: false, + progress: undefined, + eta: undefined }; this.emitter = new events_1.EventEmitter(); this.options = options; @@ -83,7 +83,7 @@ class Lame { return this.emitter; } /** - * Get status of coverter + * Get status of converter * * @returns {LameStatus} */ @@ -121,9 +121,10 @@ class Lame { args.push("--decode"); } if (this.fileBuffer != undefined) { + // File buffer is set; write it as temp file this.fileBufferTempFilePath = this.tempFilePathGenerator("raw", type); return new Promise((resolve, reject) => { - fs_1.writeFile(this.fileBufferTempFilePath, this.fileBuffer, (err) => { + fs_1.writeFile(this.fileBufferTempFilePath, this.fileBuffer, err => { if (err) { reject(err); return; @@ -140,8 +141,8 @@ class Lame { }); } else { - return this.execProgress(this.filePath, args, type) - .catch((error) => { + // File path is set + return this.execProgress(this.filePath, args, type).catch((error) => { this.removeTempFilesOnError(); throw error; }); @@ -186,14 +187,21 @@ class Lame { data = data.toString().trim(); // Every output of Lame comes as "stderr". Deciding if it is an error or valid data by regex if (data.length > 6) { - if (type == "encode" && data.search("Writing LAME Tag...done") > -1) { + if (type == "encode" && + data.search("Writing LAME Tag...done") > -1) { + // processing done this.status.finished = true; this.status.progress = 100; this.status.eta = "00:00"; this.emitter.emit("finish"); - this.emitter.emit("progress", [this.status.progress, this.status.eta]); + this.emitter.emit("progress", [ + this.status.progress, + this.status.eta + ]); } - else if (type == "encode" && data.search(/\((( [0-9])|([0-9]{2})|(100))%\)\|/) > -1) { + else if (type == "encode" && + data.search(/\((( [0-9])|([0-9]{2})|(100))%\)\|/) > -1) { + // status of processing const progressMatch = data.match(/\((( [0-9])|([0-9]{2})|(100))%\)\|/); const etaMatch = data.match(/[0-9]{1,2}:[0-9][0-9] /); const progress = String(progressMatch[1]); @@ -201,24 +209,38 @@ class Lame { if (etaMatch != null) { eta = etaMatch[0].trim(); } - if (progress != null && Number(progress) > this.status.progress) { + if (progress != null && + Number(progress) > this.status.progress) { this.status.progress = Number(progress); } if (eta != null) { this.status.eta = eta; } - this.emitter.emit("progress", [this.status.progress, this.status.eta]); + this.emitter.emit("progress", [ + this.status.progress, + this.status.eta + ]); } - else if (type == "decode" && data.search(/[0-9]{1,10}\/[0-9]{1,10}/) > -1) { + else if (type == "decode" && + data.search(/[0-9]{1,10}\/[0-9]{1,10}/) > -1) { const progressMatch = data.match(/[0-9]{1,10}\/[0-9]{1,10}/); const progressAbsolute = progressMatch[0].split("/"); - const progress = Math.floor(Number(progressAbsolute[0]) / Number(progressAbsolute[1]) * 100); - if (!isNaN(progress) && Number(progress) > this.status.progress) { + const progress = Math.floor((Number(progressAbsolute[0]) / + Number(progressAbsolute[1])) * + 100); + if (!isNaN(progress) && + Number(progress) > this.status.progress) { this.status.progress = Number(progress); } - this.emitter.emit("progress", [this.status.progress, this.status.eta]); + this.emitter.emit("progress", [ + this.status.progress, + this.status.eta + ]); } - else if (data.search(/^lame: /) > -1 || data.search(/^Warning: /) > -1 || data.search(/Error /) > -1) { + else if (data.search(/^lame: /) > -1 || + data.search(/^Warning: /) > -1 || + data.search(/Error /) > -1) { + // Unexpected output => error if (data.search(/^lame: /) == -1) { this.emitter.emit("error", new Error("lame: " + data)); } @@ -228,7 +250,7 @@ class Lame { } } }; - const progressOnClose = (code) => { + const progressOnClose = code => { if (code == 0) { if (!this.status.finished) { this.emitter.emit("finish"); @@ -267,7 +289,7 @@ class Lame { reject(error); return; } - this.progressedBuffer = new Buffer(data); + this.progressedBuffer = Buffer.from(data); this.progressedBufferTempFilePath = undefined; resolve(this); }); @@ -276,7 +298,7 @@ class Lame { resolve(this); } }); - this.emitter.on("error", (error) => { + this.emitter.on("error", error => { reject(error); }); }); diff --git a/lib/build/Lame.js.map b/lib/build/Lame.js.map index d0b8d0d..64c5425 100644 --- a/lib/build/Lame.js.map +++ b/lib/build/Lame.js.map @@ -1 +1 @@ -{"version":3,"file":"Lame.js","sourceRoot":"","sources":["../src/Lame.ts"],"names":[],"mappings":";;AACA,+CAA4C;AAC5C,2BAAgK;AAChK,+BAAgD;AAChD,iDAAsC;A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QAEjC,MAAM,MAAM,GAAG,GAAG,SAAS,OAAO,CAAC;QACnC,IAAI,IAAI,GAAG,GAAG,MAAM,UAAU,IAAI,GAAG,CAAC;QACtC,IAAI,QAAQ,GACR,gEAAgE,CAAC;QAErE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;YACzB,IAAI,IAAI,QAAQ,CAAC,MAAM,CACnB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,CAC9C,CAAC;SACL;QAED,IAAI,IAAI,IAAI,KAAK,IAAI,YAAY,IAAI,QAAQ,EAAE;YAC3C,IAAI,IAAI,MAAM,CAAC;SAClB;QAED,IAAI,CAAC,eAAY,CAAC,GAAG,MAAM,UAAU,IAAI,EAAE,CAAC,EAAE;YAC1C,OAAO,IAAI,CAAC;SACf;aAAM;YACH,OAAO,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;SACzD;IACL,CAAC;IAED;;OAEG;IACK,sBAAsB;QAC1B,IAAI,IAAI,CAAC,sBAAsB,IAAI,SAAS,EAAE;YAC1C,eAAY,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;SAC7C;QAED,IAAI,IAAI,CAAC,4BAA4B,IAAI,SAAS,EAAE;YAChD,eAAY,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;SACnD;IACL,CAAC;CACJ;AAEQ,oBAAI"} \ No newline at end of file diff --git a/lib/build/LameOptions.js b/lib/build/LameOptions.js index 804fc25..6a42d2e 100644 --- a/lib/build/LameOptions.js +++ b/lib/build/LameOptions.js @@ -195,7 +195,15 @@ class LameOptions { } } sfreq(value) { - if (value == 8 || value == 11.025 || value == 12 || value == 16 || value == 22.05 || value == 24 || value == 32 || value == 44.1 || value == 48) { + if (value == 8 || + value == 11.025 || + value == 12 || + value == 16 || + value == 22.05 || + value == 24 || + value == 32 || + value == 44.1 || + value == 48) { return [`-s`, value]; } else { @@ -259,7 +267,13 @@ class LameOptions { } } mode(value) { - if (value == "s" || value == "j" || value == "f" || value == "d" || value == "m" || value == "l" || value == "r") { + if (value == "s" || + value == "j" || + value == "f" || + value == "d" || + value == "m" || + value == "l" || + value == "r") { return [`-m`, value]; } else { @@ -283,7 +297,11 @@ class LameOptions { } } freeformat(value) { - if (value == "FreeAmp" || value == "in_mpg123" || value == "l3dec" || value == "LAME" || value == "MAD") { + if (value == "FreeAmp" || + value == "in_mpg123" || + value == "l3dec" || + value == "LAME" || + value == "MAD") { return [`--freeformat`, value]; } else { @@ -317,7 +335,6 @@ class LameOptions { else { return undefined; } - ; } replaygainAccurate(value) { if (value == true) { @@ -344,7 +361,10 @@ class LameOptions { } } preset(value) { - if (value == "medium" || value == "standard" || value == "extreme" || value == "insane") { + if (value == "medium" || + value == "standard" || + value == "extreme" || + value == "insane") { return [`--preset`, value]; } else { @@ -368,7 +388,24 @@ class LameOptions { } } bitrate(value) { - if (value == 8 || value == 16 || value == 24 || value == 32 || value == 40 || value == 48 || value == 56 || value == 64 || value == 80 || value == 96 || value == 112 || value == 128 || value == 144 || value == 160 || value == 192 || value == 224 || value == 256 || value == 320) { + if (value == 8 || + value == 16 || + value == 24 || + value == 32 || + value == 40 || + value == 48 || + value == 56 || + value == 64 || + value == 80 || + value == 96 || + value == 112 || + value == 128 || + value == 144 || + value == 160 || + value == 192 || + value == 224 || + value == 256 || + value == 320) { return [`-b`, value]; } else { @@ -484,7 +521,15 @@ class LameOptions { return [`--highpass-width`, value]; } resample(value) { - if (value == 8 || value == 11.025 || value == 12 || value == 16 || value == 22.05 || value == 24 || value == 32 || value == 44.1 || value == 48) { + if (value == 8 || + value == 11.025 || + value == 12 || + value == 16 || + value == 22.05 || + value == 24 || + value == 32 || + value == 44.1 || + value == 48) { return [`--resample`, value]; } else { @@ -494,7 +539,16 @@ class LameOptions { meta(metaObj) { for (const key in metaObj) { const value = metaObj[key]; - if (key == "title" || key == "artist" || key == "album" || key == "year" || key == "comment" || key == "track" || key == "genre" || key == "artwork" || key == "genre-list" || key == "pad-id3v2-size") { + if (key == "title" || + key == "artist" || + key == "album" || + key == "year" || + key == "comment" || + key == "track" || + key == "genre" || + key == "artwork" || + key == "genre-list" || + key == "pad-id3v2-size") { let arg0; if (key == "title") { arg0 = `--tt`; @@ -533,7 +587,14 @@ class LameOptions { this.args.push(arg0); this.args.push(arg1); } - else if (key == "add-id3v2" || key == "id3v1-only" || key == "id3v2-only" || key == "id3v2-latin1" || key == "id3v2-utf16" || key == "space-id3v1" || key == "pad-id3v2" || key == "ignore-tag-errors") { + else if (key == "add-id3v2" || + key == "id3v1-only" || + key == "id3v2-only" || + key == "id3v2-latin1" || + key == "id3v2-utf16" || + key == "space-id3v1" || + key == "pad-id3v2" || + key == "ignore-tag-errors") { this.args.push(`--${key}`); } else { diff --git a/lib/build/LameOptions.js.map b/lib/build/LameOptions.js.map index a4232e4..21efa2e 100644 --- a/lib/build/LameOptions.js.map +++ b/lib/build/LameOptions.js.map @@ -1 +1 @@ -{"version":3,"file":"LameOptions.js","sourceRoot":"","sources":["../src/LameOptions.ts"],"names":[],"mappings":";;AAGA;;;;GAIG;AACH;IAEI;;;OAGG;IACH,YAAY,OAAgB;QALpB,SAAI,GAAG,EAAE,CAAC;QAMd,qBAAqB;QACrB,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAClE,CAAC;QAED,4BAA4B;QAC5B,GAAG,CAAC,CAAC,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC;YACxB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;YAC3B,IAAI,GAAG,CAAC;YAER,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;gBACV,KAAK,QAAQ;oBACT,GAAG,GAAG,IAAI,CAAC,MAAM,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B,GAAG,IAAI,cAAc;gBACrB,GAAG,IAAI,aAAa;gBACpB,GAAG,IAAI,aAAa;gBACpB,GAAG,IAAI,WAAW;gBAClB,GAAG,IAAI,mBAAmB,EAC5B;gBACE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;aAC9B;iBAAM;gBACH,MAAM,IAAI,KAAK,CACX,kDAAkD,GAAG,GAAG,CAC3D,CAAC;aACL;SACJ;QAED,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ;AAEQ,kCAAW"} \ No newline at end of file diff --git a/lib/src/Lame.ts b/lib/src/Lame.ts index 161da42..9207448 100644 --- a/lib/src/Lame.ts +++ b/lib/src/Lame.ts @@ -1,381 +1,441 @@ import { LameStatus, Options } from "./LameTypings"; import { LameOptions } from "./LameOptions"; -import { existsSync as fsExistsSync, readFile as fsReadFile, writeFile as fsWriteFile, writeFileSync as fsWriteFileSync, unlinkSync as fsUnlinkSync } from "fs"; +import { + existsSync as fsExistsSync, + readFile as fsReadFile, + writeFile as fsWriteFile, + unlinkSync as fsUnlinkSync +} from "fs"; import { isBuffer as utilIsBuffer } from "util"; import { spawn } from "child_process"; import { EventEmitter } from "events"; /** - * Wrapper for Lame for Node - * + * Wrapper for Lame for Node + * * @class Lame */ class Lame { - private status: LameStatus = { - "started": false, - "finished": false, - "progress": undefined, - "eta": undefined - }; - private emitter: EventEmitter = new EventEmitter(); - - private options: Options; - private args: string[]; - - private filePath: string; - private fileBuffer: Buffer; - private fileBufferTempFilePath: string; - - private progressedFilePath: string; - private progressedBuffer: Buffer; - private progressedBufferTempFilePath: string; - - /** - * Creates an instance of Lame and set all options - * @param {Options} options - */ - constructor(options: Options) { - this.options = options; - this.args = new LameOptions(this.options).getArguments(); - } - - /** - * Set file path of audio to decode/encode - * - * @param {string} filePath - */ - public setFile(path: string): Lame { - if (!fsExistsSync(path)) { - throw new Error("Audio file (path) dose not exist"); - } - - this.filePath = path; - this.fileBuffer = undefined; - - return this; - } - - /** - * Set file buffer of audio to decode/encode - * - * @param {Buffer} file - */ - public setBuffer(file: Buffer): Lame { - if (!utilIsBuffer(file)) { - throw new Error("Audio file (buffer) dose not exist"); - } - - this.fileBuffer = file; - this.filePath = undefined; - - return this; - } - - /** - * Get decoded/encoded file path - * - * @returns {string} Path of decoded/encoded file - */ - public getFile(): string { - if (this.progressedFilePath == undefined) { - throw new Error("Audio is not yet decoded/encoded"); - } - - return this.progressedFilePath; - } - - /** - * Get decoded/encoded file as buffer - * - * @returns {Buffer} decoded/Encoded file - */ - public getBuffer(): Buffer { - if (this.progressedBuffer == undefined) { - throw new Error("Audio is not yet decoded/encoded"); - } - - return this.progressedBuffer; - } - - /** - * Get event emitter - * - * @returns {EventEmitter} - */ - public getEmitter(): EventEmitter { - return this.emitter; - } - - /** - * Get status of coverter - * - * @returns {LameStatus} - */ - public getStatus(): LameStatus { - return this.status; - } - - /** - * Encode audio file by Lame - * - * @return {Promise} - */ - public encode(): Promise { - return this.progress("encode"); - } - - /** - * Decode audio file by Lame - * - * @return {Promise} - */ - public decode(): Promise { - return this.progress("decode"); - } - - /** - * Decode/Encode audio file by Lame - * - * @return {Promise} - */ - private progress(type: "encode" | "decode"): Promise { - if (this.filePath == undefined && this.fileBuffer == undefined) { - throw new Error("Audio file to encode is not set"); - } - - // Set decode flag to progress a MP3 to WAV decode - const args = this.args; - if (type == "decode") { - args.push("--decode"); - } - - if (this.fileBuffer != undefined) { // File buffer is set; write it as temp file - this.fileBufferTempFilePath = this.tempFilePathGenerator("raw", type); - - return new Promise((resolve, reject) => { - fsWriteFile(this.fileBufferTempFilePath, this.fileBuffer, (err) => { - if (err) { - reject(err); - return; - } - - resolve(this.fileBufferTempFilePath); - }); - }) - .then((file: string) => { - return this.execProgress(file, args, type); - }) - .catch((error: Error) => { - this.removeTempFilesOnError(); - throw error; - }); - } - else { // File path is set - return this.execProgress(this.filePath, args, type) - .catch((error: Error) => { - this.removeTempFilesOnError(); - throw error; - }); - } - } - - /** - * Execute decoding/encoding via spawn Lame - * - * @private - * @param {string} inputFilePath Path of input file - */ - private execProgress(inputFilePath: string, args: string[], type: "encode" | "decode") { - // Add output settings args - args.push("--disptime"); - args.push("1"); - - // Add output file to args, if not undefined in options - if (this.options.output == "buffer") { - const tempOutPath = this.tempFilePathGenerator("encoded", type); - args.unshift(`${tempOutPath}`); - - // Set decode/encoded file path - this.progressedBufferTempFilePath = tempOutPath; - } - else { - // Set decode/encoded file path - this.progressedFilePath = this.options.output; - args.unshift(this.progressedFilePath); - } - - // Add input file to args - args.unshift(inputFilePath); - - // Spawn instance of encoder and hook output methods - this.status.started = true; - this.status.finished = false; - this.status.progress = 0; - this.status.eta = undefined; - - /** - * Handles output of stdout (and stderr) - * Parses data from output into object - * - * @param {(String | Buffer)} data - */ - const progressStdout = (data: String | Buffer) => { - data = data.toString().trim(); - - // Every output of Lame comes as "stderr". Deciding if it is an error or valid data by regex - if (data.length > 6) { - if (type == "encode" && data.search("Writing LAME Tag...done") > -1) { // processing done - this.status.finished = true; - this.status.progress = 100; - this.status.eta = "00:00"; - - this.emitter.emit("finish"); - this.emitter.emit("progress", [this.status.progress, this.status.eta]); - } - else if (type == "encode" && data.search(/\((( [0-9])|([0-9]{2})|(100))%\)\|/) > -1) { // status of processing - const progressMatch = data.match(/\((( [0-9])|([0-9]{2})|(100))%\)\|/); - const etaMatch = data.match(/[0-9]{1,2}:[0-9][0-9] /); - - const progress: string = String(progressMatch[1]); - let eta: string = null; - if (etaMatch != null) { - eta = etaMatch[0].trim(); - } - - if (progress != null && Number(progress) > this.status.progress) { - this.status.progress = Number(progress); - } - - if (eta != null) { - this.status.eta = eta; - } - - this.emitter.emit("progress", [this.status.progress, this.status.eta]); - } - else if (type == "decode" && data.search(/[0-9]{1,10}\/[0-9]{1,10}/) > -1) { - const progressMatch = data.match(/[0-9]{1,10}\/[0-9]{1,10}/); - const progressAbsolute = progressMatch[0].split("/"); - const progress = Math.floor(Number(progressAbsolute[0]) / Number(progressAbsolute[1]) * 100); - - if (!isNaN(progress) && Number(progress) > this.status.progress) { - this.status.progress = Number(progress); - } - - this.emitter.emit("progress", [this.status.progress, this.status.eta]); - } - else if (data.search(/^lame: /) > -1 || data.search(/^Warning: /) > -1 || data.search(/Error /) > -1) { // Unexpected output => error - if (data.search(/^lame: /) == -1) { - this.emitter.emit("error", new Error("lame: " + data)); - } - else { - this.emitter.emit("error", new Error(String(data))); - } - } - } - } - - const progressOnClose = (code) => { - if (code == 0) { - if (!this.status.finished) { - this.emitter.emit("finish"); - } - - this.status.finished = true; - this.status.progress = 100; - this.status.eta = "00:00"; - } - } - - /** - * Handles error throw of Lame instance - * - * @param {Error} error - */ - const progressError = (error: Error) => { - this.emitter.emit("error", error); - } - - const instance = spawn("lame", args); - instance.stdout.on("data", progressStdout); - instance.stderr.on("data", progressStdout); // Most output, even non-errors, are on stderr - instance.on("close", progressOnClose); - instance.on("error", progressError); - - // Return promise of finish encoding progress - return new Promise((resolve, reject) => { - this.emitter.on("finish", () => { - // If input was buffer, remove temp file - if (this.fileBufferTempFilePath != undefined) { - fsUnlinkSync(this.fileBufferTempFilePath); - } - - // If output should be a buffer, load decoded/encoded audio file in object and remove temp file - if (this.options.output == "buffer") { - fsReadFile(this.progressedBufferTempFilePath, null, (error, data: string) => { - // Remove temp decoded/encoded file - fsUnlinkSync(this.progressedBufferTempFilePath); - - if (error) { - reject(error); - return; - } - - this.progressedBuffer = new Buffer(data); - this.progressedBufferTempFilePath = undefined; - - resolve(this); - }); - } - else { - resolve(this); - } - }); - - this.emitter.on("error", (error) => { - reject(error); - }); - }); - } - - /** - * Generate temp file path - * - * @param {("raw" | "encoded")} type - * @returns {string} Path - */ - private tempFilePathGenerator(type: "raw" | "encoded", progressType: "encode" | "decode"): string { - const prefix = `${__dirname}/../.`; - let path = `${prefix}./temp/${type}/`; - let possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - - for (let i = 0; i < 32; i++) { - path += possible.charAt(Math.floor(Math.random() * possible.length)); - } - - if (type == "raw" && progressType == "decode") { - path += `.mp3`; - } - - if (!fsExistsSync(`${prefix}./temp/${path}`)) { - return path; - } - else { - return this.tempFilePathGenerator(type, progressType); - } - } - - /** - * Remove temp files, if error occurred - */ - private removeTempFilesOnError() { - if (this.fileBufferTempFilePath != undefined) { - fsUnlinkSync(this.fileBufferTempFilePath); - } - - if (this.progressedBufferTempFilePath != undefined) { - fsUnlinkSync(this.progressedBufferTempFilePath); - } - } + private status: LameStatus = { + started: false, + finished: false, + progress: undefined, + eta: undefined + }; + private emitter: EventEmitter = new EventEmitter(); + + private options: Options; + private args: string[]; + + private filePath: string; + private fileBuffer: Buffer; + private fileBufferTempFilePath: string; + + private progressedFilePath: string; + private progressedBuffer: Buffer; + private progressedBufferTempFilePath: string; + + /** + * Creates an instance of Lame and set all options + * @param {Options} options + */ + constructor(options: Options) { + this.options = options; + this.args = new LameOptions(this.options).getArguments(); + } + + /** + * Set file path of audio to decode/encode + * + * @param {string} filePath + */ + public setFile(path: string): Lame { + if (!fsExistsSync(path)) { + throw new Error("Audio file (path) dose not exist"); + } + + this.filePath = path; + this.fileBuffer = undefined; + + return this; + } + + /** + * Set file buffer of audio to decode/encode + * + * @param {Buffer} file + */ + public setBuffer(file: Buffer): Lame { + if (!utilIsBuffer(file)) { + throw new Error("Audio file (buffer) dose not exist"); + } + + this.fileBuffer = file; + this.filePath = undefined; + + return this; + } + + /** + * Get decoded/encoded file path + * + * @returns {string} Path of decoded/encoded file + */ + public getFile(): string { + if (this.progressedFilePath == undefined) { + throw new Error("Audio is not yet decoded/encoded"); + } + + return this.progressedFilePath; + } + + /** + * Get decoded/encoded file as buffer + * + * @returns {Buffer} decoded/Encoded file + */ + public getBuffer(): Buffer { + if (this.progressedBuffer == undefined) { + throw new Error("Audio is not yet decoded/encoded"); + } + + return this.progressedBuffer; + } + + /** + * Get event emitter + * + * @returns {EventEmitter} + */ + public getEmitter(): EventEmitter { + return this.emitter; + } + + /** + * Get status of converter + * + * @returns {LameStatus} + */ + public getStatus(): LameStatus { + return this.status; + } + + /** + * Encode audio file by Lame + * + * @return {Promise} + */ + public encode(): Promise { + return this.progress("encode"); + } + + /** + * Decode audio file by Lame + * + * @return {Promise} + */ + public decode(): Promise { + return this.progress("decode"); + } + + /** + * Decode/Encode audio file by Lame + * + * @return {Promise} + */ + private progress(type: "encode" | "decode"): Promise { + if (this.filePath == undefined && this.fileBuffer == undefined) { + throw new Error("Audio file to encode is not set"); + } + + // Set decode flag to progress a MP3 to WAV decode + const args = this.args; + if (type == "decode") { + args.push("--decode"); + } + + if (this.fileBuffer != undefined) { + // File buffer is set; write it as temp file + this.fileBufferTempFilePath = this.tempFilePathGenerator( + "raw", + type + ); + + return new Promise((resolve, reject) => { + fsWriteFile( + this.fileBufferTempFilePath, + this.fileBuffer, + err => { + if (err) { + reject(err); + return; + } + + resolve(this.fileBufferTempFilePath); + } + ); + }) + .then((file: string) => { + return this.execProgress(file, args, type); + }) + .catch((error: Error) => { + this.removeTempFilesOnError(); + throw error; + }); + } else { + // File path is set + return this.execProgress(this.filePath, args, type).catch( + (error: Error) => { + this.removeTempFilesOnError(); + throw error; + } + ); + } + } + + /** + * Execute decoding/encoding via spawn Lame + * + * @private + * @param {string} inputFilePath Path of input file + */ + private execProgress( + inputFilePath: string, + args: string[], + type: "encode" | "decode" + ) { + // Add output settings args + args.push("--disptime"); + args.push("1"); + + // Add output file to args, if not undefined in options + if (this.options.output == "buffer") { + const tempOutPath = this.tempFilePathGenerator("encoded", type); + args.unshift(`${tempOutPath}`); + + // Set decode/encoded file path + this.progressedBufferTempFilePath = tempOutPath; + } else { + // Set decode/encoded file path + this.progressedFilePath = this.options.output; + args.unshift(this.progressedFilePath); + } + + // Add input file to args + args.unshift(inputFilePath); + + // Spawn instance of encoder and hook output methods + this.status.started = true; + this.status.finished = false; + this.status.progress = 0; + this.status.eta = undefined; + + /** + * Handles output of stdout (and stderr) + * Parses data from output into object + * + * @param {(String | Buffer)} data + */ + const progressStdout = (data: String | Buffer) => { + data = data.toString().trim(); + + // Every output of Lame comes as "stderr". Deciding if it is an error or valid data by regex + if (data.length > 6) { + if ( + type == "encode" && + data.search("Writing LAME Tag...done") > -1 + ) { + // processing done + this.status.finished = true; + this.status.progress = 100; + this.status.eta = "00:00"; + + this.emitter.emit("finish"); + this.emitter.emit("progress", [ + this.status.progress, + this.status.eta + ]); + } else if ( + type == "encode" && + data.search(/\((( [0-9])|([0-9]{2})|(100))%\)\|/) > -1 + ) { + // status of processing + const progressMatch = data.match( + /\((( [0-9])|([0-9]{2})|(100))%\)\|/ + ); + const etaMatch = data.match(/[0-9]{1,2}:[0-9][0-9] /); + + const progress: string = String(progressMatch[1]); + let eta: string = null; + if (etaMatch != null) { + eta = etaMatch[0].trim(); + } + + if ( + progress != null && + Number(progress) > this.status.progress + ) { + this.status.progress = Number(progress); + } + + if (eta != null) { + this.status.eta = eta; + } + + this.emitter.emit("progress", [ + this.status.progress, + this.status.eta + ]); + } else if ( + type == "decode" && + data.search(/[0-9]{1,10}\/[0-9]{1,10}/) > -1 + ) { + const progressMatch = data.match( + /[0-9]{1,10}\/[0-9]{1,10}/ + ); + const progressAbsolute = progressMatch[0].split("/"); + const progress = Math.floor( + (Number(progressAbsolute[0]) / + Number(progressAbsolute[1])) * + 100 + ); + + if ( + !isNaN(progress) && + Number(progress) > this.status.progress + ) { + this.status.progress = Number(progress); + } + + this.emitter.emit("progress", [ + this.status.progress, + this.status.eta + ]); + } else if ( + data.search(/^lame: /) > -1 || + data.search(/^Warning: /) > -1 || + data.search(/Error /) > -1 + ) { + // Unexpected output => error + if (data.search(/^lame: /) == -1) { + this.emitter.emit("error", new Error("lame: " + data)); + } else { + this.emitter.emit("error", new Error(String(data))); + } + } + } + }; + + const progressOnClose = code => { + if (code == 0) { + if (!this.status.finished) { + this.emitter.emit("finish"); + } + + this.status.finished = true; + this.status.progress = 100; + this.status.eta = "00:00"; + } + }; + + /** + * Handles error throw of Lame instance + * + * @param {Error} error + */ + const progressError = (error: Error) => { + this.emitter.emit("error", error); + }; + + const instance = spawn("lame", args); + instance.stdout.on("data", progressStdout); + instance.stderr.on("data", progressStdout); // Most output, even non-errors, are on stderr + instance.on("close", progressOnClose); + instance.on("error", progressError); + + // Return promise of finish encoding progress + return new Promise((resolve, reject) => { + this.emitter.on("finish", () => { + // If input was buffer, remove temp file + if (this.fileBufferTempFilePath != undefined) { + fsUnlinkSync(this.fileBufferTempFilePath); + } + + // If output should be a buffer, load decoded/encoded audio file in object and remove temp file + if (this.options.output == "buffer") { + fsReadFile( + this.progressedBufferTempFilePath, + null, + (error, data: string) => { + // Remove temp decoded/encoded file + fsUnlinkSync(this.progressedBufferTempFilePath); + + if (error) { + reject(error); + return; + } + + this.progressedBuffer = Buffer.from(data); + this.progressedBufferTempFilePath = undefined; + + resolve(this); + } + ); + } else { + resolve(this); + } + }); + + this.emitter.on("error", error => { + reject(error); + }); + }); + } + + /** + * Generate temp file path + * + * @param {("raw" | "encoded")} type + * @returns {string} Path + */ + private tempFilePathGenerator( + type: "raw" | "encoded", + progressType: "encode" | "decode" + ): string { + const prefix = `${__dirname}/../.`; + let path = `${prefix}./temp/${type}/`; + let possible = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + + for (let i = 0; i < 32; i++) { + path += possible.charAt( + Math.floor(Math.random() * possible.length) + ); + } + + if (type == "raw" && progressType == "decode") { + path += `.mp3`; + } + + if (!fsExistsSync(`${prefix}./temp/${path}`)) { + return path; + } else { + return this.tempFilePathGenerator(type, progressType); + } + } + + /** + * Remove temp files, if error occurred + */ + private removeTempFilesOnError() { + if (this.fileBufferTempFilePath != undefined) { + fsUnlinkSync(this.fileBufferTempFilePath); + } + + if (this.progressedBufferTempFilePath != undefined) { + fsUnlinkSync(this.progressedBufferTempFilePath); + } + } } -export { Lame }; \ No newline at end of file +export { Lame }; diff --git a/lib/src/LameOptions.ts b/lib/src/LameOptions.ts index d69f593..a57b9b2 100644 --- a/lib/src/LameOptions.ts +++ b/lib/src/LameOptions.ts @@ -3,7 +3,7 @@ import * as fs from "fs"; /** * All options of node-lame; build argument array for binary - * + * * @class LameOptions */ class LameOptions { @@ -188,8 +188,7 @@ class LameOptions { private raw(value) { if (value == true) { return [`-r`]; - } - else { + } else { return undefined; } } @@ -197,35 +196,45 @@ class LameOptions { private swapBytes(value) { if (value == true) { return [`-x`]; - } - else { + } else { return undefined; } } private sfreq(value) { - if (value == 8 || value == 11.025 || value == 12 || value == 16 || value == 22.05 || value == 24 || value == 32 || value == 44.1 || value == 48) { + if ( + value == 8 || + value == 11.025 || + value == 12 || + value == 16 || + value == 22.05 || + value == 24 || + value == 32 || + value == 44.1 || + value == 48 + ) { return [`-s`, value]; - } - else { - throw new Error("lame: Invalid option: 'sfreq' is not in range of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1 or 48."); + } else { + throw new Error( + "lame: Invalid option: 'sfreq' is not in range of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1 or 48." + ); } } private bitwidth(value) { if (value == 8 || value == 16 || value == 24 || value == 32) { return [`--bitwidth`, value]; - } - else { - throw new Error("lame: Invalid option: 'sfreq' is not in range of 8, 16, 24 or 32."); + } else { + throw new Error( + "lame: Invalid option: 'sfreq' is not in range of 8, 16, 24 or 32." + ); } } private signed(value) { if (value == true) { return [`--signed`]; - } - else { + } else { return undefined; } } @@ -233,8 +242,7 @@ class LameOptions { private unsigned(value) { if (value == true) { return [`--unsigned`]; - } - else { + } else { return undefined; } } @@ -242,8 +250,7 @@ class LameOptions { private littleEndian(value) { if (value == true) { return [`--little-endian`]; - } - else { + } else { return undefined; } } @@ -251,8 +258,7 @@ class LameOptions { private bigEndian(value) { if (value == true) { return [`--big-endian`]; - } - else { + } else { return undefined; } } @@ -260,8 +266,7 @@ class LameOptions { private mp2Input(value) { if (value == true) { return [`--mp2input`]; - } - else { + } else { return undefined; } } @@ -269,26 +274,33 @@ class LameOptions { private mp3Input(value) { if (value == true) { return [`--mp3input`]; - } - else { + } else { return undefined; } } private mode(value) { - if (value == "s" || value == "j" || value == "f" || value == "d" || value == "m" || value == "l" || value == "r") { + if ( + value == "s" || + value == "j" || + value == "f" || + value == "d" || + value == "m" || + value == "l" || + value == "r" + ) { return [`-m`, value]; - } - else { - throw new Error("lame: Invalid option: 'mode' is not in range of 's', 'j', 'f', 'd', 'm', 'l' or 'r'."); + } else { + throw new Error( + "lame: Invalid option: 'mode' is not in range of 's', 'j', 'f', 'd', 'm', 'l' or 'r'." + ); } } private toMono(value) { if (value == true) { return [`-a`]; - } - else { + } else { return undefined; } } @@ -296,26 +308,31 @@ class LameOptions { private channelDifferentBlockSize(value) { if (value == true) { return [`-d`]; - } - else { + } else { return undefined; } } private freeformat(value) { - if (value == "FreeAmp" || value == "in_mpg123" || value == "l3dec" || value == "LAME" || value == "MAD") { + if ( + value == "FreeAmp" || + value == "in_mpg123" || + value == "l3dec" || + value == "LAME" || + value == "MAD" + ) { return [`--freeformat`, value]; - } - else { - throw new Error("lame: Invalid option: 'mode' is not in range of 'FreeAmp', 'in_mpg123', 'l3dec', 'LAME', 'MAD'."); + } else { + throw new Error( + "lame: Invalid option: 'mode' is not in range of 'FreeAmp', 'in_mpg123', 'l3dec', 'LAME', 'MAD'." + ); } } private disableInfoTag(value) { if (value == true) { return [`-t`]; - } - else { + } else { return undefined; } } @@ -325,34 +342,29 @@ class LameOptions { } private scale(value) { - return [`--scale`, value]; } private scaleL(value) { - return [`--scale-l`, value]; } private scaleR(value) { - return [`--scale-r`, value]; } private replaygainFast(value) { if (value == true) { return [`--replaygain-fast`]; - } - else { + } else { return undefined; - }; + } } private replaygainAccurate(value) { if (value == true) { return [`--replaygain-accurate`]; - } - else { + } else { return undefined; } } @@ -360,8 +372,7 @@ class LameOptions { private noreplaygain(value) { if (value == true) { return [`--noreplaygain`]; - } - else { + } else { return undefined; } } @@ -369,53 +380,79 @@ class LameOptions { private clipDetect(value) { if (value == true) { return [`--clipdetect`]; - } - else { + } else { return undefined; } } private preset(value) { - if (value == "medium" || value == "standard" || value == "extreme" || value == "insane") { + if ( + value == "medium" || + value == "standard" || + value == "extreme" || + value == "insane" + ) { return [`--preset`, value]; - } - else { - throw new Error("lame: Invalid option: 'mode' is not in range of 'medium', 'standard', 'extreme' or 'insane'."); + } else { + throw new Error( + "lame: Invalid option: 'mode' is not in range of 'medium', 'standard', 'extreme' or 'insane'." + ); } } private noasm(value) { if (value == "mmx" || value == "3dnow" || value == "sse") { return [`--noasm`, value]; - } - else { - throw new Error("lame: Invalid option: 'noasm' is not in range of 'mmx', '3dnow' or 'sse'."); + } else { + throw new Error( + "lame: Invalid option: 'noasm' is not in range of 'mmx', '3dnow' or 'sse'." + ); } } private quality(value) { if (value >= 0 && value <= 9) { return [`-q`, value]; - } - else { - throw new Error("lame: Invalid option: 'quality' is not in range of 0 to 9."); + } else { + throw new Error( + "lame: Invalid option: 'quality' is not in range of 0 to 9." + ); } } private bitrate(value) { - if (value == 8 || value == 16 || value == 24 || value == 32 || value == 40 || value == 48 || value == 56 || value == 64 || value == 80 || value == 96 || value == 112 || value == 128 || value == 144 || value == 160 || value == 192 || value == 224 || value == 256 || value == 320) { + if ( + value == 8 || + value == 16 || + value == 24 || + value == 32 || + value == 40 || + value == 48 || + value == 56 || + value == 64 || + value == 80 || + value == 96 || + value == 112 || + value == 128 || + value == 144 || + value == 160 || + value == 192 || + value == 224 || + value == 256 || + value == 320 + ) { return [`-b`, value]; - } - else { - throw new Error("lame: Invalid option: 'bitrate' is not in range of 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 192, 224, 256 or 320."); + } else { + throw new Error( + "lame: Invalid option: 'bitrate' is not in range of 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 192, 224, 256 or 320." + ); } } private forceBitrate(value) { if (value == true) { return [`-F`]; - } - else { + } else { return undefined; } } @@ -423,8 +460,7 @@ class LameOptions { private cbr(value) { if (value == true) { return [`--cbr`]; - } - else { + } else { return undefined; } } @@ -432,17 +468,17 @@ class LameOptions { private abr(value) { if (value >= 8 && value <= 310) { return [`--abr`, value]; - } - else { - throw new Error("lame: Invalid option: 'abr' is not in range of 8 to 310."); + } else { + throw new Error( + "lame: Invalid option: 'abr' is not in range of 8 to 310." + ); } } private vbr(value) { if (value == true) { return [`-v`]; - } - else { + } else { return undefined; } } @@ -450,17 +486,17 @@ class LameOptions { private vbrQuality(value) { if (value >= 0 && value <= 9) { return [`-V`, value]; - } - else { - throw new Error("lame: Invalid option: 'vbrQuality' is not in range of 0 to 9."); + } else { + throw new Error( + "lame: Invalid option: 'vbrQuality' is not in range of 0 to 9." + ); } } private ignoreNoiseInSfb21(value) { if (value == true) { return [`-Y`]; - } - else { + } else { return undefined; } } @@ -468,17 +504,17 @@ class LameOptions { private emp(value) { if (value == "n" || value == 5 || value == "c") { return [`-e`, value]; - } - else { - throw new Error("lame: Invalid option: 'emp' is not in range of 'n', 5 or 'c'."); + } else { + throw new Error( + "lame: Invalid option: 'emp' is not in range of 'n', 5 or 'c'." + ); } } private markAsCopyrighted(value) { if (value == true) { return [`-c`]; - } - else { + } else { return undefined; } } @@ -486,8 +522,7 @@ class LameOptions { private markAsCopy(value) { if (value == true) { return [`-o`]; - } - else { + } else { return undefined; } } @@ -495,8 +530,7 @@ class LameOptions { private crcErrorProtection(value) { if (value == true) { return [`-p`]; - } - else { + } else { return undefined; } } @@ -504,8 +538,7 @@ class LameOptions { private nores(value) { if (value == true) { return [`--nores`]; - } - else { + } else { return undefined; } } @@ -513,8 +546,7 @@ class LameOptions { private strictlyEnforceIso(value) { if (value == true) { return [`--strictly-enforce-ISO`]; - } - else { + } else { return undefined; } } @@ -536,11 +568,22 @@ class LameOptions { } private resample(value) { - if (value == 8 || value == 11.025 || value == 12 || value == 16 || value == 22.05 || value == 24 || value == 32 || value == 44.1 || value == 48) { + if ( + value == 8 || + value == 11.025 || + value == 12 || + value == 16 || + value == 22.05 || + value == 24 || + value == 32 || + value == 44.1 || + value == 48 + ) { return [`--resample`, value]; - } - else { - throw new Error("lame: Invalid option: 'resample' is not in range of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1 or 48."); + } else { + throw new Error( + "lame: Invalid option: 'resample' is not in range of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1 or 48." + ); } } @@ -548,52 +591,64 @@ class LameOptions { for (const key in metaObj) { const value = metaObj[key]; - if (key == "title" || key == "artist" || key == "album" || key == "year" || key == "comment" || key == "track" || key == "genre" || key == "artwork" || key == "genre-list" || key == "pad-id3v2-size") { + if ( + key == "title" || + key == "artist" || + key == "album" || + key == "year" || + key == "comment" || + key == "track" || + key == "genre" || + key == "artwork" || + key == "genre-list" || + key == "pad-id3v2-size" + ) { let arg0; if (key == "title") { arg0 = `--tt`; - } - else if (key == "artist") { + } else if (key == "artist") { arg0 = `--ta`; - } - else if (key == "album") { + } else if (key == "album") { arg0 = `--tl`; - } - else if (key == "year") { + } else if (key == "year") { arg0 = `--ty`; - } - else if (key == "comment") { + } else if (key == "comment") { arg0 = `--tc`; - } - else if (key == "track") { + } else if (key == "track") { arg0 = `--tn`; - } - else if (key == "genre") { + } else if (key == "genre") { arg0 = `--tg`; - } - else if (key == "artwork") { + } else if (key == "artwork") { arg0 = `--ti`; - } - else if (key == "genre-list") { + } else if (key == "genre-list") { arg0 = `--genre-list`; - } - else if (key == "pad-id3v2-size") { + } else if (key == "pad-id3v2-size") { arg0 = `--pad-id3v2-size`; - } - else { - throw new Error(`lame: Invalid option: 'meta' unknown property '${key}'`); + } else { + throw new Error( + `lame: Invalid option: 'meta' unknown property '${key}'` + ); } const arg1 = `${value}`; this.args.push(arg0); this.args.push(arg1); - } - else if (key == "add-id3v2" || key == "id3v1-only" || key == "id3v2-only" || key == "id3v2-latin1" || key == "id3v2-utf16" || key == "space-id3v1" || key == "pad-id3v2" || key == "ignore-tag-errors") { + } else if ( + key == "add-id3v2" || + key == "id3v1-only" || + key == "id3v2-only" || + key == "id3v2-latin1" || + key == "id3v2-utf16" || + key == "space-id3v1" || + key == "pad-id3v2" || + key == "ignore-tag-errors" + ) { this.args.push(`--${key}`); - } - else { - throw new Error(`lame: Invalid option: 'meta' unknown property '${key}'`); + } else { + throw new Error( + `lame: Invalid option: 'meta' unknown property '${key}'` + ); } } @@ -601,4 +656,4 @@ class LameOptions { } } -export { LameOptions }; \ No newline at end of file +export { LameOptions }; diff --git a/lib/src/LameTypings.ts b/lib/src/LameTypings.ts index 0dca80e..d81cb4b 100644 --- a/lib/src/LameTypings.ts +++ b/lib/src/LameTypings.ts @@ -1,13 +1,13 @@ /** * Status data of lame instance - * + * * @interface LameStatus */ interface LameStatus { - "started": boolean; - "finished": boolean; - "progress": number; - "eta": string; + started: boolean; + finished: boolean; + progress: number; + eta: string; } /** @@ -21,18 +21,36 @@ namespace Options { export type preset = "medium" | "standard" | "extreme" | "insane"; export type noasm = "mmx" | "3dnow" | "sse"; export type quality = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9; - export type bitrate = 8 | 16 | 24 | 32 | 40 | 48 | 56 | 64 | 80 | 96 | 112 | 128 | 144 | 160 | 192 | 224 | 256 | 320; + export type bitrate = + | 8 + | 16 + | 24 + | 32 + | 40 + | 48 + | 56 + | 64 + | 80 + | 96 + | 112 + | 128 + | 144 + | 160 + | 192 + | 224 + | 256 + | 320; export type emp = "n" | 5 | "c"; export type resample = 8 | 11.025 | 12 | 16 | 22.05 | 24 | 32 | 44.1 | 48; export interface meta { - "title"?: string; - "artist"?: string; - "album"?: string; - "year"?: string; - "comment"?: string; - "track"?: string; - "genre"?: string; + title?: string; + artist?: string; + album?: string; + year?: string; + comment?: string; + track?: string; + genre?: string; "add-id3v2"?: boolean; "id3v1-only"?: boolean; @@ -47,52 +65,52 @@ namespace Options { } interface Options { - "output": string | "buffer"; - "raw"?: boolean; + output: string | "buffer"; + raw?: boolean; "swap-bytes"?: boolean; - "sfreq"?: Options.sfreq; - "bitwidth"?: Options.bitwidth; - "signed"?: boolean; - "unsigned"?: boolean; + sfreq?: Options.sfreq; + bitwidth?: Options.bitwidth; + signed?: boolean; + unsigned?: boolean; "little-endian"?: boolean; "big-endian"?: boolean; - "mp2Input"?: boolean; - "mp3Input"?: boolean; - "mode"?: Options.mode; + mp2Input?: boolean; + mp3Input?: boolean; + mode?: Options.mode; "to-mono"?: boolean; "channel-different-block-sizes"?: boolean; - "freeformat"?: Options.freeformat; + freeformat?: Options.freeformat; "disable-info-tag"?: boolean; - "comp"?: number; - "scale"?: number; + comp?: number; + scale?: number; "scale-l"?: number; "scale-r"?: number; "replaygain-fast"?: boolean; "replaygain-accurate"?: boolean; "no-replaygain"?: boolean; "clip-detect"?: boolean; - "preset"?: Options.preset; - "noasm"?: Options.noasm; - "quality"?: Options.quality; - "bitrate"?: Options.bitrate; + preset?: Options.preset; + noasm?: Options.noasm; + quality?: Options.quality; + bitrate?: Options.bitrate; "force-bitrate"?: boolean; - "cbr"?: boolean; - "abr"?: number; - "vbr"?: boolean; + cbr?: boolean; + abr?: number; + vbr?: boolean; "vbr-quality"?: number; "ignore-noise-in-sfb21"?: boolean; - "emp"?: Options.emp; + emp?: Options.emp; "mark-as-copyrighted"?: boolean; "mark-as-copy"?: boolean; "crc-error-protection"?: boolean; - "nores"?: boolean; + nores?: boolean; "strictly-enforce-ISO"?: boolean; - "lowpass"?: number; + lowpass?: number; "lowpass-width"?: number; - "highpass"?: number; + highpass?: number; "highpass-width"?: number; - "resample"?: Options.resample; - "meta"?: Options.meta; + resample?: Options.resample; + meta?: Options.meta; } -export { LameStatus, Options }; \ No newline at end of file +export { LameStatus, Options }; diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..19bb2f6 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,378 @@ +{ + "name": "node-lame", + "version": "1.2.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/chai": { + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.1.7.tgz", + "integrity": "sha512-2Y8uPt0/jwjhQ6EiluT0XCri1Dbplr0ZxfFXUz+ye13gaqE8u5gL5ppao1JrUYr9cIip5S6MvQzBS7Kke7U9VA==", + "dev": true + }, + "@types/fs-extra": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-5.0.4.tgz", + "integrity": "sha512-DsknoBvD8s+RFfSGjmERJ7ZOP1HI0UZRA3FSI+Zakhrc/Gy26YQsLI+m5V5DHxroHRJqCDLKJp7Hixn8zyaF7g==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/mocha": { + "version": "5.2.5", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.5.tgz", + "integrity": "sha512-lAVp+Kj54ui/vLUFxsJTMtWvZraZxum3w3Nwkble2dNuV5VnPA+Mi2oGX9XYJAaIvZi3tn3cbjS/qcJXRb6Bww==", + "dev": true + }, + "@types/node": { + "version": "10.12.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.5.tgz", + "integrity": "sha512-GzdHjq3t3eGLMv92Al90Iq+EoLL+86mPfQhuglbBFO7HiLdC/rkt+zrzJJumAiBF6nsrBWhou22rPW663AAyFw==", + "dev": true + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "chai": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", + "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", + "dev": true, + "requires": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "pathval": "^1.1.0", + "type-detect": "^4.0.5" + } + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, + "commander": { + "version": "2.15.1", + "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true, + "requires": { + "type-detect": "^4.0.0" + } + }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "graceful-fs": { + "version": "4.1.15", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", + "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==", + "dev": true + }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "make-error": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz", + "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "mocha": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", + "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "dev": true, + "requires": { + "browser-stdout": "1.3.1", + "commander": "2.15.1", + "debug": "3.1.0", + "diff": "3.5.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.5", + "he": "1.1.1", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "supports-color": "5.4.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-support": { + "version": "0.5.9", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.9.tgz", + "integrity": "sha512-gR6Rw4MvUlYy83vP0vxoVNzM6t8MUXqNuRsuBmBHQDu1Fh6X015FrLdgoDKcNdkwGubozq0P4N0Q37UyFVr1EA==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "ts-node": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-7.0.1.tgz", + "integrity": "sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw==", + "dev": true, + "requires": { + "arrify": "^1.0.0", + "buffer-from": "^1.1.0", + "diff": "^3.1.0", + "make-error": "^1.1.1", + "minimist": "^1.2.0", + "mkdirp": "^0.5.1", + "source-map-support": "^0.5.6", + "yn": "^2.0.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + } + } + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, + "typescript": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.1.6.tgz", + "integrity": "sha512-tDMYfVtvpb96msS1lDX9MEdHrW4yOuZ4Kdc4Him9oU796XldPYF/t2+uKoX0BBa0hXXwDlqYQbXY5Rzjzc5hBA==", + "dev": true + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "yn": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", + "integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=", + "dev": true + } + } +} diff --git a/package.json b/package.json index 26b199f..cedfcc0 100644 --- a/package.json +++ b/package.json @@ -1,59 +1,60 @@ { - "name": "node-lame", - "description": "LAME MP3 encoder for Node.js", - "version": "1.1.0", - "homepage": "https://github.com/jankarres/node-lame", - "repository": { - "type": "git", - "url": "git+https://github.com/jankarres/node-lame.git" - }, - "bugs": { - "url": "https://github.com/jankarres/node-lame/issues" - }, - "author": { - "name": "Jan Karres", - "email": "mail@jankarres.com", - "url": "https://jankarres.com/" - }, - "contributors": [{ - "name": "Elias Porcio", - "email": "elias.porcio@gmail.com" - }], - "keywords": [ - "mp3", - "wav", - "LAME", - "MPEG-1", - "MPEG-2", - "encoder", - "audio" - ], - "license": "MIT", - "engines": { - "node": ">=8.11" - }, - "scripts": { - "build": "tsc", - "test": "./node_modules/.bin/mocha" - }, - "files": [ - "lib/build/", - "temp/", - "index.js", - "index.d.ts", - "install.sh", - "README.md" - ], - "dependencies": {}, - "devDependencies": { - "@types/chai": "^3.4.35", - "@types/fs-promise": "^1.0.3", - "@types/mocha": "^2.2.40", - "@types/node": "^8.10.1", - "chai": "^3.5.0", - "fs-promise": "^2.0.2", - "mocha": "^3.2.0", - "ts-node": "^2.1.0", - "typescript": "^2.2.1" - } -} \ No newline at end of file + "name": "node-lame", + "description": "LAME MP3 encoder for Node.js", + "version": "1.2.0", + "homepage": "https://github.com/jankarres/node-lame", + "repository": { + "type": "git", + "url": "git+https://github.com/jankarres/node-lame.git" + }, + "bugs": { + "url": "https://github.com/jankarres/node-lame/issues" + }, + "author": { + "name": "Jan Karres", + "email": "mail@jankarres.com", + "url": "https://jankarres.com/" + }, + "contributors": [ + { + "name": "Elias Porcio", + "email": "elias.porcio@gmail.com" + } + ], + "keywords": [ + "mp3", + "wav", + "LAME", + "MPEG-1", + "MPEG-2", + "encoder", + "audio" + ], + "license": "MIT", + "engines": { + "node": ">=10.13" + }, + "scripts": { + "build": "tsc", + "test": "./node_modules/.bin/mocha" + }, + "files": [ + "lib/build/", + "temp/", + "index.js", + "index.d.ts", + "README.md" + ], + "dependencies": {}, + "devDependencies": { + "@types/chai": "~4.1.7", + "@types/fs-extra": "^5.0.4", + "@types/mocha": "~5.2.5", + "@types/node": "^10.12.5", + "chai": "~4.2.0", + "fs-extra": "^7.0.1", + "mocha": "~5.2.0", + "ts-node": "~7.0.1", + "typescript": "~3.1.6" + } +} diff --git a/test/tests.js b/test/tests.js index 1c9b9a0..e844df5 100644 --- a/test/tests.js +++ b/test/tests.js @@ -1,23 +1,20 @@ const testCase = require("mocha").describe; -const pre = require("mocha").before; const assertions = require("mocha").it; const assert = require("chai").assert; const fs = require("fs"); -const fsp = require("fs-promise"); -const util = require("util"); +const fsp = require("fs-extra"); const Lame = require("../index").Lame; testCase("Lame class", () => { - - const TESTFILE_DURATION = 12; //Audio duration of the Testfile in seconds - const RESULT_DURATION_TOLERANCE = 1; //Max difference between Testfile duration and converted file duration in seconds - const EXPECTED_WAV_SIZE = 2142500; //Size of an correctly converted wav file in bytes - const WAV_SIZE_TOLERANCE = 500; //Max difference between EXPECTED_WAV_SIZE and the actual size of the converted file + const TEST_FILE_DURATION = 12; // Audio duration of the TEST_FILE in seconds + const RESULT_DURATION_TOLERANCE = 1; // Max difference between TEST_FILE duration and converted file duration in seconds + const EXPECTED_WAV_SIZE = 2142500; // Size of an correctly converted wav file in bytes + const WAV_SIZE_TOLERANCE = 500; // Max difference between EXPECTED_WAV_SIZE and the actual size of the converted file testCase("Encode to .mp3", () => { - const TESTFILE = "./test/example.wav"; - const OUTPUTFILE = "./test/encoded.mp3"; + const TEST_FILE = "./test/example.wav"; + const OUTPUT_FILE = "./test/encoded.mp3"; /** * @testname Set invalid wav file @@ -28,22 +25,22 @@ testCase("Lame class", () => { const targetBitrate = 128; const instance = new Lame({ - "output": OUTPUTFILE, - "bitrate": targetBitrate + output: OUTPUT_FILE, + bitrate: targetBitrate }); instance.setFile("./test/notAWavFile.wav"); - return instance.encode() - .catch((error) => { - errorCaught = true; + return instance.encode().catch(error => { + errorCaught = true; - const expected = "lame: Warning: unsupported audio format"; - const actuall = error.message; + const expected = + "lame: Warning: unsupported audio format\nCan't init infile './test/notAWavFile.wav'"; + const actual = error.message; - assert.equal(actuall, expected); - assert.isTrue(errorCaught); - }); + assert.equal(actual, expected); + assert.isTrue(errorCaught); + }); }); /** @@ -54,25 +51,27 @@ testCase("Lame class", () => { const targetBitrate = 128; const instance = new Lame({ - "output": OUTPUTFILE, - "bitrate": targetBitrate + output: OUTPUT_FILE, + bitrate: targetBitrate }); - instance.setFile(TESTFILE); - - return instance.encode() - .then(() => { - // Test expected file duration - return fsp.stat(OUTPUTFILE) - .then((stats) => { - const size = stats.size; - const resultDuration = (size * 8) / (targetBitrate * 1000); - fs.unlinkSync(OUTPUTFILE); - - const isDurationWithinTolerance = (TESTFILE_DURATION - resultDuration) < RESULT_DURATION_TOLERANCE && TESTFILE_DURATION - resultDuration > ((-1) * RESULT_DURATION_TOLERANCE); - assert.isTrue(isDurationWithinTolerance); - }) + instance.setFile(TEST_FILE); + + return instance.encode().then(() => { + // Test expected file duration + return fsp.stat(OUTPUT_FILE).then(stats => { + const size = stats.size; + const resultDuration = (size * 8) / (targetBitrate * 1000); + fs.unlinkSync(OUTPUT_FILE); + + const isDurationWithinTolerance = + TEST_FILE_DURATION - resultDuration < + RESULT_DURATION_TOLERANCE && + TEST_FILE_DURATION - resultDuration > + -1 * RESULT_DURATION_TOLERANCE; + assert.isTrue(isDurationWithinTolerance); }); + }); }); /** @@ -84,23 +83,26 @@ testCase("Lame class", () => { const output = "buffer"; const instance = new Lame({ - "output": output, - "bitrate": targetBitrate + output: output, + bitrate: targetBitrate }); - instance.setFile(TESTFILE); + instance.setFile(TEST_FILE); - return instance.encode() - .then(() => { - // Test expected file duration - const buffer = instance.getBuffer(); + return instance.encode().then(() => { + // Test expected file duration + const buffer = instance.getBuffer(); - const size = buffer.byteLength; - resultDuration = (size * 8) / (targetBitrate * 1000); + const size = buffer.byteLength; + resultDuration = (size * 8) / (targetBitrate * 1000); - const isDurationWithinTolerance = (TESTFILE_DURATION - resultDuration < RESULT_DURATION_TOLERANCE && TESTFILE_DURATION - resultDuration > (-1) * RESULT_DURATION_TOLERANCE); - assert(isDurationWithinTolerance); - }); + const isDurationWithinTolerance = + TEST_FILE_DURATION - resultDuration < + RESULT_DURATION_TOLERANCE && + TEST_FILE_DURATION - resultDuration > + -1 * RESULT_DURATION_TOLERANCE; + assert(isDurationWithinTolerance); + }); }); /** @@ -110,28 +112,31 @@ testCase("Lame class", () => { assertions("Encode buffer to file", () => { const targetBitrate = 128; - return fsp.readFile(TESTFILE) - .then((inputBuffer) => { - const instance = new Lame({ - "output": OUTPUTFILE, - "bitrate": targetBitrate - }); - - instance.setBuffer(inputBuffer); + return fsp.readFile(TEST_FILE).then(inputBuffer => { + const instance = new Lame({ + output: OUTPUT_FILE, + bitrate: targetBitrate + }); - return instance.encode() - .then(() => { - // Test expected file duration - return fsp.stat(OUTPUTFILE).then((stats) => { - const size = stats.size; - const resultDuration = (size * 8) / (targetBitrate * 1000); - fs.unlinkSync(OUTPUTFILE); + instance.setBuffer(inputBuffer); - const isDurationWithinTolerance = (TESTFILE_DURATION - resultDuration) < RESULT_DURATION_TOLERANCE && TESTFILE_DURATION - resultDuration > ((-1) * RESULT_DURATION_TOLERANCE); - assert.isTrue(isDurationWithinTolerance); - }) - }); + return instance.encode().then(() => { + // Test expected file duration + return fsp.stat(OUTPUT_FILE).then(stats => { + const size = stats.size; + const resultDuration = + (size * 8) / (targetBitrate * 1000); + fs.unlinkSync(OUTPUT_FILE); + + const isDurationWithinTolerance = + TEST_FILE_DURATION - resultDuration < + RESULT_DURATION_TOLERANCE && + TEST_FILE_DURATION - resultDuration > + -1 * RESULT_DURATION_TOLERANCE; + assert.isTrue(isDurationWithinTolerance); + }); }); + }); }); /** @@ -141,33 +146,34 @@ testCase("Lame class", () => { assertions("Encode buffer to buffer", () => { const targetBitrate = 128; - return fsp.readFile(TESTFILE) - .then((inputBuffer) => { - - const instance = new Lame({ - "output": "buffer", - "bitrate": targetBitrate - }); - instance.setBuffer(inputBuffer); - - return instance.encode() - .then(() => { - // Test expected file duration - const buffer = instance.getBuffer(); + return fsp.readFile(TEST_FILE).then(inputBuffer => { + const instance = new Lame({ + output: "buffer", + bitrate: targetBitrate + }); + instance.setBuffer(inputBuffer); - const size = buffer.byteLength; - const resultDuration = (size * 8) / (targetBitrate * 1000); + return instance.encode().then(() => { + // Test expected file duration + const buffer = instance.getBuffer(); - const isDurationWithinTolerance = (TESTFILE_DURATION - resultDuration) < RESULT_DURATION_TOLERANCE && TESTFILE_DURATION - resultDuration > ((-1) * RESULT_DURATION_TOLERANCE); - assert.isTrue(isDurationWithinTolerance); - }); + const size = buffer.byteLength; + const resultDuration = (size * 8) / (targetBitrate * 1000); + + const isDurationWithinTolerance = + TEST_FILE_DURATION - resultDuration < + RESULT_DURATION_TOLERANCE && + TEST_FILE_DURATION - resultDuration > + -1 * RESULT_DURATION_TOLERANCE; + assert.isTrue(isDurationWithinTolerance); }); + }); }); }); testCase("Decode to .wav", () => { - const TESTFILE = "./test/example.mp3"; - const OUTPUTFILE = "./test/converted.wav"; + const TEST_FILE = "./test/example.mp3"; + const OUTPUT_FILE = "./test/converted.wav"; /** * @testname Set invalid wav file @@ -178,22 +184,22 @@ testCase("Lame class", () => { const targetBitrate = 128; const instance = new Lame({ - "output": OUTPUTFILE, - "bitrate": targetBitrate + output: OUTPUT_FILE, + bitrate: targetBitrate }); instance.setFile("./test/notAnMp3File.mp3"); - return instance.decode() - .catch((error) => { - errorCaught = true; + return instance.decode().catch(error => { + errorCaught = true; - const expected = "lame: Error reading headers in mp3 input file ./test/notAnMp3File.mp3.\nCan't init infile './test/notAnMp3File.mp3'"; - const actuall = error.message; + const expected = + "lame: Error reading headers in mp3 input file ./test/notAnMp3File.mp3.\nCan't init infile './test/notAnMp3File.mp3'"; + const actual = error.message; - assert.equal(actuall, expected); - assert.isTrue(errorCaught); - }); + assert.equal(actual, expected); + assert.isTrue(errorCaught); + }); }); /** @@ -204,24 +210,25 @@ testCase("Lame class", () => { const targetBitrate = 128; const instance = new Lame({ - "output": OUTPUTFILE, - "bitrate": targetBitrate + output: OUTPUT_FILE, + bitrate: targetBitrate }); - instance.setFile(TESTFILE); + instance.setFile(TEST_FILE); - return instance.decode() - .then(() => { - // Test expected file size - return fsp.stat(OUTPUTFILE) - .then((stats) => { - fs.unlinkSync(OUTPUTFILE); - - const actualSize = stats.size; - const isSizeWithinTolerance = (EXPECTED_WAV_SIZE - actualSize) < WAV_SIZE_TOLERANCE && EXPECTED_WAV_SIZE - actualSize > ((-1) * WAV_SIZE_TOLERANCE); - assert.isTrue(isSizeWithinTolerance); - }) + return instance.decode().then(() => { + // Test expected file size + return fsp.stat(OUTPUT_FILE).then(stats => { + fs.unlinkSync(OUTPUT_FILE); + + const actualSize = stats.size; + const isSizeWithinTolerance = + EXPECTED_WAV_SIZE - actualSize < WAV_SIZE_TOLERANCE && + EXPECTED_WAV_SIZE - actualSize > + -1 * WAV_SIZE_TOLERANCE; + assert.isTrue(isSizeWithinTolerance); }); + }); }); /** @@ -233,21 +240,22 @@ testCase("Lame class", () => { const output = "buffer"; const instance = new Lame({ - "output": output, - "bitrate": targetBitrate + output: output, + bitrate: targetBitrate }); - instance.setFile(TESTFILE); + instance.setFile(TEST_FILE); - return instance.decode() - .then(() => { - // Test expected file size - const buffer = instance.getBuffer(); + return instance.decode().then(() => { + // Test expected file size + const buffer = instance.getBuffer(); - const actualSize = buffer.byteLength; - const isSizeWithinTolerance = (EXPECTED_WAV_SIZE - actualSize) < WAV_SIZE_TOLERANCE && EXPECTED_WAV_SIZE - actualSize > ((-1) * WAV_SIZE_TOLERANCE); - assert.isTrue(isSizeWithinTolerance); - }); + const actualSize = buffer.byteLength; + const isSizeWithinTolerance = + EXPECTED_WAV_SIZE - actualSize < WAV_SIZE_TOLERANCE && + EXPECTED_WAV_SIZE - actualSize > -1 * WAV_SIZE_TOLERANCE; + assert.isTrue(isSizeWithinTolerance); + }); }); /** @@ -257,28 +265,29 @@ testCase("Lame class", () => { assertions("Decode buffer to file", () => { const targetBitrate = 128; - return fsp.readFile(TESTFILE) - .then((inputBuffer) => { - const instance = new Lame({ - "output": OUTPUTFILE, - "bitrate": targetBitrate - }); - - instance.setBuffer(inputBuffer); + return fsp.readFile(TEST_FILE).then(inputBuffer => { + const instance = new Lame({ + output: OUTPUT_FILE, + bitrate: targetBitrate + }); - return instance.decode() - .then(() => { - // Test expected file size - return fsp.stat(OUTPUTFILE) - .then((stats) => { - fs.unlinkSync(OUTPUTFILE); + instance.setBuffer(inputBuffer); - const actualSize = stats.size; - const isSizeWithinTolerance = (EXPECTED_WAV_SIZE - actualSize) < WAV_SIZE_TOLERANCE && EXPECTED_WAV_SIZE - actualSize > ((-1) * WAV_SIZE_TOLERANCE); - assert.isTrue(isSizeWithinTolerance); - }) - }); + return instance.decode().then(() => { + // Test expected file size + return fsp.stat(OUTPUT_FILE).then(stats => { + fs.unlinkSync(OUTPUT_FILE); + + const actualSize = stats.size; + const isSizeWithinTolerance = + EXPECTED_WAV_SIZE - actualSize < + WAV_SIZE_TOLERANCE && + EXPECTED_WAV_SIZE - actualSize > + -1 * WAV_SIZE_TOLERANCE; + assert.isTrue(isSizeWithinTolerance); + }); }); + }); }); /** @@ -288,48 +297,47 @@ testCase("Lame class", () => { assertions("Decode buffer to buffer", () => { const targetBitrate = 128; - return fsp.readFile(TESTFILE) - .then((inputBuffer) => { - - const instance = new Lame({ - "output": "buffer", - "bitrate": targetBitrate - }); - instance.setBuffer(inputBuffer); + return fsp.readFile(TEST_FILE).then(inputBuffer => { + const instance = new Lame({ + output: "buffer", + bitrate: targetBitrate + }); + instance.setBuffer(inputBuffer); - return instance.decode() - .then(() => { - // Test expected file size - const buffer = instance.getBuffer(); + return instance.decode().then(() => { + // Test expected file size + const buffer = instance.getBuffer(); - const actualSize = buffer.byteLength; - const isSizeWithinTolerance = (EXPECTED_WAV_SIZE - actualSize) < WAV_SIZE_TOLERANCE && EXPECTED_WAV_SIZE - actualSize > ((-1) * WAV_SIZE_TOLERANCE); - assert.isTrue(isSizeWithinTolerance); - }); + const actualSize = buffer.byteLength; + const isSizeWithinTolerance = + EXPECTED_WAV_SIZE - actualSize < WAV_SIZE_TOLERANCE && + EXPECTED_WAV_SIZE - actualSize > + -1 * WAV_SIZE_TOLERANCE; + assert.isTrue(isSizeWithinTolerance); }); + }); }); }); testCase("Other", () => { - const TESTFILE = "./test/example.wav"; - const OUTPUTFILE = "./test/encoded.mp3"; + const TEST_FILE = "./test/example.wav"; + const OUTPUT_FILE = "./test/encoded.mp3"; /** * @testname Option output required - * Call Lame constructor with empty options obbject + * Call Lame constructor with empty options object */ assertions("Option output required", () => { let errorCaught = false; try { const instance = new Lame({}); - } - catch (error) { + } catch (error) { errorCaught = true; const expected = "lame: Invalid option: 'output' is required"; - const actuall = error.message; + const actual = error.message; - assert.equal(actuall, expected); + assert.equal(actual, expected); } assert.isTrue(errorCaught); @@ -343,21 +351,21 @@ testCase("Lame class", () => { let errorCaught = false; const instance = new Lame({ - "output": OUTPUTFILE + output: OUTPUT_FILE }); instance.setFile("./test/notAWavFile.wav"); - return instance.encode() - .catch((error) => { - errorCaught = true; + return instance.encode().catch(error => { + errorCaught = true; - const expected = "lame: Warning: unsupported audio format"; - const actuall = error.message; + const expected = + "lame: Warning: unsupported audio format\nCan't init infile './test/notAWavFile.wav'"; + const actual = error.message; - assert.equal(actuall, expected); - assert.isTrue(errorCaught); - }) + assert.equal(actual, expected); + assert.isTrue(errorCaught); + }); }); /** @@ -369,18 +377,17 @@ testCase("Lame class", () => { try { const instance = new Lame({ - "output": OUTPUTFILE + output: OUTPUT_FILE }); instance.setFile("./test/not-existing.wav"); - } - catch (error) { + } catch (error) { errorCaught = true; const expected = "Audio file (path) dose not exist"; - const actuall = error.message; + const actual = error.message; - assert.equal(actuall, expected); + assert.equal(actual, expected); } assert.isTrue(errorCaught); @@ -394,11 +401,11 @@ testCase("Lame class", () => { const targetBitrate = 128; const instance = new Lame({ - "output": OUTPUTFILE, - "bitrate": targetBitrate + output: OUTPUT_FILE, + bitrate: targetBitrate }); - instance.setFile(TESTFILE); + instance.setFile(TEST_FILE); const actual = instance.getStatus(); @@ -413,24 +420,23 @@ testCase("Lame class", () => { }); /** - * @testname Get status object during convertion + * @testname Get status object during converting * Setup the converter properly, call the encode function and immediately read the status object. */ - assertions("Get status object during convertion", () => { + assertions("Get status object during converting", () => { const targetBitrate = 128; const instance = new Lame({ - "output": OUTPUTFILE, - "bitrate": targetBitrate + output: OUTPUT_FILE, + bitrate: targetBitrate }); - instance.setFile(TESTFILE); + instance.setFile(TEST_FILE); const emitter = instance.getEmitter(); - instance.encode() - .then(() => { - fs.unlinkSync(OUTPUTFILE); - }); + instance.encode().then(() => { + fs.unlinkSync(OUTPUT_FILE); + }); const actual = instance.getStatus(); const expected = { @@ -438,60 +444,58 @@ testCase("Lame class", () => { finished: false, progress: 0, eta: undefined - } + }; assert.deepEqual(actual, expected); // Ensure next test will executed after finishing encoding - return new Promise((resolve, rejetct) => { + return new Promise(resolve => { emitter.on("finish", resolve); }); }); /** - * @testname Get status object after convertion + * @testname Get status object after converting * Setup the converter properly, call the encode function and read the status object afterwards. */ - assertions("Get status object after convertion", () => { + assertions("Get status object after converting", () => { const targetBitrate = 128; const instance = new Lame({ - "output": OUTPUTFILE, - "bitrate": targetBitrate + output: OUTPUT_FILE, + bitrate: targetBitrate }); - instance.setFile(TESTFILE); + instance.setFile(TEST_FILE); - return instance.encode() - .then(() => { - const actual = instance.getStatus(); + return instance.encode().then(() => { + const actual = instance.getStatus(); - const expected = { - started: true, - finished: true, - progress: 100, - eta: "00:00" - } + const expected = { + started: true, + finished: true, + progress: 100, + eta: "00:00" + }; - fs.unlinkSync(OUTPUTFILE); - assert.deepEqual(actual, expected); - }); + fs.unlinkSync(OUTPUT_FILE); + assert.deepEqual(actual, expected); + }); }); - /** - * @testname Get status eventEmitter successful convertion + * @testname Get status eventEmitter successful converting * Setup the converter properly, call the encode function and check if progress and finish were emitted. */ - assertions("Get status eventEmitter successful convertion", () => { + assertions("Get status eventEmitter successful converting", () => { const targetBitrate = 128; const instance = new Lame({ - "output": OUTPUTFILE, - "bitrate": targetBitrate + output: OUTPUT_FILE, + bitrate: targetBitrate }); - instance.setFile(TESTFILE); + instance.setFile(TEST_FILE); const emitter = instance.getEmitter(); @@ -505,31 +509,30 @@ testCase("Lame class", () => { emitter.on("finish", () => { finishTriggered = true; - fs.unlinkSync(OUTPUTFILE); + fs.unlinkSync(OUTPUT_FILE); }); - emitter.on("error", (error) => { + emitter.on("error", error => { assert.isTrue(false); }); - return instance.encode() - .then(() => { - // error expected is irrelevant for this test - assert.isTrue(progressTriggered); - assert.isTrue(finishTriggered); - }); + return instance.encode().then(() => { + // error expected is irrelevant for this test + assert.isTrue(progressTriggered); + assert.isTrue(finishTriggered); + }); }); /** - * @testname Get status eventEmitter unsuccessful convertion + * @testname Get status eventEmitter unsuccessful converting * Setup the converter with invalid source file, call the encode function and check if an error is emitted. */ - assertions("Get status eventEmitter unsuccessful convertion", () => { + assertions("Get status eventEmitter unsuccessful converting", () => { const targetBitrate = 128; const instance = new Lame({ - "output": OUTPUTFILE, - "bitrate": targetBitrate + output: OUTPUT_FILE, + bitrate: targetBitrate }); instance.setFile("./test/notAWavFile.wav"); @@ -538,82 +541,81 @@ testCase("Lame class", () => { let errorTriggered = false; - emitter.on("error", (error) => { + emitter.on("error", error => { errorTriggered = true; }); - return instance.encode() - .catch(() => { - return new Promise((resove, reject) => { - setTimeout(() => { - assert.isTrue(errorTriggered); + return instance.encode().catch(() => { + return new Promise(resolve => { + setTimeout(() => { + assert.isTrue(errorTriggered); - resove(); - }, 500); - }); + resolve(); + }, 500); }); + }); }); /** - * @testname Options - * Specifiy optional Options and check if they are set in the options object. - */ + * @testname Options + * Specify optional Options and check if they are set in the options object. + */ assertions("Options", () => { const instance = new Lame({ - "output": OUTPUTFILE, - "bitrate": 128, - "raw": true, + output: OUTPUT_FILE, + bitrate: 128, + raw: true, "swap-bytes": true, - "sfreq": 22.05, - "bitwidth": 32, - "signed": true, - "unsigned": true, + sfreq: 22.05, + bitwidth: 32, + signed: true, + unsigned: true, "little-endian": true, "big-endian": true, - "mp2Input": true, - "mp3Input": true, - "mode": "r", + mp2Input: true, + mp3Input: true, + mode: "r", "to-mono": true, "channel-different-block-sizes": true, - "freeformat": "FreeAmp", + freeformat: "FreeAmp", "disable-info-tag": true, - "comp": 5, - "scale": 2, + comp: 5, + scale: 2, "scale-l": 1, "scale-r": 3, "replaygain-fast": true, "replaygain-accurate": true, "no-replaygain": true, "clip-detect": true, - "preset": "medium", - "noasm": "sse", - "quality": 3, + preset: "medium", + noasm: "sse", + quality: 3, "force-bitrate": true, - "cbr": true, - "abr": 45, - "vbr": true, + cbr: true, + abr: 45, + vbr: true, "vbr-quality": 6, "ignore-noise-in-sfb21": true, - "emp": "5", + emp: "5", "mark-as-copyrighted": true, "mark-as-copy": true, "crc-error-protection": true, - "nores": true, + nores: true, "strictly-enforce-ISO": true, - "lowpass": 55, + lowpass: 55, "lowpass-width": 9, - "highpass": 400, + highpass: 400, "highpass-width": 4, - "resample": 44.1, - "meta": { - "title": "test title", - "artist": "test artist", - "album": "test album", - "year": "2017", - "comment": "test comment", - "track": "3", - "genre": "test genre", - "artwork": "testpic.jpg", + resample: 44.1, + meta: { + title: "test title", + artist: "test artist", + album: "test album", + year: "2017", + comment: "test comment", + track: "3", + genre: "test genre", + artwork: "testpic.jpg", "add-id3v2": true, "id3v1-only": true, "id3v2-only": true, @@ -626,106 +628,105 @@ testCase("Lame class", () => { "genre-list": "test, genres" } }); - instance.setFile(TESTFILE); + instance.setFile(TEST_FILE); expected = [ - '-b', + "-b", 128, - '-r', - '-x', - '-s', + "-r", + "-x", + "-s", 22.05, - '--bitwidth', + "--bitwidth", 32, - '--signed', - '--unsigned', - '--little-endian', - '--big-endian', - '--mp2input', - '--mp3input', - '-m', - 'r', - '-a', - '-d', - '--freeformat', - 'FreeAmp', - '-t', - '--comp', + "--signed", + "--unsigned", + "--little-endian", + "--big-endian", + "--mp2input", + "--mp3input", + "-m", + "r", + "-a", + "-d", + "--freeformat", + "FreeAmp", + "-t", + "--comp", 5, - '--scale', + "--scale", 2, - '--scale-l', + "--scale-l", 1, - '--scale-r', + "--scale-r", 3, - '--replaygain-fast', - '--replaygain-accurate', - '--noreplaygain', - '--clipdetect', - '--preset', - 'medium', - '--noasm', - 'sse', - '-q', + "--replaygain-fast", + "--replaygain-accurate", + "--noreplaygain", + "--clipdetect", + "--preset", + "medium", + "--noasm", + "sse", + "-q", 3, - '-F', - '--cbr', - '--abr', + "-F", + "--cbr", + "--abr", 45, - '-v', - '-V', + "-v", + "-V", 6, - '-Y', - '-e', - '5', - '-c', - '-o', - '-p', - '--nores', - '--strictly-enforce-ISO', - '--lowpass', + "-Y", + "-e", + "5", + "-c", + "-o", + "-p", + "--nores", + "--strictly-enforce-ISO", + "--lowpass", 55, - '--lowpass-width', + "--lowpass-width", 9, - '--highpass', + "--highpass", 400, - '--highpass-width', + "--highpass-width", 4, - '--resample', + "--resample", 44.1, - '--tt', - 'test title', - '--ta', - 'test artist', - '--tl', - 'test album', - '--ty', - '2017', - '--tc', - 'test comment', - '--tn', - '3', - '--tg', - 'test genre', - '--ti', - 'testpic.jpg', - '--add-id3v2', - '--id3v1-only', - '--id3v2-only', - '--id3v2-latin1', - '--id3v2-utf16', - '--space-id3v1', - '--pad-id3v2', - '--pad-id3v2-size', - '2', - '--ignore-tag-errors', - '--genre-list', - 'test, genres' + "--tt", + "test title", + "--ta", + "test artist", + "--tl", + "test album", + "--ty", + "2017", + "--tc", + "test comment", + "--tn", + "3", + "--tg", + "test genre", + "--ti", + "testpic.jpg", + "--add-id3v2", + "--id3v1-only", + "--id3v2-only", + "--id3v2-latin1", + "--id3v2-utf16", + "--space-id3v1", + "--pad-id3v2", + "--pad-id3v2-size", + "2", + "--ignore-tag-errors", + "--genre-list", + "test, genres" ]; const actual = instance.args; assert.deepEqual(expected, actual); - }); }); -}); \ No newline at end of file +}); diff --git a/tsconfig.json b/tsconfig.json index 614394d..5b2e6c7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,9 +10,7 @@ "noImplicitAny": false, "noImplicitReturns": false }, - "include": [ - "lib/src/*.ts" - ], + "include": ["lib/src/*.ts"], "formatCodeOptions": { "indentSize": 5, "tabSize": 5, @@ -29,4 +27,4 @@ }, "compileOnSave": true, "buildOnSave": false -} \ No newline at end of file +} diff --git a/tslint.json b/tslint.json new file mode 100644 index 0000000..33d96ca --- /dev/null +++ b/tslint.json @@ -0,0 +1,15 @@ +{ + "defaultSeverity": "error", + "extends": [ + "tslint:recommended", + "tslint-config-airbnb", + "tslint-config-prettier" + ], + "jsRules": { + "indent": [true, "spaces", 4] + }, + "rules": { + "indent": [true, "spaces", 4] + }, + "rulesDirectory": [] +}