diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..b44c19be --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,139 @@ +module.exports = { + "env": { + "browser": true, + "es6": true + }, + "extends": [ + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": "tsconfig.json", + "sourceType": "module" + }, + "plugins": [ + "eslint-plugin-import", + "eslint-plugin-jsdoc", + "eslint-plugin-prefer-arrow", + "@typescript-eslint" + ], + "rules": { + "@typescript-eslint/adjacent-overload-signatures": "error", + "@typescript-eslint/array-type": [ + "error", + { + "default": "array-simple" + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "types": { + "Object": { + "message": "Avoid using the `Object` type. Did you mean `object`?" + }, + "Function": { + "message": "Avoid using the `Function` type. Prefer a specific function type." + }, + "Boolean": { + "message": "Avoid using the `Boolean` type. Did you mean `boolean`?" + }, + "Number": { + "message": "Avoid using the `Number` type. Did you mean `number`?" + }, + "String": { + "message": "Avoid using the `String` type. Did you mean `string`?" + }, + "Symbol": { + "message": "Avoid using the `Symbol` type. Did you mean `symbol`?" + } + } + } + ], + "@typescript-eslint/dot-notation": "error", + "@typescript-eslint/explicit-function-return-type": [ + "error", + { + "allowExpressions": true + } + ], + "@typescript-eslint/explicit-module-boundary-types": "off", + "@typescript-eslint/naming-convention": [ + "warn", + { "selector": "default", "format": ["camelCase"] }, + { "selector": "typeLike", "format": ["PascalCase"] }, + { "selector": "property", "modifiers": ["private"], "format": ["camelCase"], "leadingUnderscore": "require" }, + { "selector": "property", "modifiers": ["static", "readonly"], "format": ["UPPER_CASE"] }, + { "selector": "property", "modifiers": ["private", "static", "readonly"], "format": ["UPPER_CASE"], "leadingUnderscore": "forbid" }, + { "selector": "enumMember", "format": ["PascalCase"] } + ], + "@typescript-eslint/no-inferrable-types": 0, + "@typescript-eslint/no-misused-new": "error", + "@typescript-eslint/no-namespace": "error", + "@typescript-eslint/no-parameter-properties": "warn", + "@typescript-eslint/no-shadow": "error", + "@typescript-eslint/prefer-namespace-keyword": "error", + "@typescript-eslint/restrict-template-expressions": 0, + "@typescript-eslint/triple-slash-reference": [ + "off", + { + "path": "always", + "types": "prefer-import", + "lib": "always" + } + ], + "@typescript-eslint/unbound-method": [ + "error", + { + "ignoreStatic": true + } + ], + "@typescript-eslint/unified-signatures": "error", + "constructor-super": "error", + "dot-notation": [ + "error", + { + "allowPattern": "^_.+" + } + ], + "eqeqeq": "error", + "guard-for-in": "error", + "jsdoc/check-alignment": "error", + "max-len": [ + "warn", + { + "code": 120 + } + ], + "new-parens": "error", + "no-caller": "error", + "no-cond-assign": "error", + "no-console": "error", + "no-debugger": "error", + "no-empty": "error", + "no-empty-function": "error", + "no-eval": "error", + "no-invalid-this": "error", + "no-multiple-empty-lines": "warn", + "no-new-wrappers": "error", + "no-shadow": "off", // Required for @typescript-eslint/no-shadow to work properly + "no-throw-literal": "error", + "no-trailing-spaces": "error", + "no-undef-init": "error", + "no-unsafe-finally": "error", + "no-unused-expressions": "error", + "no-unused-labels": "error", + "no-var": "error", + "one-var": [ + "error", + "never" + ], + "prefer-arrow/prefer-arrow-functions": "error", + "prefer-const": "error", + "radix": "error", + "spaced-comment": [ "error", "always" ], + "use-isnan": "error", + "valid-typeof": "error" + } +}; diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index bcc99f18..f4d52e32 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -7,7 +7,8 @@ + - + \ No newline at end of file diff --git a/README.md b/README.md index 7154de68..243c8817 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # TagLib# for Node -| Master | Develop | Latest | -|--------|---------|--------| -|[![Build Status](https://ci.appveyor.com/api/projects/status/7hdfrbc4ecvvruwv/branch/master?svg=true)](https://ci.appveyor.com/project/benrr101/node-taglib-sharp/branch/master)|[![Build Status](https://ci.appveyor.com/api/projects/status/7hdfrbc4ecvvruwv/branch/develop?svg=true)](https://ci.appveyor.com/project/benrr101/node-taglib-sharp/branch/develop)|[![Build Status](https://ci.appveyor.com/api/projects/status/7hdfrbc4ecvvruwv?svg=true)](https://ci.appveyor.com/project/benrr101/node-taglib-sharp) -|[![Coverage Status](https://coveralls.io/repos/github/benrr101/node-taglib-sharp/badge.svg?branch=master)](https://coveralls.io/github/benrr101/node-taglib-sharp?branch=master)|[![Coverage Status](https://coveralls.io/repos/github/benrr101/node-taglib-sharp/badge.svg?branch=develop)](https://coveralls.io/github/benrr101/node-taglib-sharp?branch=develop)|[![Coverage Status](https://coveralls.io/repos/github/benrr101/node-taglib-sharp/badge.svg?latest)](https://coveralls.io/github/benrr101/node-taglib-sharp) +| Master | Develop | Latest | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [![Build Status](https://ci.appveyor.com/api/projects/status/7hdfrbc4ecvvruwv/branch/master?svg=true)](https://ci.appveyor.com/project/benrr101/node-taglib-sharp/branch/master) | [![Build Status](https://ci.appveyor.com/api/projects/status/7hdfrbc4ecvvruwv/branch/develop?svg=true)](https://ci.appveyor.com/project/benrr101/node-taglib-sharp/branch/develop) | [![Build Status](https://ci.appveyor.com/api/projects/status/7hdfrbc4ecvvruwv?svg=true)](https://ci.appveyor.com/project/benrr101/node-taglib-sharp) | +| [![Coverage Status](https://coveralls.io/repos/github/benrr101/node-taglib-sharp/badge.svg?branch=master)](https://coveralls.io/github/benrr101/node-taglib-sharp?branch=master) | [![Coverage Status](https://coveralls.io/repos/github/benrr101/node-taglib-sharp/badge.svg?branch=develop)](https://coveralls.io/github/benrr101/node-taglib-sharp?branch=develop) | [![Coverage Status](https://coveralls.io/repos/github/benrr101/node-taglib-sharp/badge.svg?latest)](https://coveralls.io/github/benrr101/node-taglib-sharp) | ## Description TagLib# is a .NET library that has been around for years. It provides a unified interface for @@ -22,7 +22,7 @@ improved on the original TagLib, hence why this project exists. * [ID3v2](https://id3.org/Developer%20Information): `AAC`, `AIF`, `AIFF`, `AVI`, `DIVX`, `FLAC`, `M2A`, `MP1`, `MP2`, `MP3`, `WAV` * MovieID: `AVI`, `DIVX`, `WAV` * [RIFF Info](https://www.exiftool.org/TagNames/RIFF.html#Info): `AVI`, `DIVX`, `WAV` -* [Xiph Comment](https://www.xiph.org/vorbis/doc/v-comment.html): `FLAC` +* [Xiph Comment](https://www.xiph.org/vorbis/doc/v-comment.html): `FLAC`, `OGA`, `OGG`, `OGV`, `OPUS` * ... More coming soon ## Supported File Formats @@ -33,6 +33,7 @@ improved on the original TagLib, hence why this project exists. * MPEG-1/2 Audio: `M2A`, `MP1`, `MP2`, `MP3` * MPEG-1/2 Video: `M2V`, `MPE`, `MPEG`, `MPG`, `MPV2` * Monkey's Audio: `APE` +* Ogg: `OGA`, `OGG`, `OGV`, `OPUS` * Resource Interchange File Format (RIFF): `AVI`, `DIVX`, `WAV` * ... More coming soon diff --git a/docs/.nojekyll b/docs/.nojekyll new file mode 100644 index 00000000..e2ac6616 --- /dev/null +++ b/docs/.nojekyll @@ -0,0 +1 @@ +TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index 6fe740c1..a786b4ac 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2,10 +2,10 @@ node-taglib-sharp / [Exports](modules.md) # TagLib# for Node -| Master | Develop | Latest | -|--------|---------|--------| -|[![Build Status](https://ci.appveyor.com/api/projects/status/7hdfrbc4ecvvruwv/branch/master?svg=true)](https://ci.appveyor.com/project/benrr101/node-taglib-sharp/branch/master)|[![Build Status](https://ci.appveyor.com/api/projects/status/7hdfrbc4ecvvruwv/branch/develop?svg=true)](https://ci.appveyor.com/project/benrr101/node-taglib-sharp/branch/develop)|[![Build Status](https://ci.appveyor.com/api/projects/status/7hdfrbc4ecvvruwv?svg=true)](https://ci.appveyor.com/project/benrr101/node-taglib-sharp) -|[![Coverage Status](https://coveralls.io/repos/github/benrr101/node-taglib-sharp/badge.svg?branch=master)](https://coveralls.io/github/benrr101/node-taglib-sharp?branch=master)|[![Coverage Status](https://coveralls.io/repos/github/benrr101/node-taglib-sharp/badge.svg?branch=develop)](https://coveralls.io/github/benrr101/node-taglib-sharp?branch=develop)|[![Coverage Status](https://coveralls.io/repos/github/benrr101/node-taglib-sharp/badge.svg?latest)](https://coveralls.io/github/benrr101/node-taglib-sharp) +| Master | Develop | Latest | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [![Build Status](https://ci.appveyor.com/api/projects/status/7hdfrbc4ecvvruwv/branch/master?svg=true)](https://ci.appveyor.com/project/benrr101/node-taglib-sharp/branch/master) | [![Build Status](https://ci.appveyor.com/api/projects/status/7hdfrbc4ecvvruwv/branch/develop?svg=true)](https://ci.appveyor.com/project/benrr101/node-taglib-sharp/branch/develop) | [![Build Status](https://ci.appveyor.com/api/projects/status/7hdfrbc4ecvvruwv?svg=true)](https://ci.appveyor.com/project/benrr101/node-taglib-sharp) | +| [![Coverage Status](https://coveralls.io/repos/github/benrr101/node-taglib-sharp/badge.svg?branch=master)](https://coveralls.io/github/benrr101/node-taglib-sharp?branch=master) | [![Coverage Status](https://coveralls.io/repos/github/benrr101/node-taglib-sharp/badge.svg?branch=develop)](https://coveralls.io/github/benrr101/node-taglib-sharp?branch=develop) | [![Coverage Status](https://coveralls.io/repos/github/benrr101/node-taglib-sharp/badge.svg?latest)](https://coveralls.io/github/benrr101/node-taglib-sharp) | ## Description TagLib# is a .NET library that has been around for years. It provides a unified interface for @@ -24,7 +24,7 @@ improved on the original TagLib, hence why this project exists. * [ID3v2](https://id3.org/Developer%20Information): `AAC`, `AIF`, `AIFF`, `AVI`, `DIVX`, `FLAC`, `M2A`, `MP1`, `MP2`, `MP3`, `WAV` * MovieID: `AVI`, `DIVX`, `WAV` * [RIFF Info](https://www.exiftool.org/TagNames/RIFF.html#Info): `AVI`, `DIVX`, `WAV` -* [Xiph Comment](https://www.xiph.org/vorbis/doc/v-comment.html): `FLAC` +* [Xiph Comment](https://www.xiph.org/vorbis/doc/v-comment.html): `FLAC`, `OGA`, `OGG`, `OGV`, `OPUS` * ... More coming soon ## Supported File Formats @@ -35,6 +35,7 @@ improved on the original TagLib, hence why this project exists. * MPEG-1/2 Audio: `M2A`, `MP1`, `MP2`, `MP3` * MPEG-1/2 Video: `M2V`, `MPE`, `MPEG`, `MPG`, `MPV2` * Monkey's Audio: `APE` +* Ogg: `OGA`, `OGG`, `OGV`, `OPUS` * Resource Interchange File Format (RIFF): `AVI`, `DIVX`, `WAV` * ... More coming soon diff --git a/docs/classes/aacfile.md b/docs/classes/AacFile.md similarity index 64% rename from docs/classes/aacfile.md rename to docs/classes/AacFile.md index ed8a22e0..52747a20 100644 --- a/docs/classes/aacfile.md +++ b/docs/classes/AacFile.md @@ -2,16 +2,16 @@ # Class: AacFile -This class extends [File](file.md) to provide tagging and properties for ADTS AAC audio files. +This class extends [File](File.md) to provide tagging and properties for ADTS AAC audio files. -**`remarks`** A [Id3v1Tag](id3v1tag.md) and [Id3v2Tag](id3v2tag.md) will be added automatically to any file +**`remarks`** A [Id3v1Tag](Id3v1Tag.md) and [Id3v2Tag](Id3v2Tag.md) will be added automatically to any file that doesn't contain one. This change does not affect the file until it is saved and can be reversed using the following method: `file.removeTags(file.tagTypes & ~file.tagTypesOnDisk);` ## Hierarchy -- `SandwichFile` +- `default` ↳ **`AacFile`** @@ -19,58 +19,53 @@ This class extends [File](file.md) to provide tagging and properties for ADTS AA ### Constructors -- [constructor](aacfile.md#constructor) - -### Properties - -- [\_fileAbstraction](aacfile.md#_fileabstraction) -- [\_fileStream](aacfile.md#_filestream) -- [\_tagTypesOnDisk](aacfile.md#_tagtypesondisk) +- [constructor](AacFile.md#constructor) ### Accessors -- [corruptionReasons](aacfile.md#corruptionreasons) -- [endTag](aacfile.md#endtag) -- [fileAbstraction](aacfile.md#fileabstraction) -- [isPossiblyCorrupt](aacfile.md#ispossiblycorrupt) -- [isWritable](aacfile.md#iswritable) -- [length](aacfile.md#length) -- [mediaEndPosition](aacfile.md#mediaendposition) -- [mediaStartPosition](aacfile.md#mediastartposition) -- [mimeType](aacfile.md#mimetype) -- [mode](aacfile.md#mode) -- [name](aacfile.md#name) -- [position](aacfile.md#position) -- [properties](aacfile.md#properties) -- [startTag](aacfile.md#starttag) -- [tag](aacfile.md#tag) -- [tagTypes](aacfile.md#tagtypes) -- [tagTypesOnDisk](aacfile.md#tagtypesondisk) -- [bufferSize](aacfile.md#buffersize) +- [corruptionReasons](AacFile.md#corruptionreasons) +- [endTag](AacFile.md#endtag) +- [fileAbstraction](AacFile.md#fileabstraction) +- [hasTags](AacFile.md#hastags) +- [isPossiblyCorrupt](AacFile.md#ispossiblycorrupt) +- [isWritable](AacFile.md#iswritable) +- [length](AacFile.md#length) +- [mediaEndPosition](AacFile.md#mediaendposition) +- [mediaStartPosition](AacFile.md#mediastartposition) +- [mimeType](AacFile.md#mimetype) +- [mode](AacFile.md#mode) +- [name](AacFile.md#name) +- [position](AacFile.md#position) +- [properties](AacFile.md#properties) +- [startTag](AacFile.md#starttag) +- [tag](AacFile.md#tag) +- [tagTypes](AacFile.md#tagtypes) +- [tagTypesOnDisk](AacFile.md#tagtypesondisk) +- [bufferSize](AacFile.md#buffersize) ### Methods -- [dispose](aacfile.md#dispose) -- [find](aacfile.md#find) -- [getTag](aacfile.md#gettag) -- [insert](aacfile.md#insert) -- [markAsCorrupt](aacfile.md#markascorrupt) -- [preSave](aacfile.md#presave) -- [rFind](aacfile.md#rfind) -- [readBlock](aacfile.md#readblock) -- [readProperties](aacfile.md#readproperties) -- [removeBlock](aacfile.md#removeblock) -- [removeTags](aacfile.md#removetags) -- [save](aacfile.md#save) -- [seek](aacfile.md#seek) -- [truncate](aacfile.md#truncate) -- [writeBlock](aacfile.md#writeblock) -- [addFileType](aacfile.md#addfiletype) -- [addFileTypeResolver](aacfile.md#addfiletyperesolver) -- [createFromAbstraction](aacfile.md#createfromabstraction) -- [createFromPath](aacfile.md#createfrompath) -- [removeFileType](aacfile.md#removefiletype) -- [removeFileTypeResolver](aacfile.md#removefiletyperesolver) +- [dispose](AacFile.md#dispose) +- [find](AacFile.md#find) +- [getTag](AacFile.md#gettag) +- [insert](AacFile.md#insert) +- [markAsCorrupt](AacFile.md#markascorrupt) +- [preSave](AacFile.md#presave) +- [rFind](AacFile.md#rfind) +- [readBlock](AacFile.md#readblock) +- [readProperties](AacFile.md#readproperties) +- [removeBlock](AacFile.md#removeblock) +- [removeTags](AacFile.md#removetags) +- [save](AacFile.md#save) +- [seek](AacFile.md#seek) +- [truncate](AacFile.md#truncate) +- [writeBlock](AacFile.md#writeblock) +- [addFileType](AacFile.md#addfiletype) +- [addFileTypeResolver](AacFile.md#addfiletyperesolver) +- [createFromAbstraction](AacFile.md#createfromabstraction) +- [createFromPath](AacFile.md#createfrompath) +- [removeFileType](AacFile.md#removefiletype) +- [removeFileTypeResolver](AacFile.md#removefiletyperesolver) ## Constructors @@ -85,42 +80,12 @@ This class extends [File](file.md) to provide tagging and properties for ADTS AA | Name | Type | | :------ | :------ | | `file` | `string` \| `IFileAbstraction` | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | #### Overrides SandwichFile.constructor -## Properties - -### \_fileAbstraction - -• `Protected` **\_fileAbstraction**: `IFileAbstraction` - -#### Inherited from - -SandwichFile.\_fileAbstraction - -___ - -### \_fileStream - -• `Protected` **\_fileStream**: `IStream` - -#### Inherited from - -SandwichFile.\_fileStream - -___ - -### \_tagTypesOnDisk - -• `Protected` **\_tagTypesOnDisk**: [`TagTypes`](../enums/tagtypes.md) - -#### Inherited from - -SandwichFile.\_tagTypesOnDisk - ## Accessors ### corruptionReasons @@ -133,6 +98,10 @@ Reasons for which this file is marked as corrupt. `string`[] +#### Inherited from + +SandwichFile.corruptionReasons + ___ ### endTag @@ -145,6 +114,10 @@ Gets the collection of tags appearing at the end of the file. `default` +#### Inherited from + +SandwichFile.endTag + ___ ### fileAbstraction @@ -157,6 +130,27 @@ Gets the {@link IFileAbstraction} representing the file. `IFileAbstraction` +#### Inherited from + +SandwichFile.fileAbstraction + +___ + +### hasTags + +• `get` **hasTags**(): `boolean` + +Shortcut property to determine if a file has tags in memory. +NOTE: Just because `tag !== undefined` does not mean there are tags in memory. + +#### Returns + +`boolean` + +#### Inherited from + +SandwichFile.hasTags + ___ ### isPossiblyCorrupt @@ -170,6 +164,10 @@ be written. `boolean` +#### Inherited from + +SandwichFile.isPossiblyCorrupt + ___ ### isWritable @@ -182,6 +180,10 @@ Indicates whether or not tags can be written back to the current file. `boolean` +#### Inherited from + +SandwichFile.isWritable + ___ ### length @@ -195,30 +197,42 @@ is not open for reading; `number` +#### Inherited from + +SandwichFile.length + ___ ### mediaEndPosition • `get` **mediaEndPosition**(): `number` -Gets the position at which the media content of this file ends. +**`inheritdoc`** #### Returns `number` +#### Inherited from + +SandwichFile.mediaEndPosition + ___ ### mediaStartPosition • `get` **mediaStartPosition**(): `number` -Gets the position at which the media content of this file starts. +**`inheritdoc`** #### Returns `number` +#### Inherited from + +SandwichFile.mediaStartPosition + ___ ### mimeType @@ -231,34 +245,46 @@ Gets the MimeType of the file as determined during creation of the instance. `string` +#### Inherited from + +SandwichFile.mimeType + ___ ### mode -• `get` **mode**(): [`FileAccessMode`](../enums/fileaccessmode.md) +• `get` **mode**(): [`FileAccessMode`](../enums/FileAccessMode.md) Gets the file access mode in use by the current instance. #### Returns -[`FileAccessMode`](../enums/fileaccessmode.md) +[`FileAccessMode`](../enums/FileAccessMode.md) + +#### Inherited from + +SandwichFile.mode • `set` **mode**(`val`): `void` Sets the file access mode in use by the current instance. Changing the value will cause the stream currently in use to be closed, except when a change is made from -[FileAccessMode.Write](../enums/fileaccessmode.md#write) to [FileAccessMode.Read](../enums/fileaccessmode.md#read) which has no effect. +[FileAccessMode.Write](../enums/FileAccessMode.md#write) to [FileAccessMode.Read](../enums/FileAccessMode.md#read) which has no effect. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `val` | [`FileAccessMode`](../enums/fileaccessmode.md) | File access mode to change to | +| `val` | [`FileAccessMode`](../enums/FileAccessMode.md) | File access mode to change to | #### Returns `void` +#### Inherited from + +SandwichFile.mode + ___ ### name @@ -271,6 +297,10 @@ Gets the name of the file as stored in its file abstraction. `string` +#### Inherited from + +SandwichFile.name + ___ ### position @@ -284,17 +314,25 @@ if the file is not open for reading `number` +#### Inherited from + +SandwichFile.position + ___ ### properties -• `get` **properties**(): [`Properties`](properties.md) +• `get` **properties**(): [`Properties`](Properties.md) Gets the media properties of the file represented by the current instance. #### Returns -[`Properties`](properties.md) +[`Properties`](Properties.md) + +#### Inherited from + +SandwichFile.properties ___ @@ -308,6 +346,10 @@ Gets the collection of tags appearing at the start of the file. `default` +#### Inherited from + +SandwichFile.startTag + ___ ### tag @@ -320,29 +362,59 @@ Gets an abstract representation of all tags stored in the current instance. `default` +#### Inherited from + +SandwichFile.tag + ___ ### tagTypes -• `get` **tagTypes**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypes**(): [`TagTypes`](../enums/TagTypes.md) Gets the tag types contained in the current instance. #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) + +#### Inherited from + +SandwichFile.tagTypes ___ ### tagTypesOnDisk -• `get` **tagTypesOnDisk**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypesOnDisk**(): [`TagTypes`](../enums/TagTypes.md) + +Gets the tag types contained in the physical file represented by the current instance. + +#### Returns + +[`TagTypes`](../enums/TagTypes.md) + +#### Inherited from + +SandwichFile.tagTypesOnDisk + +• `set` **tagTypesOnDisk**(`value`): `void` Gets the tag types contained in the physical file represented by the current instance. +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | [`TagTypes`](../enums/TagTypes.md) | + #### Returns -[`TagTypes`](../enums/tagtypes.md) +`void` + +#### Inherited from + +SandwichFile.tagTypesOnDisk ___ @@ -356,6 +428,10 @@ Gets the buffer size to use when reading large blocks of data `number` +#### Inherited from + +SandwichFile.bufferSize + ## Methods ### dispose @@ -387,9 +463,9 @@ Searches forward through a file for a specified pattern, starting at a specified | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | `undefined` | Pattern to search for in the current instance. Must be smaller than the | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern to search for in the current instance. Must be smaller than the | | `startPosition` | `number` | `0` | Seek position to start searching. Must be positive, safe integer. | -| `before?` | [`ByteVector`](bytevector.md) | `undefined` | Optional pattern that the searched for pattern must appear before. If this pattern is found first, `-1` is returned. | +| `before?` | [`ByteVector`](ByteVector.md) | `undefined` | Optional pattern that the searched for pattern must appear before. If this pattern is found first, `-1` is returned. | #### Returns @@ -405,7 +481,7 @@ ___ ### getTag -▸ **getTag**(`type`, `create`): [`Tag`](tag.md) +▸ **getTag**(`type`, `create`): [`Tag`](Tag.md) **`inheritdoc`** @@ -413,12 +489,12 @@ ___ | Name | Type | | :------ | :------ | -| `type` | [`TagTypes`](../enums/tagtypes.md) | +| `type` | [`TagTypes`](../enums/TagTypes.md) | | `create` | `boolean` | #### Returns -[`Tag`](tag.md) +[`Tag`](Tag.md) #### Inherited from @@ -440,7 +516,7 @@ specified location, replacing a specified number of bytes. | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | `undefined` | Data to insert into the file. | +| `data` | [`ByteVector`](ByteVector.md) | `undefined` | Data to insert into the file. | | `start` | `number` | `undefined` | Index into the file at which to insert the data. Must be safe positive integer. | | `replace` | `number` | `0` | Number of bytes to replace. Typically this is the original size of the data block so that a new block will replace the old one. | @@ -505,7 +581,7 @@ Searches backwards through a file for a specified pattern, starting at a specifi | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | `undefined` | Pattern to search for in the current instance. Must be shorter than the [bufferSize](aacfile.md#buffersize) | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern to search for in the current instance. Must be shorter than the [bufferSize](AacFile.md#buffersize) | | `startPosition` | `number` | `0` | Number of bytes from end of the file to begin searching. | #### Returns @@ -522,11 +598,11 @@ ___ ### readBlock -▸ **readBlock**(`length`): [`ByteVector`](bytevector.md) +▸ **readBlock**(`length`): [`ByteVector`](ByteVector.md) Reads a specified number of bytes at the current seek position from the current position. This method reads the block of data at the current seek position. To change the seek -position, use [File.seek](file.md#seek). +position, use [File.seek](File.md#seek). **`throws`** Error Thrown when `length` is not a positive, safe integer. @@ -538,7 +614,7 @@ position, use [File.seek](file.md#seek). #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ByteVector Object containing the data read from the current instance. @@ -550,17 +626,17 @@ ___ ### readProperties -▸ `Protected` **readProperties**(`readStyle`): [`Properties`](properties.md) +▸ `Protected` **readProperties**(`readStyle`): [`Properties`](Properties.md) #### Parameters | Name | Type | | :------ | :------ | -| `readStyle` | [`ReadStyle`](../enums/readstyle.md) | +| `readStyle` | [`ReadStyle`](../enums/ReadStyle.md) | #### Returns -[`Properties`](properties.md) +[`Properties`](Properties.md) #### Overrides @@ -604,7 +680,7 @@ ___ | Name | Type | | :------ | :------ | -| `types` | [`TagTypes`](../enums/tagtypes.md) | +| `types` | [`TagTypes`](../enums/TagTypes.md) | #### Returns @@ -641,10 +717,10 @@ specified origin. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `offset` | `number` | Byte offset to seek to. Must be a safe, positive integer. | -| `origin` | `SeekOrigin` | Origin from which to seek | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `offset` | `number` | `undefined` | Byte offset to seek to. Must be a safe, positive integer. | +| `origin` | `SeekOrigin` | `SeekOrigin.Begin` | Origin from which to seek | #### Returns @@ -692,7 +768,7 @@ the file if writing past the current end. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | ByteVector containing data to the current instance. | +| `data` | [`ByteVector`](ByteVector.md) | ByteVector containing data to the current instance. | #### Returns @@ -708,7 +784,7 @@ ___ ▸ `Static` **addFileType**(`mimeType`, `constructor`, `override?`): `void` -Registers the constructor for a subclass of [File](file.md) with the MimeType it is associated +Registers the constructor for a subclass of [File](File.md) with the MimeType it is associated with. Optionally, the MimeType can be forcefully overridden if it was already registered. #### Parameters @@ -716,8 +792,8 @@ with. Optionally, the MimeType can be forcefully overridden if it was already re | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | | `mimeType` | `string` | `undefined` | MimeType to register this subclass constructor to. | -| `constructor` | [`FileTypeConstructor`](../modules.md#filetypeconstructor) | `undefined` | Constructor for a subclass of [File](file.md) that will be called if a file with a MimeType of `mimeType` is created. | -| `override` | `boolean` | `false` | If `true` and a subclass of [File](file.md) was already registered to `mimeType`, it will be forcefully overridden. If `false`, an {@link Error} will be thrown if a subclass already registered to the MimeType.} | +| `constructor` | [`FileTypeConstructor`](../modules.md#filetypeconstructor) | `undefined` | Constructor for a subclass of [File](File.md) that will be called if a file with a MimeType of `mimeType` is created. | +| `override` | `boolean` | `false` | If `true` and a subclass of [File](File.md) was already registered to `mimeType`, it will be forcefully overridden. If `false`, an {@link Error} will be thrown if a subclass already registered to the MimeType.} | #### Returns @@ -739,7 +815,7 @@ Registers a [FileTypeResolver](../modules.md#filetyperesolver) to the front of t | Name | Type | Description | | :------ | :------ | :------ | -| `resolver` | [`FileTypeResolver`](../modules.md#filetyperesolver) | Function to handle resolving a subclass of [File](file.md) from an {@link IFileAbstraction} | +| `resolver` | [`FileTypeResolver`](../modules.md#filetyperesolver) | Function to handle resolving a subclass of [File](File.md) from an {@link IFileAbstraction} | #### Returns @@ -753,24 +829,24 @@ ___ ### createFromAbstraction -▸ `Static` **createFromAbstraction**(`abstraction`, `mimeType?`, `propertiesStyle?`): [`File`](file.md) +▸ `Static` **createFromAbstraction**(`abstraction`, `mimeType?`, `propertiesStyle?`): [`File`](File.md) -Creates a new instance of a [File](file.md) subclass for a specified file abstraction, MimeType, +Creates a new instance of a [File](File.md) subclass for a specified file abstraction, MimeType, and property read style. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `abstraction` | `IFileAbstraction` | Object to use when reading/writing from the current instance. | -| `mimeType?` | `string` | Optional, MimeType to use for determining the subclass of [File](file.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | Optional, level of detail to use when reading the media information from the new instance. If omitted, [ReadStyle.Average](../enums/readstyle.md#average) is used. | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `abstraction` | `IFileAbstraction` | `undefined` | Object to use when reading/writing from the current instance. | +| `mimeType?` | `string` | `undefined` | Optional, MimeType to use for determining the subclass of [File](File.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | `ReadStyle.Average` | Optional, level of detail to use when reading the media information from the new instance. If omitted, [ReadStyle.Average](../enums/ReadStyle.md#average) is used. | #### Returns -[`File`](file.md) +[`File`](File.md) -New instance of [File](file.md) as read from the specified abstraction. +New instance of [File](File.md) as read from the specified abstraction. #### Inherited from @@ -780,24 +856,24 @@ ___ ### createFromPath -▸ `Static` **createFromPath**(`filePath`, `mimeType?`, `propertiesStyle?`): [`File`](file.md) +▸ `Static` **createFromPath**(`filePath`, `mimeType?`, `propertiesStyle?`): [`File`](File.md) -Creates a new instance of [File](file.md) subclass for a specified file path, MimeType, and +Creates a new instance of [File](File.md) subclass for a specified file path, MimeType, and property read style. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `filePath` | `string` | Path to the file to read/write. | -| `mimeType?` | `string` | Optional, MimeType to use for determining the subclass of [File](file.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | Optional, level of detail to use when reading the media information from the new instance. If omitted [ReadStyle.Average](../enums/readstyle.md#average) is used. | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `filePath` | `string` | `undefined` | Path to the file to read/write. | +| `mimeType?` | `string` | `undefined` | Optional, MimeType to use for determining the subclass of [File](File.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | `ReadStyle.Average` | Optional, level of detail to use when reading the media information from the new instance. If omitted [ReadStyle.Average](../enums/ReadStyle.md#average) is used. | #### Returns -[`File`](file.md) +[`File`](File.md) -New instance of [File](file.md) as read from the specified path. +New instance of [File](File.md) as read from the specified path. #### Inherited from diff --git a/docs/classes/aacfilesettings.md b/docs/classes/AacFileSettings.md similarity index 84% rename from docs/classes/aacfilesettings.md rename to docs/classes/AacFileSettings.md index 3a4050fb..7a101495 100644 --- a/docs/classes/aacfilesettings.md +++ b/docs/classes/AacFileSettings.md @@ -9,17 +9,17 @@ in order for changes to take effect. ### Constructors -- [constructor](aacfilesettings.md#constructor) +- [constructor](AacFileSettings.md#constructor) ### Properties -- [supportedTagTypes](aacfilesettings.md#supportedtagtypes) +- [SUPPORTED\_TAG\_TYPES](AacFileSettings.md#supported_tag_types) ### Accessors -- [defaultTagTypes](aacfilesettings.md#defaulttagtypes) -- [preferApeTagAtFileEnd](aacfilesettings.md#preferapetagatfileend) -- [preferId3v2TagAtFileEnd](aacfilesettings.md#preferid3v2tagatfileend) +- [defaultTagTypes](AacFileSettings.md#defaulttagtypes) +- [preferApeTagAtFileEnd](AacFileSettings.md#preferapetagatfileend) +- [preferId3v2TagAtFileEnd](AacFileSettings.md#preferid3v2tagatfileend) ## Constructors @@ -29,34 +29,34 @@ in order for changes to take effect. ## Properties -### supportedTagTypes +### SUPPORTED\_TAG\_TYPES -▪ `Static` `Readonly` **supportedTagTypes**: `number` +▪ `Static` `Readonly` **SUPPORTED\_TAG\_TYPES**: `number` ## Accessors ### defaultTagTypes -• `Static` `get` **defaultTagTypes**(): [`TagTypes`](../enums/tagtypes.md) +• `Static` `get` **defaultTagTypes**(): [`TagTypes`](../enums/TagTypes.md) Gets the default types of tags for an AAC file. When opening a file, if these tag types do not exist on the file, they will be created. #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) • `Static` `set` **defaultTagTypes**(`value`): `void` Sets the default types of tags for an AAC file. When opening a file, if these tag types do -not exist on the file, they will be created. See [supportedTagTypes](aacfilesettings.md#supportedtagtypes) for a list of tag +not exist on the file, they will be created. See [SUPPORTED_TAG_TYPES](AacFileSettings.md#supported_tag_types) for a list of tag types that are supported by node-taglib-sharp for AAC files. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`TagTypes`](../enums/tagtypes.md) | +| `value` | [`TagTypes`](../enums/TagTypes.md) | #### Returns diff --git a/docs/classes/aifffile.md b/docs/classes/AiffFile.md similarity index 59% rename from docs/classes/aifffile.md rename to docs/classes/AiffFile.md index 6c4cf58e..f25e0cbd 100644 --- a/docs/classes/aifffile.md +++ b/docs/classes/AiffFile.md @@ -4,7 +4,7 @@ ## Hierarchy -- [`File`](file.md) +- [`File`](File.md) ↳ **`AiffFile`** @@ -12,58 +12,56 @@ ### Constructors -- [constructor](aifffile.md#constructor) +- [constructor](AiffFile.md#constructor) ### Properties -- [\_fileAbstraction](aifffile.md#_fileabstraction) -- [\_fileStream](aifffile.md#_filestream) -- [\_tagTypesOnDisk](aifffile.md#_tagtypesondisk) -- [aiffFormType](aifffile.md#aiffformtype) -- [commIdentifier](aifffile.md#commidentifier) -- [fileIdentifier](aifffile.md#fileidentifier) -- [id3Identifier](aifffile.md#id3identifier) -- [soundIdentifier](aifffile.md#soundidentifier) +- [AIFF\_FORM\_TYPE](AiffFile.md#aiff_form_type) +- [COMM\_IDENTIFIER](AiffFile.md#comm_identifier) +- [FILE\_IDENTIFIER](AiffFile.md#file_identifier) +- [ID3\_IDENTIFIER](AiffFile.md#id3_identifier) +- [SOUND\_IDENTIFIER](AiffFile.md#sound_identifier) ### Accessors -- [corruptionReasons](aifffile.md#corruptionreasons) -- [fileAbstraction](aifffile.md#fileabstraction) -- [isPossiblyCorrupt](aifffile.md#ispossiblycorrupt) -- [isWritable](aifffile.md#iswritable) -- [length](aifffile.md#length) -- [mimeType](aifffile.md#mimetype) -- [mode](aifffile.md#mode) -- [name](aifffile.md#name) -- [position](aifffile.md#position) -- [properties](aifffile.md#properties) -- [tag](aifffile.md#tag) -- [tagTypes](aifffile.md#tagtypes) -- [tagTypesOnDisk](aifffile.md#tagtypesondisk) -- [bufferSize](aifffile.md#buffersize) +- [corruptionReasons](AiffFile.md#corruptionreasons) +- [fileAbstraction](AiffFile.md#fileabstraction) +- [hasTags](AiffFile.md#hastags) +- [isPossiblyCorrupt](AiffFile.md#ispossiblycorrupt) +- [isWritable](AiffFile.md#iswritable) +- [length](AiffFile.md#length) +- [mimeType](AiffFile.md#mimetype) +- [mode](AiffFile.md#mode) +- [name](AiffFile.md#name) +- [position](AiffFile.md#position) +- [properties](AiffFile.md#properties) +- [tag](AiffFile.md#tag) +- [tagTypes](AiffFile.md#tagtypes) +- [tagTypesOnDisk](AiffFile.md#tagtypesondisk) +- [bufferSize](AiffFile.md#buffersize) ### Methods -- [dispose](aifffile.md#dispose) -- [find](aifffile.md#find) -- [getTag](aifffile.md#gettag) -- [insert](aifffile.md#insert) -- [markAsCorrupt](aifffile.md#markascorrupt) -- [preSave](aifffile.md#presave) -- [rFind](aifffile.md#rfind) -- [readBlock](aifffile.md#readblock) -- [removeBlock](aifffile.md#removeblock) -- [removeTags](aifffile.md#removetags) -- [save](aifffile.md#save) -- [seek](aifffile.md#seek) -- [truncate](aifffile.md#truncate) -- [writeBlock](aifffile.md#writeblock) -- [addFileType](aifffile.md#addfiletype) -- [addFileTypeResolver](aifffile.md#addfiletyperesolver) -- [createFromAbstraction](aifffile.md#createfromabstraction) -- [createFromPath](aifffile.md#createfrompath) -- [removeFileType](aifffile.md#removefiletype) -- [removeFileTypeResolver](aifffile.md#removefiletyperesolver) +- [dispose](AiffFile.md#dispose) +- [find](AiffFile.md#find) +- [getTag](AiffFile.md#gettag) +- [insert](AiffFile.md#insert) +- [markAsCorrupt](AiffFile.md#markascorrupt) +- [preSave](AiffFile.md#presave) +- [rFind](AiffFile.md#rfind) +- [readBlock](AiffFile.md#readblock) +- [removeBlock](AiffFile.md#removeblock) +- [removeTags](AiffFile.md#removetags) +- [save](AiffFile.md#save) +- [seek](AiffFile.md#seek) +- [truncate](AiffFile.md#truncate) +- [writeBlock](AiffFile.md#writeblock) +- [addFileType](AiffFile.md#addfiletype) +- [addFileTypeResolver](AiffFile.md#addfiletyperesolver) +- [createFromAbstraction](AiffFile.md#createfromabstraction) +- [createFromPath](AiffFile.md#createfrompath) +- [removeFileType](AiffFile.md#removefiletype) +- [removeFileTypeResolver](AiffFile.md#removefiletyperesolver) ## Constructors @@ -71,7 +69,7 @@ • **new AiffFile**(`file`, `propertiesStyle`) -Constructs and initializes a new instance of [AiffFile](aifffile.md) for a specified file +Constructs and initializes a new instance of [AiffFile](AiffFile.md) for a specified file abstraction and specified read style. #### Parameters @@ -79,79 +77,49 @@ abstraction and specified read style. | Name | Type | Description | | :------ | :------ | :------ | | `file` | `string` \| `IFileAbstraction` | File abstraction to use when reading and writing to the file | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | Level of accuracy to read the media properties, or [ReadStyle.None](../enums/readstyle.md#none) to ignore the properties | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | Level of accuracy to read the media properties, or [ReadStyle.None](../enums/ReadStyle.md#none) to ignore the properties | #### Overrides -[File](file.md).[constructor](file.md#constructor) +[File](File.md).[constructor](File.md#constructor) ## Properties -### \_fileAbstraction +### AIFF\_FORM\_TYPE -• `Protected` **\_fileAbstraction**: `IFileAbstraction` - -#### Inherited from - -[File](file.md).[_fileAbstraction](file.md#_fileabstraction) - -___ - -### \_fileStream - -• `Protected` **\_fileStream**: `IStream` - -#### Inherited from - -[File](file.md).[_fileStream](file.md#_filestream) - -___ - -### \_tagTypesOnDisk - -• `Protected` **\_tagTypesOnDisk**: [`TagTypes`](../enums/tagtypes.md) - -#### Inherited from - -[File](file.md).[_tagTypesOnDisk](file.md#_tagtypesondisk) - -___ - -### aiffFormType - -▪ `Static` `Readonly` **aiffFormType**: [`ByteVector`](bytevector.md) +▪ `Static` `Readonly` **AIFF\_FORM\_TYPE**: [`ByteVector`](ByteVector.md) Identifier used to recognize an AIFF form type. ___ -### commIdentifier +### COMM\_IDENTIFIER -▪ `Static` `Readonly` **commIdentifier**: [`ByteVector`](bytevector.md) +▪ `Static` `Readonly` **COMM\_IDENTIFIER**: [`ByteVector`](ByteVector.md) Identifier used to recognize an AIFF common chunk. ___ -### fileIdentifier +### FILE\_IDENTIFIER -▪ `Static` `Readonly` **fileIdentifier**: [`ByteVector`](bytevector.md) +▪ `Static` `Readonly` **FILE\_IDENTIFIER**: [`ByteVector`](ByteVector.md) Identifier used to recognize an AIFF file. ___ -### id3Identifier +### ID3\_IDENTIFIER -▪ `Static` `Readonly` **id3Identifier**: [`ByteVector`](bytevector.md) +▪ `Static` `Readonly` **ID3\_IDENTIFIER**: [`ByteVector`](ByteVector.md) Identifier used to recognize an AIFF ID3 chunk. ___ -### soundIdentifier +### SOUND\_IDENTIFIER -▪ `Static` `Readonly` **soundIdentifier**: [`ByteVector`](bytevector.md) +▪ `Static` `Readonly` **SOUND\_IDENTIFIER**: [`ByteVector`](ByteVector.md) Identifier used to recognize an AIFF sound data chunk. @@ -167,6 +135,10 @@ Reasons for which this file is marked as corrupt. `string`[] +#### Inherited from + +File.corruptionReasons + ___ ### fileAbstraction @@ -179,6 +151,27 @@ Gets the {@link IFileAbstraction} representing the file. `IFileAbstraction` +#### Inherited from + +File.fileAbstraction + +___ + +### hasTags + +• `get` **hasTags**(): `boolean` + +Shortcut property to determine if a file has tags in memory. +NOTE: Just because `tag !== undefined` does not mean there are tags in memory. + +#### Returns + +`boolean` + +#### Inherited from + +File.hasTags + ___ ### isPossiblyCorrupt @@ -192,6 +185,10 @@ be written. `boolean` +#### Inherited from + +File.isPossiblyCorrupt + ___ ### isWritable @@ -204,6 +201,10 @@ Indicates whether or not tags can be written back to the current file. `boolean` +#### Inherited from + +File.isWritable + ___ ### length @@ -217,6 +218,10 @@ is not open for reading; `number` +#### Inherited from + +File.length + ___ ### mimeType @@ -229,34 +234,46 @@ Gets the MimeType of the file as determined during creation of the instance. `string` +#### Inherited from + +File.mimeType + ___ ### mode -• `get` **mode**(): [`FileAccessMode`](../enums/fileaccessmode.md) +• `get` **mode**(): [`FileAccessMode`](../enums/FileAccessMode.md) Gets the file access mode in use by the current instance. #### Returns -[`FileAccessMode`](../enums/fileaccessmode.md) +[`FileAccessMode`](../enums/FileAccessMode.md) + +#### Inherited from + +File.mode • `set` **mode**(`val`): `void` Sets the file access mode in use by the current instance. Changing the value will cause the stream currently in use to be closed, except when a change is made from -[FileAccessMode.Write](../enums/fileaccessmode.md#write) to [FileAccessMode.Read](../enums/fileaccessmode.md#read) which has no effect. +[FileAccessMode.Write](../enums/FileAccessMode.md#write) to [FileAccessMode.Read](../enums/FileAccessMode.md#read) which has no effect. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `val` | [`FileAccessMode`](../enums/fileaccessmode.md) | File access mode to change to | +| `val` | [`FileAccessMode`](../enums/FileAccessMode.md) | File access mode to change to | #### Returns `void` +#### Inherited from + +File.mode + ___ ### name @@ -269,6 +286,10 @@ Gets the name of the file as stored in its file abstraction. `string` +#### Inherited from + +File.name + ___ ### position @@ -282,57 +303,91 @@ if the file is not open for reading `number` +#### Inherited from + +File.position + ___ ### properties -• `get` **properties**(): [`Properties`](properties.md) - -Gets the media properties of the file represented by the current instance. +• `get` **properties**(): [`Properties`](Properties.md) **`inheritdoc`** #### Returns -[`Properties`](properties.md) +[`Properties`](Properties.md) + +#### Overrides + +File.properties ___ ### tag -• `get` **tag**(): [`Tag`](tag.md) - -Gets an abstract representation of all tags stored in the current instance. +• `get` **tag**(): [`Tag`](Tag.md) **`inheritdoc`** #### Returns -[`Tag`](tag.md) +[`Tag`](Tag.md) + +#### Overrides + +File.tag ___ ### tagTypes -• `get` **tagTypes**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypes**(): [`TagTypes`](../enums/TagTypes.md) Gets the tag types contained in the current instance. #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) + +#### Inherited from + +File.tagTypes ___ ### tagTypesOnDisk -• `get` **tagTypesOnDisk**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypesOnDisk**(): [`TagTypes`](../enums/TagTypes.md) Gets the tag types contained in the physical file represented by the current instance. #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) + +#### Inherited from + +File.tagTypesOnDisk + +• `set` **tagTypesOnDisk**(`value`): `void` + +Gets the tag types contained in the physical file represented by the current instance. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | [`TagTypes`](../enums/TagTypes.md) | + +#### Returns + +`void` + +#### Inherited from + +File.tagTypesOnDisk ___ @@ -346,6 +401,10 @@ Gets the buffer size to use when reading large blocks of data `number` +#### Inherited from + +File.bufferSize + ## Methods ### dispose @@ -360,7 +419,7 @@ Dispose the current instance. Equivalent to setting the mode to closed. #### Inherited from -[File](file.md).[dispose](file.md#dispose) +[File](File.md).[dispose](File.md#dispose) ___ @@ -377,9 +436,9 @@ Searches forward through a file for a specified pattern, starting at a specified | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | `undefined` | Pattern to search for in the current instance. Must be smaller than the | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern to search for in the current instance. Must be smaller than the | | `startPosition` | `number` | `0` | Seek position to start searching. Must be positive, safe integer. | -| `before?` | [`ByteVector`](bytevector.md) | `undefined` | Optional pattern that the searched for pattern must appear before. If this pattern is found first, `-1` is returned. | +| `before?` | [`ByteVector`](ByteVector.md) | `undefined` | Optional pattern that the searched for pattern must appear before. If this pattern is found first, `-1` is returned. | #### Returns @@ -389,13 +448,13 @@ Index at which the value was found. If not found, `-1` is returned. #### Inherited from -[File](file.md).[find](file.md#find) +[File](File.md).[find](File.md#find) ___ ### getTag -▸ **getTag**(`type`, `create`): [`Tag`](tag.md) +▸ **getTag**(`type`, `create`): [`Tag`](Tag.md) Gets a tag of the specified type from the current instance, optionally creating a new tag if possible. @@ -404,12 +463,12 @@ possible. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`TagTypes`](../enums/tagtypes.md) | Type of tag to read. | +| `type` | [`TagTypes`](../enums/TagTypes.md) | Type of tag to read. | | `create` | `boolean` | Whether or not to try and create the tag if one is not found. `true` does not guarantee the tag will be created. For example, trying to create an ID3v2 tag on an OGG Vorbis file will always fail. | #### Returns -[`Tag`](tag.md) +[`Tag`](Tag.md) Tag object containing the tag that was found in or added to the current instance. If no matching tag was found and none was created, `undefined` is returned. It is safe @@ -418,7 +477,7 @@ Tag object containing the tag that was found in or added to the current instance #### Overrides -[File](file.md).[getTag](file.md#gettag) +[File](File.md).[getTag](File.md#gettag) ___ @@ -436,7 +495,7 @@ specified location, replacing a specified number of bytes. | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | `undefined` | Data to insert into the file. | +| `data` | [`ByteVector`](ByteVector.md) | `undefined` | Data to insert into the file. | | `start` | `number` | `undefined` | Index into the file at which to insert the data. Must be safe positive integer. | | `replace` | `number` | `0` | Number of bytes to replace. Typically this is the original size of the data block so that a new block will replace the old one. | @@ -446,7 +505,7 @@ specified location, replacing a specified number of bytes. #### Inherited from -[File](file.md).[insert](file.md#insert) +[File](File.md).[insert](File.md#insert) ___ @@ -468,7 +527,7 @@ Mark the current instance as corrupt. NOTE: Not intended to be used outside of t #### Inherited from -[File](file.md).[markAsCorrupt](file.md#markascorrupt) +[File](File.md).[markAsCorrupt](File.md#markascorrupt) ___ @@ -484,7 +543,7 @@ Prepares to save the file. This must be called at the beginning of every File.sa #### Inherited from -[File](file.md).[preSave](file.md#presave) +[File](File.md).[preSave](File.md#presave) ___ @@ -501,7 +560,7 @@ Searches backwards through a file for a specified pattern, starting at a specifi | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | `undefined` | Pattern to search for in the current instance. Must be shorter than the [bufferSize](aifffile.md#buffersize) | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern to search for in the current instance. Must be shorter than the [bufferSize](AiffFile.md#buffersize) | | `startPosition` | `number` | `0` | Number of bytes from end of the file to begin searching. | #### Returns @@ -512,17 +571,17 @@ Index at which the value wa found. If not found, `-1` is returned. #### Inherited from -[File](file.md).[rFind](file.md#rfind) +[File](File.md).[rFind](File.md#rfind) ___ ### readBlock -▸ **readBlock**(`length`): [`ByteVector`](bytevector.md) +▸ **readBlock**(`length`): [`ByteVector`](ByteVector.md) Reads a specified number of bytes at the current seek position from the current position. This method reads the block of data at the current seek position. To change the seek -position, use [File.seek](file.md#seek). +position, use [File.seek](File.md#seek). **`throws`** Error Thrown when `length` is not a positive, safe integer. @@ -534,13 +593,13 @@ position, use [File.seek](file.md#seek). #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ByteVector Object containing the data read from the current instance. #### Inherited from -[File](file.md).[readBlock](file.md#readblock) +[File](File.md).[readBlock](File.md#readblock) ___ @@ -566,7 +625,7 @@ Removes a specified block of data from the file represented by the current insta #### Inherited from -[File](file.md).[removeBlock](file.md#removeblock) +[File](File.md).[removeBlock](File.md#removeblock) ___ @@ -575,13 +634,13 @@ ___ ▸ **removeTags**(`types`): `void` Removes a set of tag types from the current instance. In order to remove all tags from a -file, pass [TagTypes.AllTags](../enums/tagtypes.md#alltags) as `types` +file, pass [TagTypes.AllTags](../enums/TagTypes.md#alltags) as `types` #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `types` | [`TagTypes`](../enums/tagtypes.md) | Bitwise combined [TagTypes](../enums/tagtypes.md) value containing the tag types to be removed from the file | +| `types` | [`TagTypes`](../enums/TagTypes.md) | Bitwise combined [TagTypes](../enums/TagTypes.md) value containing the tag types to be removed from the file | #### Returns @@ -589,7 +648,7 @@ file, pass [TagTypes.AllTags](../enums/tagtypes.md#alltags) as `types` #### Overrides -[File](file.md).[removeTags](file.md#removetags) +[File](File.md).[removeTags](File.md#removetags) ___ @@ -605,7 +664,7 @@ Saves the changes made in the current instance to the file it represents. #### Overrides -[File](file.md).[save](file.md#save) +[File](File.md).[save](File.md#save) ___ @@ -618,10 +677,10 @@ specified origin. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `offset` | `number` | Byte offset to seek to. Must be a safe, positive integer. | -| `origin` | `SeekOrigin` | Origin from which to seek | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `offset` | `number` | `undefined` | Byte offset to seek to. Must be a safe, positive integer. | +| `origin` | `SeekOrigin` | `SeekOrigin.Begin` | Origin from which to seek | #### Returns @@ -629,7 +688,7 @@ specified origin. #### Inherited from -[File](file.md).[seek](file.md#seek) +[File](File.md).[seek](File.md#seek) ___ @@ -651,7 +710,7 @@ Resizes the current instance to a specific number of bytes. #### Inherited from -[File](file.md).[truncate](file.md#truncate) +[File](File.md).[truncate](File.md#truncate) ___ @@ -669,7 +728,7 @@ the file if writing past the current end. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | ByteVector containing data to the current instance. | +| `data` | [`ByteVector`](ByteVector.md) | ByteVector containing data to the current instance. | #### Returns @@ -677,7 +736,7 @@ the file if writing past the current end. #### Inherited from -[File](file.md).[writeBlock](file.md#writeblock) +[File](File.md).[writeBlock](File.md#writeblock) ___ @@ -685,7 +744,7 @@ ___ ▸ `Static` **addFileType**(`mimeType`, `constructor`, `override?`): `void` -Registers the constructor for a subclass of [File](file.md) with the MimeType it is associated +Registers the constructor for a subclass of [File](File.md) with the MimeType it is associated with. Optionally, the MimeType can be forcefully overridden if it was already registered. #### Parameters @@ -693,8 +752,8 @@ with. Optionally, the MimeType can be forcefully overridden if it was already re | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | | `mimeType` | `string` | `undefined` | MimeType to register this subclass constructor to. | -| `constructor` | [`FileTypeConstructor`](../modules.md#filetypeconstructor) | `undefined` | Constructor for a subclass of [File](file.md) that will be called if a file with a MimeType of `mimeType` is created. | -| `override` | `boolean` | `false` | If `true` and a subclass of [File](file.md) was already registered to `mimeType`, it will be forcefully overridden. If `false`, an {@link Error} will be thrown if a subclass already registered to the MimeType.} | +| `constructor` | [`FileTypeConstructor`](../modules.md#filetypeconstructor) | `undefined` | Constructor for a subclass of [File](File.md) that will be called if a file with a MimeType of `mimeType` is created. | +| `override` | `boolean` | `false` | If `true` and a subclass of [File](File.md) was already registered to `mimeType`, it will be forcefully overridden. If `false`, an {@link Error} will be thrown if a subclass already registered to the MimeType.} | #### Returns @@ -702,7 +761,7 @@ with. Optionally, the MimeType can be forcefully overridden if it was already re #### Inherited from -[File](file.md).[addFileType](file.md#addfiletype) +[File](File.md).[addFileType](File.md#addfiletype) ___ @@ -716,7 +775,7 @@ Registers a [FileTypeResolver](../modules.md#filetyperesolver) to the front of t | Name | Type | Description | | :------ | :------ | :------ | -| `resolver` | [`FileTypeResolver`](../modules.md#filetyperesolver) | Function to handle resolving a subclass of [File](file.md) from an {@link IFileAbstraction} | +| `resolver` | [`FileTypeResolver`](../modules.md#filetyperesolver) | Function to handle resolving a subclass of [File](File.md) from an {@link IFileAbstraction} | #### Returns @@ -724,61 +783,61 @@ Registers a [FileTypeResolver](../modules.md#filetyperesolver) to the front of t #### Inherited from -[File](file.md).[addFileTypeResolver](file.md#addfiletyperesolver) +[File](File.md).[addFileTypeResolver](File.md#addfiletyperesolver) ___ ### createFromAbstraction -▸ `Static` **createFromAbstraction**(`abstraction`, `mimeType?`, `propertiesStyle?`): [`File`](file.md) +▸ `Static` **createFromAbstraction**(`abstraction`, `mimeType?`, `propertiesStyle?`): [`File`](File.md) -Creates a new instance of a [File](file.md) subclass for a specified file abstraction, MimeType, +Creates a new instance of a [File](File.md) subclass for a specified file abstraction, MimeType, and property read style. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `abstraction` | `IFileAbstraction` | Object to use when reading/writing from the current instance. | -| `mimeType?` | `string` | Optional, MimeType to use for determining the subclass of [File](file.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | Optional, level of detail to use when reading the media information from the new instance. If omitted, [ReadStyle.Average](../enums/readstyle.md#average) is used. | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `abstraction` | `IFileAbstraction` | `undefined` | Object to use when reading/writing from the current instance. | +| `mimeType?` | `string` | `undefined` | Optional, MimeType to use for determining the subclass of [File](File.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | `ReadStyle.Average` | Optional, level of detail to use when reading the media information from the new instance. If omitted, [ReadStyle.Average](../enums/ReadStyle.md#average) is used. | #### Returns -[`File`](file.md) +[`File`](File.md) -New instance of [File](file.md) as read from the specified abstraction. +New instance of [File](File.md) as read from the specified abstraction. #### Inherited from -[File](file.md).[createFromAbstraction](file.md#createfromabstraction) +[File](File.md).[createFromAbstraction](File.md#createfromabstraction) ___ ### createFromPath -▸ `Static` **createFromPath**(`filePath`, `mimeType?`, `propertiesStyle?`): [`File`](file.md) +▸ `Static` **createFromPath**(`filePath`, `mimeType?`, `propertiesStyle?`): [`File`](File.md) -Creates a new instance of [File](file.md) subclass for a specified file path, MimeType, and +Creates a new instance of [File](File.md) subclass for a specified file path, MimeType, and property read style. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `filePath` | `string` | Path to the file to read/write. | -| `mimeType?` | `string` | Optional, MimeType to use for determining the subclass of [File](file.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | Optional, level of detail to use when reading the media information from the new instance. If omitted [ReadStyle.Average](../enums/readstyle.md#average) is used. | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `filePath` | `string` | `undefined` | Path to the file to read/write. | +| `mimeType?` | `string` | `undefined` | Optional, MimeType to use for determining the subclass of [File](File.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | `ReadStyle.Average` | Optional, level of detail to use when reading the media information from the new instance. If omitted [ReadStyle.Average](../enums/ReadStyle.md#average) is used. | #### Returns -[`File`](file.md) +[`File`](File.md) -New instance of [File](file.md) as read from the specified path. +New instance of [File](File.md) as read from the specified path. #### Inherited from -[File](file.md).[createFromPath](file.md#createfrompath) +[File](File.md).[createFromPath](File.md#createfrompath) ___ @@ -800,7 +859,7 @@ Used for removing a file type constructor during unit testing #### Inherited from -[File](file.md).[removeFileType](file.md#removefiletype) +[File](File.md).[removeFileType](File.md#removefiletype) ___ @@ -822,4 +881,4 @@ Used for removing a file type resolver during unit testing #### Inherited from -[File](file.md).[removeFileTypeResolver](file.md#removefiletyperesolver) +[File](File.md).[removeFileTypeResolver](File.md#removefiletyperesolver) diff --git a/docs/classes/apefile.md b/docs/classes/ApeFile.md similarity index 65% rename from docs/classes/apefile.md rename to docs/classes/ApeFile.md index b009b804..0f4cb620 100644 --- a/docs/classes/apefile.md +++ b/docs/classes/ApeFile.md @@ -3,13 +3,13 @@ # Class: ApeFile Provides tagging and properties support for Monkey's Audio APE files. -Note, a [ApeTag](apetag.md) will be added automatically to any file that doesn't contain one. This -change does not affect the physical file until [File.save](file.md#save) is called and can be reversed +Note, a [ApeTag](ApeTag.md) will be added automatically to any file that doesn't contain one. This +change does not affect the physical file until [File.save](File.md#save) is called and can be reversed using the following method: `file.removeTags(file.tagTypes & ~file.tagTypesOnDisk);` ## Hierarchy -- `SandwichFile` +- `default` ↳ **`ApeFile`** @@ -17,59 +17,53 @@ using the following method: `file.removeTags(file.tagTypes & ~file.tagTypesOnDis ### Constructors -- [constructor](apefile.md#constructor) - -### Properties - -- [\_fileAbstraction](apefile.md#_fileabstraction) -- [\_fileStream](apefile.md#_filestream) -- [\_tagTypesOnDisk](apefile.md#_tagtypesondisk) +- [constructor](ApeFile.md#constructor) ### Accessors -- [corruptionReasons](apefile.md#corruptionreasons) -- [endTag](apefile.md#endtag) -- [fileAbstraction](apefile.md#fileabstraction) -- [isPossiblyCorrupt](apefile.md#ispossiblycorrupt) -- [isWritable](apefile.md#iswritable) -- [length](apefile.md#length) -- [mediaEndPosition](apefile.md#mediaendposition) -- [mediaStartPosition](apefile.md#mediastartposition) -- [mimeType](apefile.md#mimetype) -- [mode](apefile.md#mode) -- [name](apefile.md#name) -- [position](apefile.md#position) -- [properties](apefile.md#properties) -- [startTag](apefile.md#starttag) -- [tag](apefile.md#tag) -- [tagTypes](apefile.md#tagtypes) -- [tagTypesOnDisk](apefile.md#tagtypesondisk) -- [bufferSize](apefile.md#buffersize) +- [corruptionReasons](ApeFile.md#corruptionreasons) +- [endTag](ApeFile.md#endtag) +- [fileAbstraction](ApeFile.md#fileabstraction) +- [hasTags](ApeFile.md#hastags) +- [isPossiblyCorrupt](ApeFile.md#ispossiblycorrupt) +- [isWritable](ApeFile.md#iswritable) +- [length](ApeFile.md#length) +- [mediaEndPosition](ApeFile.md#mediaendposition) +- [mediaStartPosition](ApeFile.md#mediastartposition) +- [mimeType](ApeFile.md#mimetype) +- [mode](ApeFile.md#mode) +- [name](ApeFile.md#name) +- [position](ApeFile.md#position) +- [properties](ApeFile.md#properties) +- [startTag](ApeFile.md#starttag) +- [tag](ApeFile.md#tag) +- [tagTypes](ApeFile.md#tagtypes) +- [tagTypesOnDisk](ApeFile.md#tagtypesondisk) +- [bufferSize](ApeFile.md#buffersize) ### Methods -- [dispose](apefile.md#dispose) -- [find](apefile.md#find) -- [getTag](apefile.md#gettag) -- [insert](apefile.md#insert) -- [markAsCorrupt](apefile.md#markascorrupt) -- [preSave](apefile.md#presave) -- [rFind](apefile.md#rfind) -- [readBlock](apefile.md#readblock) -- [readEnd](apefile.md#readend) -- [readProperties](apefile.md#readproperties) -- [removeBlock](apefile.md#removeblock) -- [removeTags](apefile.md#removetags) -- [save](apefile.md#save) -- [seek](apefile.md#seek) -- [truncate](apefile.md#truncate) -- [writeBlock](apefile.md#writeblock) -- [addFileType](apefile.md#addfiletype) -- [addFileTypeResolver](apefile.md#addfiletyperesolver) -- [createFromAbstraction](apefile.md#createfromabstraction) -- [createFromPath](apefile.md#createfrompath) -- [removeFileType](apefile.md#removefiletype) -- [removeFileTypeResolver](apefile.md#removefiletyperesolver) +- [dispose](ApeFile.md#dispose) +- [find](ApeFile.md#find) +- [getTag](ApeFile.md#gettag) +- [insert](ApeFile.md#insert) +- [markAsCorrupt](ApeFile.md#markascorrupt) +- [preSave](ApeFile.md#presave) +- [rFind](ApeFile.md#rfind) +- [readBlock](ApeFile.md#readblock) +- [readProperties](ApeFile.md#readproperties) +- [removeBlock](ApeFile.md#removeblock) +- [removeTags](ApeFile.md#removetags) +- [save](ApeFile.md#save) +- [seek](ApeFile.md#seek) +- [truncate](ApeFile.md#truncate) +- [writeBlock](ApeFile.md#writeblock) +- [addFileType](ApeFile.md#addfiletype) +- [addFileTypeResolver](ApeFile.md#addfiletyperesolver) +- [createFromAbstraction](ApeFile.md#createfromabstraction) +- [createFromPath](ApeFile.md#createfrompath) +- [removeFileType](ApeFile.md#removefiletype) +- [removeFileTypeResolver](ApeFile.md#removefiletyperesolver) ## Constructors @@ -84,42 +78,12 @@ using the following method: `file.removeTags(file.tagTypes & ~file.tagTypesOnDis | Name | Type | | :------ | :------ | | `file` | `string` \| `IFileAbstraction` | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | #### Overrides SandwichFile.constructor -## Properties - -### \_fileAbstraction - -• `Protected` **\_fileAbstraction**: `IFileAbstraction` - -#### Inherited from - -SandwichFile.\_fileAbstraction - -___ - -### \_fileStream - -• `Protected` **\_fileStream**: `IStream` - -#### Inherited from - -SandwichFile.\_fileStream - -___ - -### \_tagTypesOnDisk - -• `Protected` **\_tagTypesOnDisk**: [`TagTypes`](../enums/tagtypes.md) - -#### Inherited from - -SandwichFile.\_tagTypesOnDisk - ## Accessors ### corruptionReasons @@ -132,6 +96,10 @@ Reasons for which this file is marked as corrupt. `string`[] +#### Inherited from + +SandwichFile.corruptionReasons + ___ ### endTag @@ -144,6 +112,10 @@ Gets the collection of tags appearing at the end of the file. `default` +#### Inherited from + +SandwichFile.endTag + ___ ### fileAbstraction @@ -156,6 +128,27 @@ Gets the {@link IFileAbstraction} representing the file. `IFileAbstraction` +#### Inherited from + +SandwichFile.fileAbstraction + +___ + +### hasTags + +• `get` **hasTags**(): `boolean` + +Shortcut property to determine if a file has tags in memory. +NOTE: Just because `tag !== undefined` does not mean there are tags in memory. + +#### Returns + +`boolean` + +#### Inherited from + +SandwichFile.hasTags + ___ ### isPossiblyCorrupt @@ -169,6 +162,10 @@ be written. `boolean` +#### Inherited from + +SandwichFile.isPossiblyCorrupt + ___ ### isWritable @@ -181,6 +178,10 @@ Indicates whether or not tags can be written back to the current file. `boolean` +#### Inherited from + +SandwichFile.isWritable + ___ ### length @@ -194,30 +195,42 @@ is not open for reading; `number` +#### Inherited from + +SandwichFile.length + ___ ### mediaEndPosition • `get` **mediaEndPosition**(): `number` -Gets the position at which the media content of this file ends. +**`inheritdoc`** #### Returns `number` +#### Inherited from + +SandwichFile.mediaEndPosition + ___ ### mediaStartPosition • `get` **mediaStartPosition**(): `number` -Gets the position at which the media content of this file starts. +**`inheritdoc`** #### Returns `number` +#### Inherited from + +SandwichFile.mediaStartPosition + ___ ### mimeType @@ -230,34 +243,46 @@ Gets the MimeType of the file as determined during creation of the instance. `string` +#### Inherited from + +SandwichFile.mimeType + ___ ### mode -• `get` **mode**(): [`FileAccessMode`](../enums/fileaccessmode.md) +• `get` **mode**(): [`FileAccessMode`](../enums/FileAccessMode.md) Gets the file access mode in use by the current instance. #### Returns -[`FileAccessMode`](../enums/fileaccessmode.md) +[`FileAccessMode`](../enums/FileAccessMode.md) + +#### Inherited from + +SandwichFile.mode • `set` **mode**(`val`): `void` Sets the file access mode in use by the current instance. Changing the value will cause the stream currently in use to be closed, except when a change is made from -[FileAccessMode.Write](../enums/fileaccessmode.md#write) to [FileAccessMode.Read](../enums/fileaccessmode.md#read) which has no effect. +[FileAccessMode.Write](../enums/FileAccessMode.md#write) to [FileAccessMode.Read](../enums/FileAccessMode.md#read) which has no effect. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `val` | [`FileAccessMode`](../enums/fileaccessmode.md) | File access mode to change to | +| `val` | [`FileAccessMode`](../enums/FileAccessMode.md) | File access mode to change to | #### Returns `void` +#### Inherited from + +SandwichFile.mode + ___ ### name @@ -270,6 +295,10 @@ Gets the name of the file as stored in its file abstraction. `string` +#### Inherited from + +SandwichFile.name + ___ ### position @@ -283,17 +312,25 @@ if the file is not open for reading `number` +#### Inherited from + +SandwichFile.position + ___ ### properties -• `get` **properties**(): [`Properties`](properties.md) +• `get` **properties**(): [`Properties`](Properties.md) Gets the media properties of the file represented by the current instance. #### Returns -[`Properties`](properties.md) +[`Properties`](Properties.md) + +#### Inherited from + +SandwichFile.properties ___ @@ -307,6 +344,10 @@ Gets the collection of tags appearing at the start of the file. `default` +#### Inherited from + +SandwichFile.startTag + ___ ### tag @@ -319,29 +360,59 @@ Gets an abstract representation of all tags stored in the current instance. `default` +#### Inherited from + +SandwichFile.tag + ___ ### tagTypes -• `get` **tagTypes**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypes**(): [`TagTypes`](../enums/TagTypes.md) Gets the tag types contained in the current instance. #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) + +#### Inherited from + +SandwichFile.tagTypes ___ ### tagTypesOnDisk -• `get` **tagTypesOnDisk**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypesOnDisk**(): [`TagTypes`](../enums/TagTypes.md) Gets the tag types contained in the physical file represented by the current instance. #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) + +#### Inherited from + +SandwichFile.tagTypesOnDisk + +• `set` **tagTypesOnDisk**(`value`): `void` + +Gets the tag types contained in the physical file represented by the current instance. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | [`TagTypes`](../enums/TagTypes.md) | + +#### Returns + +`void` + +#### Inherited from + +SandwichFile.tagTypesOnDisk ___ @@ -355,6 +426,10 @@ Gets the buffer size to use when reading large blocks of data `number` +#### Inherited from + +SandwichFile.bufferSize + ## Methods ### dispose @@ -386,9 +461,9 @@ Searches forward through a file for a specified pattern, starting at a specified | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | `undefined` | Pattern to search for in the current instance. Must be smaller than the | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern to search for in the current instance. Must be smaller than the | | `startPosition` | `number` | `0` | Seek position to start searching. Must be positive, safe integer. | -| `before?` | [`ByteVector`](bytevector.md) | `undefined` | Optional pattern that the searched for pattern must appear before. If this pattern is found first, `-1` is returned. | +| `before?` | [`ByteVector`](ByteVector.md) | `undefined` | Optional pattern that the searched for pattern must appear before. If this pattern is found first, `-1` is returned. | #### Returns @@ -404,7 +479,7 @@ ___ ### getTag -▸ **getTag**(`type`, `create`): [`Tag`](tag.md) +▸ **getTag**(`type`, `create`): [`Tag`](Tag.md) **`inheritdoc`** @@ -412,12 +487,12 @@ ___ | Name | Type | | :------ | :------ | -| `type` | [`TagTypes`](../enums/tagtypes.md) | +| `type` | [`TagTypes`](../enums/TagTypes.md) | | `create` | `boolean` | #### Returns -[`Tag`](tag.md) +[`Tag`](Tag.md) #### Inherited from @@ -439,7 +514,7 @@ specified location, replacing a specified number of bytes. | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | `undefined` | Data to insert into the file. | +| `data` | [`ByteVector`](ByteVector.md) | `undefined` | Data to insert into the file. | | `start` | `number` | `undefined` | Index into the file at which to insert the data. Must be safe positive integer. | | `replace` | `number` | `0` | Number of bytes to replace. Typically this is the original size of the data block so that a new block will replace the old one. | @@ -504,7 +579,7 @@ Searches backwards through a file for a specified pattern, starting at a specifi | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | `undefined` | Pattern to search for in the current instance. Must be shorter than the [bufferSize](apefile.md#buffersize) | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern to search for in the current instance. Must be shorter than the [bufferSize](ApeFile.md#buffersize) | | `startPosition` | `number` | `0` | Number of bytes from end of the file to begin searching. | #### Returns @@ -521,11 +596,11 @@ ___ ### readBlock -▸ **readBlock**(`length`): [`ByteVector`](bytevector.md) +▸ **readBlock**(`length`): [`ByteVector`](ByteVector.md) Reads a specified number of bytes at the current seek position from the current position. This method reads the block of data at the current seek position. To change the seek -position, use [File.seek](file.md#seek). +position, use [File.seek](File.md#seek). **`throws`** Error Thrown when `length` is not a positive, safe integer. @@ -537,7 +612,7 @@ position, use [File.seek](file.md#seek). #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ByteVector Object containing the data read from the current instance. @@ -547,28 +622,9 @@ SandwichFile.readBlock ___ -### readEnd - -▸ `Protected` **readEnd**(`_end`, `_propertiesStyle`): `void` - -**`inheritdoc`** - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `_end` | `number` | -| `_propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | - -#### Returns - -`void` - -___ - ### readProperties -▸ `Protected` **readProperties**(`readStyle`): [`Properties`](properties.md) +▸ `Protected` **readProperties**(`readStyle`): [`Properties`](Properties.md) **`inheritdoc`** @@ -576,11 +632,11 @@ ___ | Name | Type | | :------ | :------ | -| `readStyle` | [`ReadStyle`](../enums/readstyle.md) | +| `readStyle` | [`ReadStyle`](../enums/ReadStyle.md) | #### Returns -[`Properties`](properties.md) +[`Properties`](Properties.md) #### Overrides @@ -624,7 +680,7 @@ ___ | Name | Type | | :------ | :------ | -| `types` | [`TagTypes`](../enums/tagtypes.md) | +| `types` | [`TagTypes`](../enums/TagTypes.md) | #### Returns @@ -661,10 +717,10 @@ specified origin. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `offset` | `number` | Byte offset to seek to. Must be a safe, positive integer. | -| `origin` | `SeekOrigin` | Origin from which to seek | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `offset` | `number` | `undefined` | Byte offset to seek to. Must be a safe, positive integer. | +| `origin` | `SeekOrigin` | `SeekOrigin.Begin` | Origin from which to seek | #### Returns @@ -712,7 +768,7 @@ the file if writing past the current end. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | ByteVector containing data to the current instance. | +| `data` | [`ByteVector`](ByteVector.md) | ByteVector containing data to the current instance. | #### Returns @@ -728,7 +784,7 @@ ___ ▸ `Static` **addFileType**(`mimeType`, `constructor`, `override?`): `void` -Registers the constructor for a subclass of [File](file.md) with the MimeType it is associated +Registers the constructor for a subclass of [File](File.md) with the MimeType it is associated with. Optionally, the MimeType can be forcefully overridden if it was already registered. #### Parameters @@ -736,8 +792,8 @@ with. Optionally, the MimeType can be forcefully overridden if it was already re | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | | `mimeType` | `string` | `undefined` | MimeType to register this subclass constructor to. | -| `constructor` | [`FileTypeConstructor`](../modules.md#filetypeconstructor) | `undefined` | Constructor for a subclass of [File](file.md) that will be called if a file with a MimeType of `mimeType` is created. | -| `override` | `boolean` | `false` | If `true` and a subclass of [File](file.md) was already registered to `mimeType`, it will be forcefully overridden. If `false`, an {@link Error} will be thrown if a subclass already registered to the MimeType.} | +| `constructor` | [`FileTypeConstructor`](../modules.md#filetypeconstructor) | `undefined` | Constructor for a subclass of [File](File.md) that will be called if a file with a MimeType of `mimeType` is created. | +| `override` | `boolean` | `false` | If `true` and a subclass of [File](File.md) was already registered to `mimeType`, it will be forcefully overridden. If `false`, an {@link Error} will be thrown if a subclass already registered to the MimeType.} | #### Returns @@ -759,7 +815,7 @@ Registers a [FileTypeResolver](../modules.md#filetyperesolver) to the front of t | Name | Type | Description | | :------ | :------ | :------ | -| `resolver` | [`FileTypeResolver`](../modules.md#filetyperesolver) | Function to handle resolving a subclass of [File](file.md) from an {@link IFileAbstraction} | +| `resolver` | [`FileTypeResolver`](../modules.md#filetyperesolver) | Function to handle resolving a subclass of [File](File.md) from an {@link IFileAbstraction} | #### Returns @@ -773,24 +829,24 @@ ___ ### createFromAbstraction -▸ `Static` **createFromAbstraction**(`abstraction`, `mimeType?`, `propertiesStyle?`): [`File`](file.md) +▸ `Static` **createFromAbstraction**(`abstraction`, `mimeType?`, `propertiesStyle?`): [`File`](File.md) -Creates a new instance of a [File](file.md) subclass for a specified file abstraction, MimeType, +Creates a new instance of a [File](File.md) subclass for a specified file abstraction, MimeType, and property read style. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `abstraction` | `IFileAbstraction` | Object to use when reading/writing from the current instance. | -| `mimeType?` | `string` | Optional, MimeType to use for determining the subclass of [File](file.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | Optional, level of detail to use when reading the media information from the new instance. If omitted, [ReadStyle.Average](../enums/readstyle.md#average) is used. | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `abstraction` | `IFileAbstraction` | `undefined` | Object to use when reading/writing from the current instance. | +| `mimeType?` | `string` | `undefined` | Optional, MimeType to use for determining the subclass of [File](File.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | `ReadStyle.Average` | Optional, level of detail to use when reading the media information from the new instance. If omitted, [ReadStyle.Average](../enums/ReadStyle.md#average) is used. | #### Returns -[`File`](file.md) +[`File`](File.md) -New instance of [File](file.md) as read from the specified abstraction. +New instance of [File](File.md) as read from the specified abstraction. #### Inherited from @@ -800,24 +856,24 @@ ___ ### createFromPath -▸ `Static` **createFromPath**(`filePath`, `mimeType?`, `propertiesStyle?`): [`File`](file.md) +▸ `Static` **createFromPath**(`filePath`, `mimeType?`, `propertiesStyle?`): [`File`](File.md) -Creates a new instance of [File](file.md) subclass for a specified file path, MimeType, and +Creates a new instance of [File](File.md) subclass for a specified file path, MimeType, and property read style. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `filePath` | `string` | Path to the file to read/write. | -| `mimeType?` | `string` | Optional, MimeType to use for determining the subclass of [File](file.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | Optional, level of detail to use when reading the media information from the new instance. If omitted [ReadStyle.Average](../enums/readstyle.md#average) is used. | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `filePath` | `string` | `undefined` | Path to the file to read/write. | +| `mimeType?` | `string` | `undefined` | Optional, MimeType to use for determining the subclass of [File](File.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | `ReadStyle.Average` | Optional, level of detail to use when reading the media information from the new instance. If omitted [ReadStyle.Average](../enums/ReadStyle.md#average) is used. | #### Returns -[`File`](file.md) +[`File`](File.md) -New instance of [File](file.md) as read from the specified path. +New instance of [File](File.md) as read from the specified path. #### Inherited from diff --git a/docs/classes/apefilesettings.md b/docs/classes/ApeFileSettings.md similarity index 84% rename from docs/classes/apefilesettings.md rename to docs/classes/ApeFileSettings.md index 8129dedf..a059cbc5 100644 --- a/docs/classes/apefilesettings.md +++ b/docs/classes/ApeFileSettings.md @@ -9,17 +9,17 @@ in order for changes to take effect. ### Constructors -- [constructor](apefilesettings.md#constructor) +- [constructor](ApeFileSettings.md#constructor) ### Properties -- [supportedTagTypes](apefilesettings.md#supportedtagtypes) +- [SUPPORTED\_TAG\_TYPES](ApeFileSettings.md#supported_tag_types) ### Accessors -- [defaultTagTypes](apefilesettings.md#defaulttagtypes) -- [preferApeTagAtFileEnd](apefilesettings.md#preferapetagatfileend) -- [preferId3v2TagAtFileEnd](apefilesettings.md#preferid3v2tagatfileend) +- [defaultTagTypes](ApeFileSettings.md#defaulttagtypes) +- [preferApeTagAtFileEnd](ApeFileSettings.md#preferapetagatfileend) +- [preferId3v2TagAtFileEnd](ApeFileSettings.md#preferid3v2tagatfileend) ## Constructors @@ -29,34 +29,34 @@ in order for changes to take effect. ## Properties -### supportedTagTypes +### SUPPORTED\_TAG\_TYPES -▪ `Static` `Readonly` **supportedTagTypes**: `number` +▪ `Static` `Readonly` **SUPPORTED\_TAG\_TYPES**: `number` ## Accessors ### defaultTagTypes -• `Static` `get` **defaultTagTypes**(): [`TagTypes`](../enums/tagtypes.md) +• `Static` `get` **defaultTagTypes**(): [`TagTypes`](../enums/TagTypes.md) Gets the default types of tags for an APE file. When opening a file, if these tag types do not exist on the file, they will be created. #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) • `Static` `set` **defaultTagTypes**(`value`): `void` Sets the default types of tags for an APE file. When opening a file, if these tag types do -not exist on the file, they will be created. See [supportedTagTypes](apefilesettings.md#supportedtagtypes) for a list of tag +not exist on the file, they will be created. See [SUPPORTED_TAG_TYPES](ApeFileSettings.md#supported_tag_types) for a list of tag types that are supported by node-taglib-sharp for APE files. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`TagTypes`](../enums/tagtypes.md) | +| `value` | [`TagTypes`](../enums/TagTypes.md) | #### Returns diff --git a/docs/classes/apetag.md b/docs/classes/ApeTag.md similarity index 52% rename from docs/classes/apetag.md rename to docs/classes/ApeTag.md index e05e2f15..74033703 100644 --- a/docs/classes/apetag.md +++ b/docs/classes/ApeTag.md @@ -6,7 +6,7 @@ Provides a representation of an APEv2 tag which can be read from and written to ## Hierarchy -- [`Tag`](tag.md) +- [`Tag`](Tag.md) ↳ **`ApeTag`** @@ -14,92 +14,93 @@ Provides a representation of an APEv2 tag which can be read from and written to ### Accessors -- [album](apetag.md#album) -- [albumArtists](apetag.md#albumartists) -- [albumArtistsSort](apetag.md#albumartistssort) -- [albumSort](apetag.md#albumsort) -- [amazonId](apetag.md#amazonid) -- [beatsPerMinute](apetag.md#beatsperminute) -- [comment](apetag.md#comment) -- [composers](apetag.md#composers) -- [composersSort](apetag.md#composerssort) -- [conductor](apetag.md#conductor) -- [copyright](apetag.md#copyright) -- [dateTagged](apetag.md#datetagged) -- [description](apetag.md#description) -- [disc](apetag.md#disc) -- [discCount](apetag.md#disccount) -- [firstAlbumArtist](apetag.md#firstalbumartist) -- [firstAlbumArtistSort](apetag.md#firstalbumartistsort) -- [firstComposer](apetag.md#firstcomposer) -- [firstComposerSort](apetag.md#firstcomposersort) -- [firstGenre](apetag.md#firstgenre) -- [firstPerformer](apetag.md#firstperformer) -- [firstPerformerSort](apetag.md#firstperformersort) -- [genres](apetag.md#genres) -- [grouping](apetag.md#grouping) -- [initialKey](apetag.md#initialkey) -- [isEmpty](apetag.md#isempty) -- [isHeaderPresent](apetag.md#isheaderpresent) -- [isrc](apetag.md#isrc) -- [items](apetag.md#items) -- [joinedAlbumArtists](apetag.md#joinedalbumartists) -- [joinedComposers](apetag.md#joinedcomposers) -- [joinedGenres](apetag.md#joinedgenres) -- [joinedPerformers](apetag.md#joinedperformers) -- [joinedPerformersSort](apetag.md#joinedperformerssort) -- [lyrics](apetag.md#lyrics) -- [musicBrainzArtistId](apetag.md#musicbrainzartistid) -- [musicBrainzDiscId](apetag.md#musicbrainzdiscid) -- [musicBrainzReleaseArtistId](apetag.md#musicbrainzreleaseartistid) -- [musicBrainzReleaseCountry](apetag.md#musicbrainzreleasecountry) -- [musicBrainzReleaseGroupId](apetag.md#musicbrainzreleasegroupid) -- [musicBrainzReleaseId](apetag.md#musicbrainzreleaseid) -- [musicBrainzReleaseStatus](apetag.md#musicbrainzreleasestatus) -- [musicBrainzReleaseType](apetag.md#musicbrainzreleasetype) -- [musicBrainzTrackId](apetag.md#musicbrainztrackid) -- [musicIpId](apetag.md#musicipid) -- [performers](apetag.md#performers) -- [performersRole](apetag.md#performersrole) -- [performersSort](apetag.md#performerssort) -- [pictures](apetag.md#pictures) -- [publisher](apetag.md#publisher) -- [remixedBy](apetag.md#remixedby) -- [replayGainAlbumGain](apetag.md#replaygainalbumgain) -- [replayGainAlbumPeak](apetag.md#replaygainalbumpeak) -- [replayGainTrackGain](apetag.md#replaygaintrackgain) -- [replayGainTrackPeak](apetag.md#replaygaintrackpeak) -- [sizeOnDisk](apetag.md#sizeondisk) -- [subtitle](apetag.md#subtitle) -- [tagTypes](apetag.md#tagtypes) -- [title](apetag.md#title) -- [titleSort](apetag.md#titlesort) -- [track](apetag.md#track) -- [trackCount](apetag.md#trackcount) -- [year](apetag.md#year) +- [album](ApeTag.md#album) +- [albumArtists](ApeTag.md#albumartists) +- [albumArtistsSort](ApeTag.md#albumartistssort) +- [albumSort](ApeTag.md#albumsort) +- [amazonId](ApeTag.md#amazonid) +- [beatsPerMinute](ApeTag.md#beatsperminute) +- [comment](ApeTag.md#comment) +- [composers](ApeTag.md#composers) +- [composersSort](ApeTag.md#composerssort) +- [conductor](ApeTag.md#conductor) +- [copyright](ApeTag.md#copyright) +- [dateTagged](ApeTag.md#datetagged) +- [description](ApeTag.md#description) +- [disc](ApeTag.md#disc) +- [discCount](ApeTag.md#disccount) +- [firstAlbumArtist](ApeTag.md#firstalbumartist) +- [firstAlbumArtistSort](ApeTag.md#firstalbumartistsort) +- [firstComposer](ApeTag.md#firstcomposer) +- [firstComposerSort](ApeTag.md#firstcomposersort) +- [firstGenre](ApeTag.md#firstgenre) +- [firstPerformer](ApeTag.md#firstperformer) +- [firstPerformerSort](ApeTag.md#firstperformersort) +- [genres](ApeTag.md#genres) +- [grouping](ApeTag.md#grouping) +- [initialKey](ApeTag.md#initialkey) +- [isCompilation](ApeTag.md#iscompilation) +- [isEmpty](ApeTag.md#isempty) +- [isHeaderPresent](ApeTag.md#isheaderpresent) +- [isrc](ApeTag.md#isrc) +- [items](ApeTag.md#items) +- [joinedAlbumArtists](ApeTag.md#joinedalbumartists) +- [joinedComposers](ApeTag.md#joinedcomposers) +- [joinedGenres](ApeTag.md#joinedgenres) +- [joinedPerformers](ApeTag.md#joinedperformers) +- [joinedPerformersSort](ApeTag.md#joinedperformerssort) +- [lyrics](ApeTag.md#lyrics) +- [musicBrainzArtistId](ApeTag.md#musicbrainzartistid) +- [musicBrainzDiscId](ApeTag.md#musicbrainzdiscid) +- [musicBrainzReleaseArtistId](ApeTag.md#musicbrainzreleaseartistid) +- [musicBrainzReleaseCountry](ApeTag.md#musicbrainzreleasecountry) +- [musicBrainzReleaseGroupId](ApeTag.md#musicbrainzreleasegroupid) +- [musicBrainzReleaseId](ApeTag.md#musicbrainzreleaseid) +- [musicBrainzReleaseStatus](ApeTag.md#musicbrainzreleasestatus) +- [musicBrainzReleaseType](ApeTag.md#musicbrainzreleasetype) +- [musicBrainzTrackId](ApeTag.md#musicbrainztrackid) +- [musicIpId](ApeTag.md#musicipid) +- [performers](ApeTag.md#performers) +- [performersRole](ApeTag.md#performersrole) +- [performersSort](ApeTag.md#performerssort) +- [pictures](ApeTag.md#pictures) +- [publisher](ApeTag.md#publisher) +- [remixedBy](ApeTag.md#remixedby) +- [replayGainAlbumGain](ApeTag.md#replaygainalbumgain) +- [replayGainAlbumPeak](ApeTag.md#replaygainalbumpeak) +- [replayGainTrackGain](ApeTag.md#replaygaintrackgain) +- [replayGainTrackPeak](ApeTag.md#replaygaintrackpeak) +- [sizeOnDisk](ApeTag.md#sizeondisk) +- [subtitle](ApeTag.md#subtitle) +- [tagTypes](ApeTag.md#tagtypes) +- [title](ApeTag.md#title) +- [titleSort](ApeTag.md#titlesort) +- [track](ApeTag.md#track) +- [trackCount](ApeTag.md#trackcount) +- [year](ApeTag.md#year) ### Methods -- [appendStringValue](apetag.md#appendstringvalue) -- [appendStringValues](apetag.md#appendstringvalues) -- [clear](apetag.md#clear) -- [copyTo](apetag.md#copyto) -- [getItem](apetag.md#getitem) -- [hasItem](apetag.md#hasitem) -- [removeItem](apetag.md#removeitem) -- [render](apetag.md#render) -- [setInfoTag](apetag.md#setinfotag) -- [setItem](apetag.md#setitem) -- [setNumericValue](apetag.md#setnumericvalue) -- [setStringValue](apetag.md#setstringvalue) -- [setStringValues](apetag.md#setstringvalues) -- [firstInGroup](apetag.md#firstingroup) -- [fromData](apetag.md#fromdata) -- [fromEmpty](apetag.md#fromempty) -- [fromFile](apetag.md#fromfile) -- [isFalsyOrLikeEmpty](apetag.md#isfalsyorlikeempty) -- [joinGroup](apetag.md#joingroup) -- [tagTypeFlagsToArray](apetag.md#tagtypeflagstoarray) +- [appendStringValue](ApeTag.md#appendstringvalue) +- [appendStringValues](ApeTag.md#appendstringvalues) +- [clear](ApeTag.md#clear) +- [copyTo](ApeTag.md#copyto) +- [getItem](ApeTag.md#getitem) +- [hasItem](ApeTag.md#hasitem) +- [removeItem](ApeTag.md#removeitem) +- [render](ApeTag.md#render) +- [setInfoTag](ApeTag.md#setinfotag) +- [setItem](ApeTag.md#setitem) +- [setNumericValue](ApeTag.md#setnumericvalue) +- [setStringValue](ApeTag.md#setstringvalue) +- [setStringValues](ApeTag.md#setstringvalues) +- [firstInGroup](ApeTag.md#firstingroup) +- [fromData](ApeTag.md#fromdata) +- [fromEmpty](ApeTag.md#fromempty) +- [fromFile](ApeTag.md#fromfile) +- [isFalsyOrLikeEmpty](ApeTag.md#isfalsyorlikeempty) +- [joinGroup](ApeTag.md#joingroup) +- [tagTypeFlagsToArray](ApeTag.md#tagtypeflagstoarray) ## Accessors @@ -107,22 +108,17 @@ Provides a representation of an APEv2 tag which can be read from and written to • `get` **album**(): `string` -Gets the album of the media represented by the current instance. For video media, this -represents the collection the video belongs to. - **`inheritdoc`** Album item #### Returns `string` -Album of the media represented by the current instance or `undefined` if no value - is present +#### Overrides -• `set` **album**(`value`): `void` +Tag.album -Gets the album of the media represented by the current instance. For video media, this -represents the collection the video belongs to. +• `set` **album**(`value`): `void` **`inheritdoc`** Album item @@ -136,8 +132,9 @@ represents the collection the video belongs to. `void` -Album of the media represented by the current instance or `undefined` if no value - is present +#### Overrides + +Tag.album ___ @@ -145,9 +142,6 @@ ___ • `get` **albumArtists**(): `string`[] -Gets the band or artist who is credited credited in the creation of the entire album or -collection containing the media described by the current instance. - **`inheritdoc`** This property is implemented using the "Album Artist" item and "AlbumArtist" as a backup if it exists. @@ -156,14 +150,11 @@ it exists. `string`[] -Band or artist credited with the creation of the entire album or collection - containing the media described by the current instance or an empty array if no value is - present +#### Overrides -• `set` **albumArtists**(`value`): `void` +Tag.albumArtists -Gets the band or artist who is credited credited in the creation of the entire album or -collection containing the media described by the current instance. +• `set` **albumArtists**(`value`): `void` **`inheritdoc`** Will be stored in "Album Artist" primarily. If "AlbumArtist" exists, value will also be @@ -179,9 +170,9 @@ stored there for compatibility. `void` -Band or artist credited with the creation of the entire album or collection - containing the media described by the current instance or an empty array if no value is - present +#### Overrides + +Tag.albumArtists ___ @@ -189,24 +180,18 @@ ___ • `get` **albumArtistsSort**(): `string`[] -Gets the sortable names of the bands/artists who are credited with creating the entire -album or collection containing the media described by the current instance. - **`inheritdoc`** AlbumArtistSort item #### Returns `string`[] -Sortable names for the bands/artists are credited with the creation of the entire - album or collection containing the media described by the current instance, or an empty - array if no value is present. +#### Overrides + +Tag.albumArtistsSort • `set` **albumArtistsSort**(`value`): `void` -Gets the sortable names of the bands/artists who are credited with creating the entire -album or collection containing the media described by the current instance. - **`inheritdoc`** AlbumArtistSort item #### Parameters @@ -219,9 +204,9 @@ album or collection containing the media described by the current instance. `void` -Sortable names for the bands/artists are credited with the creation of the entire - album or collection containing the media described by the current instance, or an empty - array if no value is present. +#### Overrides + +Tag.albumArtistsSort ___ @@ -229,20 +214,17 @@ ___ • `get` **albumSort**(): `string` -Gets the sortable name of the album title of the media represented by the current instance. - **`inheritdoc`** AlbumSort item #### Returns `string` -Sortable name for the album title of the media or `undefined` if the value is not - present +#### Overrides -• `set` **albumSort**(`value`): `void` +Tag.albumSort -Gets the sortable name of the album title of the media represented by the current instance. +• `set` **albumSort**(`value`): `void` **`inheritdoc`** AlbumSort item @@ -256,8 +238,9 @@ Gets the sortable name of the album title of the media represented by the curren `void` -Sortable name for the album title of the media or `undefined` if the value is not - present +#### Overrides + +Tag.albumSort ___ @@ -265,20 +248,17 @@ ___ • `get` **amazonId**(): `string` -Gets the Amazon ID of the media represented by the current instance. - **`inheritdoc`** ASIN item #### Returns `string` -Amazon ID of the media represented by the current instance or `undefined` if no - value is present +#### Overrides -• `set` **amazonId**(`value`): `void` +Tag.amazonId -Gets the Amazon ID of the media represented by the current instance. +• `set` **amazonId**(`value`): `void` **`inheritdoc`** ASIN item @@ -292,8 +272,9 @@ Gets the Amazon ID of the media represented by the current instance. `void` -Amazon ID of the media represented by the current instance or `undefined` if no - value is present +#### Overrides + +Tag.amazonId ___ @@ -301,22 +282,17 @@ ___ • `get` **beatsPerMinute**(): `number` -Gets the number of beats per minute in the audio of the media represented by the current -instance. - **`inheritdoc`** BPM item #### Returns `number` -Beats per minute of the audio in the media represented by the current instance, or - `0` if not specified +#### Overrides -• `set` **beatsPerMinute**(`value`): `void` +Tag.beatsPerMinute -Gets the number of beats per minute in the audio of the media represented by the current -instance. +• `set` **beatsPerMinute**(`value`): `void` **`inheritdoc`** BPM item @@ -330,8 +306,9 @@ instance. `void` -Beats per minute of the audio in the media represented by the current instance, or - `0` if not specified +#### Overrides + +Tag.beatsPerMinute ___ @@ -339,20 +316,17 @@ ___ • `get` **comment**(): `string` -Gets a user comment on the media represented by the current instance. - **`inheritdoc`** Comment item #### Returns `string` -User comments on the media represented by the current instance or `undefined` if - the value is not present +#### Overrides -• `set` **comment**(`value`): `void` +Tag.comment -Gets a user comment on the media represented by the current instance. +• `set` **comment**(`value`): `void` **`inheritdoc`** Comment item @@ -366,8 +340,9 @@ Gets a user comment on the media represented by the current instance. `void` -User comments on the media represented by the current instance or `undefined` if - the value is not present +#### Overrides + +Tag.comment ___ @@ -375,20 +350,17 @@ ___ • `get` **composers**(): `string`[] -Gets the composers of the media represented by the current instance. - **`inheritdoc`** Composer item #### Returns `string`[] -Composers of the media represented by the current instance of an empty array if no - value is present. +#### Overrides -• `set` **composers**(`value`): `void` +Tag.composers -Gets the composers of the media represented by the current instance. +• `set` **composers**(`value`): `void` **`inheritdoc`** Composer item @@ -402,8 +374,9 @@ Gets the composers of the media represented by the current instance. `void` -Composers of the media represented by the current instance of an empty array if no - value is present. +#### Overrides + +Tag.composers ___ @@ -411,20 +384,17 @@ ___ • `get` **composersSort**(): `string`[] -Gets the sortable names of the composers of the media represented by the current instance. - **`inheritdoc`** ComposerSort item #### Returns `string`[] -Sortable names for the composers of the media represented by the current instance - or an empty array if no value is present. +#### Overrides -• `set` **composersSort**(`value`): `void` +Tag.composersSort -Gets the sortable names of the composers of the media represented by the current instance. +• `set` **composersSort**(`value`): `void` **`inheritdoc`** ComposerSort @@ -438,8 +408,9 @@ Gets the sortable names of the composers of the media represented by the current `void` -Sortable names for the composers of the media represented by the current instance - or an empty array if no value is present. +#### Overrides + +Tag.composersSort ___ @@ -447,20 +418,17 @@ ___ • `get` **conductor**(): `string` -Gets the conductor or director of the media represented by the current instance. - **`inheritdoc`** Conductor item #### Returns `string` -Conductor or director of the media represented by the current instance or - `undefined` if no value present. +#### Overrides -• `set` **conductor**(`value`): `void` +Tag.conductor -Gets the conductor or director of the media represented by the current instance. +• `set` **conductor**(`value`): `void` **`inheritdoc`** Conductor item @@ -474,8 +442,9 @@ Gets the conductor or director of the media represented by the current instance. `void` -Conductor or director of the media represented by the current instance or - `undefined` if no value present. +#### Overrides + +Tag.conductor ___ @@ -483,20 +452,17 @@ ___ • `get` **copyright**(): `string` -Gets the copyright information for the media represented by the current instance. - **`inheritdoc`** Copyright item #### Returns `string` -Copyright information for the media represented by the current instance or - `undefined` if no value is present. +#### Overrides -• `set` **copyright**(`value`): `void` +Tag.copyright -Gets the copyright information for the media represented by the current instance. +• `set` **copyright**(`value`): `void` **`inheritdoc`** Copyright item @@ -510,8 +476,9 @@ Gets the copyright information for the media represented by the current instance `void` -Copyright information for the media represented by the current instance or - `undefined` if no value is present. +#### Overrides + +Tag.copyright ___ @@ -519,19 +486,17 @@ ___ • `get` **dateTagged**(): `Date` -Gets the date and time at which the tag has been written. - **`inheritdoc`** DateTagged item #### Returns `Date` -Date/time at which the tag has been written, or `undefined` if no value is present +#### Overrides -• `set` **dateTagged**(`value`): `void` +Tag.dateTagged -Gets the date and time at which the tag has been written. +• `set` **dateTagged**(`value`): `void` **`inheritdoc`** DateTagged item @@ -545,7 +510,9 @@ Gets the date and time at which the tag has been written. `void` -Date/time at which the tag has been written, or `undefined` if no value is present +#### Overrides + +Tag.dateTagged ___ @@ -553,24 +520,17 @@ ___ • `get` **description**(): `string` -Gets a short description of the media. For music, this could be the comment that the artist -made of his/her work. For a video, this should be a short summary of the story/plot, but -generally no spoliers. This should give the impression of what to expect in the media. - **`inheritdoc`** Description item #### Returns `string` -Description of the media represented by the current instance or `undefined` if no - value is present +#### Overrides -• `set` **description**(`value`): `void` +Tag.description -Gets a short description of the media. For music, this could be the comment that the artist -made of his/her work. For a video, this should be a short summary of the story/plot, but -generally no spoliers. This should give the impression of what to expect in the media. +• `set` **description**(`value`): `void` **`inheritdoc`** Description item @@ -584,8 +544,9 @@ generally no spoliers. This should give the impression of what to expect in the `void` -Description of the media represented by the current instance or `undefined` if no - value is present +#### Overrides + +Tag.description ___ @@ -593,22 +554,17 @@ ___ • `get` **disc**(): `number` -Gets the number of the disc containing the media represented by the current instance in the -boxed set. For a series, this represents the season number. - **`inheritdoc`** Disc item numerator #### Returns `number` -Number of the disc or season of the media represented by the current instance in a - boxed set. +#### Overrides -• `set` **disc**(`value`): `void` +Tag.disc -Gets the number of the disc containing the media represented by the current instance in the -boxed set. For a series, this represents the season number. +• `set` **disc**(`value`): `void` **`inheritdoc`** Disc item numerator @@ -622,8 +578,9 @@ boxed set. For a series, this represents the season number. `void` -Number of the disc or season of the media represented by the current instance in a - boxed set. +#### Overrides + +Tag.disc ___ @@ -631,22 +588,17 @@ ___ • `get` **discCount**(): `number` -Gets the number of discs or seasons in the boxed set containing the media represented by the -current instance. - **`inheritdoc`** Disc item denominator #### Returns `number` -Number of discs or seasons in the boxed set containing the media represented by the - current instance or `0` if not specified. +#### Overrides -• `set` **discCount**(`value`): `void` +Tag.discCount -Gets the number of discs or seasons in the boxed set containing the media represented by the -current instance. +• `set` **discCount**(`value`): `void` **`inheritdoc`** Disc item denominator @@ -660,8 +612,9 @@ current instance. `void` -Number of discs or seasons in the boxed set containing the media represented by the - current instance or `0` if not specified. +#### Overrides + +Tag.discCount ___ @@ -669,104 +622,129 @@ ___ • `get` **firstAlbumArtist**(): `string` -Gets the the first value contained in [albumArtists](apetag.md#albumartists). +Gets the first value contained in [albumArtists](ApeTag.md#albumartists). #### Returns `string` +#### Inherited from + +Tag.firstAlbumArtist + ___ ### firstAlbumArtistSort • `get` **firstAlbumArtistSort**(): `string` -Gets the first value contained in [albumArtistsSort](apetag.md#albumartistssort) +Gets the first value contained in [albumArtistsSort](ApeTag.md#albumartistssort) #### Returns `string` +#### Inherited from + +Tag.firstAlbumArtistSort + ___ ### firstComposer • `get` **firstComposer**(): `string` -Gets the first value contained in [composers](apetag.md#composers) +Gets the first value contained in [composers](ApeTag.md#composers) #### Returns `string` +#### Inherited from + +Tag.firstComposer + ___ ### firstComposerSort • `get` **firstComposerSort**(): `string` -Gets the first value contained in [composersSort](apetag.md#composerssort) +Gets the first value contained in [composersSort](ApeTag.md#composerssort) #### Returns `string` +#### Inherited from + +Tag.firstComposerSort + ___ ### firstGenre • `get` **firstGenre**(): `string` -Gets the first value contained in [genres](apetag.md#genres) +Gets the first value contained in [genres](ApeTag.md#genres) #### Returns `string` +#### Inherited from + +Tag.firstGenre + ___ ### firstPerformer • `get` **firstPerformer**(): `string` -Gets the first value contained in [performers](apetag.md#performers) +Gets the first value contained in [performers](ApeTag.md#performers) #### Returns `string` +#### Inherited from + +Tag.firstPerformer + ___ ### firstPerformerSort • `get` **firstPerformerSort**(): `string` -Gets the first value contained in [performersSort](apetag.md#performerssort) +Gets the first value contained in [performersSort](ApeTag.md#performerssort) #### Returns `string` +#### Inherited from + +Tag.firstPerformerSort + ___ ### genres • `get` **genres**(): `string`[] -Gets the genres of the media represented by the current instance. - **`inheritdoc`** Genre item #### Returns `string`[] -Genres of the media represented by the current instance or an empty array if no - value is present. +#### Overrides -• `set` **genres**(`value`): `void` +Tag.genres -Gets the genres of the media represented by the current instance. +• `set` **genres**(`value`): `void` **`inheritdoc`** Genre item @@ -780,8 +758,9 @@ Gets the genres of the media represented by the current instance. `void` -Genres of the media represented by the current instance or an empty array if no - value is present. +#### Overrides + +Tag.genres ___ @@ -789,20 +768,17 @@ ___ • `get` **grouping**(): `string` -Gets the grouping on the album which the media in the current instance belongs to. - **`inheritdoc`** Grouping item #### Returns `string` -Grouping on the album which the media in the current instance belongs to or - `undefined` if no value is present. +#### Overrides -• `set` **grouping**(`value`): `void` +Tag.grouping -Gets the grouping on the album which the media in the current instance belongs to. +• `set` **grouping**(`value`): `void` **`inheritdoc`** Grouping item @@ -816,8 +792,9 @@ Gets the grouping on the album which the media in the current instance belongs t `void` -Grouping on the album which the media in the current instance belongs to or - `undefined` if no value is present. +#### Overrides + +Tag.grouping ___ @@ -833,6 +810,10 @@ Gets the initial key of the track. Initial key of the track or `undefined` if no value is set +#### Inherited from + +Tag.initialKey + • `set` **initialKey**(`value`): `void` Sets the initial key of the track. @@ -849,21 +830,59 @@ Sets the initial key of the track. Initial key of the track or `undefined` if no value is set +#### Inherited from + +Tag.initialKey + +___ + +### isCompilation + +• `get` **isCompilation**(): `boolean` + +Gets whether or not the album described by the current instance is a compilation. + +#### Returns + +`boolean` + +#### Inherited from + +Tag.isCompilation + +• `set` **isCompilation**(`value`): `void` + +Gets whether or not the album described by the current instance is a compilation. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | `boolean` | Whether or not the album described by the current instance is a compilation | + +#### Returns + +`void` + +#### Inherited from + +Tag.isCompilation + ___ ### isEmpty • `get` **isEmpty**(): `boolean` -Gets whether or not the current instance is empty. - **`inheritdoc`** #### Returns `boolean` -`true` if the current instance does not contain any values. `false` otherwise +#### Overrides + +Tag.isEmpty ___ @@ -905,6 +924,10 @@ Gets the ISRC (International Standard Recording Code) of the track. the ISRC of the track or `undefined` if no value is set +#### Inherited from + +Tag.isrc + • `set` **isrc**(`value`): `void` Sets the ISRC (International Standard Recording Code) of the track. @@ -921,6 +944,10 @@ Sets the ISRC (International Standard Recording Code) of the track. the ISRC of the track or `undefined` if no value is set +#### Inherited from + +Tag.isrc + ___ ### items @@ -939,80 +966,97 @@ ___ • `get` **joinedAlbumArtists**(): `string` -Gets a semicolon and space separated string containing the values in [albumArtists](apetag.md#albumartists) +Gets a semicolon and space separated string containing the values in [albumArtists](ApeTag.md#albumartists) #### Returns `string` +#### Inherited from + +Tag.joinedAlbumArtists + ___ ### joinedComposers • `get` **joinedComposers**(): `string` -Gets a semicolon and space separated string containing the values in [composers](apetag.md#composers) +Gets a semicolon and space separated string containing the values in [composers](ApeTag.md#composers) #### Returns `string` +#### Inherited from + +Tag.joinedComposers + ___ ### joinedGenres • `get` **joinedGenres**(): `string` -Gets a semicolon and space separated string containing the values in [genres](apetag.md#genres) +Gets a semicolon and space separated string containing the values in [genres](ApeTag.md#genres) #### Returns `string` +#### Inherited from + +Tag.joinedGenres + ___ ### joinedPerformers • `get` **joinedPerformers**(): `string` -Gets a semicolon and space separated string containing the values in [performers](apetag.md#performers) +Gets a semicolon and space separated string containing the values in [performers](ApeTag.md#performers) #### Returns `string` +#### Inherited from + +Tag.joinedPerformers + ___ ### joinedPerformersSort • `get` **joinedPerformersSort**(): `string` -Gets a semicolon and space separated string containing the values in [performersSort](apetag.md#performerssort) +Gets a semicolon and space separated string containing the values in [performersSort](ApeTag.md#performerssort) #### Returns `string` +#### Inherited from + +Tag.joinedPerformersSort + ___ ### lyrics • `get` **lyrics**(): `string` -Gets the lyrics or script of the media represented by the current instance. - **`inheritdoc`** Lyrics item #### Returns `string` -Lyrics or script of the media represented by the current instance or `undefined` if - no value is present +#### Overrides -• `set` **lyrics**(`value`): `void` +Tag.lyrics -Gets the lyrics or script of the media represented by the current instance. +• `set` **lyrics**(`value`): `void` **`inheritdoc`** Lyrics item @@ -1026,8 +1070,9 @@ Gets the lyrics or script of the media represented by the current instance. `void` -Lyrics or script of the media represented by the current instance or `undefined` if - no value is present +#### Overrides + +Tag.lyrics ___ @@ -1035,20 +1080,17 @@ ___ • `get` **musicBrainzArtistId**(): `string` -Gets the MusicBrainz artist ID of the media represented by the current instance. - **`inheritdoc`** MUSICBRAINZ_ARTISTID item #### Returns `string` -MusicBrainz ArtistID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides -• `set` **musicBrainzArtistId**(`value`): `void` +Tag.musicBrainzArtistId -Gets the MusicBrainz artist ID of the media represented by the current instance. +• `set` **musicBrainzArtistId**(`value`): `void` **`inheritdoc`** MUSICBRAINZ_ARTISTID item @@ -1062,8 +1104,9 @@ Gets the MusicBrainz artist ID of the media represented by the current instance. `void` -MusicBrainz ArtistID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzArtistId ___ @@ -1071,20 +1114,17 @@ ___ • `get` **musicBrainzDiscId**(): `string` -Gets the MusicBrainz disc ID of the media represented by the current instance. - **`inheritdoc`** MUSICBRAINZ_DISCID item #### Returns `string` -MusicBrainz DiscID of the media represented by the current instance or `undefined` - if no value is present +#### Overrides -• `set` **musicBrainzDiscId**(`value`): `void` +Tag.musicBrainzDiscId -Gets the MusicBrainz disc ID of the media represented by the current instance. +• `set` **musicBrainzDiscId**(`value`): `void` **`inheritdoc`** MUSICBRAINZ_DISCID item @@ -1098,8 +1138,9 @@ Gets the MusicBrainz disc ID of the media represented by the current instance. `void` -MusicBrainz DiscID of the media represented by the current instance or `undefined` - if no value is present +#### Overrides + +Tag.musicBrainzDiscId ___ @@ -1107,21 +1148,18 @@ ___ • `get` **musicBrainzReleaseArtistId**(): `string` -Gets the MusicBrainz release artist ID of the media represented by the current instance. - **`inheritdoc`** MUSICBRAINZ_ARTISTID item #### Returns `string` -MusicBrainz ReleaseArtistID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzReleaseArtistId • `set` **musicBrainzReleaseArtistId**(`value`): `void` -Gets the MusicBrainz release artist ID of the media represented by the current instance. - **`inheritdoc`** MUSICBRAINZ_ARTISTID item #### Parameters @@ -1134,8 +1172,9 @@ Gets the MusicBrainz release artist ID of the media represented by the current i `void` -MusicBrainz ReleaseArtistID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzReleaseArtistId ___ @@ -1143,20 +1182,17 @@ ___ • `get` **musicBrainzReleaseCountry**(): `string` -Gets the MusicBrainz release country of the media represented by the current instance. - **`inheritdoc`** RELEASECOUNTRY item #### Returns `string` -MusicBrainz ReleaseCountry of the media represented by the current instance or - `undefined` if no value is present +#### Overrides -• `set` **musicBrainzReleaseCountry**(`value`): `void` +Tag.musicBrainzReleaseCountry -Gets the MusicBrainz release country of the media represented by the current instance. +• `set` **musicBrainzReleaseCountry**(`value`): `void` **`inheritdoc`** RELEASECOUNTRY item @@ -1170,8 +1206,9 @@ Gets the MusicBrainz release country of the media represented by the current ins `void` -MusicBrainz ReleaseCountry of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzReleaseCountry ___ @@ -1179,20 +1216,17 @@ ___ • `get` **musicBrainzReleaseGroupId**(): `string` -Gets the MusicBrainz release group ID of the media represented by the current instance. - **`inheritdoc`** MUSICBRAINZ_RELEASEGROUPID item #### Returns `string` -MusicBrainz ReleaseGroupID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides -• `set` **musicBrainzReleaseGroupId**(`value`): `void` +Tag.musicBrainzReleaseGroupId -Gets the MusicBrainz release group ID of the media represented by the current instance. +• `set` **musicBrainzReleaseGroupId**(`value`): `void` **`inheritdoc`** MUSICBRAINZ_RELEASEGROUPID item @@ -1206,8 +1240,9 @@ Gets the MusicBrainz release group ID of the media represented by the current in `void` -MusicBrainz ReleaseGroupID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzReleaseGroupId ___ @@ -1215,20 +1250,17 @@ ___ • `get` **musicBrainzReleaseId**(): `string` -Gets the MusicBrainz release ID of the media represented by the current instance. - **`inheritdoc`** MUSICBRAINZ_ALBUMID item #### Returns `string` -MusicBrainz ReleaseID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides -• `set` **musicBrainzReleaseId**(`value`): `void` +Tag.musicBrainzReleaseId -Gets the MusicBrainz release ID of the media represented by the current instance. +• `set` **musicBrainzReleaseId**(`value`): `void` **`inheritdoc`** MUSICBRAINZ_ALBUMID item @@ -1242,8 +1274,9 @@ Gets the MusicBrainz release ID of the media represented by the current instance `void` -MusicBrainz ReleaseID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzReleaseId ___ @@ -1251,20 +1284,17 @@ ___ • `get` **musicBrainzReleaseStatus**(): `string` -Gets the MusicBrainz release status of the media represented by the current instance. - **`inheritdoc`** MUSICBRAINZ_ALBUMSTATUS item #### Returns `string` -MusicBrainz ReleaseStatus of the media represented by the current instance or - `undefined` if no value is present +#### Overrides -• `set` **musicBrainzReleaseStatus**(`value`): `void` +Tag.musicBrainzReleaseStatus -Gets the MusicBrainz release status of the media represented by the current instance. +• `set` **musicBrainzReleaseStatus**(`value`): `void` **`inheritdoc`** MUSICBRAINZ_ALBUMSTATUS item @@ -1278,8 +1308,9 @@ Gets the MusicBrainz release status of the media represented by the current inst `void` -MusicBrainz ReleaseStatus of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzReleaseStatus ___ @@ -1287,21 +1318,18 @@ ___ • `get` **musicBrainzReleaseType**(): `string` -Gets the MusicBrainz release type of the media represented by the current instance. - **`inheritdoc`** MUSICBRAINZ_ALBUMTYPE item #### Returns `string` -MusicBrainz ReleaseType of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzReleaseType • `set` **musicBrainzReleaseType**(`value`): `void` -Gets the MusicBrainz release type of the media represented by the current instance. - **`inheritdoc`** MUSICBRAINZ_ALBUMTYPE item #### Parameters @@ -1314,8 +1342,9 @@ Gets the MusicBrainz release type of the media represented by the current instan `void` -MusicBrainz ReleaseType of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzReleaseType ___ @@ -1323,22 +1352,17 @@ ___ • `get` **musicBrainzTrackId**(): `string` -Gets the MusicBrainz track ID of the media represented by the media represented by the -current instance. - **`inheritdoc`** MUSICBRAINZ_TRACKID item #### Returns `string` -MusicBrainz TrackID of the media represented by the current instance or `undefined` - if no value is present +#### Overrides -• `set` **musicBrainzTrackId**(`value`): `void` +Tag.musicBrainzTrackId -Gets the MusicBrainz track ID of the media represented by the media represented by the -current instance. +• `set` **musicBrainzTrackId**(`value`): `void` **`inheritdoc`** MUSICBRAINZ_TRACKID item @@ -1352,8 +1376,9 @@ current instance. `void` -MusicBrainz TrackID of the media represented by the current instance or `undefined` - if no value is present +#### Overrides + +Tag.musicBrainzTrackId ___ @@ -1361,20 +1386,17 @@ ___ • `get` **musicIpId**(): `string` -Gets the MusicIP PUID of the media represented by the current instance. - **`inheritdoc`** MUSICIP_PUID item #### Returns `string` -MusicIP PUID of the media represented by the current instance or `undefined` if no - value is present +#### Overrides -• `set` **musicIpId**(`value`): `void` +Tag.musicIpId -Gets the MusicIP PUID of the media represented by the current instance. +• `set` **musicIpId**(`value`): `void` **`inheritdoc`** MUSICIP_PUID item @@ -1388,8 +1410,9 @@ Gets the MusicIP PUID of the media represented by the current instance. `void` -MusicIP PUID of the media represented by the current instance or `undefined` if no - value is present +#### Overrides + +Tag.musicIpId ___ @@ -1397,20 +1420,17 @@ ___ • `get` **performers**(): `string`[] -Gets the performers or artists who performed in the media described by the current instance. - **`inheritdoc`** Artist item #### Returns `string`[] -Performers who performed in the media described by the current instance or an empty - array if no value is present. +#### Overrides -• `set` **performers**(`value`): `void` +Tag.performers -Gets the performers or artists who performed in the media described by the current instance. +• `set` **performers**(`value`): `void` **`inheritdoc`** Artist item @@ -1424,8 +1444,9 @@ Gets the performers or artists who performed in the media described by the curre `void` -Performers who performed in the media described by the current instance or an empty - array if no value is present. +#### Overrides + +Tag.performers ___ @@ -1433,26 +1454,17 @@ ___ • `get` **performersRole**(): `string`[] -Gets the characters portrayed by an actor for a video or instruments played by a musician -for music. This must match the [performers](apetag.md#performers) array (for each person, correspond one/more -role). Several roles for the same artist/actor can be separated with semicolons. For -example: "Bass; Backing Vocals; Vibraphone". - **`inheritdoc`** PerformersRole item #### Returns `string`[] -Array containing the roles played by the performers in the media described by the - current instance, or an empty array if no value is present. +#### Overrides -• `set` **performersRole**(`value`): `void` +Tag.performersRole -Gets the characters portrayed by an actor for a video or instruments played by a musician -for music. This must match the [performers](apetag.md#performers) array (for each person, correspond one/more -role). Several roles for the same artist/actor can be separated with semicolons. For -example: "Bass; Backing Vocals; Vibraphone". +• `set` **performersRole**(`value`): `void` **`inheritdoc`** PerformersRole item @@ -1466,8 +1478,9 @@ example: "Bass; Backing Vocals; Vibraphone". `void` -Array containing the roles played by the performers in the media described by the - current instance, or an empty array if no value is present. +#### Overrides + +Tag.performersRole ___ @@ -1475,22 +1488,17 @@ ___ • `get` **performersSort**(): `string`[] -Gets the sortable names of the performers or artists who performed in the media described by -the current instance. - **`inheritdoc`** ArtistSort item #### Returns `string`[] -Sortable names for the performers who performed in the media described by the - current instance, or an empty array if no value is present. +#### Overrides -• `set` **performersSort**(`value`): `void` +Tag.performersSort -Gets the sortable names of the performers or artists who performed in the media described by -the current instance. +• `set` **performersSort**(`value`): `void` **`inheritdoc`** ArtistSort item @@ -1504,29 +1512,27 @@ the current instance. `void` -Sortable names for the performers who performed in the media described by the - current instance, or an empty array if no value is present. +#### Overrides + +Tag.performersSort ___ ### pictures -• `get` **pictures**(): [`IPicture`](../interfaces/ipicture.md)[] - -Gets a collection of pictures associated with the media represented by the current instance. +• `get` **pictures**(): [`IPicture`](../interfaces/IPicture.md)[] **`inheritdoc`** Cover Art items #### Returns -[`IPicture`](../interfaces/ipicture.md)[] +[`IPicture`](../interfaces/IPicture.md)[] -Array containing a collection of pictures associated with the media represented by - the current instance or an empty array if no pictures are present. +#### Overrides -• `set` **pictures**(`value`): `void` +Tag.pictures -Gets a collection of pictures associated with the media represented by the current instance. +• `set` **pictures**(`value`): `void` **`inheritdoc`** Cover Art items @@ -1534,14 +1540,15 @@ Gets a collection of pictures associated with the media represented by the curre | Name | Type | | :------ | :------ | -| `value` | [`IPicture`](../interfaces/ipicture.md)[] | +| `value` | [`IPicture`](../interfaces/IPicture.md)[] | #### Returns `void` -Array containing a collection of pictures associated with the media represented by - the current instance or an empty array if no pictures are present. +#### Overrides + +Tag.pictures ___ @@ -1557,6 +1564,10 @@ Gets the publisher of the track. Publisher of the track or `undefined` if no value is set +#### Inherited from + +Tag.publisher + • `set` **publisher**(`value`): `void` Sets the publisher of the track. @@ -1573,6 +1584,10 @@ Sets the publisher of the track. Publisher of the track or `undefined` if no value is set +#### Inherited from + +Tag.publisher + ___ ### remixedBy @@ -1587,6 +1602,10 @@ Gets the remixer of the track. Remixer of the track or `undefined` if no value is set +#### Inherited from + +Tag.remixedBy + • `set` **remixedBy**(`value`): `void` Sets the remixer of the track. @@ -1603,26 +1622,28 @@ Sets the remixer of the track. Remixer of the track or `undefined` if no value is set +#### Inherited from + +Tag.remixedBy + ___ ### replayGainAlbumGain • `get` **replayGainAlbumGain**(): `number` -Gets the ReplayGain album gain in dB. - **`inheritdoc`** REPLAYGAIN_ALBUM_GAIN item #### Returns `number` -Album gain as per the ReplayGain specifications, in dB, or `NaN` if no value is set +#### Overrides + +Tag.replayGainAlbumGain • `set` **replayGainAlbumGain**(`value`): `void` -Gets the ReplayGain album gain in dB. - **`inheritdoc`** REPLAYGAIN_ALBUM_GAIN item #### Parameters @@ -1635,7 +1656,9 @@ Gets the ReplayGain album gain in dB. `void` -Album gain as per the ReplayGain specifications, in dB, or `NaN` if no value is set +#### Overrides + +Tag.replayGainAlbumGain ___ @@ -1643,19 +1666,17 @@ ___ • `get` **replayGainAlbumPeak**(): `number` -Gets the ReplayGain album peak sample. - **`inheritdoc`** REPLAYGAIN_ALBUM_PEAK item #### Returns `number` -Album peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Overrides -• `set` **replayGainAlbumPeak**(`value`): `void` +Tag.replayGainAlbumPeak -Gets the ReplayGain album peak sample. +• `set` **replayGainAlbumPeak**(`value`): `void` **`inheritdoc`** REPLAYGAIN_ALBUM_PEAK item @@ -1669,7 +1690,9 @@ Gets the ReplayGain album peak sample. `void` -Album peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Overrides + +Tag.replayGainAlbumPeak ___ @@ -1677,19 +1700,17 @@ ___ • `get` **replayGainTrackGain**(): `number` -Gets the ReplayGain track gain in dB. - **`inheritdoc`** REPLAYGAIN_TRACK_GAIN item #### Returns `number` -Track gain as per ReplayGain specifications, in dB, or `NaN` if no value is set +#### Overrides -• `set` **replayGainTrackGain**(`value`): `void` +Tag.replayGainTrackGain -Gets the ReplayGain track gain in dB. +• `set` **replayGainTrackGain**(`value`): `void` **`inheritdoc`** REPLAYGAIN_TRACK_GAIN item @@ -1703,7 +1724,9 @@ Gets the ReplayGain track gain in dB. `void` -Track gain as per ReplayGain specifications, in dB, or `NaN` if no value is set +#### Overrides + +Tag.replayGainTrackGain ___ @@ -1711,19 +1734,17 @@ ___ • `get` **replayGainTrackPeak**(): `number` -Gets the ReplayGain track peak sample. - **`inheritdoc`** REPLAYGAIN_TRACK_PEAK item #### Returns `number` -Track peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Overrides -• `set` **replayGainTrackPeak**(`value`): `void` +Tag.replayGainTrackPeak -Gets the ReplayGain track peak sample. +• `set` **replayGainTrackPeak**(`value`): `void` **`inheritdoc`** REPLAYGAIN_TRACK_PEAK item @@ -1737,7 +1758,9 @@ Gets the ReplayGain track peak sample. `void` -Track peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Overrides + +Tag.replayGainTrackPeak ___ @@ -1745,34 +1768,33 @@ ___ • `get` **sizeOnDisk**(): `number` -Gets the size of the tag in bytes on disk as it was read from disk. - **`inheritdoc`** #### Returns `number` +#### Overrides + +Tag.sizeOnDisk + ___ ### subtitle • `get` **subtitle**(): `string` -Gets a description, one-line. It represents the tagline of the vide/music. - **`inheritdoc`** Subtitle item #### Returns `string` -Subtitle of the media represented by the current instance or `undefined` if no - value is present +#### Overrides -• `set` **subtitle**(`value`): `void` +Tag.subtitle -Gets a description, one-line. It represents the tagline of the vide/music. +• `set` **subtitle**(`value`): `void` **`inheritdoc`** Subtitle @@ -1786,23 +1808,28 @@ Gets a description, one-line. It represents the tagline of the vide/music. `void` -Subtitle of the media represented by the current instance or `undefined` if no - value is present +#### Overrides + +Tag.subtitle ___ ### tagTypes -• `get` **tagTypes**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypes**(): [`TagTypes`](../enums/TagTypes.md) -Gets the tag types contained in the current instance. A bit wise combined [TagTypes](../enums/tagtypes.md) +Gets the tag types contained in the current instance. A bit wise combined [TagTypes](../enums/TagTypes.md) containing the tag types contained in the current instance. **`inheritdoc`** #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) + +#### Overrides + +Tag.tagTypes ___ @@ -1810,20 +1837,17 @@ ___ • `get` **title**(): `string` -Gets the title for the media described by the current instance. - **`inheritdoc`** Title item #### Returns `string` -Title of the media described by the current instance or `undefined` if no value is - present. +#### Overrides -• `set` **title**(`value`): `void` +Tag.title -Gets the title for the media described by the current instance. +• `set` **title**(`value`): `void` **`inheritdoc`** Title item @@ -1837,8 +1861,9 @@ Gets the title for the media described by the current instance. `void` -Title of the media described by the current instance or `undefined` if no value is - present. +#### Overrides + +Tag.title ___ @@ -1846,20 +1871,17 @@ ___ • `get` **titleSort**(): `string` -Gets the sortable name for the title of the media described by the current instance. - **`inheritdoc`** TitleSort item #### Returns `string` -Sortable name of the media described by the current instance or `undefined` if no - value is present +#### Overrides -• `set` **titleSort**(`value`): `void` +Tag.titleSort -Gets the sortable name for the title of the media described by the current instance. +• `set` **titleSort**(`value`): `void` **`inheritdoc`** TitleSort item @@ -1873,8 +1895,9 @@ Gets the sortable name for the title of the media described by the current insta `void` -Sortable name of the media described by the current instance or `undefined` if no - value is present +#### Overrides + +Tag.titleSort ___ @@ -1882,22 +1905,17 @@ ___ • `get` **track**(): `number` -Gets the position of the media represented by the current instance in its containing album -or season (for a series). - **`inheritdoc`** Track item numerator #### Returns `number` -Position of the media represented by the current instance in its containing album - or `0` if not specified. +#### Overrides -• `set` **track**(`value`): `void` +Tag.track -Gets the position of the media represented by the current instance in its containing album -or season (for a series). +• `set` **track**(`value`): `void` **`inheritdoc`** Track item numerator @@ -1911,8 +1929,9 @@ or season (for a series). `void` -Position of the media represented by the current instance in its containing album - or `0` if not specified. +#### Overrides + +Tag.track ___ @@ -1920,22 +1939,17 @@ ___ • `get` **trackCount**(): `number` -Gets the number of tracks in the album or the number of episodes in a series of the media -represented by the current instance. - **`inheritdoc`** Track item denominator #### Returns `number` -Number of tracks in the album or number of episodes in a series of the media - represented by the current instance or `0` if not specified. +#### Overrides -• `set` **trackCount**(`value`): `void` +Tag.trackCount -Gets the number of tracks in the album or the number of episodes in a series of the media -represented by the current instance. +• `set` **trackCount**(`value`): `void` **`inheritdoc`** Track item denominator @@ -1949,8 +1963,9 @@ represented by the current instance. `void` -Number of tracks in the album or number of episodes in a series of the media - represented by the current instance or `0` if not specified. +#### Overrides + +Tag.trackCount ___ @@ -1958,20 +1973,17 @@ ___ • `get` **year**(): `number` -Gets the year that the media represented by the current instance was recorded. - **`inheritdoc`** Year item #### Returns `number` -Year that the media represented by the current instance was created or `0` if no - value is present. +#### Overrides -• `set` **year**(`value`): `void` +Tag.year -Gets the year that the media represented by the current instance was recorded. +• `set` **year**(`value`): `void` **`inheritdoc`** Year item @@ -1985,8 +1997,9 @@ Gets the year that the media represented by the current instance was recorded. `void` -Year that the media represented by the current instance was created or `0` if no - value is present. +#### Overrides + +Tag.year ## Methods @@ -2043,7 +2056,7 @@ Clears all values stored in the current instance. #### Overrides -[Tag](tag.md).[clear](tag.md#clear) +[Tag](Tag.md).[clear](Tag.md#clear) ___ @@ -2051,19 +2064,19 @@ ___ ▸ **copyTo**(`target`, `overwrite`): `void` -Copies the values from the current instance to another [Tag](tag.md), optionally overwriting +Copies the values from the current instance to another [Tag](Tag.md), optionally overwriting existing values. **`remarks`** This method only copies the most basic values when copying between different tag formats. However, if `target` is of the same type as the current instance, more advanced copying may be done. For example if both `this` and `target` are - [Id3v2Tag](id3v2tag.md), all frames will be copied to the target. + [Id3v2Tag](Id3v2Tag.md), all frames will be copied to the target. #### Parameters | Name | Type | | :------ | :------ | -| `target` | [`Tag`](tag.md) | +| `target` | [`Tag`](Tag.md) | | `overwrite` | `boolean` | #### Returns @@ -2072,7 +2085,7 @@ Copies the values from the current instance to another [Tag](tag.md), optionally #### Overrides -[Tag](tag.md).[copyTo](tag.md#copyto) +[Tag](Tag.md).[copyTo](Tag.md#copyto) ___ @@ -2137,13 +2150,13 @@ ___ ### render -▸ **render**(): [`ByteVector`](bytevector.md) +▸ **render**(): [`ByteVector`](ByteVector.md) Renders the current instance as a raw APEv2 tag. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ByteVector Bytes that represent the current instance @@ -2163,7 +2176,7 @@ Set the tags that represent the tagger software (node-taglib-sharp) itself. #### Inherited from -[Tag](tag.md).[setInfoTag](tag.md#setinfotag) +[Tag](Tag.md).[setInfoTag](Tag.md#setinfotag) ___ @@ -2270,44 +2283,44 @@ First string contained in `group` or `undefined` if the array is #### Inherited from -[Tag](tag.md).[firstInGroup](tag.md#firstingroup) +[Tag](Tag.md).[firstInGroup](Tag.md#firstingroup) ___ ### fromData -▸ `Static` **fromData**(`data`): [`ApeTag`](apetag.md) +▸ `Static` **fromData**(`data`): [`ApeTag`](ApeTag.md) Constructs and initializes a new instance by reading the contents of a raw tag in a -specified [ByteVector](bytevector.md) object. +specified [ByteVector](ByteVector.md) object. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Object containing the raw tag | +| `data` | [`ByteVector`](ByteVector.md) | Object containing the raw tag | #### Returns -[`ApeTag`](apetag.md) +[`ApeTag`](ApeTag.md) ___ ### fromEmpty -▸ `Static` **fromEmpty**(): [`ApeTag`](apetag.md) +▸ `Static` **fromEmpty**(): [`ApeTag`](ApeTag.md) Constructs an empty APEv2 tag. #### Returns -[`ApeTag`](apetag.md) +[`ApeTag`](ApeTag.md) ___ ### fromFile -▸ `Static` **fromFile**(`file`, `position`): [`ApeTag`](apetag.md) +▸ `Static` **fromFile**(`file`, `position`): [`ApeTag`](ApeTag.md) Constructs a new instance by reading the contents from a specified position in a specified file. @@ -2319,12 +2332,12 @@ file. | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File to read the tag from | +| `file` | [`File`](File.md) | File to read the tag from | | `position` | `number` | Position where the tag header or footer begins | #### Returns -[`ApeTag`](apetag.md) +[`ApeTag`](ApeTag.md) ___ @@ -2350,7 +2363,7 @@ If `value` is a string, `true` is returned if the value is falsy or all #### Inherited from -[Tag](tag.md).[isFalsyOrLikeEmpty](tag.md#isfalsyorlikeempty) +[Tag](Tag.md).[isFalsyOrLikeEmpty](Tag.md#isfalsyorlikeempty) ___ @@ -2375,24 +2388,24 @@ A semicolon and space separated string containing the values from `group` #### Inherited from -[Tag](tag.md).[joinGroup](tag.md#joingroup) +[Tag](Tag.md).[joinGroup](Tag.md#joingroup) ___ ### tagTypeFlagsToArray -▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/tagtypes.md)[] +▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/TagTypes.md)[] #### Parameters | Name | Type | | :------ | :------ | -| `tagTypes` | [`TagTypes`](../enums/tagtypes.md) | +| `tagTypes` | [`TagTypes`](../enums/TagTypes.md) | #### Returns -[`TagTypes`](../enums/tagtypes.md)[] +[`TagTypes`](../enums/TagTypes.md)[] #### Inherited from -[Tag](tag.md).[tagTypeFlagsToArray](tag.md#tagtypeflagstoarray) +[Tag](Tag.md).[tagTypeFlagsToArray](Tag.md#tagtypeflagstoarray) diff --git a/docs/classes/asfcontentdescriptionobject.md b/docs/classes/AsfContentDescriptionObject.md similarity index 76% rename from docs/classes/asfcontentdescriptionobject.md rename to docs/classes/AsfContentDescriptionObject.md index da6b65a0..90bcdaf9 100644 --- a/docs/classes/asfcontentdescriptionobject.md +++ b/docs/classes/AsfContentDescriptionObject.md @@ -8,7 +8,7 @@ information such as title, author, copyright, description, rating information. ## Hierarchy -- `BaseObject` +- `default` ↳ **`AsfContentDescriptionObject`** @@ -16,24 +16,24 @@ information such as title, author, copyright, description, rating information. ### Accessors -- [author](asfcontentdescriptionobject.md#author) -- [copyright](asfcontentdescriptionobject.md#copyright) -- [description](asfcontentdescriptionobject.md#description) -- [guid](asfcontentdescriptionobject.md#guid) -- [isEmpty](asfcontentdescriptionobject.md#isempty) -- [objectType](asfcontentdescriptionobject.md#objecttype) -- [originalSize](asfcontentdescriptionobject.md#originalsize) -- [rating](asfcontentdescriptionobject.md#rating) -- [title](asfcontentdescriptionobject.md#title) +- [author](AsfContentDescriptionObject.md#author) +- [copyright](AsfContentDescriptionObject.md#copyright) +- [description](AsfContentDescriptionObject.md#description) +- [guid](AsfContentDescriptionObject.md#guid) +- [isEmpty](AsfContentDescriptionObject.md#isempty) +- [objectType](AsfContentDescriptionObject.md#objecttype) +- [originalSize](AsfContentDescriptionObject.md#originalsize) +- [rating](AsfContentDescriptionObject.md#rating) +- [title](AsfContentDescriptionObject.md#title) ### Methods -- [initializeFromFile](asfcontentdescriptionobject.md#initializefromfile) -- [initializeFromGuid](asfcontentdescriptionobject.md#initializefromguid) -- [render](asfcontentdescriptionobject.md#render) -- [renderInternal](asfcontentdescriptionobject.md#renderinternal) -- [fromEmpty](asfcontentdescriptionobject.md#fromempty) -- [fromFile](asfcontentdescriptionobject.md#fromfile) +- [initializeFromFile](AsfContentDescriptionObject.md#initializefromfile) +- [initializeFromGuid](AsfContentDescriptionObject.md#initializefromguid) +- [render](AsfContentDescriptionObject.md#render) +- [renderInternal](AsfContentDescriptionObject.md#renderinternal) +- [fromEmpty](AsfContentDescriptionObject.md#fromempty) +- [fromFile](AsfContentDescriptionObject.md#fromfile) ## Accessors @@ -137,6 +137,10 @@ Gets the GUID that identifies the current instance. `default` +#### Inherited from + +BaseObject.guid + ___ ### isEmpty @@ -163,6 +167,10 @@ ___ `ObjectType` +#### Overrides + +BaseObject.objectType + ___ ### originalSize @@ -175,6 +183,10 @@ Gets the original size of the current instance. `number` +#### Inherited from + +BaseObject.originalSize + ___ ### rating @@ -248,7 +260,7 @@ file. | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File which contains the details of the new instance to create | +| `file` | [`File`](File.md) | File which contains the details of the new instance to create | | `position` | `number` | Position in `file` where the object begins | #### Returns @@ -285,13 +297,13 @@ ___ ### render -▸ **render**(): [`ByteVector`](bytevector.md) +▸ **render**(): [`ByteVector`](ByteVector.md) Renders the current instance as a raw ASF object. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides @@ -301,7 +313,7 @@ ___ ### renderInternal -▸ `Protected` **renderInternal**(`data`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderInternal**(`data`): [`ByteVector`](ByteVector.md) Renders the current instance as a raw ASF object containing the specified data. @@ -312,11 +324,11 @@ Renders the current instance as a raw ASF object containing the specified data. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Data to store in the rendered version of the current instance. | +| `data` | [`ByteVector`](ByteVector.md) | Data to store in the rendered version of the current instance. | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from @@ -326,25 +338,25 @@ ___ ### fromEmpty -▸ `Static` **fromEmpty**(): [`AsfContentDescriptionObject`](asfcontentdescriptionobject.md) +▸ `Static` **fromEmpty**(): [`AsfContentDescriptionObject`](AsfContentDescriptionObject.md) #### Returns -[`AsfContentDescriptionObject`](asfcontentdescriptionobject.md) +[`AsfContentDescriptionObject`](AsfContentDescriptionObject.md) ___ ### fromFile -▸ `Static` **fromFile**(`file`, `position`): [`AsfContentDescriptionObject`](asfcontentdescriptionobject.md) +▸ `Static` **fromFile**(`file`, `position`): [`AsfContentDescriptionObject`](AsfContentDescriptionObject.md) #### Parameters | Name | Type | | :------ | :------ | -| `file` | [`File`](file.md) | +| `file` | [`File`](File.md) | | `position` | `number` | #### Returns -[`AsfContentDescriptionObject`](asfcontentdescriptionobject.md) +[`AsfContentDescriptionObject`](AsfContentDescriptionObject.md) diff --git a/docs/classes/AsfContentDescriptor.md b/docs/classes/AsfContentDescriptor.md new file mode 100644 index 00000000..fa763b45 --- /dev/null +++ b/docs/classes/AsfContentDescriptor.md @@ -0,0 +1,275 @@ +[node-taglib-sharp](../README.md) / [Exports](../modules.md) / AsfContentDescriptor + +# Class: AsfContentDescriptor + +This class provides a representation of an ASF content descriptor to be used in combination with +{@link ExtendedContentDescriptionObject}. + +**`remarks`** This class can store various types of information. Although [toString](AsfContentDescriptor.md#tostring) provides + a representation of all types of values, it is recommended to determine which of the `get*` + methods to use by accessing [type](AsfContentDescriptor.md#type) + +## Hierarchy + +- `DescriptorBase` + + ↳ **`AsfContentDescriptor`** + +## Table of contents + +### Constructors + +- [constructor](AsfContentDescriptor.md#constructor) + +### Accessors + +- [boolValue](AsfContentDescriptor.md#boolvalue) +- [byteValue](AsfContentDescriptor.md#bytevalue) +- [guidValue](AsfContentDescriptor.md#guidvalue) +- [name](AsfContentDescriptor.md#name) +- [stringValue](AsfContentDescriptor.md#stringvalue) +- [type](AsfContentDescriptor.md#type) +- [uintValue](AsfContentDescriptor.md#uintvalue) +- [ulongValue](AsfContentDescriptor.md#ulongvalue) +- [ushortValue](AsfContentDescriptor.md#ushortvalue) + +### Methods + +- [render](AsfContentDescriptor.md#render) +- [toString](AsfContentDescriptor.md#tostring) +- [fromFile](AsfContentDescriptor.md#fromfile) + +## Constructors + +### constructor + +• **new AsfContentDescriptor**(`name`, `type`, `value`) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `name` | `string` | +| `type` | [`AsfObjectDataType`](../enums/AsfObjectDataType.md) | +| `value` | `DescriptorValue` | + +#### Overrides + +DescriptorBase.constructor + +## Accessors + +### boolValue + +• `get` **boolValue**(): `boolean` + +Gets the boolean value of the current instance. + +#### Returns + +`boolean` + +boolean Boolean value of the current instance is returned if [type](AsfContentDescriptor.md#type) is + {@link DataType.Bool}. `undefined` is returned otherwise. + +#### Inherited from + +DescriptorBase.boolValue + +___ + +### byteValue + +• `get` **byteValue**(): [`ByteVector`](ByteVector.md) + +Gets the binary contents of the current instance. + +#### Returns + +[`ByteVector`](ByteVector.md) + +ByteVector Byte contents of the current instance, if [type](AsfContentDescriptor.md#type) is + {@link DataType.Bytes}. `undefined` is returned otherwise. + +#### Inherited from + +DescriptorBase.byteValue + +___ + +### guidValue + +• `get` **guidValue**(): `default` + +Gets the guid contents of the current instance. + +#### Returns + +`default` + +UuidWrapper GUID contents of the current instance, if [type](AsfContentDescriptor.md#type) is + {@link DataType.Guid}. `undefined` is returned otherwise. + +#### Inherited from + +DescriptorBase.guidValue + +___ + +### name + +• `get` **name**(): `string` + +Gets the name of the current instance. + +#### Returns + +`string` + +#### Inherited from + +DescriptorBase.name + +___ + +### stringValue + +• `get` **stringValue**(): `string` + +Gets the string contents of the current instance. + +#### Returns + +`string` + +string String contents of the current instance if [type](AsfContentDescriptor.md#type) is + {@link DataType.Unicode}. `undefined` is returned otherwise. + +#### Inherited from + +DescriptorBase.stringValue + +___ + +### type + +• `get` **type**(): [`AsfObjectDataType`](../enums/AsfObjectDataType.md) + +Gets the type of data contained in the current instance. + +#### Returns + +[`AsfObjectDataType`](../enums/AsfObjectDataType.md) + +#### Inherited from + +DescriptorBase.type + +___ + +### uintValue + +• `get` **uintValue**(): `number` + +Gets the 32-bit double word contents of the current instance. + +#### Returns + +`number` + +number Double word contents of the current instance, if [type](AsfContentDescriptor.md#type) is + {@link DataType.DWord}. `undefined` is returned otherwise. + +#### Inherited from + +DescriptorBase.uintValue + +___ + +### ulongValue + +• `get` **ulongValue**(): `bigint` + +Gets the 64-bit quad word contents of the current instance. + +#### Returns + +`bigint` + +bigint Quad word contents of the current instance, if [type](AsfContentDescriptor.md#type) is + {@link DataType.QWord}. `undefined` is returned otherwise. + +#### Inherited from + +DescriptorBase.ulongValue + +___ + +### ushortValue + +• `get` **ushortValue**(): `number` + +Gets the 16-bit word contents of the current instance. + +#### Returns + +`number` + +number Word contents of the current instance, if [type](AsfContentDescriptor.md#type) is + {@link DataType.Word}. `undefined` is returned otherwise. + +#### Inherited from + +DescriptorBase.ushortValue + +## Methods + +### render + +▸ **render**(): [`ByteVector`](ByteVector.md) + +**`inheritdoc`** + +#### Returns + +[`ByteVector`](ByteVector.md) + +#### Overrides + +DescriptorBase.render + +___ + +### toString + +▸ **toString**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +DescriptorBase.toString + +___ + +### fromFile + +▸ `Static` **fromFile**(`file`): [`AsfContentDescriptor`](AsfContentDescriptor.md) + +Instantiates a new instance by reading in the contents from a file. + +**`internal`** + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `file` | [`File`](File.md) | The file to read the raw ASF description record from | + +#### Returns + +[`AsfContentDescriptor`](AsfContentDescriptor.md) diff --git a/docs/classes/asfextendedcontentdescriptionobject.md b/docs/classes/AsfExtendedContentDescriptionObject.md similarity index 69% rename from docs/classes/asfextendedcontentdescriptionobject.md rename to docs/classes/AsfExtendedContentDescriptionObject.md index a56e9ae6..60edac3b 100644 --- a/docs/classes/asfextendedcontentdescriptionobject.md +++ b/docs/classes/AsfExtendedContentDescriptionObject.md @@ -7,7 +7,7 @@ read from and written to disk. ## Hierarchy -- `BaseObject` +- `default` ↳ **`AsfExtendedContentDescriptionObject`** @@ -15,36 +15,36 @@ read from and written to disk. ### Accessors -- [descriptors](asfextendedcontentdescriptionobject.md#descriptors) -- [guid](asfextendedcontentdescriptionobject.md#guid) -- [isEmpty](asfextendedcontentdescriptionobject.md#isempty) -- [objectType](asfextendedcontentdescriptionobject.md#objecttype) -- [originalSize](asfextendedcontentdescriptionobject.md#originalsize) +- [descriptors](AsfExtendedContentDescriptionObject.md#descriptors) +- [guid](AsfExtendedContentDescriptionObject.md#guid) +- [isEmpty](AsfExtendedContentDescriptionObject.md#isempty) +- [objectType](AsfExtendedContentDescriptionObject.md#objecttype) +- [originalSize](AsfExtendedContentDescriptionObject.md#originalsize) ### Methods -- [addDescriptor](asfextendedcontentdescriptionobject.md#adddescriptor) -- [getDescriptors](asfextendedcontentdescriptionobject.md#getdescriptors) -- [initializeFromFile](asfextendedcontentdescriptionobject.md#initializefromfile) -- [initializeFromGuid](asfextendedcontentdescriptionobject.md#initializefromguid) -- [removeDescriptors](asfextendedcontentdescriptionobject.md#removedescriptors) -- [render](asfextendedcontentdescriptionobject.md#render) -- [renderInternal](asfextendedcontentdescriptionobject.md#renderinternal) -- [setDescriptors](asfextendedcontentdescriptionobject.md#setdescriptors) -- [fromEmpty](asfextendedcontentdescriptionobject.md#fromempty) -- [fromFile](asfextendedcontentdescriptionobject.md#fromfile) +- [addDescriptor](AsfExtendedContentDescriptionObject.md#adddescriptor) +- [getDescriptors](AsfExtendedContentDescriptionObject.md#getdescriptors) +- [initializeFromFile](AsfExtendedContentDescriptionObject.md#initializefromfile) +- [initializeFromGuid](AsfExtendedContentDescriptionObject.md#initializefromguid) +- [removeDescriptors](AsfExtendedContentDescriptionObject.md#removedescriptors) +- [render](AsfExtendedContentDescriptionObject.md#render) +- [renderInternal](AsfExtendedContentDescriptionObject.md#renderinternal) +- [setDescriptors](AsfExtendedContentDescriptionObject.md#setdescriptors) +- [fromEmpty](AsfExtendedContentDescriptionObject.md#fromempty) +- [fromFile](AsfExtendedContentDescriptionObject.md#fromfile) ## Accessors ### descriptors -• `get` **descriptors**(): [`AsfContentDescriptor`](asfcontentdescriptor.md)[] +• `get` **descriptors**(): [`AsfContentDescriptor`](AsfContentDescriptor.md)[] Gets all descriptors stored in the current instance. #### Returns -[`AsfContentDescriptor`](asfcontentdescriptor.md)[] +[`AsfContentDescriptor`](AsfContentDescriptor.md)[] ___ @@ -58,6 +58,10 @@ Gets the GUID that identifies the current instance. `default` +#### Inherited from + +BaseObject.guid + ___ ### isEmpty @@ -85,6 +89,10 @@ ___ `ObjectType` +#### Overrides + +BaseObject.objectType + ___ ### originalSize @@ -97,6 +105,10 @@ Gets the original size of the current instance. `number` +#### Inherited from + +BaseObject.originalSize + ## Methods ### addDescriptor @@ -109,7 +121,7 @@ Adds a descriptor to the current instance. | Name | Type | Description | | :------ | :------ | :------ | -| `descriptor` | [`AsfContentDescriptor`](asfcontentdescriptor.md) | Record to add to the current instance | +| `descriptor` | [`AsfContentDescriptor`](AsfContentDescriptor.md) | Record to add to the current instance | #### Returns @@ -119,7 +131,7 @@ ___ ### getDescriptors -▸ **getDescriptors**(...`names`): [`AsfContentDescriptor`](asfcontentdescriptor.md)[] +▸ **getDescriptors**(...`names`): [`AsfContentDescriptor`](AsfContentDescriptor.md)[] Gets all descriptors with a name matching one of the provided collection of names the current instance. @@ -132,7 +144,7 @@ current instance. #### Returns -[`AsfContentDescriptor`](asfcontentdescriptor.md)[] +[`AsfContentDescriptor`](AsfContentDescriptor.md)[] ___ @@ -147,7 +159,7 @@ file. | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File which contains the details of the new instance to create | +| `file` | [`File`](File.md) | File which contains the details of the new instance to create | | `position` | `number` | Position in `file` where the object begins | #### Returns @@ -202,13 +214,13 @@ ___ ### render -▸ **render**(): [`ByteVector`](bytevector.md) +▸ **render**(): [`ByteVector`](ByteVector.md) **`inheritdoc`** #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides @@ -218,7 +230,7 @@ ___ ### renderInternal -▸ `Protected` **renderInternal**(`data`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderInternal**(`data`): [`ByteVector`](ByteVector.md) Renders the current instance as a raw ASF object containing the specified data. @@ -229,11 +241,11 @@ Renders the current instance as a raw ASF object containing the specified data. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Data to store in the rendered version of the current instance. | +| `data` | [`ByteVector`](ByteVector.md) | Data to store in the rendered version of the current instance. | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from @@ -257,7 +269,7 @@ Sets a collection of descriptors for a given name, removing the existing matchin | Name | Type | Description | | :------ | :------ | :------ | | `name` | `string` | Name of the descriptors to be added/removed | -| `...descriptors` | [`AsfContentDescriptor`](asfcontentdescriptor.md)[] | Descriptors to add to the new instance | +| `...descriptors` | [`AsfContentDescriptor`](AsfContentDescriptor.md)[] | Descriptors to add to the new instance | #### Returns @@ -267,19 +279,19 @@ ___ ### fromEmpty -▸ `Static` **fromEmpty**(): [`AsfExtendedContentDescriptionObject`](asfextendedcontentdescriptionobject.md) +▸ `Static` **fromEmpty**(): [`AsfExtendedContentDescriptionObject`](AsfExtendedContentDescriptionObject.md) Constructs and initializes a new, empty extended content description object. #### Returns -[`AsfExtendedContentDescriptionObject`](asfextendedcontentdescriptionobject.md) +[`AsfExtendedContentDescriptionObject`](AsfExtendedContentDescriptionObject.md) ___ ### fromFile -▸ `Static` **fromFile**(`file`, `position`): [`AsfExtendedContentDescriptionObject`](asfextendedcontentdescriptionobject.md) +▸ `Static` **fromFile**(`file`, `position`): [`AsfExtendedContentDescriptionObject`](AsfExtendedContentDescriptionObject.md) Constructs and initializes a new instance that is read in from the provided file at the provided position. @@ -288,9 +300,9 @@ provided position. | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File to read the instance from. Must not be falsey | +| `file` | [`File`](File.md) | File to read the instance from. Must not be falsey | | `position` | `number` | Position in the file where the instance begins. Must be a positive, safe integer. | #### Returns -[`AsfExtendedContentDescriptionObject`](asfextendedcontentdescriptionobject.md) +[`AsfExtendedContentDescriptionObject`](AsfExtendedContentDescriptionObject.md) diff --git a/docs/classes/asffile.md b/docs/classes/AsfFile.md similarity index 61% rename from docs/classes/asffile.md rename to docs/classes/AsfFile.md index c1be46e6..1f36bc70 100644 --- a/docs/classes/asffile.md +++ b/docs/classes/AsfFile.md @@ -6,7 +6,7 @@ This class provides tagging and properties support for Microsoft's ASF files. ## Hierarchy -- [`File`](file.md) +- [`File`](File.md) ↳ **`AsfFile`** @@ -14,53 +14,48 @@ This class provides tagging and properties support for Microsoft's ASF files. ### Constructors -- [constructor](asffile.md#constructor) - -### Properties - -- [\_fileAbstraction](asffile.md#_fileabstraction) -- [\_fileStream](asffile.md#_filestream) -- [\_tagTypesOnDisk](asffile.md#_tagtypesondisk) +- [constructor](AsfFile.md#constructor) ### Accessors -- [corruptionReasons](asffile.md#corruptionreasons) -- [fileAbstraction](asffile.md#fileabstraction) -- [isPossiblyCorrupt](asffile.md#ispossiblycorrupt) -- [isWritable](asffile.md#iswritable) -- [length](asffile.md#length) -- [mimeType](asffile.md#mimetype) -- [mode](asffile.md#mode) -- [name](asffile.md#name) -- [position](asffile.md#position) -- [properties](asffile.md#properties) -- [tag](asffile.md#tag) -- [tagTypes](asffile.md#tagtypes) -- [tagTypesOnDisk](asffile.md#tagtypesondisk) -- [bufferSize](asffile.md#buffersize) +- [corruptionReasons](AsfFile.md#corruptionreasons) +- [fileAbstraction](AsfFile.md#fileabstraction) +- [hasTags](AsfFile.md#hastags) +- [isPossiblyCorrupt](AsfFile.md#ispossiblycorrupt) +- [isWritable](AsfFile.md#iswritable) +- [length](AsfFile.md#length) +- [mimeType](AsfFile.md#mimetype) +- [mode](AsfFile.md#mode) +- [name](AsfFile.md#name) +- [position](AsfFile.md#position) +- [properties](AsfFile.md#properties) +- [tag](AsfFile.md#tag) +- [tagTypes](AsfFile.md#tagtypes) +- [tagTypesOnDisk](AsfFile.md#tagtypesondisk) +- [bufferSize](AsfFile.md#buffersize) ### Methods -- [dispose](asffile.md#dispose) -- [find](asffile.md#find) -- [getTag](asffile.md#gettag) -- [insert](asffile.md#insert) -- [markAsCorrupt](asffile.md#markascorrupt) -- [preSave](asffile.md#presave) -- [rFind](asffile.md#rfind) -- [readBlock](asffile.md#readblock) -- [removeBlock](asffile.md#removeblock) -- [removeTags](asffile.md#removetags) -- [save](asffile.md#save) -- [seek](asffile.md#seek) -- [truncate](asffile.md#truncate) -- [writeBlock](asffile.md#writeblock) -- [addFileType](asffile.md#addfiletype) -- [addFileTypeResolver](asffile.md#addfiletyperesolver) -- [createFromAbstraction](asffile.md#createfromabstraction) -- [createFromPath](asffile.md#createfrompath) -- [removeFileType](asffile.md#removefiletype) -- [removeFileTypeResolver](asffile.md#removefiletyperesolver) +- [dispose](AsfFile.md#dispose) +- [find](AsfFile.md#find) +- [getTag](AsfFile.md#gettag) +- [insert](AsfFile.md#insert) +- [markAsCorrupt](AsfFile.md#markascorrupt) +- [preSave](AsfFile.md#presave) +- [rFind](AsfFile.md#rfind) +- [readBlock](AsfFile.md#readblock) +- [removeBlock](AsfFile.md#removeblock) +- [removeTags](AsfFile.md#removetags) +- [save](AsfFile.md#save) +- [seek](AsfFile.md#seek) +- [truncate](AsfFile.md#truncate) +- [writeBlock](AsfFile.md#writeblock) +- [addFileType](AsfFile.md#addfiletype) +- [addFileTypeResolver](AsfFile.md#addfiletyperesolver) +- [createFromAbstraction](AsfFile.md#createfromabstraction) +- [createFromPath](AsfFile.md#createfrompath) +- [removeFileType](AsfFile.md#removefiletype) +- [removeFileTypeResolver](AsfFile.md#removefiletyperesolver) ## Constructors @@ -73,65 +68,60 @@ This class provides tagging and properties support for Microsoft's ASF files. | Name | Type | | :------ | :------ | | `file` | `string` \| `IFileAbstraction` | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | #### Overrides -[File](file.md).[constructor](file.md#constructor) - -## Properties - -### \_fileAbstraction +[File](File.md).[constructor](File.md#constructor) -• `Protected` **\_fileAbstraction**: `IFileAbstraction` +## Accessors -#### Inherited from +### corruptionReasons -[File](file.md).[_fileAbstraction](file.md#_fileabstraction) +• `get` **corruptionReasons**(): `string`[] -___ +Reasons for which this file is marked as corrupt. -### \_fileStream +#### Returns -• `Protected` **\_fileStream**: `IStream` +`string`[] #### Inherited from -[File](file.md).[_fileStream](file.md#_filestream) +File.corruptionReasons ___ -### \_tagTypesOnDisk - -• `Protected` **\_tagTypesOnDisk**: [`TagTypes`](../enums/tagtypes.md) - -#### Inherited from - -[File](file.md).[_tagTypesOnDisk](file.md#_tagtypesondisk) +### fileAbstraction -## Accessors +• `get` **fileAbstraction**(): `IFileAbstraction` -### corruptionReasons +Gets the {@link IFileAbstraction} representing the file. -• `get` **corruptionReasons**(): `string`[] +#### Returns -Reasons for which this file is marked as corrupt. +`IFileAbstraction` -#### Returns +#### Inherited from -`string`[] +File.fileAbstraction ___ -### fileAbstraction +### hasTags -• `get` **fileAbstraction**(): `IFileAbstraction` +• `get` **hasTags**(): `boolean` -Gets the {@link IFileAbstraction} representing the file. +Shortcut property to determine if a file has tags in memory. +NOTE: Just because `tag !== undefined` does not mean there are tags in memory. #### Returns -`IFileAbstraction` +`boolean` + +#### Inherited from + +File.hasTags ___ @@ -146,6 +136,10 @@ be written. `boolean` +#### Inherited from + +File.isPossiblyCorrupt + ___ ### isWritable @@ -158,6 +152,10 @@ Indicates whether or not tags can be written back to the current file. `boolean` +#### Inherited from + +File.isWritable + ___ ### length @@ -171,6 +169,10 @@ is not open for reading; `number` +#### Inherited from + +File.length + ___ ### mimeType @@ -183,34 +185,46 @@ Gets the MimeType of the file as determined during creation of the instance. `string` +#### Inherited from + +File.mimeType + ___ ### mode -• `get` **mode**(): [`FileAccessMode`](../enums/fileaccessmode.md) +• `get` **mode**(): [`FileAccessMode`](../enums/FileAccessMode.md) Gets the file access mode in use by the current instance. #### Returns -[`FileAccessMode`](../enums/fileaccessmode.md) +[`FileAccessMode`](../enums/FileAccessMode.md) + +#### Inherited from + +File.mode • `set` **mode**(`val`): `void` Sets the file access mode in use by the current instance. Changing the value will cause the stream currently in use to be closed, except when a change is made from -[FileAccessMode.Write](../enums/fileaccessmode.md#write) to [FileAccessMode.Read](../enums/fileaccessmode.md#read) which has no effect. +[FileAccessMode.Write](../enums/FileAccessMode.md#write) to [FileAccessMode.Read](../enums/FileAccessMode.md#read) which has no effect. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `val` | [`FileAccessMode`](../enums/fileaccessmode.md) | File access mode to change to | +| `val` | [`FileAccessMode`](../enums/FileAccessMode.md) | File access mode to change to | #### Returns `void` +#### Inherited from + +File.mode + ___ ### name @@ -223,6 +237,10 @@ Gets the name of the file as stored in its file abstraction. `string` +#### Inherited from + +File.name + ___ ### position @@ -236,57 +254,91 @@ if the file is not open for reading `number` +#### Inherited from + +File.position + ___ ### properties -• `get` **properties**(): [`Properties`](properties.md) - -Gets the media properties of the file represented by the current instance. +• `get` **properties**(): [`Properties`](Properties.md) **`inheritdoc`** #### Returns -[`Properties`](properties.md) +[`Properties`](Properties.md) + +#### Overrides + +File.properties ___ ### tag -• `get` **tag**(): [`AsfTag`](asftag.md) - -Gets an abstract representation of all tags stored in the current instance. +• `get` **tag**(): [`AsfTag`](AsfTag.md) **`inheritdoc`** #### Returns -[`AsfTag`](asftag.md) +[`AsfTag`](AsfTag.md) + +#### Overrides + +File.tag ___ ### tagTypes -• `get` **tagTypes**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypes**(): [`TagTypes`](../enums/TagTypes.md) Gets the tag types contained in the current instance. #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) + +#### Inherited from + +File.tagTypes ___ ### tagTypesOnDisk -• `get` **tagTypesOnDisk**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypesOnDisk**(): [`TagTypes`](../enums/TagTypes.md) + +Gets the tag types contained in the physical file represented by the current instance. + +#### Returns + +[`TagTypes`](../enums/TagTypes.md) + +#### Inherited from + +File.tagTypesOnDisk + +• `set` **tagTypesOnDisk**(`value`): `void` Gets the tag types contained in the physical file represented by the current instance. +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | [`TagTypes`](../enums/TagTypes.md) | + #### Returns -[`TagTypes`](../enums/tagtypes.md) +`void` + +#### Inherited from + +File.tagTypesOnDisk ___ @@ -300,6 +352,10 @@ Gets the buffer size to use when reading large blocks of data `number` +#### Inherited from + +File.bufferSize + ## Methods ### dispose @@ -314,7 +370,7 @@ Dispose the current instance. Equivalent to setting the mode to closed. #### Inherited from -[File](file.md).[dispose](file.md#dispose) +[File](File.md).[dispose](File.md#dispose) ___ @@ -331,9 +387,9 @@ Searches forward through a file for a specified pattern, starting at a specified | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | `undefined` | Pattern to search for in the current instance. Must be smaller than the | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern to search for in the current instance. Must be smaller than the | | `startPosition` | `number` | `0` | Seek position to start searching. Must be positive, safe integer. | -| `before?` | [`ByteVector`](bytevector.md) | `undefined` | Optional pattern that the searched for pattern must appear before. If this pattern is found first, `-1` is returned. | +| `before?` | [`ByteVector`](ByteVector.md) | `undefined` | Optional pattern that the searched for pattern must appear before. If this pattern is found first, `-1` is returned. | #### Returns @@ -343,13 +399,13 @@ Index at which the value was found. If not found, `-1` is returned. #### Inherited from -[File](file.md).[find](file.md#find) +[File](File.md).[find](File.md#find) ___ ### getTag -▸ **getTag**(`type`, `_create`): [`Tag`](tag.md) +▸ **getTag**(`type`): [`Tag`](Tag.md) Gets a tag of the specified type from the current instance, optionally creating a new tag if possible. @@ -358,12 +414,11 @@ possible. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`TagTypes`](../enums/tagtypes.md) | Type of tag to read. | -| `_create` | `boolean` | Whether or not to try and create the tag if one is not found. `true` does not guarantee the tag will be created. For example, trying to create an ID3v2 tag on an OGG Vorbis file will always fail. | +| `type` | [`TagTypes`](../enums/TagTypes.md) | Type of tag to read. | #### Returns -[`Tag`](tag.md) +[`Tag`](Tag.md) Tag object containing the tag that was found in or added to the current instance. If no matching tag was found and none was created, `undefined` is returned. It is safe @@ -372,7 +427,7 @@ Tag object containing the tag that was found in or added to the current instance #### Overrides -[File](file.md).[getTag](file.md#gettag) +[File](File.md).[getTag](File.md#gettag) ___ @@ -390,7 +445,7 @@ specified location, replacing a specified number of bytes. | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | `undefined` | Data to insert into the file. | +| `data` | [`ByteVector`](ByteVector.md) | `undefined` | Data to insert into the file. | | `start` | `number` | `undefined` | Index into the file at which to insert the data. Must be safe positive integer. | | `replace` | `number` | `0` | Number of bytes to replace. Typically this is the original size of the data block so that a new block will replace the old one. | @@ -400,7 +455,7 @@ specified location, replacing a specified number of bytes. #### Inherited from -[File](file.md).[insert](file.md#insert) +[File](File.md).[insert](File.md#insert) ___ @@ -422,7 +477,7 @@ Mark the current instance as corrupt. NOTE: Not intended to be used outside of t #### Inherited from -[File](file.md).[markAsCorrupt](file.md#markascorrupt) +[File](File.md).[markAsCorrupt](File.md#markascorrupt) ___ @@ -438,7 +493,7 @@ Prepares to save the file. This must be called at the beginning of every File.sa #### Inherited from -[File](file.md).[preSave](file.md#presave) +[File](File.md).[preSave](File.md#presave) ___ @@ -455,7 +510,7 @@ Searches backwards through a file for a specified pattern, starting at a specifi | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | `undefined` | Pattern to search for in the current instance. Must be shorter than the [bufferSize](asffile.md#buffersize) | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern to search for in the current instance. Must be shorter than the [bufferSize](AsfFile.md#buffersize) | | `startPosition` | `number` | `0` | Number of bytes from end of the file to begin searching. | #### Returns @@ -466,17 +521,17 @@ Index at which the value wa found. If not found, `-1` is returned. #### Inherited from -[File](file.md).[rFind](file.md#rfind) +[File](File.md).[rFind](File.md#rfind) ___ ### readBlock -▸ **readBlock**(`length`): [`ByteVector`](bytevector.md) +▸ **readBlock**(`length`): [`ByteVector`](ByteVector.md) Reads a specified number of bytes at the current seek position from the current position. This method reads the block of data at the current seek position. To change the seek -position, use [File.seek](file.md#seek). +position, use [File.seek](File.md#seek). **`throws`** Error Thrown when `length` is not a positive, safe integer. @@ -488,13 +543,13 @@ position, use [File.seek](file.md#seek). #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ByteVector Object containing the data read from the current instance. #### Inherited from -[File](file.md).[readBlock](file.md#readblock) +[File](File.md).[readBlock](File.md#readblock) ___ @@ -520,7 +575,7 @@ Removes a specified block of data from the file represented by the current insta #### Inherited from -[File](file.md).[removeBlock](file.md#removeblock) +[File](File.md).[removeBlock](File.md#removeblock) ___ @@ -529,13 +584,13 @@ ___ ▸ **removeTags**(`types`): `void` Removes a set of tag types from the current instance. In order to remove all tags from a -file, pass [TagTypes.AllTags](../enums/tagtypes.md#alltags) as `types` +file, pass [TagTypes.AllTags](../enums/TagTypes.md#alltags) as `types` #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `types` | [`TagTypes`](../enums/tagtypes.md) | Bitwise combined [TagTypes](../enums/tagtypes.md) value containing the tag types to be removed from the file | +| `types` | [`TagTypes`](../enums/TagTypes.md) | Bitwise combined [TagTypes](../enums/TagTypes.md) value containing the tag types to be removed from the file | #### Returns @@ -543,7 +598,7 @@ file, pass [TagTypes.AllTags](../enums/tagtypes.md#alltags) as `types` #### Overrides -[File](file.md).[removeTags](file.md#removetags) +[File](File.md).[removeTags](File.md#removetags) ___ @@ -559,7 +614,7 @@ Saves the changes made in the current instance to the file it represents. #### Overrides -[File](file.md).[save](file.md#save) +[File](File.md).[save](File.md#save) ___ @@ -572,10 +627,10 @@ specified origin. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `offset` | `number` | Byte offset to seek to. Must be a safe, positive integer. | -| `origin` | `SeekOrigin` | Origin from which to seek | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `offset` | `number` | `undefined` | Byte offset to seek to. Must be a safe, positive integer. | +| `origin` | `SeekOrigin` | `SeekOrigin.Begin` | Origin from which to seek | #### Returns @@ -583,7 +638,7 @@ specified origin. #### Inherited from -[File](file.md).[seek](file.md#seek) +[File](File.md).[seek](File.md#seek) ___ @@ -605,7 +660,7 @@ Resizes the current instance to a specific number of bytes. #### Inherited from -[File](file.md).[truncate](file.md#truncate) +[File](File.md).[truncate](File.md#truncate) ___ @@ -623,7 +678,7 @@ the file if writing past the current end. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | ByteVector containing data to the current instance. | +| `data` | [`ByteVector`](ByteVector.md) | ByteVector containing data to the current instance. | #### Returns @@ -631,7 +686,7 @@ the file if writing past the current end. #### Inherited from -[File](file.md).[writeBlock](file.md#writeblock) +[File](File.md).[writeBlock](File.md#writeblock) ___ @@ -639,7 +694,7 @@ ___ ▸ `Static` **addFileType**(`mimeType`, `constructor`, `override?`): `void` -Registers the constructor for a subclass of [File](file.md) with the MimeType it is associated +Registers the constructor for a subclass of [File](File.md) with the MimeType it is associated with. Optionally, the MimeType can be forcefully overridden if it was already registered. #### Parameters @@ -647,8 +702,8 @@ with. Optionally, the MimeType can be forcefully overridden if it was already re | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | | `mimeType` | `string` | `undefined` | MimeType to register this subclass constructor to. | -| `constructor` | [`FileTypeConstructor`](../modules.md#filetypeconstructor) | `undefined` | Constructor for a subclass of [File](file.md) that will be called if a file with a MimeType of `mimeType` is created. | -| `override` | `boolean` | `false` | If `true` and a subclass of [File](file.md) was already registered to `mimeType`, it will be forcefully overridden. If `false`, an {@link Error} will be thrown if a subclass already registered to the MimeType.} | +| `constructor` | [`FileTypeConstructor`](../modules.md#filetypeconstructor) | `undefined` | Constructor for a subclass of [File](File.md) that will be called if a file with a MimeType of `mimeType` is created. | +| `override` | `boolean` | `false` | If `true` and a subclass of [File](File.md) was already registered to `mimeType`, it will be forcefully overridden. If `false`, an {@link Error} will be thrown if a subclass already registered to the MimeType.} | #### Returns @@ -656,7 +711,7 @@ with. Optionally, the MimeType can be forcefully overridden if it was already re #### Inherited from -[File](file.md).[addFileType](file.md#addfiletype) +[File](File.md).[addFileType](File.md#addfiletype) ___ @@ -670,7 +725,7 @@ Registers a [FileTypeResolver](../modules.md#filetyperesolver) to the front of t | Name | Type | Description | | :------ | :------ | :------ | -| `resolver` | [`FileTypeResolver`](../modules.md#filetyperesolver) | Function to handle resolving a subclass of [File](file.md) from an {@link IFileAbstraction} | +| `resolver` | [`FileTypeResolver`](../modules.md#filetyperesolver) | Function to handle resolving a subclass of [File](File.md) from an {@link IFileAbstraction} | #### Returns @@ -678,61 +733,61 @@ Registers a [FileTypeResolver](../modules.md#filetyperesolver) to the front of t #### Inherited from -[File](file.md).[addFileTypeResolver](file.md#addfiletyperesolver) +[File](File.md).[addFileTypeResolver](File.md#addfiletyperesolver) ___ ### createFromAbstraction -▸ `Static` **createFromAbstraction**(`abstraction`, `mimeType?`, `propertiesStyle?`): [`File`](file.md) +▸ `Static` **createFromAbstraction**(`abstraction`, `mimeType?`, `propertiesStyle?`): [`File`](File.md) -Creates a new instance of a [File](file.md) subclass for a specified file abstraction, MimeType, +Creates a new instance of a [File](File.md) subclass for a specified file abstraction, MimeType, and property read style. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `abstraction` | `IFileAbstraction` | Object to use when reading/writing from the current instance. | -| `mimeType?` | `string` | Optional, MimeType to use for determining the subclass of [File](file.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | Optional, level of detail to use when reading the media information from the new instance. If omitted, [ReadStyle.Average](../enums/readstyle.md#average) is used. | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `abstraction` | `IFileAbstraction` | `undefined` | Object to use when reading/writing from the current instance. | +| `mimeType?` | `string` | `undefined` | Optional, MimeType to use for determining the subclass of [File](File.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | `ReadStyle.Average` | Optional, level of detail to use when reading the media information from the new instance. If omitted, [ReadStyle.Average](../enums/ReadStyle.md#average) is used. | #### Returns -[`File`](file.md) +[`File`](File.md) -New instance of [File](file.md) as read from the specified abstraction. +New instance of [File](File.md) as read from the specified abstraction. #### Inherited from -[File](file.md).[createFromAbstraction](file.md#createfromabstraction) +[File](File.md).[createFromAbstraction](File.md#createfromabstraction) ___ ### createFromPath -▸ `Static` **createFromPath**(`filePath`, `mimeType?`, `propertiesStyle?`): [`File`](file.md) +▸ `Static` **createFromPath**(`filePath`, `mimeType?`, `propertiesStyle?`): [`File`](File.md) -Creates a new instance of [File](file.md) subclass for a specified file path, MimeType, and +Creates a new instance of [File](File.md) subclass for a specified file path, MimeType, and property read style. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `filePath` | `string` | Path to the file to read/write. | -| `mimeType?` | `string` | Optional, MimeType to use for determining the subclass of [File](file.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | Optional, level of detail to use when reading the media information from the new instance. If omitted [ReadStyle.Average](../enums/readstyle.md#average) is used. | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `filePath` | `string` | `undefined` | Path to the file to read/write. | +| `mimeType?` | `string` | `undefined` | Optional, MimeType to use for determining the subclass of [File](File.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | `ReadStyle.Average` | Optional, level of detail to use when reading the media information from the new instance. If omitted [ReadStyle.Average](../enums/ReadStyle.md#average) is used. | #### Returns -[`File`](file.md) +[`File`](File.md) -New instance of [File](file.md) as read from the specified path. +New instance of [File](File.md) as read from the specified path. #### Inherited from -[File](file.md).[createFromPath](file.md#createfrompath) +[File](File.md).[createFromPath](File.md#createfrompath) ___ @@ -754,7 +809,7 @@ Used for removing a file type constructor during unit testing #### Inherited from -[File](file.md).[removeFileType](file.md#removefiletype) +[File](File.md).[removeFileType](File.md#removefiletype) ___ @@ -776,4 +831,4 @@ Used for removing a file type resolver during unit testing #### Inherited from -[File](file.md).[removeFileTypeResolver](file.md#removefiletyperesolver) +[File](File.md).[removeFileTypeResolver](File.md#removefiletyperesolver) diff --git a/docs/classes/asffilepropertiesobject.md b/docs/classes/AsfFilePropertiesObject.md similarity index 70% rename from docs/classes/asffilepropertiesobject.md rename to docs/classes/AsfFilePropertiesObject.md index 32a288b5..1205791f 100644 --- a/docs/classes/asffilepropertiesobject.md +++ b/docs/classes/AsfFilePropertiesObject.md @@ -8,7 +8,7 @@ found within the Data object. ## Hierarchy -- `BaseObject` +- `default` ↳ **`AsfFilePropertiesObject`** @@ -16,28 +16,28 @@ found within the Data object. ### Accessors -- [creationDate](asffilepropertiesobject.md#creationdate) -- [dataPacketsCount](asffilepropertiesobject.md#datapacketscount) -- [fileId](asffilepropertiesobject.md#fileid) -- [fileSize](asffilepropertiesobject.md#filesize) -- [flags](asffilepropertiesobject.md#flags) -- [guid](asffilepropertiesobject.md#guid) -- [maximumBitrate](asffilepropertiesobject.md#maximumbitrate) -- [maximumDataPacketSize](asffilepropertiesobject.md#maximumdatapacketsize) -- [minimumDataPacketSize](asffilepropertiesobject.md#minimumdatapacketsize) -- [objectType](asffilepropertiesobject.md#objecttype) -- [originalSize](asffilepropertiesobject.md#originalsize) -- [playDurationMilliseconds](asffilepropertiesobject.md#playdurationmilliseconds) -- [prerollMilliseconds](asffilepropertiesobject.md#prerollmilliseconds) -- [sendDurationMilliseconds](asffilepropertiesobject.md#senddurationmilliseconds) +- [creationDate](AsfFilePropertiesObject.md#creationdate) +- [dataPacketsCount](AsfFilePropertiesObject.md#datapacketscount) +- [fileId](AsfFilePropertiesObject.md#fileid) +- [fileSize](AsfFilePropertiesObject.md#filesize) +- [flags](AsfFilePropertiesObject.md#flags) +- [guid](AsfFilePropertiesObject.md#guid) +- [maximumBitrate](AsfFilePropertiesObject.md#maximumbitrate) +- [maximumDataPacketSize](AsfFilePropertiesObject.md#maximumdatapacketsize) +- [minimumDataPacketSize](AsfFilePropertiesObject.md#minimumdatapacketsize) +- [objectType](AsfFilePropertiesObject.md#objecttype) +- [originalSize](AsfFilePropertiesObject.md#originalsize) +- [playDurationMilliseconds](AsfFilePropertiesObject.md#playdurationmilliseconds) +- [prerollMilliseconds](AsfFilePropertiesObject.md#prerollmilliseconds) +- [sendDurationMilliseconds](AsfFilePropertiesObject.md#senddurationmilliseconds) ### Methods -- [initializeFromFile](asffilepropertiesobject.md#initializefromfile) -- [initializeFromGuid](asffilepropertiesobject.md#initializefromguid) -- [render](asffilepropertiesobject.md#render) -- [renderInternal](asffilepropertiesobject.md#renderinternal) -- [fromFile](asffilepropertiesobject.md#fromfile) +- [initializeFromFile](AsfFilePropertiesObject.md#initializefromfile) +- [initializeFromGuid](AsfFilePropertiesObject.md#initializefromguid) +- [render](AsfFilePropertiesObject.md#render) +- [renderInternal](AsfFilePropertiesObject.md#renderinternal) +- [fromFile](AsfFilePropertiesObject.md#fromfile) ## Accessors @@ -100,15 +100,15 @@ Gets whether the file described by the current instance is broadcast or seekable bitwise OR of the flags in {@link FilePropertiesFlags}. * If {@link FilePropertiesFlags.Broadcast} is set, the following properties are not valid - * [fileId](asffilepropertiesobject.md#fileid) - * [creationDate](asffilepropertiesobject.md#creationdate) - * [dataPacketsCount](asffilepropertiesobject.md#datapacketscount) - * [playDurationMilliseconds](asffilepropertiesobject.md#playdurationmilliseconds) - * [sendDurationMilliseconds](asffilepropertiesobject.md#senddurationmilliseconds) - * [maximumDataPacketSize](asffilepropertiesobject.md#maximumdatapacketsize) and [minimumDataPacketSize](asffilepropertiesobject.md#minimumdatapacketsize) are set to the + * [fileId](AsfFilePropertiesObject.md#fileid) + * [creationDate](AsfFilePropertiesObject.md#creationdate) + * [dataPacketsCount](AsfFilePropertiesObject.md#datapacketscount) + * [playDurationMilliseconds](AsfFilePropertiesObject.md#playdurationmilliseconds) + * [sendDurationMilliseconds](AsfFilePropertiesObject.md#senddurationmilliseconds) + * [maximumDataPacketSize](AsfFilePropertiesObject.md#maximumdatapacketsize) and [minimumDataPacketSize](AsfFilePropertiesObject.md#minimumdatapacketsize) are set to the actual packet size * If {@link FilePropertiesFlags.Seekable} is set, an audio stream is present and the - [maximumDataPacketSize](asffilepropertiesobject.md#maximumdatapacketsize) and [minimumDataPacketSize](asffilepropertiesobject.md#minimumdatapacketsize) are set to the same + [maximumDataPacketSize](AsfFilePropertiesObject.md#maximumdatapacketsize) and [minimumDataPacketSize](AsfFilePropertiesObject.md#minimumdatapacketsize) are set to the same size. It can also be seekable if the file has an audio stream and a video stream with a matching simple index object. @@ -128,6 +128,10 @@ Gets the GUID that identifies the current instance. `default` +#### Inherited from + +BaseObject.guid + ___ ### maximumBitrate @@ -177,6 +181,10 @@ ___ `ObjectType` +#### Overrides + +BaseObject.objectType + ___ ### originalSize @@ -189,6 +197,10 @@ Gets the original size of the current instance. `number` +#### Inherited from + +BaseObject.originalSize + ___ ### playDurationMilliseconds @@ -241,7 +253,7 @@ file. | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File which contains the details of the new instance to create | +| `file` | [`File`](File.md) | File which contains the details of the new instance to create | | `position` | `number` | Position in `file` where the object begins | #### Returns @@ -278,13 +290,13 @@ ___ ### render -▸ **render**(): [`ByteVector`](bytevector.md) +▸ **render**(): [`ByteVector`](ByteVector.md) **`inheritdoc`** #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides @@ -294,7 +306,7 @@ ___ ### renderInternal -▸ `Protected` **renderInternal**(`data`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderInternal**(`data`): [`ByteVector`](ByteVector.md) Renders the current instance as a raw ASF object containing the specified data. @@ -305,11 +317,11 @@ Renders the current instance as a raw ASF object containing the specified data. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Data to store in the rendered version of the current instance. | +| `data` | [`ByteVector`](ByteVector.md) | Data to store in the rendered version of the current instance. | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from @@ -319,15 +331,15 @@ ___ ### fromFile -▸ `Static` **fromFile**(`file`, `position`): [`AsfFilePropertiesObject`](asffilepropertiesobject.md) +▸ `Static` **fromFile**(`file`, `position`): [`AsfFilePropertiesObject`](AsfFilePropertiesObject.md) #### Parameters | Name | Type | | :------ | :------ | -| `file` | [`File`](file.md) | +| `file` | [`File`](File.md) | | `position` | `number` | #### Returns -[`AsfFilePropertiesObject`](asffilepropertiesobject.md) +[`AsfFilePropertiesObject`](AsfFilePropertiesObject.md) diff --git a/docs/classes/asfheaderextensionobject.md b/docs/classes/AsfHeaderExtensionObject.md similarity index 74% rename from docs/classes/asfheaderextensionobject.md rename to docs/classes/AsfHeaderExtensionObject.md index 49edb1e9..26a53f0c 100644 --- a/docs/classes/asfheaderextensionobject.md +++ b/docs/classes/AsfHeaderExtensionObject.md @@ -7,7 +7,7 @@ object which can be read from and written to disk. ## Hierarchy -- `BaseObject` +- `default` ↳ **`AsfHeaderExtensionObject`** @@ -15,19 +15,19 @@ object which can be read from and written to disk. ### Accessors -- [children](asfheaderextensionobject.md#children) -- [guid](asfheaderextensionobject.md#guid) -- [objectType](asfheaderextensionobject.md#objecttype) -- [originalSize](asfheaderextensionobject.md#originalsize) +- [children](AsfHeaderExtensionObject.md#children) +- [guid](AsfHeaderExtensionObject.md#guid) +- [objectType](AsfHeaderExtensionObject.md#objecttype) +- [originalSize](AsfHeaderExtensionObject.md#originalsize) ### Methods -- [addUniqueObject](asfheaderextensionobject.md#adduniqueobject) -- [initializeFromFile](asfheaderextensionobject.md#initializefromfile) -- [initializeFromGuid](asfheaderextensionobject.md#initializefromguid) -- [render](asfheaderextensionobject.md#render) -- [renderInternal](asfheaderextensionobject.md#renderinternal) -- [fromFile](asfheaderextensionobject.md#fromfile) +- [addUniqueObject](AsfHeaderExtensionObject.md#adduniqueobject) +- [initializeFromFile](AsfHeaderExtensionObject.md#initializefromfile) +- [initializeFromGuid](AsfHeaderExtensionObject.md#initializefromguid) +- [render](AsfHeaderExtensionObject.md#render) +- [renderInternal](AsfHeaderExtensionObject.md#renderinternal) +- [fromFile](AsfHeaderExtensionObject.md#fromfile) ## Accessors @@ -59,6 +59,10 @@ Gets the GUID that identifies the current instance. `default` +#### Inherited from + +BaseObject.guid + ___ ### objectType @@ -71,6 +75,10 @@ ___ `ObjectType` +#### Overrides + +BaseObject.objectType + ___ ### originalSize @@ -83,6 +91,10 @@ Gets the original size of the current instance. `number` +#### Inherited from + +BaseObject.originalSize + ## Methods ### addUniqueObject @@ -114,7 +126,7 @@ file. | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File which contains the details of the new instance to create | +| `file` | [`File`](File.md) | File which contains the details of the new instance to create | | `position` | `number` | Position in `file` where the object begins | #### Returns @@ -151,13 +163,13 @@ ___ ### render -▸ **render**(): [`ByteVector`](bytevector.md) +▸ **render**(): [`ByteVector`](ByteVector.md) **`inheritdoc`** #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides @@ -167,7 +179,7 @@ ___ ### renderInternal -▸ `Protected` **renderInternal**(`data`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderInternal**(`data`): [`ByteVector`](ByteVector.md) Renders the current instance as a raw ASF object containing the specified data. @@ -178,11 +190,11 @@ Renders the current instance as a raw ASF object containing the specified data. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Data to store in the rendered version of the current instance. | +| `data` | [`ByteVector`](ByteVector.md) | Data to store in the rendered version of the current instance. | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from @@ -192,7 +204,7 @@ ___ ### fromFile -▸ `Static` **fromFile**(`file`, `position`): [`AsfHeaderExtensionObject`](asfheaderextensionobject.md) +▸ `Static` **fromFile**(`file`, `position`): [`AsfHeaderExtensionObject`](AsfHeaderExtensionObject.md) Constructs and initialized a new instance by reading the contents from a specified position in the provided file. @@ -201,9 +213,9 @@ in the provided file. | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File containing contents that will be read into the new instance | +| `file` | [`File`](File.md) | File containing contents that will be read into the new instance | | `position` | `number` | Position in the file where the instance begins | #### Returns -[`AsfHeaderExtensionObject`](asfheaderextensionobject.md) +[`AsfHeaderExtensionObject`](AsfHeaderExtensionObject.md) diff --git a/docs/classes/asfheaderobject.md b/docs/classes/AsfHeaderObject.md similarity index 73% rename from docs/classes/asfheaderobject.md rename to docs/classes/AsfHeaderObject.md index 10fc0263..5f7dd563 100644 --- a/docs/classes/asfheaderobject.md +++ b/docs/classes/AsfHeaderObject.md @@ -7,7 +7,7 @@ to disk. ## Hierarchy -- `BaseObject` +- `default` ↳ **`AsfHeaderObject`** @@ -15,23 +15,23 @@ to disk. ### Accessors -- [children](asfheaderobject.md#children) -- [extension](asfheaderobject.md#extension) -- [guid](asfheaderobject.md#guid) -- [hasContentDescriptors](asfheaderobject.md#hascontentdescriptors) -- [objectType](asfheaderobject.md#objecttype) -- [originalSize](asfheaderobject.md#originalsize) -- [properties](asfheaderobject.md#properties) +- [children](AsfHeaderObject.md#children) +- [extension](AsfHeaderObject.md#extension) +- [guid](AsfHeaderObject.md#guid) +- [hasContentDescriptors](AsfHeaderObject.md#hascontentdescriptors) +- [objectType](AsfHeaderObject.md#objecttype) +- [originalSize](AsfHeaderObject.md#originalsize) +- [properties](AsfHeaderObject.md#properties) ### Methods -- [addUniqueObject](asfheaderobject.md#adduniqueobject) -- [initializeFromFile](asfheaderobject.md#initializefromfile) -- [initializeFromGuid](asfheaderobject.md#initializefromguid) -- [removeContentDescriptor](asfheaderobject.md#removecontentdescriptor) -- [render](asfheaderobject.md#render) -- [renderInternal](asfheaderobject.md#renderinternal) -- [fromFile](asfheaderobject.md#fromfile) +- [addUniqueObject](AsfHeaderObject.md#adduniqueobject) +- [initializeFromFile](AsfHeaderObject.md#initializefromfile) +- [initializeFromGuid](AsfHeaderObject.md#initializefromguid) +- [removeContentDescriptor](AsfHeaderObject.md#removecontentdescriptor) +- [render](AsfHeaderObject.md#render) +- [renderInternal](AsfHeaderObject.md#renderinternal) +- [fromFile](AsfHeaderObject.md#fromfile) ## Accessors @@ -55,13 +55,13 @@ ___ ### extension -• `get` **extension**(): [`AsfHeaderExtensionObject`](asfheaderextensionobject.md) +• `get` **extension**(): [`AsfHeaderExtensionObject`](AsfHeaderExtensionObject.md) Gets the header extension object contained in the current instance. #### Returns -[`AsfHeaderExtensionObject`](asfheaderextensionobject.md) +[`AsfHeaderExtensionObject`](AsfHeaderExtensionObject.md) HeaderExtensionObject Header extension contained in this instance, if it exists. `undefined` is returned if it doesn't exist @@ -78,6 +78,10 @@ Gets the GUID that identifies the current instance. `default` +#### Inherited from + +BaseObject.guid + ___ ### hasContentDescriptors @@ -105,6 +109,10 @@ ___ `ObjectType` +#### Overrides + +BaseObject.objectType + ___ ### originalSize @@ -117,17 +125,21 @@ Gets the original size of the current instance. `number` +#### Inherited from + +BaseObject.originalSize + ___ ### properties -• `get` **properties**(): [`Properties`](properties.md) +• `get` **properties**(): [`Properties`](Properties.md) Get the media properties contained within the current instance. #### Returns -[`Properties`](properties.md) +[`Properties`](Properties.md) ## Methods @@ -160,7 +172,7 @@ file. | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File which contains the details of the new instance to create | +| `file` | [`File`](File.md) | File which contains the details of the new instance to create | | `position` | `number` | Position in `file` where the object begins | #### Returns @@ -209,13 +221,13 @@ ___ ### render -▸ **render**(): [`ByteVector`](bytevector.md) +▸ **render**(): [`ByteVector`](ByteVector.md) **`inheritdoc`** #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides @@ -225,7 +237,7 @@ ___ ### renderInternal -▸ `Protected` **renderInternal**(`data`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderInternal**(`data`): [`ByteVector`](ByteVector.md) Renders the current instance as a raw ASF object containing the specified data. @@ -236,11 +248,11 @@ Renders the current instance as a raw ASF object containing the specified data. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Data to store in the rendered version of the current instance. | +| `data` | [`ByteVector`](ByteVector.md) | Data to store in the rendered version of the current instance. | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from @@ -250,7 +262,7 @@ ___ ### fromFile -▸ `Static` **fromFile**(`file`, `position`): [`AsfHeaderObject`](asfheaderobject.md) +▸ `Static` **fromFile**(`file`, `position`): [`AsfHeaderObject`](AsfHeaderObject.md) Constructs and initializes a new instance by reading the contents from a specified position in the provided file. @@ -259,9 +271,9 @@ in the provided file. | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File containing contents that will be read into the new instance | +| `file` | [`File`](File.md) | File containing contents that will be read into the new instance | | `position` | `number` | Position in the file where the instance begins | #### Returns -[`AsfHeaderObject`](asfheaderobject.md) +[`AsfHeaderObject`](AsfHeaderObject.md) diff --git a/docs/classes/AsfMetadataDescriptor.md b/docs/classes/AsfMetadataDescriptor.md new file mode 100644 index 00000000..e2414ab3 --- /dev/null +++ b/docs/classes/AsfMetadataDescriptor.md @@ -0,0 +1,303 @@ +[node-taglib-sharp](../README.md) / [Exports](../modules.md) / AsfMetadataDescriptor + +# Class: AsfMetadataDescriptor + +This class provides a representation of an ASF description record to be used inside a +MetadataLibraryObject. + +**`remarks`** This class can store various types of information. Although [toString](AsfMetadataDescriptor.md#tostring) provides + a representation of all types of values, it is recommended to determine which of the `get*` + methods to use by accessing [type](AsfMetadataDescriptor.md#type) + +## Hierarchy + +- `DescriptorBase` + + ↳ **`AsfMetadataDescriptor`** + +## Table of contents + +### Constructors + +- [constructor](AsfMetadataDescriptor.md#constructor) + +### Accessors + +- [boolValue](AsfMetadataDescriptor.md#boolvalue) +- [byteValue](AsfMetadataDescriptor.md#bytevalue) +- [guidValue](AsfMetadataDescriptor.md#guidvalue) +- [languageListIndex](AsfMetadataDescriptor.md#languagelistindex) +- [name](AsfMetadataDescriptor.md#name) +- [streamNumber](AsfMetadataDescriptor.md#streamnumber) +- [stringValue](AsfMetadataDescriptor.md#stringvalue) +- [type](AsfMetadataDescriptor.md#type) +- [uintValue](AsfMetadataDescriptor.md#uintvalue) +- [ulongValue](AsfMetadataDescriptor.md#ulongvalue) +- [ushortValue](AsfMetadataDescriptor.md#ushortvalue) + +### Methods + +- [render](AsfMetadataDescriptor.md#render) +- [toString](AsfMetadataDescriptor.md#tostring) +- [fromFile](AsfMetadataDescriptor.md#fromfile) + +## Constructors + +### constructor + +• **new AsfMetadataDescriptor**(`languageListIndex`, `streamNumber`, `name`, `type`, `value`) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `languageListIndex` | `number` | +| `streamNumber` | `number` | +| `name` | `string` | +| `type` | [`AsfObjectDataType`](../enums/AsfObjectDataType.md) | +| `value` | `DescriptorValue` | + +#### Overrides + +DescriptorBase.constructor + +## Accessors + +### boolValue + +• `get` **boolValue**(): `boolean` + +Gets the boolean value of the current instance. + +#### Returns + +`boolean` + +boolean Boolean value of the current instance is returned if [type](AsfMetadataDescriptor.md#type) is + {@link DataType.Bool}. `undefined` is returned otherwise. + +#### Inherited from + +DescriptorBase.boolValue + +___ + +### byteValue + +• `get` **byteValue**(): [`ByteVector`](ByteVector.md) + +Gets the binary contents of the current instance. + +#### Returns + +[`ByteVector`](ByteVector.md) + +ByteVector Byte contents of the current instance, if [type](AsfMetadataDescriptor.md#type) is + {@link DataType.Bytes}. `undefined` is returned otherwise. + +#### Inherited from + +DescriptorBase.byteValue + +___ + +### guidValue + +• `get` **guidValue**(): `default` + +Gets the guid contents of the current instance. + +#### Returns + +`default` + +UuidWrapper GUID contents of the current instance, if [type](AsfMetadataDescriptor.md#type) is + {@link DataType.Guid}. `undefined` is returned otherwise. + +#### Inherited from + +DescriptorBase.guidValue + +___ + +### languageListIndex + +• `get` **languageListIndex**(): `number` + +Gets the index of the language associated with the current instance. + +#### Returns + +`number` + +___ + +### name + +• `get` **name**(): `string` + +Gets the name of the current instance. + +#### Returns + +`string` + +#### Inherited from + +DescriptorBase.name + +___ + +### streamNumber + +• `get` **streamNumber**(): `number` + +Gets the index of the stream associated with the current instance. + +#### Returns + +`number` + +___ + +### stringValue + +• `get` **stringValue**(): `string` + +Gets the string contents of the current instance. + +#### Returns + +`string` + +string String contents of the current instance if [type](AsfMetadataDescriptor.md#type) is + {@link DataType.Unicode}. `undefined` is returned otherwise. + +#### Inherited from + +DescriptorBase.stringValue + +___ + +### type + +• `get` **type**(): [`AsfObjectDataType`](../enums/AsfObjectDataType.md) + +Gets the type of data contained in the current instance. + +#### Returns + +[`AsfObjectDataType`](../enums/AsfObjectDataType.md) + +#### Inherited from + +DescriptorBase.type + +___ + +### uintValue + +• `get` **uintValue**(): `number` + +Gets the 32-bit double word contents of the current instance. + +#### Returns + +`number` + +number Double word contents of the current instance, if [type](AsfMetadataDescriptor.md#type) is + {@link DataType.DWord}. `undefined` is returned otherwise. + +#### Inherited from + +DescriptorBase.uintValue + +___ + +### ulongValue + +• `get` **ulongValue**(): `bigint` + +Gets the 64-bit quad word contents of the current instance. + +#### Returns + +`bigint` + +bigint Quad word contents of the current instance, if [type](AsfMetadataDescriptor.md#type) is + {@link DataType.QWord}. `undefined` is returned otherwise. + +#### Inherited from + +DescriptorBase.ulongValue + +___ + +### ushortValue + +• `get` **ushortValue**(): `number` + +Gets the 16-bit word contents of the current instance. + +#### Returns + +`number` + +number Word contents of the current instance, if [type](AsfMetadataDescriptor.md#type) is + {@link DataType.Word}. `undefined` is returned otherwise. + +#### Inherited from + +DescriptorBase.ushortValue + +## Methods + +### render + +▸ **render**(): [`ByteVector`](ByteVector.md) + +**`inheritdoc`** + +#### Returns + +[`ByteVector`](ByteVector.md) + +#### Overrides + +DescriptorBase.render + +___ + +### toString + +▸ **toString**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +DescriptorBase.toString + +___ + +### fromFile + +▸ `Static` **fromFile**(`file`): [`AsfMetadataDescriptor`](AsfMetadataDescriptor.md) + +Instantiates a new instance by reading in the contents from a file. + +**`internal`** + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `file` | [`File`](File.md) | The file to read the raw ASF description record from | + +#### Returns + +[`AsfMetadataDescriptor`](AsfMetadataDescriptor.md) diff --git a/docs/classes/asfmetadatalibraryobject.md b/docs/classes/AsfMetadataLibraryObject.md similarity index 72% rename from docs/classes/asfmetadatalibraryobject.md rename to docs/classes/AsfMetadataLibraryObject.md index a694c6c8..4114cb13 100644 --- a/docs/classes/asfmetadatalibraryobject.md +++ b/docs/classes/AsfMetadataLibraryObject.md @@ -7,7 +7,7 @@ and written to disk. ## Hierarchy -- `BaseObject` +- `default` ↳ **`AsfMetadataLibraryObject`** @@ -15,24 +15,24 @@ and written to disk. ### Accessors -- [guid](asfmetadatalibraryobject.md#guid) -- [isEmpty](asfmetadatalibraryobject.md#isempty) -- [objectType](asfmetadatalibraryobject.md#objecttype) -- [originalSize](asfmetadatalibraryobject.md#originalsize) -- [records](asfmetadatalibraryobject.md#records) +- [guid](AsfMetadataLibraryObject.md#guid) +- [isEmpty](AsfMetadataLibraryObject.md#isempty) +- [objectType](AsfMetadataLibraryObject.md#objecttype) +- [originalSize](AsfMetadataLibraryObject.md#originalsize) +- [records](AsfMetadataLibraryObject.md#records) ### Methods -- [addRecord](asfmetadatalibraryobject.md#addrecord) -- [getRecords](asfmetadatalibraryobject.md#getrecords) -- [initializeFromFile](asfmetadatalibraryobject.md#initializefromfile) -- [initializeFromGuid](asfmetadatalibraryobject.md#initializefromguid) -- [removeRecords](asfmetadatalibraryobject.md#removerecords) -- [render](asfmetadatalibraryobject.md#render) -- [renderInternal](asfmetadatalibraryobject.md#renderinternal) -- [setRecords](asfmetadatalibraryobject.md#setrecords) -- [fromEmpty](asfmetadatalibraryobject.md#fromempty) -- [fromFile](asfmetadatalibraryobject.md#fromfile) +- [addRecord](AsfMetadataLibraryObject.md#addrecord) +- [getRecords](AsfMetadataLibraryObject.md#getrecords) +- [initializeFromFile](AsfMetadataLibraryObject.md#initializefromfile) +- [initializeFromGuid](AsfMetadataLibraryObject.md#initializefromguid) +- [removeRecords](AsfMetadataLibraryObject.md#removerecords) +- [render](AsfMetadataLibraryObject.md#render) +- [renderInternal](AsfMetadataLibraryObject.md#renderinternal) +- [setRecords](AsfMetadataLibraryObject.md#setrecords) +- [fromEmpty](AsfMetadataLibraryObject.md#fromempty) +- [fromFile](AsfMetadataLibraryObject.md#fromfile) ## Accessors @@ -46,6 +46,10 @@ Gets the GUID that identifies the current instance. `default` +#### Inherited from + +BaseObject.guid + ___ ### isEmpty @@ -73,6 +77,10 @@ ___ `ObjectType` +#### Overrides + +BaseObject.objectType + ___ ### originalSize @@ -85,17 +93,21 @@ Gets the original size of the current instance. `number` +#### Inherited from + +BaseObject.originalSize + ___ ### records -• `get` **records**(): [`AsfMetadataDescriptor`](asfmetadatadescriptor.md)[] +• `get` **records**(): [`AsfMetadataDescriptor`](AsfMetadataDescriptor.md)[] Gets all records stored in the current instance. #### Returns -[`AsfMetadataDescriptor`](asfmetadatadescriptor.md)[] +[`AsfMetadataDescriptor`](AsfMetadataDescriptor.md)[] ## Methods @@ -109,7 +121,7 @@ Adds a record to the current instance. | Name | Type | Description | | :------ | :------ | :------ | -| `record` | [`AsfMetadataDescriptor`](asfmetadatadescriptor.md) | Record to add to the current instance | +| `record` | [`AsfMetadataDescriptor`](AsfMetadataDescriptor.md) | Record to add to the current instance | #### Returns @@ -119,7 +131,7 @@ ___ ### getRecords -▸ **getRecords**(`languageListIndex`, `streamNumber`, ...`names`): [`AsfMetadataDescriptor`](asfmetadatadescriptor.md)[] +▸ **getRecords**(`languageListIndex`, `streamNumber`, ...`names`): [`AsfMetadataDescriptor`](AsfMetadataDescriptor.md)[] Gets all records with a given language, stream, and any of a collection of names from the current instance. @@ -134,7 +146,7 @@ current instance. #### Returns -[`AsfMetadataDescriptor`](asfmetadatadescriptor.md)[] +[`AsfMetadataDescriptor`](AsfMetadataDescriptor.md)[] ___ @@ -149,7 +161,7 @@ file. | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File which contains the details of the new instance to create | +| `file` | [`File`](File.md) | File which contains the details of the new instance to create | | `position` | `number` | Position in `file` where the object begins | #### Returns @@ -206,13 +218,13 @@ ___ ### render -▸ **render**(): [`ByteVector`](bytevector.md) +▸ **render**(): [`ByteVector`](ByteVector.md) **`inheritdoc`** #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides @@ -222,7 +234,7 @@ ___ ### renderInternal -▸ `Protected` **renderInternal**(`data`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderInternal**(`data`): [`ByteVector`](ByteVector.md) Renders the current instance as a raw ASF object containing the specified data. @@ -233,11 +245,11 @@ Renders the current instance as a raw ASF object containing the specified data. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Data to store in the rendered version of the current instance. | +| `data` | [`ByteVector`](ByteVector.md) | Data to store in the rendered version of the current instance. | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from @@ -265,7 +277,7 @@ records that match. | `languageListIndex` | `number` | Index of the desired language in the language list | | `streamNumber` | `number` | Index of the stream in the file the desired records applies to | | `name` | `string` | Names of the records to remove | -| `...records` | [`AsfMetadataDescriptor`](asfmetadatadescriptor.md)[] | Records to insert into the current instance | +| `...records` | [`AsfMetadataDescriptor`](AsfMetadataDescriptor.md)[] | Records to insert into the current instance | #### Returns @@ -275,27 +287,27 @@ ___ ### fromEmpty -▸ `Static` **fromEmpty**(): [`AsfMetadataLibraryObject`](asfmetadatalibraryobject.md) +▸ `Static` **fromEmpty**(): [`AsfMetadataLibraryObject`](AsfMetadataLibraryObject.md) Constructs and initializes a new instance that does not contain any records. #### Returns -[`AsfMetadataLibraryObject`](asfmetadatalibraryobject.md) +[`AsfMetadataLibraryObject`](AsfMetadataLibraryObject.md) ___ ### fromFile -▸ `Static` **fromFile**(`file`, `position`): [`AsfMetadataLibraryObject`](asfmetadatalibraryobject.md) +▸ `Static` **fromFile**(`file`, `position`): [`AsfMetadataLibraryObject`](AsfMetadataLibraryObject.md) #### Parameters | Name | Type | | :------ | :------ | -| `file` | [`File`](file.md) | +| `file` | [`File`](File.md) | | `position` | `number` | #### Returns -[`AsfMetadataLibraryObject`](asfmetadatalibraryobject.md) +[`AsfMetadataLibraryObject`](AsfMetadataLibraryObject.md) diff --git a/docs/classes/asfpaddingobject.md b/docs/classes/AsfPaddingObject.md similarity index 73% rename from docs/classes/asfpaddingobject.md rename to docs/classes/AsfPaddingObject.md index 34342a6f..1d95627c 100644 --- a/docs/classes/asfpaddingobject.md +++ b/docs/classes/AsfPaddingObject.md @@ -7,7 +7,7 @@ written to disk. ## Hierarchy -- `BaseObject` +- `default` ↳ **`AsfPaddingObject`** @@ -15,23 +15,23 @@ written to disk. ### Properties -- [HEADER\_LENGTH](asfpaddingobject.md#header_length) +- [HEADER\_LENGTH](AsfPaddingObject.md#header_length) ### Accessors -- [guid](asfpaddingobject.md#guid) -- [objectType](asfpaddingobject.md#objecttype) -- [originalSize](asfpaddingobject.md#originalsize) -- [size](asfpaddingobject.md#size) +- [guid](AsfPaddingObject.md#guid) +- [objectType](AsfPaddingObject.md#objecttype) +- [originalSize](AsfPaddingObject.md#originalsize) +- [size](AsfPaddingObject.md#size) ### Methods -- [initializeFromFile](asfpaddingobject.md#initializefromfile) -- [initializeFromGuid](asfpaddingobject.md#initializefromguid) -- [render](asfpaddingobject.md#render) -- [renderInternal](asfpaddingobject.md#renderinternal) -- [fromFile](asfpaddingobject.md#fromfile) -- [fromSize](asfpaddingobject.md#fromsize) +- [initializeFromFile](AsfPaddingObject.md#initializefromfile) +- [initializeFromGuid](AsfPaddingObject.md#initializefromguid) +- [render](AsfPaddingObject.md#render) +- [renderInternal](AsfPaddingObject.md#renderinternal) +- [fromFile](AsfPaddingObject.md#fromfile) +- [fromSize](AsfPaddingObject.md#fromsize) ## Properties @@ -51,6 +51,10 @@ Gets the GUID that identifies the current instance. `default` +#### Inherited from + +BaseObject.guid + ___ ### objectType @@ -63,6 +67,10 @@ ___ `ObjectType` +#### Overrides + +BaseObject.objectType + ___ ### originalSize @@ -75,6 +83,10 @@ Gets the original size of the current instance. `number` +#### Inherited from + +BaseObject.originalSize + ___ ### size @@ -116,7 +128,7 @@ file. | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File which contains the details of the new instance to create | +| `file` | [`File`](File.md) | File which contains the details of the new instance to create | | `position` | `number` | Position in `file` where the object begins | #### Returns @@ -153,13 +165,13 @@ ___ ### render -▸ **render**(): [`ByteVector`](bytevector.md) +▸ **render**(): [`ByteVector`](ByteVector.md) **`inheritdoc`** #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides @@ -169,7 +181,7 @@ ___ ### renderInternal -▸ `Protected` **renderInternal**(`data`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderInternal**(`data`): [`ByteVector`](ByteVector.md) Renders the current instance as a raw ASF object containing the specified data. @@ -180,11 +192,11 @@ Renders the current instance as a raw ASF object containing the specified data. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Data to store in the rendered version of the current instance. | +| `data` | [`ByteVector`](ByteVector.md) | Data to store in the rendered version of the current instance. | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from @@ -194,7 +206,7 @@ ___ ### fromFile -▸ `Static` **fromFile**(`file`, `position`): [`AsfPaddingObject`](asfpaddingobject.md) +▸ `Static` **fromFile**(`file`, `position`): [`AsfPaddingObject`](AsfPaddingObject.md) Constructs and initializes a new instance by reading it from a file. @@ -202,18 +214,18 @@ Constructs and initializes a new instance by reading it from a file. | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File to read the padding object from | +| `file` | [`File`](File.md) | File to read the padding object from | | `position` | `number` | Index into the file where the padding object starts from | #### Returns -[`AsfPaddingObject`](asfpaddingobject.md) +[`AsfPaddingObject`](AsfPaddingObject.md) ___ ### fromSize -▸ `Static` **fromSize**(`size`): [`AsfPaddingObject`](asfpaddingobject.md) +▸ `Static` **fromSize**(`size`): [`AsfPaddingObject`](AsfPaddingObject.md) Constructs and initializes a new instance with a fixed size. @@ -225,4 +237,4 @@ Constructs and initializes a new instance with a fixed size. #### Returns -[`AsfPaddingObject`](asfpaddingobject.md) +[`AsfPaddingObject`](AsfPaddingObject.md) diff --git a/docs/classes/asfstreampropertiesobject.md b/docs/classes/AsfStreamPropertiesObject.md similarity index 67% rename from docs/classes/asfstreampropertiesobject.md rename to docs/classes/AsfStreamPropertiesObject.md index 848b1775..897a3cab 100644 --- a/docs/classes/asfstreampropertiesobject.md +++ b/docs/classes/AsfStreamPropertiesObject.md @@ -7,7 +7,7 @@ written to disk. ## Hierarchy -- `BaseObject` +- `default` ↳ **`AsfStreamPropertiesObject`** @@ -15,49 +15,49 @@ written to disk. ### Accessors -- [codec](asfstreampropertiesobject.md#codec) -- [errorCorrectionData](asfstreampropertiesobject.md#errorcorrectiondata) -- [errorCorrectionType](asfstreampropertiesobject.md#errorcorrectiontype) -- [flags](asfstreampropertiesobject.md#flags) -- [guid](asfstreampropertiesobject.md#guid) -- [objectType](asfstreampropertiesobject.md#objecttype) -- [originalSize](asfstreampropertiesobject.md#originalsize) -- [streamNumber](asfstreampropertiesobject.md#streamnumber) -- [streamType](asfstreampropertiesobject.md#streamtype) -- [timeOffsetMilliseconds](asfstreampropertiesobject.md#timeoffsetmilliseconds) -- [typeSpecificData](asfstreampropertiesobject.md#typespecificdata) +- [codec](AsfStreamPropertiesObject.md#codec) +- [errorCorrectionData](AsfStreamPropertiesObject.md#errorcorrectiondata) +- [errorCorrectionType](AsfStreamPropertiesObject.md#errorcorrectiontype) +- [flags](AsfStreamPropertiesObject.md#flags) +- [guid](AsfStreamPropertiesObject.md#guid) +- [objectType](AsfStreamPropertiesObject.md#objecttype) +- [originalSize](AsfStreamPropertiesObject.md#originalsize) +- [streamNumber](AsfStreamPropertiesObject.md#streamnumber) +- [streamType](AsfStreamPropertiesObject.md#streamtype) +- [timeOffsetMilliseconds](AsfStreamPropertiesObject.md#timeoffsetmilliseconds) +- [typeSpecificData](AsfStreamPropertiesObject.md#typespecificdata) ### Methods -- [initializeFromFile](asfstreampropertiesobject.md#initializefromfile) -- [initializeFromGuid](asfstreampropertiesobject.md#initializefromguid) -- [render](asfstreampropertiesobject.md#render) -- [renderInternal](asfstreampropertiesobject.md#renderinternal) -- [fromFile](asfstreampropertiesobject.md#fromfile) +- [initializeFromFile](AsfStreamPropertiesObject.md#initializefromfile) +- [initializeFromGuid](AsfStreamPropertiesObject.md#initializefromguid) +- [render](AsfStreamPropertiesObject.md#render) +- [renderInternal](AsfStreamPropertiesObject.md#renderinternal) +- [fromFile](AsfStreamPropertiesObject.md#fromfile) ## Accessors ### codec -• `get` **codec**(): [`ICodec`](../interfaces/icodec.md) +• `get` **codec**(): [`ICodec`](../interfaces/ICodec.md) Gets the codec information contained in the current instance. #### Returns -[`ICodec`](../interfaces/icodec.md) +[`ICodec`](../interfaces/ICodec.md) ___ ### errorCorrectionData -• `get` **errorCorrectionData**(): [`ByteVector`](bytevector.md) +• `get` **errorCorrectionData**(): [`ByteVector`](ByteVector.md) Gets the error correction data contained in the current instance. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ___ @@ -101,6 +101,10 @@ Gets the GUID that identifies the current instance. `default` +#### Inherited from + +BaseObject.guid + ___ ### objectType @@ -113,6 +117,10 @@ ___ `ObjectType` +#### Overrides + +BaseObject.objectType + ___ ### originalSize @@ -125,6 +133,10 @@ Gets the original size of the current instance. `number` +#### Inherited from + +BaseObject.originalSize + ___ ### streamNumber @@ -165,15 +177,15 @@ ___ ### typeSpecificData -• `get` **typeSpecificData**(): [`ByteVector`](bytevector.md) +• `get` **typeSpecificData**(): [`ByteVector`](ByteVector.md) Gets the type specific data contained in the current instance. -**`remarks`** The parsed version of this data is available in [codec](asfstreampropertiesobject.md#codec). +**`remarks`** The parsed version of this data is available in [codec](AsfStreamPropertiesObject.md#codec). #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ## Methods @@ -188,7 +200,7 @@ file. | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File which contains the details of the new instance to create | +| `file` | [`File`](File.md) | File which contains the details of the new instance to create | | `position` | `number` | Position in `file` where the object begins | #### Returns @@ -225,13 +237,13 @@ ___ ### render -▸ **render**(): [`ByteVector`](bytevector.md) +▸ **render**(): [`ByteVector`](ByteVector.md) **`inheritdoc`** #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides @@ -241,7 +253,7 @@ ___ ### renderInternal -▸ `Protected` **renderInternal**(`data`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderInternal**(`data`): [`ByteVector`](ByteVector.md) Renders the current instance as a raw ASF object containing the specified data. @@ -252,11 +264,11 @@ Renders the current instance as a raw ASF object containing the specified data. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Data to store in the rendered version of the current instance. | +| `data` | [`ByteVector`](ByteVector.md) | Data to store in the rendered version of the current instance. | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from @@ -266,7 +278,7 @@ ___ ### fromFile -▸ `Static` **fromFile**(`file`, `position`): [`AsfStreamPropertiesObject`](asfstreampropertiesobject.md) +▸ `Static` **fromFile**(`file`, `position`): [`AsfStreamPropertiesObject`](AsfStreamPropertiesObject.md) Constructs and initializes a new instance by reading contents from a specified position in the provided file. @@ -275,9 +287,9 @@ the provided file. | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File from which the contents of the new instance will be read | +| `file` | [`File`](File.md) | File from which the contents of the new instance will be read | | `position` | `number` | Index into the file where the stream properties object begins | #### Returns -[`AsfStreamPropertiesObject`](asfstreampropertiesobject.md) +[`AsfStreamPropertiesObject`](AsfStreamPropertiesObject.md) diff --git a/docs/classes/asftag.md b/docs/classes/AsfTag.md similarity index 61% rename from docs/classes/asftag.md rename to docs/classes/AsfTag.md index f375f65d..e2d0b519 100644 --- a/docs/classes/asftag.md +++ b/docs/classes/AsfTag.md @@ -2,12 +2,12 @@ # Class: AsfTag -This class extends [Tag](tag.md) to provide a representation of an ASF tag which can be read from +This class extends [Tag](Tag.md) to provide a representation of an ASF tag which can be read from and written to disk. ## Hierarchy -- [`Tag`](tag.md) +- [`Tag`](Tag.md) ↳ **`AsfTag`** @@ -15,94 +15,95 @@ and written to disk. ### Accessors -- [album](asftag.md#album) -- [albumArtists](asftag.md#albumartists) -- [albumArtistsSort](asftag.md#albumartistssort) -- [albumSort](asftag.md#albumsort) -- [amazonId](asftag.md#amazonid) -- [beatsPerMinute](asftag.md#beatsperminute) -- [comment](asftag.md#comment) -- [composers](asftag.md#composers) -- [composersSort](asftag.md#composerssort) -- [conductor](asftag.md#conductor) -- [contentDescriptionObject](asftag.md#contentdescriptionobject) -- [copyright](asftag.md#copyright) -- [dateTagged](asftag.md#datetagged) -- [description](asftag.md#description) -- [disc](asftag.md#disc) -- [discCount](asftag.md#disccount) -- [extendedContentDescriptionObject](asftag.md#extendedcontentdescriptionobject) -- [firstAlbumArtist](asftag.md#firstalbumartist) -- [firstAlbumArtistSort](asftag.md#firstalbumartistsort) -- [firstComposer](asftag.md#firstcomposer) -- [firstComposerSort](asftag.md#firstcomposersort) -- [firstGenre](asftag.md#firstgenre) -- [firstPerformer](asftag.md#firstperformer) -- [firstPerformerSort](asftag.md#firstperformersort) -- [genres](asftag.md#genres) -- [grouping](asftag.md#grouping) -- [initialKey](asftag.md#initialkey) -- [isEmpty](asftag.md#isempty) -- [isrc](asftag.md#isrc) -- [joinedAlbumArtists](asftag.md#joinedalbumartists) -- [joinedComposers](asftag.md#joinedcomposers) -- [joinedGenres](asftag.md#joinedgenres) -- [joinedPerformers](asftag.md#joinedperformers) -- [joinedPerformersSort](asftag.md#joinedperformerssort) -- [lyrics](asftag.md#lyrics) -- [metadataLibraryObject](asftag.md#metadatalibraryobject) -- [musicBrainzAlbumArtistId](asftag.md#musicbrainzalbumartistid) -- [musicBrainzArtistId](asftag.md#musicbrainzartistid) -- [musicBrainzDiscId](asftag.md#musicbrainzdiscid) -- [musicBrainzReleaseArtistId](asftag.md#musicbrainzreleaseartistid) -- [musicBrainzReleaseCountry](asftag.md#musicbrainzreleasecountry) -- [musicBrainzReleaseGroupId](asftag.md#musicbrainzreleasegroupid) -- [musicBrainzReleaseId](asftag.md#musicbrainzreleaseid) -- [musicBrainzReleaseStatus](asftag.md#musicbrainzreleasestatus) -- [musicBrainzReleaseType](asftag.md#musicbrainzreleasetype) -- [musicBrainzTrackId](asftag.md#musicbrainztrackid) -- [musicIpId](asftag.md#musicipid) -- [performers](asftag.md#performers) -- [performersRole](asftag.md#performersrole) -- [performersSort](asftag.md#performerssort) -- [pictures](asftag.md#pictures) -- [publisher](asftag.md#publisher) -- [remixedBy](asftag.md#remixedby) -- [replayGainAlbumGain](asftag.md#replaygainalbumgain) -- [replayGainAlbumPeak](asftag.md#replaygainalbumpeak) -- [replayGainTrackGain](asftag.md#replaygaintrackgain) -- [replayGainTrackPeak](asftag.md#replaygaintrackpeak) -- [sizeOnDisk](asftag.md#sizeondisk) -- [subtitle](asftag.md#subtitle) -- [tagTypes](asftag.md#tagtypes) -- [title](asftag.md#title) -- [titleSort](asftag.md#titlesort) -- [track](asftag.md#track) -- [trackCount](asftag.md#trackcount) -- [year](asftag.md#year) +- [album](AsfTag.md#album) +- [albumArtists](AsfTag.md#albumartists) +- [albumArtistsSort](AsfTag.md#albumartistssort) +- [albumSort](AsfTag.md#albumsort) +- [amazonId](AsfTag.md#amazonid) +- [beatsPerMinute](AsfTag.md#beatsperminute) +- [comment](AsfTag.md#comment) +- [composers](AsfTag.md#composers) +- [composersSort](AsfTag.md#composerssort) +- [conductor](AsfTag.md#conductor) +- [contentDescriptionObject](AsfTag.md#contentdescriptionobject) +- [copyright](AsfTag.md#copyright) +- [dateTagged](AsfTag.md#datetagged) +- [description](AsfTag.md#description) +- [disc](AsfTag.md#disc) +- [discCount](AsfTag.md#disccount) +- [extendedContentDescriptionObject](AsfTag.md#extendedcontentdescriptionobject) +- [firstAlbumArtist](AsfTag.md#firstalbumartist) +- [firstAlbumArtistSort](AsfTag.md#firstalbumartistsort) +- [firstComposer](AsfTag.md#firstcomposer) +- [firstComposerSort](AsfTag.md#firstcomposersort) +- [firstGenre](AsfTag.md#firstgenre) +- [firstPerformer](AsfTag.md#firstperformer) +- [firstPerformerSort](AsfTag.md#firstperformersort) +- [genres](AsfTag.md#genres) +- [grouping](AsfTag.md#grouping) +- [initialKey](AsfTag.md#initialkey) +- [isCompilation](AsfTag.md#iscompilation) +- [isEmpty](AsfTag.md#isempty) +- [isrc](AsfTag.md#isrc) +- [joinedAlbumArtists](AsfTag.md#joinedalbumartists) +- [joinedComposers](AsfTag.md#joinedcomposers) +- [joinedGenres](AsfTag.md#joinedgenres) +- [joinedPerformers](AsfTag.md#joinedperformers) +- [joinedPerformersSort](AsfTag.md#joinedperformerssort) +- [lyrics](AsfTag.md#lyrics) +- [metadataLibraryObject](AsfTag.md#metadatalibraryobject) +- [musicBrainzAlbumArtistId](AsfTag.md#musicbrainzalbumartistid) +- [musicBrainzArtistId](AsfTag.md#musicbrainzartistid) +- [musicBrainzDiscId](AsfTag.md#musicbrainzdiscid) +- [musicBrainzReleaseArtistId](AsfTag.md#musicbrainzreleaseartistid) +- [musicBrainzReleaseCountry](AsfTag.md#musicbrainzreleasecountry) +- [musicBrainzReleaseGroupId](AsfTag.md#musicbrainzreleasegroupid) +- [musicBrainzReleaseId](AsfTag.md#musicbrainzreleaseid) +- [musicBrainzReleaseStatus](AsfTag.md#musicbrainzreleasestatus) +- [musicBrainzReleaseType](AsfTag.md#musicbrainzreleasetype) +- [musicBrainzTrackId](AsfTag.md#musicbrainztrackid) +- [musicIpId](AsfTag.md#musicipid) +- [performers](AsfTag.md#performers) +- [performersRole](AsfTag.md#performersrole) +- [performersSort](AsfTag.md#performerssort) +- [pictures](AsfTag.md#pictures) +- [publisher](AsfTag.md#publisher) +- [remixedBy](AsfTag.md#remixedby) +- [replayGainAlbumGain](AsfTag.md#replaygainalbumgain) +- [replayGainAlbumPeak](AsfTag.md#replaygainalbumpeak) +- [replayGainTrackGain](AsfTag.md#replaygaintrackgain) +- [replayGainTrackPeak](AsfTag.md#replaygaintrackpeak) +- [sizeOnDisk](AsfTag.md#sizeondisk) +- [subtitle](AsfTag.md#subtitle) +- [tagTypes](AsfTag.md#tagtypes) +- [title](AsfTag.md#title) +- [titleSort](AsfTag.md#titlesort) +- [track](AsfTag.md#track) +- [trackCount](AsfTag.md#trackcount) +- [year](AsfTag.md#year) ### Methods -- [addDescriptor](asftag.md#adddescriptor) -- [clear](asftag.md#clear) -- [copyTo](asftag.md#copyto) -- [getDescriptorString](asftag.md#getdescriptorstring) -- [getDescriptorStrings](asftag.md#getdescriptorstrings) -- [getDescriptorUint](asftag.md#getdescriptoruint) -- [getDescriptors](asftag.md#getdescriptors) -- [removeDescriptors](asftag.md#removedescriptors) -- [setDescriptorString](asftag.md#setdescriptorstring) -- [setDescriptorStrings](asftag.md#setdescriptorstrings) -- [setDescriptors](asftag.md#setdescriptors) -- [setInfoTag](asftag.md#setinfotag) -- [firstInGroup](asftag.md#firstingroup) -- [fromEmpty](asftag.md#fromempty) -- [fromHeader](asftag.md#fromheader) -- [isFalsyOrLikeEmpty](asftag.md#isfalsyorlikeempty) -- [joinGroup](asftag.md#joingroup) -- [pictureFromData](asftag.md#picturefromdata) -- [pictureToData](asftag.md#picturetodata) -- [tagTypeFlagsToArray](asftag.md#tagtypeflagstoarray) +- [addDescriptor](AsfTag.md#adddescriptor) +- [clear](AsfTag.md#clear) +- [copyTo](AsfTag.md#copyto) +- [getDescriptorString](AsfTag.md#getdescriptorstring) +- [getDescriptorStrings](AsfTag.md#getdescriptorstrings) +- [getDescriptorUint](AsfTag.md#getdescriptoruint) +- [getDescriptors](AsfTag.md#getdescriptors) +- [removeDescriptors](AsfTag.md#removedescriptors) +- [setDescriptorString](AsfTag.md#setdescriptorstring) +- [setDescriptorStrings](AsfTag.md#setdescriptorstrings) +- [setDescriptors](AsfTag.md#setdescriptors) +- [setInfoTag](AsfTag.md#setinfotag) +- [firstInGroup](AsfTag.md#firstingroup) +- [fromEmpty](AsfTag.md#fromempty) +- [fromHeader](AsfTag.md#fromheader) +- [isFalsyOrLikeEmpty](AsfTag.md#isfalsyorlikeempty) +- [joinGroup](AsfTag.md#joingroup) +- [pictureFromData](AsfTag.md#picturefromdata) +- [pictureToData](AsfTag.md#picturetodata) +- [tagTypeFlagsToArray](AsfTag.md#tagtypeflagstoarray) ## Accessors @@ -110,9 +111,6 @@ and written to disk. • `get` **album**(): `string` -Gets the album of the media represented by the current instance. For video media, this -represents the collection the video belongs to. - **`inheritdoc`** **`remarks`** via `WM/AlbumTitle` or `Album` descriptors @@ -122,13 +120,11 @@ represents the collection the video belongs to. `string` -Album of the media represented by the current instance or `undefined` if no value - is present +#### Overrides -• `set` **album**(`value`): `void` +Tag.album -Gets the album of the media represented by the current instance. For video media, this -represents the collection the video belongs to. +• `set` **album**(`value`): `void` **`inheritdoc`** @@ -145,8 +141,9 @@ represents the collection the video belongs to. `void` -Album of the media represented by the current instance or `undefined` if no value - is present +#### Overrides + +Tag.album ___ @@ -154,9 +151,6 @@ ___ • `get` **albumArtists**(): `string`[] -Gets the band or artist who is credited credited in the creation of the entire album or -collection containing the media described by the current instance. - **`inheritdoc`** **`remarks`** via `WM/AlbumArtist` or `AlbumArtist` descriptors @@ -165,14 +159,11 @@ collection containing the media described by the current instance. `string`[] -Band or artist credited with the creation of the entire album or collection - containing the media described by the current instance or an empty array if no value is - present +#### Overrides -• `set` **albumArtists**(`value`): `void` +Tag.albumArtists -Gets the band or artist who is credited credited in the creation of the entire album or -collection containing the media described by the current instance. +• `set` **albumArtists**(`value`): `void` **`inheritdoc`** @@ -188,9 +179,9 @@ collection containing the media described by the current instance. `void` -Band or artist credited with the creation of the entire album or collection - containing the media described by the current instance or an empty array if no value is - present +#### Overrides + +Tag.albumArtists ___ @@ -198,9 +189,6 @@ ___ • `get` **albumArtistsSort**(): `string`[] -Gets the sortable names of the bands/artists who are credited with creating the entire -album or collection containing the media described by the current instance. - **`inheritdoc`** **`remarks`** via `WM/AlbumArtistSortOrder` descriptor @@ -210,14 +198,11 @@ album or collection containing the media described by the current instance. `string`[] -Sortable names for the bands/artists are credited with the creation of the entire - album or collection containing the media described by the current instance, or an empty - array if no value is present. +#### Overrides -• `set` **albumArtistsSort**(`value`): `void` +Tag.albumArtistsSort -Gets the sortable names of the bands/artists who are credited with creating the entire -album or collection containing the media described by the current instance. +• `set` **albumArtistsSort**(`value`): `void` **`inheritdoc`** @@ -234,9 +219,9 @@ album or collection containing the media described by the current instance. `void` -Sortable names for the bands/artists are credited with the creation of the entire - album or collection containing the media described by the current instance, or an empty - array if no value is present. +#### Overrides + +Tag.albumArtistsSort ___ @@ -244,8 +229,6 @@ ___ • `get` **albumSort**(): `string` -Gets the sortable name of the album title of the media represented by the current instance. - **`inheritdoc`** **`remarks`** via `WM/AlbumSortOrder` descriptors @@ -254,12 +237,11 @@ Gets the sortable name of the album title of the media represented by the curren `string` -Sortable name for the album title of the media or `undefined` if the value is not - present +#### Overrides -• `set` **albumSort**(`value`): `void` +Tag.albumSort -Gets the sortable name of the album title of the media represented by the current instance. +• `set` **albumSort**(`value`): `void` **`inheritdoc`** @@ -275,8 +257,9 @@ Gets the sortable name of the album title of the media represented by the curren `void` -Sortable name for the album title of the media or `undefined` if the value is not - present +#### Overrides + +Tag.albumSort ___ @@ -296,6 +279,10 @@ Gets the Amazon ID of the media represented by the current instance. Amazon ID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.amazonId + • `set` **amazonId**(`value`): `void` Sets the Amazon ID of the media represented by the current instance. @@ -316,15 +303,16 @@ Sets the Amazon ID of the media represented by the current instance. Amazon ID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.amazonId + ___ ### beatsPerMinute • `get` **beatsPerMinute**(): `number` -Gets the number of beats per minute in the audio of the media represented by the current -instance. - **`inheritdoc`** **`remarks`** via `WM/BeatsPerMinute` descriptor @@ -334,13 +322,11 @@ instance. `number` -Beats per minute of the audio in the media represented by the current instance, or - `0` if not specified +#### Overrides -• `set` **beatsPerMinute**(`value`): `void` +Tag.beatsPerMinute -Gets the number of beats per minute in the audio of the media represented by the current -instance. +• `set` **beatsPerMinute**(`value`): `void` **`inheritdoc`** @@ -357,8 +343,9 @@ instance. `void` -Beats per minute of the audio in the media represented by the current instance, or - `0` if not specified +#### Overrides + +Tag.beatsPerMinute ___ @@ -366,32 +353,29 @@ ___ • `get` **comment**(): `string` -Gets a user comment on the media represented by the current instance. - **`inheritdoc`** **`remarks`** via `WM/Text` descriptor https://docs.microsoft.com/en-us/windows/win32/wmformat/wm-text It should be noted that many applications store comments in the field read by - [description](asftag.md#description). + [description](AsfTag.md#description). #### Returns `string` -User comments on the media represented by the current instance or `undefined` if - the value is not present +#### Overrides -• `set` **comment**(`value`): `void` +Tag.comment -Gets a user comment on the media represented by the current instance. +• `set` **comment**(`value`): `void` **`inheritdoc`** **`remarks`** via `WM/Text` descriptor https://docs.microsoft.com/en-us/windows/win32/wmformat/wm-text It should be noted that many applications store comments in the field read by - [description](asftag.md#description). + [description](AsfTag.md#description). #### Parameters @@ -403,8 +387,9 @@ Gets a user comment on the media represented by the current instance. `void` -User comments on the media represented by the current instance or `undefined` if - the value is not present +#### Overrides + +Tag.comment ___ @@ -412,8 +397,6 @@ ___ • `get` **composers**(): `string`[] -Gets the composers of the media represented by the current instance. - **`inheritdoc`** **`remarks`** via `WM/Composer` or `Composer` descriptors @@ -423,12 +406,11 @@ Gets the composers of the media represented by the current instance. `string`[] -Composers of the media represented by the current instance of an empty array if no - value is present. +#### Overrides -• `set` **composers**(`value`): `void` +Tag.composers -Gets the composers of the media represented by the current instance. +• `set` **composers**(`value`): `void` **`inheritdoc`** @@ -445,8 +427,9 @@ Gets the composers of the media represented by the current instance. `void` -Composers of the media represented by the current instance of an empty array if no - value is present. +#### Overrides + +Tag.composers ___ @@ -468,6 +451,10 @@ Gets the sortable names of the composers of the media represented by the current Sortable names for the composers of the media represented by the current instance or an empty array if no value is present. +#### Inherited from + +Tag.composersSort + • `set` **composersSort**(`value`): `void` Sets the sortable names of the composers of the media represented by the current instance. @@ -490,14 +477,16 @@ Sets the sortable names of the composers of the media represented by the current Sortable names for the composers of the media represented by the current instance or an empty array if no value is present. +#### Inherited from + +Tag.composersSort + ___ ### conductor • `get` **conductor**(): `string` -Gets the conductor or director of the media represented by the current instance. - **`inheritdoc`** **`remarks`** via `WM/Conductor` descriptor @@ -507,13 +496,12 @@ Gets the conductor or director of the media represented by the current instance. `string` -Conductor or director of the media represented by the current instance or - `undefined` if no value present. +#### Overrides + +Tag.conductor • `set` **conductor**(`value`): `void` -Gets the conductor or director of the media represented by the current instance. - **`inheritdoc`** **`remarks`** via `WM/Conductor` descriptor @@ -529,20 +517,21 @@ Gets the conductor or director of the media represented by the current instance. `void` -Conductor or director of the media represented by the current instance or - `undefined` if no value present. +#### Overrides + +Tag.conductor ___ ### contentDescriptionObject -• `get` **contentDescriptionObject**(): [`AsfContentDescriptionObject`](asfcontentdescriptionobject.md) +• `get` **contentDescriptionObject**(): [`AsfContentDescriptionObject`](AsfContentDescriptionObject.md) Gets the ASF content description object used by the current instance. #### Returns -[`AsfContentDescriptionObject`](asfcontentdescriptionobject.md) +[`AsfContentDescriptionObject`](AsfContentDescriptionObject.md) ___ @@ -550,8 +539,6 @@ ___ • `get` **copyright**(): `string` -Gets the copyright information for the media represented by the current instance. - **`inheritdoc`** **`remarks`** via {@link ContentDescriptionObject.copyright} @@ -560,13 +547,12 @@ Gets the copyright information for the media represented by the current instance `string` -Copyright information for the media represented by the current instance or - `undefined` if no value is present. +#### Overrides + +Tag.copyright • `set` **copyright**(`value`): `void` -Gets the copyright information for the media represented by the current instance. - **`inheritdoc`** **`remarks`** via {@link ContentDescriptionObject.copyright} @@ -581,8 +567,9 @@ Gets the copyright information for the media represented by the current instance `void` -Copyright information for the media represented by the current instance or - `undefined` if no value is present. +#### Overrides + +Tag.copyright ___ @@ -598,6 +585,10 @@ Gets the date and time at which the tag has been written. Date/time at which the tag has been written, or `undefined` if no value is present +#### Inherited from + +Tag.dateTagged + • `set` **dateTagged**(`value`): `void` Sets the date and time at which the tag has been written. @@ -614,16 +605,16 @@ Sets the date and time at which the tag has been written. Date/time at which the tag has been written, or `undefined` if no value is present +#### Inherited from + +Tag.dateTagged + ___ ### description • `get` **description**(): `string` -Gets a short description of the media. For music, this could be the comment that the artist -made of his/her work. For a video, this should be a short summary of the story/plot, but -generally no spoliers. This should give the impression of what to expect in the media. - **`inheritdoc`** **`remarks`** via {@link ContentDescriptor.description} @@ -633,14 +624,11 @@ generally no spoliers. This should give the impression of what to expect in the `string` -Description of the media represented by the current instance or `undefined` if no - value is present +#### Overrides -• `set` **description**(`value`): `void` +Tag.description -Gets a short description of the media. For music, this could be the comment that the artist -made of his/her work. For a video, this should be a short summary of the story/plot, but -generally no spoliers. This should give the impression of what to expect in the media. +• `set` **description**(`value`): `void` **`inheritdoc`** @@ -657,8 +645,9 @@ generally no spoliers. This should give the impression of what to expect in the `void` -Description of the media represented by the current instance or `undefined` if no - value is present +#### Overrides + +Tag.description ___ @@ -666,9 +655,6 @@ ___ • `get` **disc**(): `number` -Gets the number of the disc containing the media represented by the current instance in the -boxed set. For a series, this represents the season number. - **`inheritdoc`** **`remarks`** via `WM/PartOfSet` descriptor @@ -678,13 +664,11 @@ boxed set. For a series, this represents the season number. `number` -Number of the disc or season of the media represented by the current instance in a - boxed set. +#### Overrides -• `set` **disc**(`value`): `void` +Tag.disc -Gets the number of the disc containing the media represented by the current instance in the -boxed set. For a series, this represents the season number. +• `set` **disc**(`value`): `void` **`inheritdoc`** @@ -701,8 +685,9 @@ boxed set. For a series, this represents the season number. `void` -Number of the disc or season of the media represented by the current instance in a - boxed set. +#### Overrides + +Tag.disc ___ @@ -710,9 +695,6 @@ ___ • `get` **discCount**(): `number` -Gets the number of discs or seasons in the boxed set containing the media represented by the -current instance. - **`inheritdoc`** **`remarks`** via `WM/PartOfSet` descriptor @@ -722,13 +704,11 @@ current instance. `number` -Number of discs or seasons in the boxed set containing the media represented by the - current instance or `0` if not specified. +#### Overrides -• `set` **discCount**(`value`): `void` +Tag.discCount -Gets the number of discs or seasons in the boxed set containing the media represented by the -current instance. +• `set` **discCount**(`value`): `void` **`inheritdoc`** @@ -745,20 +725,21 @@ current instance. `void` -Number of discs or seasons in the boxed set containing the media represented by the - current instance or `0` if not specified. +#### Overrides + +Tag.discCount ___ ### extendedContentDescriptionObject -• `get` **extendedContentDescriptionObject**(): [`AsfExtendedContentDescriptionObject`](asfextendedcontentdescriptionobject.md) +• `get` **extendedContentDescriptionObject**(): [`AsfExtendedContentDescriptionObject`](AsfExtendedContentDescriptionObject.md) Gets the ASF extended content description used by the current instance. #### Returns -[`AsfExtendedContentDescriptionObject`](asfextendedcontentdescriptionobject.md) +[`AsfExtendedContentDescriptionObject`](AsfExtendedContentDescriptionObject.md) ___ @@ -766,92 +747,118 @@ ___ • `get` **firstAlbumArtist**(): `string` -Gets the the first value contained in [albumArtists](asftag.md#albumartists). +Gets the first value contained in [albumArtists](AsfTag.md#albumartists). #### Returns `string` +#### Inherited from + +Tag.firstAlbumArtist + ___ ### firstAlbumArtistSort • `get` **firstAlbumArtistSort**(): `string` -Gets the first value contained in [albumArtistsSort](asftag.md#albumartistssort) +Gets the first value contained in [albumArtistsSort](AsfTag.md#albumartistssort) #### Returns `string` +#### Inherited from + +Tag.firstAlbumArtistSort + ___ ### firstComposer • `get` **firstComposer**(): `string` -Gets the first value contained in [composers](asftag.md#composers) +Gets the first value contained in [composers](AsfTag.md#composers) #### Returns `string` +#### Inherited from + +Tag.firstComposer + ___ ### firstComposerSort • `get` **firstComposerSort**(): `string` -Gets the first value contained in [composersSort](asftag.md#composerssort) +Gets the first value contained in [composersSort](AsfTag.md#composerssort) #### Returns `string` +#### Inherited from + +Tag.firstComposerSort + ___ ### firstGenre • `get` **firstGenre**(): `string` -Gets the first value contained in [genres](asftag.md#genres) +Gets the first value contained in [genres](AsfTag.md#genres) #### Returns `string` +#### Inherited from + +Tag.firstGenre + ___ ### firstPerformer • `get` **firstPerformer**(): `string` -Gets the first value contained in [performers](asftag.md#performers) +Gets the first value contained in [performers](AsfTag.md#performers) #### Returns `string` +#### Inherited from + +Tag.firstPerformer + ___ ### firstPerformerSort • `get` **firstPerformerSort**(): `string` -Gets the first value contained in [performersSort](asftag.md#performerssort) +Gets the first value contained in [performersSort](AsfTag.md#performerssort) #### Returns `string` +#### Inherited from + +Tag.firstPerformerSort + ___ ### genres • `get` **genres**(): `string`[] -Gets the genres of the media represented by the current instance. - **`inheritdoc`** **`remarks`** via `WM/Genre`, `WM/GenreID`, or `Genre` descriptors @@ -862,12 +869,11 @@ Gets the genres of the media represented by the current instance. `string`[] -Genres of the media represented by the current instance or an empty array if no - value is present. +#### Overrides -• `set` **genres**(`value`): `void` +Tag.genres -Gets the genres of the media represented by the current instance. +• `set` **genres**(`value`): `void` **`inheritdoc`** @@ -885,8 +891,9 @@ Gets the genres of the media represented by the current instance. `void` -Genres of the media represented by the current instance or an empty array if no - value is present. +#### Overrides + +Tag.genres ___ @@ -894,8 +901,6 @@ ___ • `get` **grouping**(): `string` -Gets the grouping on the album which the media in the current instance belongs to. - **`inheritdoc`** **`remarks`** via `WM/ContentGroupDescription` descriptor @@ -905,12 +910,11 @@ Gets the grouping on the album which the media in the current instance belongs t `string` -Grouping on the album which the media in the current instance belongs to or - `undefined` if no value is present. +#### Overrides -• `set` **grouping**(`value`): `void` +Tag.grouping -Gets the grouping on the album which the media in the current instance belongs to. +• `set` **grouping**(`value`): `void` **`inheritdoc`** @@ -927,8 +931,9 @@ Gets the grouping on the album which the media in the current instance belongs t `void` -Grouping on the album which the media in the current instance belongs to or - `undefined` if no value is present. +#### Overrides + +Tag.grouping ___ @@ -944,6 +949,10 @@ Gets the initial key of the track. Initial key of the track or `undefined` if no value is set +#### Inherited from + +Tag.initialKey + • `set` **initialKey**(`value`): `void` Sets the initial key of the track. @@ -960,21 +969,59 @@ Sets the initial key of the track. Initial key of the track or `undefined` if no value is set +#### Inherited from + +Tag.initialKey + +___ + +### isCompilation + +• `get` **isCompilation**(): `boolean` + +Gets whether or not the album described by the current instance is a compilation. + +#### Returns + +`boolean` + +#### Inherited from + +Tag.isCompilation + +• `set` **isCompilation**(`value`): `void` + +Gets whether or not the album described by the current instance is a compilation. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | `boolean` | Whether or not the album described by the current instance is a compilation | + +#### Returns + +`void` + +#### Inherited from + +Tag.isCompilation + ___ ### isEmpty • `get` **isEmpty**(): `boolean` -Gets whether or not the current instance is empty. - **`inheritdoc`** #### Returns `boolean` -`true` if the current instance does not contain any values. `false` otherwise +#### Overrides + +Tag.isEmpty ___ @@ -990,6 +1037,10 @@ Gets the ISRC (International Standard Recording Code) of the track. the ISRC of the track or `undefined` if no value is set +#### Inherited from + +Tag.isrc + • `set` **isrc**(`value`): `void` Sets the ISRC (International Standard Recording Code) of the track. @@ -1006,74 +1057,96 @@ Sets the ISRC (International Standard Recording Code) of the track. the ISRC of the track or `undefined` if no value is set +#### Inherited from + +Tag.isrc + ___ ### joinedAlbumArtists • `get` **joinedAlbumArtists**(): `string` -Gets a semicolon and space separated string containing the values in [albumArtists](asftag.md#albumartists) +Gets a semicolon and space separated string containing the values in [albumArtists](AsfTag.md#albumartists) #### Returns `string` +#### Inherited from + +Tag.joinedAlbumArtists + ___ ### joinedComposers • `get` **joinedComposers**(): `string` -Gets a semicolon and space separated string containing the values in [composers](asftag.md#composers) +Gets a semicolon and space separated string containing the values in [composers](AsfTag.md#composers) #### Returns `string` +#### Inherited from + +Tag.joinedComposers + ___ ### joinedGenres • `get` **joinedGenres**(): `string` -Gets a semicolon and space separated string containing the values in [genres](asftag.md#genres) +Gets a semicolon and space separated string containing the values in [genres](AsfTag.md#genres) #### Returns `string` +#### Inherited from + +Tag.joinedGenres + ___ ### joinedPerformers • `get` **joinedPerformers**(): `string` -Gets a semicolon and space separated string containing the values in [performers](asftag.md#performers) +Gets a semicolon and space separated string containing the values in [performers](AsfTag.md#performers) #### Returns `string` +#### Inherited from + +Tag.joinedPerformers + ___ ### joinedPerformersSort • `get` **joinedPerformersSort**(): `string` -Gets a semicolon and space separated string containing the values in [performersSort](asftag.md#performerssort) +Gets a semicolon and space separated string containing the values in [performersSort](AsfTag.md#performerssort) #### Returns `string` +#### Inherited from + +Tag.joinedPerformersSort + ___ ### lyrics • `get` **lyrics**(): `string` -Gets the lyrics or script of the media represented by the current instance. - **`inheritdoc`** **`remarks`** via `WM/Lyrics` descriptor @@ -1083,12 +1156,11 @@ Gets the lyrics or script of the media represented by the current instance. `string` -Lyrics or script of the media represented by the current instance or `undefined` if - no value is present +#### Overrides -• `set` **lyrics**(`value`): `void` +Tag.lyrics -Gets the lyrics or script of the media represented by the current instance. +• `set` **lyrics**(`value`): `void` **`inheritdoc`** @@ -1105,20 +1177,21 @@ Gets the lyrics or script of the media represented by the current instance. `void` -Lyrics or script of the media represented by the current instance or `undefined` if - no value is present +#### Overrides + +Tag.lyrics ___ ### metadataLibraryObject -• `get` **metadataLibraryObject**(): [`AsfMetadataLibraryObject`](asfmetadatalibraryobject.md) +• `get` **metadataLibraryObject**(): [`AsfMetadataLibraryObject`](AsfMetadataLibraryObject.md) Gets the ASF metadata library object used by the current instance. #### Returns -[`AsfMetadataLibraryObject`](asfmetadatalibraryobject.md) +[`AsfMetadataLibraryObject`](AsfMetadataLibraryObject.md) ___ @@ -1156,8 +1229,6 @@ ___ • `get` **musicBrainzArtistId**(): `string` -Gets the MusicBrainz artist ID of the media represented by the current instance. - **`inheritdoc`** **`remarks`** via `MusicBrainz/Artist Id` descriptor @@ -1166,12 +1237,11 @@ Gets the MusicBrainz artist ID of the media represented by the current instance. `string` -MusicBrainz ArtistID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides -• `set` **musicBrainzArtistId**(`value`): `void` +Tag.musicBrainzArtistId -Gets the MusicBrainz artist ID of the media represented by the current instance. +• `set` **musicBrainzArtistId**(`value`): `void` **`inheritdoc`** @@ -1187,8 +1257,9 @@ Gets the MusicBrainz artist ID of the media represented by the current instance. `void` -MusicBrainz ArtistID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzArtistId ___ @@ -1196,8 +1267,6 @@ ___ • `get` **musicBrainzDiscId**(): `string` -Gets the MusicBrainz disc ID of the media represented by the current instance. - **`inheritdoc`** **`remarks`** via `MusicBrainz/Disc Id` descriptor @@ -1206,13 +1275,12 @@ Gets the MusicBrainz disc ID of the media represented by the current instance. `string` -MusicBrainz DiscID of the media represented by the current instance or `undefined` - if no value is present +#### Overrides + +Tag.musicBrainzDiscId • `set` **musicBrainzDiscId**(`value`): `void` -Gets the MusicBrainz disc ID of the media represented by the current instance. - **`inheritdoc`** **`remarks`** via `MusicBrainz/Disc Id` descriptor @@ -1227,8 +1295,9 @@ Gets the MusicBrainz disc ID of the media represented by the current instance. `void` -MusicBrainz DiscID of the media represented by the current instance or `undefined` - if no value is present +#### Overrides + +Tag.musicBrainzDiscId ___ @@ -1248,6 +1317,10 @@ Gets the MusicBrainz release artist ID of the media represented by the current i MusicBrainz ReleaseArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseArtistId + • `set` **musicBrainzReleaseArtistId**(`value`): `void` Sets the MusicBrainz release artist ID of the media represented by the current instance. @@ -1268,14 +1341,16 @@ Sets the MusicBrainz release artist ID of the media represented by the current i MusicBrainz ReleaseArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseArtistId + ___ ### musicBrainzReleaseCountry • `get` **musicBrainzReleaseCountry**(): `string` -Gets the MusicBrainz release country of the media represented by the current instance. - **`inheritdoc`** **`remarks`** via `MusicBrainz/Album Release Country` descriptor @@ -1284,12 +1359,11 @@ Gets the MusicBrainz release country of the media represented by the current ins `string` -MusicBrainz ReleaseCountry of the media represented by the current instance or - `undefined` if no value is present +#### Overrides -• `set` **musicBrainzReleaseCountry**(`value`): `void` +Tag.musicBrainzReleaseCountry -Gets the MusicBrainz release country of the media represented by the current instance. +• `set` **musicBrainzReleaseCountry**(`value`): `void` **`inheritdoc`** @@ -1305,8 +1379,9 @@ Gets the MusicBrainz release country of the media represented by the current ins `void` -MusicBrainz ReleaseCountry of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzReleaseCountry ___ @@ -1314,8 +1389,6 @@ ___ • `get` **musicBrainzReleaseGroupId**(): `string` -Gets the MusicBrainz release group ID of the media represented by the current instance. - **`inheritdoc`** **`remarks`** via `MusicBrainz/Release Group Id` descriptor @@ -1324,12 +1397,11 @@ Gets the MusicBrainz release group ID of the media represented by the current in `string` -MusicBrainz ReleaseGroupID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides -• `set` **musicBrainzReleaseGroupId**(`value`): `void` +Tag.musicBrainzReleaseGroupId -Gets the MusicBrainz release group ID of the media represented by the current instance. +• `set` **musicBrainzReleaseGroupId**(`value`): `void` **`inheritdoc`** @@ -1345,8 +1417,9 @@ Gets the MusicBrainz release group ID of the media represented by the current in `void` -MusicBrainz ReleaseGroupID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzReleaseGroupId ___ @@ -1354,8 +1427,6 @@ ___ • `get` **musicBrainzReleaseId**(): `string` -Gets the MusicBrainz release ID of the media represented by the current instance. - **`inheritdoc`** **`remarks`** via `MusicBrainz/Album Id` descriptor @@ -1364,12 +1435,11 @@ Gets the MusicBrainz release ID of the media represented by the current instance `string` -MusicBrainz ReleaseID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides -• `set` **musicBrainzReleaseId**(`value`): `void` +Tag.musicBrainzReleaseId -Gets the MusicBrainz release ID of the media represented by the current instance. +• `set` **musicBrainzReleaseId**(`value`): `void` **`inheritdoc`** @@ -1385,8 +1455,9 @@ Gets the MusicBrainz release ID of the media represented by the current instance `void` -MusicBrainz ReleaseID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzReleaseId ___ @@ -1394,8 +1465,6 @@ ___ • `get` **musicBrainzReleaseStatus**(): `string` -Gets the MusicBrainz release status of the media represented by the current instance. - **`inheritdoc`** **`remarks`** via `MusicBrainz/Album Status` descriptor @@ -1404,12 +1473,11 @@ Gets the MusicBrainz release status of the media represented by the current inst `string` -MusicBrainz ReleaseStatus of the media represented by the current instance or - `undefined` if no value is present +#### Overrides -• `set` **musicBrainzReleaseStatus**(`value`): `void` +Tag.musicBrainzReleaseStatus -Gets the MusicBrainz release status of the media represented by the current instance. +• `set` **musicBrainzReleaseStatus**(`value`): `void` **`inheritdoc`** @@ -1425,8 +1493,9 @@ Gets the MusicBrainz release status of the media represented by the current inst `void` -MusicBrainz ReleaseStatus of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzReleaseStatus ___ @@ -1434,8 +1503,6 @@ ___ • `get` **musicBrainzReleaseType**(): `string` -Gets the MusicBrainz release type of the media represented by the current instance. - **`inheritdoc`** **`remarks`** via `MusicBrainz/Album Type` descriptor @@ -1444,12 +1511,11 @@ Gets the MusicBrainz release type of the media represented by the current instan `string` -MusicBrainz ReleaseType of the media represented by the current instance or - `undefined` if no value is present +#### Overrides -• `set` **musicBrainzReleaseType**(`value`): `void` +Tag.musicBrainzReleaseType -Gets the MusicBrainz release type of the media represented by the current instance. +• `set` **musicBrainzReleaseType**(`value`): `void` **`inheritdoc`** @@ -1465,8 +1531,9 @@ Gets the MusicBrainz release type of the media represented by the current instan `void` -MusicBrainz ReleaseType of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzReleaseType ___ @@ -1474,9 +1541,6 @@ ___ • `get` **musicBrainzTrackId**(): `string` -Gets the MusicBrainz track ID of the media represented by the media represented by the -current instance. - **`inheritdoc`** **`remarks`** via `MusicBrainz/Track Id` descriptor @@ -1485,13 +1549,11 @@ current instance. `string` -MusicBrainz TrackID of the media represented by the current instance or `undefined` - if no value is present +#### Overrides -• `set` **musicBrainzTrackId**(`value`): `void` +Tag.musicBrainzTrackId -Gets the MusicBrainz track ID of the media represented by the media represented by the -current instance. +• `set` **musicBrainzTrackId**(`value`): `void` **`inheritdoc`** @@ -1507,8 +1569,9 @@ current instance. `void` -MusicBrainz TrackID of the media represented by the current instance or `undefined` - if no value is present +#### Overrides + +Tag.musicBrainzTrackId ___ @@ -1516,8 +1579,6 @@ ___ • `get` **musicIpId**(): `string` -Gets the MusicIP PUID of the media represented by the current instance. - **`inheritdoc`** **`remarks`** via `MusicIP/PUID` descriptor @@ -1526,12 +1587,11 @@ Gets the MusicIP PUID of the media represented by the current instance. `string` -MusicIP PUID of the media represented by the current instance or `undefined` if no - value is present +#### Overrides -• `set` **musicIpId**(`value`): `void` +Tag.musicIpId -Gets the MusicIP PUID of the media represented by the current instance. +• `set` **musicIpId**(`value`): `void` **`inheritdoc`** @@ -1547,8 +1607,9 @@ Gets the MusicIP PUID of the media represented by the current instance. `void` -MusicIP PUID of the media represented by the current instance or `undefined` if no - value is present +#### Overrides + +Tag.musicIpId ___ @@ -1556,8 +1617,6 @@ ___ • `get` **performers**(): `string`[] -Gets the performers or artists who performed in the media described by the current instance. - **`inheritdoc`** **`remarks`** via {@link ContentDescriptor.author} @@ -1566,12 +1625,11 @@ Gets the performers or artists who performed in the media described by the curre `string`[] -Performers who performed in the media described by the current instance or an empty - array if no value is present. +#### Overrides -• `set` **performers**(`value`): `void` +Tag.performers -Gets the performers or artists who performed in the media described by the current instance. +• `set` **performers**(`value`): `void` **`inheritdoc`** @@ -1587,8 +1645,9 @@ Gets the performers or artists who performed in the media described by the curre `void` -Performers who performed in the media described by the current instance or an empty - array if no value is present. +#### Overrides + +Tag.performers ___ @@ -1597,12 +1656,12 @@ ___ • `get` **performersRole**(): `string`[] Gets the characters portrayed by an actor for a video or instruments played by a musician -for music. This must match the [performers](asftag.md#performers) array (for each person, correspond one/more +for music. This must match the [performers](AsfTag.md#performers) array (for each person, correspond one/more role). Several roles for the same artist/actor can be separated with semicolons. For example: "Bass; Backing Vocals; Vibraphone". **`remarks`** It is highly important to match each role to the performers. This means that an entry - in the [performersRole](asftag.md#performersrole) array is `undefined` to maintain the relationship between + in the [performersRole](AsfTag.md#performersrole) array is `undefined` to maintain the relationship between `performers[i]` and `performersRole[i]`. #### Returns @@ -1612,15 +1671,19 @@ example: "Bass; Backing Vocals; Vibraphone". Array containing the roles played by the performers in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +Tag.performersRole + • `set` **performersRole**(`value`): `void` Sets the characters portrayed by an actor for a video or instruments played by a musician -for music. This must match the [performers](asftag.md#performers) array (for each person, correspond one/more +for music. This must match the [performers](AsfTag.md#performers) array (for each person, correspond one/more role). Several roles for the same artist/actor can be separated with semicolons. For example: "Bass; Backing Vocals; Vibraphone". **`remarks`** It is highly important to match each role to the performers. This means that an entry - in the [performersRole](asftag.md#performersrole) array is `undefined` to maintain the relationship between + in the [performersRole](AsfTag.md#performersrole) array is `undefined` to maintain the relationship between `performers[i]` and `performersRole[i]`. #### Parameters @@ -1636,15 +1699,16 @@ example: "Bass; Backing Vocals; Vibraphone". Array containing the roles played by the performers in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +Tag.performersRole + ___ ### performersSort • `get` **performersSort**(): `string`[] -Gets the sortable names of the performers or artists who performed in the media described by -the current instance. - **`inheritdoc`** **`remarks`** via "WM/ArtistSortOrder" descriptor @@ -1654,13 +1718,11 @@ the current instance. `string`[] -Sortable names for the performers who performed in the media described by the - current instance, or an empty array if no value is present. +#### Overrides -• `set` **performersSort**(`value`): `void` +Tag.performersSort -Gets the sortable names of the performers or artists who performed in the media described by -the current instance. +• `set` **performersSort**(`value`): `void` **`inheritdoc`** @@ -1677,16 +1739,15 @@ the current instance. `void` -Sortable names for the performers who performed in the media described by the - current instance, or an empty array if no value is present. +#### Overrides + +Tag.performersSort ___ ### pictures -• `get` **pictures**(): [`IPicture`](../interfaces/ipicture.md)[] - -Gets a collection of pictures associated with the media represented by the current instance. +• `get` **pictures**(): [`IPicture`](../interfaces/IPicture.md)[] **`inheritdoc`** @@ -1696,14 +1757,13 @@ Gets a collection of pictures associated with the media represented by the curre #### Returns -[`IPicture`](../interfaces/ipicture.md)[] +[`IPicture`](../interfaces/IPicture.md)[] -Array containing a collection of pictures associated with the media represented by - the current instance or an empty array if no pictures are present. +#### Overrides -• `set` **pictures**(`value`): `void` +Tag.pictures -Gets a collection of pictures associated with the media represented by the current instance. +• `set` **pictures**(`value`): `void` **`inheritdoc`** @@ -1714,14 +1774,15 @@ Gets a collection of pictures associated with the media represented by the curre | Name | Type | | :------ | :------ | -| `value` | [`IPicture`](../interfaces/ipicture.md)[] | +| `value` | [`IPicture`](../interfaces/IPicture.md)[] | #### Returns `void` -Array containing a collection of pictures associated with the media represented by - the current instance or an empty array if no pictures are present. +#### Overrides + +Tag.pictures ___ @@ -1737,6 +1798,10 @@ Gets the publisher of the track. Publisher of the track or `undefined` if no value is set +#### Inherited from + +Tag.publisher + • `set` **publisher**(`value`): `void` Sets the publisher of the track. @@ -1753,6 +1818,10 @@ Sets the publisher of the track. Publisher of the track or `undefined` if no value is set +#### Inherited from + +Tag.publisher + ___ ### remixedBy @@ -1767,6 +1836,10 @@ Gets the remixer of the track. Remixer of the track or `undefined` if no value is set +#### Inherited from + +Tag.remixedBy + • `set` **remixedBy**(`value`): `void` Sets the remixer of the track. @@ -1783,14 +1856,16 @@ Sets the remixer of the track. Remixer of the track or `undefined` if no value is set +#### Inherited from + +Tag.remixedBy + ___ ### replayGainAlbumGain • `get` **replayGainAlbumGain**(): `number` -Gets the ReplayGain album gain in dB. - **`inheritdoc`** **`remarks`** via `ReplayGain/Album` descriptor @@ -1799,12 +1874,12 @@ Gets the ReplayGain album gain in dB. `number` -Album gain as per the ReplayGain specifications, in dB, or `NaN` if no value is set +#### Overrides + +Tag.replayGainAlbumGain • `set` **replayGainAlbumGain**(`value`): `void` -Gets the ReplayGain album gain in dB. - **`inheritdoc`** **`remarks`** via `ReplayGain/Album` descriptor @@ -1819,7 +1894,9 @@ Gets the ReplayGain album gain in dB. `void` -Album gain as per the ReplayGain specifications, in dB, or `NaN` if no value is set +#### Overrides + +Tag.replayGainAlbumGain ___ @@ -1827,8 +1904,6 @@ ___ • `get` **replayGainAlbumPeak**(): `number` -Gets the ReplayGain album peak sample. - **`inheritdoc`** **`remarks`** via `ReplayGain/Album Peak` descriptor @@ -1837,12 +1912,12 @@ Gets the ReplayGain album peak sample. `number` -Album peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Overrides + +Tag.replayGainAlbumPeak • `set` **replayGainAlbumPeak**(`value`): `void` -Gets the ReplayGain album peak sample. - **`inheritdoc`** **`remarks`** via `ReplayGain/Album Peak` descriptor @@ -1857,7 +1932,9 @@ Gets the ReplayGain album peak sample. `void` -Album peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Overrides + +Tag.replayGainAlbumPeak ___ @@ -1865,8 +1942,6 @@ ___ • `get` **replayGainTrackGain**(): `number` -Gets the ReplayGain track gain in dB. - **`inheritdoc`** **`remarks`** via `ReplayGain/Track` descriptor @@ -1875,11 +1950,11 @@ Gets the ReplayGain track gain in dB. `number` -Track gain as per ReplayGain specifications, in dB, or `NaN` if no value is set +#### Overrides -• `set` **replayGainTrackGain**(`value`): `void` +Tag.replayGainTrackGain -Gets the ReplayGain track gain in dB. +• `set` **replayGainTrackGain**(`value`): `void` **`inheritdoc`** @@ -1895,7 +1970,9 @@ Gets the ReplayGain track gain in dB. `void` -Track gain as per ReplayGain specifications, in dB, or `NaN` if no value is set +#### Overrides + +Tag.replayGainTrackGain ___ @@ -1903,8 +1980,6 @@ ___ • `get` **replayGainTrackPeak**(): `number` -Gets the ReplayGain track peak sample. - **`inheritdoc`** **`remarks`** via `ReplayGain/Track Peak` descriptor @@ -1913,11 +1988,11 @@ Gets the ReplayGain track peak sample. `number` -Track peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Overrides -• `set` **replayGainTrackPeak**(`value`): `void` +Tag.replayGainTrackPeak -Gets the ReplayGain track peak sample. +• `set` **replayGainTrackPeak**(`value`): `void` **`inheritdoc`** @@ -1933,7 +2008,9 @@ Gets the ReplayGain track peak sample. `void` -Track peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Overrides + +Tag.replayGainTrackPeak ___ @@ -1941,22 +2018,22 @@ ___ • `get` **sizeOnDisk**(): `number` -Gets the size of the tag in bytes on disk as it was read from disk. - **`inheritdoc`** #### Returns `number` +#### Overrides + +Tag.sizeOnDisk + ___ ### subtitle • `get` **subtitle**(): `string` -Gets a description, one-line. It represents the tagline of the vide/music. - **`inheritdoc`** **`remarks`** via `WM/SubTitle` descriptor @@ -1966,12 +2043,11 @@ Gets a description, one-line. It represents the tagline of the vide/music. `string` -Subtitle of the media represented by the current instance or `undefined` if no - value is present +#### Overrides -• `set` **subtitle**(`value`): `void` +Tag.subtitle -Gets a description, one-line. It represents the tagline of the vide/music. +• `set` **subtitle**(`value`): `void` **`inheritdoc`** @@ -1988,23 +2064,28 @@ Gets a description, one-line. It represents the tagline of the vide/music. `void` -Subtitle of the media represented by the current instance or `undefined` if no - value is present +#### Overrides + +Tag.subtitle ___ ### tagTypes -• `get` **tagTypes**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypes**(): [`TagTypes`](../enums/TagTypes.md) -Gets the tag types contained in the current instance. A bit wise combined [TagTypes](../enums/tagtypes.md) +Gets the tag types contained in the current instance. A bit wise combined [TagTypes](../enums/TagTypes.md) containing the tag types contained in the current instance. **`inheritdoc`** #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) + +#### Overrides + +Tag.tagTypes ___ @@ -2012,8 +2093,6 @@ ___ • `get` **title**(): `string` -Gets the title for the media described by the current instance. - **`inheritdoc`** **`remarks`** via content description object @@ -2022,12 +2101,11 @@ Gets the title for the media described by the current instance. `string` -Title of the media described by the current instance or `undefined` if no value is - present. +#### Overrides -• `set` **title**(`value`): `void` +Tag.title -Gets the title for the media described by the current instance. +• `set` **title**(`value`): `void` **`inheritdoc`** @@ -2043,8 +2121,9 @@ Gets the title for the media described by the current instance. `void` -Title of the media described by the current instance or `undefined` if no value is - present. +#### Overrides + +Tag.title ___ @@ -2052,8 +2131,6 @@ ___ • `get` **titleSort**(): `string` -Gets the sortable name for the title of the media described by the current instance. - **`inheritdoc`** **`remarks`** via "WM/TitleSortOrder" @@ -2063,12 +2140,11 @@ Gets the sortable name for the title of the media described by the current insta `string` -Sortable name of the media described by the current instance or `undefined` if no - value is present +#### Overrides -• `set` **titleSort**(`value`): `void` +Tag.titleSort -Gets the sortable name for the title of the media described by the current instance. +• `set` **titleSort**(`value`): `void` **`inheritdoc`** @@ -2085,8 +2161,9 @@ Gets the sortable name for the title of the media described by the current insta `void` -Sortable name of the media described by the current instance or `undefined` if no - value is present +#### Overrides + +Tag.titleSort ___ @@ -2094,9 +2171,6 @@ ___ • `get` **track**(): `number` -Gets the position of the media represented by the current instance in its containing album -or season (for a series). - **`inheritdoc`** **`remarks`** via `WM/TrackNumber` descriptor @@ -2106,13 +2180,11 @@ or season (for a series). `number` -Position of the media represented by the current instance in its containing album - or `0` if not specified. +#### Overrides -• `set` **track**(`value`): `void` +Tag.track -Gets the position of the media represented by the current instance in its containing album -or season (for a series). +• `set` **track**(`value`): `void` **`inheritdoc`** @@ -2129,8 +2201,9 @@ or season (for a series). `void` -Position of the media represented by the current instance in its containing album - or `0` if not specified. +#### Overrides + +Tag.track ___ @@ -2138,9 +2211,6 @@ ___ • `get` **trackCount**(): `number` -Gets the number of tracks in the album or the number of episodes in a series of the media -represented by the current instance. - **`inheritdoc`** **`remarks`** via `TrackTotal` descriptor @@ -2149,13 +2219,11 @@ represented by the current instance. `number` -Number of tracks in the album or number of episodes in a series of the media - represented by the current instance or `0` if not specified. +#### Overrides -• `set` **trackCount**(`value`): `void` +Tag.trackCount -Gets the number of tracks in the album or the number of episodes in a series of the media -represented by the current instance. +• `set` **trackCount**(`value`): `void` **`inheritdoc`** @@ -2171,8 +2239,9 @@ represented by the current instance. `void` -Number of tracks in the album or number of episodes in a series of the media - represented by the current instance or `0` if not specified. +#### Overrides + +Tag.trackCount ___ @@ -2180,8 +2249,6 @@ ___ • `get` **year**(): `number` -Gets the year that the media represented by the current instance was recorded. - **`inheritdoc`** **`remarks`** via `WM/Year` descriptor @@ -2191,12 +2258,11 @@ Gets the year that the media represented by the current instance was recorded. `number` -Year that the media represented by the current instance was created or `0` if no - value is present. +#### Overrides -• `set` **year**(`value`): `void` +Tag.year -Gets the year that the media represented by the current instance was recorded. +• `set` **year**(`value`): `void` **`inheritdoc`** @@ -2213,8 +2279,9 @@ Gets the year that the media represented by the current instance was recorded. `void` -Year that the media represented by the current instance was created or `0` if no - value is present. +#### Overrides + +Tag.year ## Methods @@ -2228,7 +2295,7 @@ Adds a descriptor to the current instance's extended content description object. | Name | Type | Description | | :------ | :------ | :------ | -| `descriptor` | [`AsfContentDescriptor`](asfcontentdescriptor.md) | Content descriptor to add to the current instance. Must be truthy | +| `descriptor` | [`AsfContentDescriptor`](AsfContentDescriptor.md) | Content descriptor to add to the current instance. Must be truthy | #### Returns @@ -2250,7 +2317,7 @@ Clears all values stored in the current instance. #### Overrides -[Tag](tag.md).[clear](tag.md#clear) +[Tag](Tag.md).[clear](Tag.md#clear) ___ @@ -2258,19 +2325,19 @@ ___ ▸ **copyTo**(`target`, `overwrite`): `void` -Copies the values from the current instance to another [Tag](tag.md), optionally overwriting +Copies the values from the current instance to another [Tag](Tag.md), optionally overwriting existing values. **`remarks`** This method only copies the most basic values when copying between different tag formats. However, if `target` is of the same type as the current instance, more advanced copying may be done. For example if both `this` and `target` are - [Id3v2Tag](id3v2tag.md), all frames will be copied to the target. + [Id3v2Tag](Id3v2Tag.md), all frames will be copied to the target. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `target` | [`Tag`](tag.md) | Target tag to copy values to | +| `target` | [`Tag`](Tag.md) | Target tag to copy values to | | `overwrite` | `boolean` | Whether or not to copy values over existing ones | #### Returns @@ -2279,7 +2346,7 @@ Copies the values from the current instance to another [Tag](tag.md), optionally #### Inherited from -[Tag](tag.md).[copyTo](tag.md#copyto) +[Tag](Tag.md).[copyTo](Tag.md#copyto) ___ @@ -2345,7 +2412,7 @@ ___ ### getDescriptors -▸ **getDescriptors**(...`names`): [`AsfContentDescriptor`](asfcontentdescriptor.md)[] +▸ **getDescriptors**(...`names`): [`AsfContentDescriptor`](AsfContentDescriptor.md)[] Gets all descriptors in the extended description object with names matching any of the names in the provided collection of names. @@ -2358,7 +2425,7 @@ in the provided collection of names. #### Returns -[`AsfContentDescriptor`](asfcontentdescriptor.md)[] +[`AsfContentDescriptor`](AsfContentDescriptor.md)[] ___ @@ -2443,7 +2510,7 @@ name, removing the existing matching records. | Name | Type | Description | | :------ | :------ | :------ | | `name` | `string` | Name of the descriptors to be added/removed | -| `...descriptors` | [`AsfContentDescriptor`](asfcontentdescriptor.md)[] | Descriptors to add to the new instance | +| `...descriptors` | [`AsfContentDescriptor`](AsfContentDescriptor.md)[] | Descriptors to add to the new instance | #### Returns @@ -2465,7 +2532,7 @@ Set the tags that represent the tagger software (node-taglib-sharp) itself. #### Inherited from -[Tag](tag.md).[setInfoTag](tag.md#setinfotag) +[Tag](Tag.md).[setInfoTag](Tag.md#setinfotag) ___ @@ -2490,25 +2557,25 @@ First string contained in `group` or `undefined` if the array is #### Inherited from -[Tag](tag.md).[firstInGroup](tag.md#firstingroup) +[Tag](Tag.md).[firstInGroup](Tag.md#firstingroup) ___ ### fromEmpty -▸ `Static` **fromEmpty**(): [`AsfTag`](asftag.md) +▸ `Static` **fromEmpty**(): [`AsfTag`](AsfTag.md) Constructs and initializes a new, empty instance. #### Returns -[`AsfTag`](asftag.md) +[`AsfTag`](AsfTag.md) ___ ### fromHeader -▸ `Static` **fromHeader**(`header`): [`AsfTag`](asftag.md) +▸ `Static` **fromHeader**(`header`): [`AsfTag`](AsfTag.md) Constructs and initializes a new instance using the children of a {@link HeaderObject} object. @@ -2517,11 +2584,11 @@ object. | Name | Type | Description | | :------ | :------ | :------ | -| `header` | [`AsfHeaderObject`](asfheaderobject.md) | Header object whose children will be used to populate the new instance | +| `header` | [`AsfHeaderObject`](AsfHeaderObject.md) | Header object whose children will be used to populate the new instance | #### Returns -[`AsfTag`](asftag.md) +[`AsfTag`](AsfTag.md) ___ @@ -2547,7 +2614,7 @@ If `value` is a string, `true` is returned if the value is falsy or all #### Inherited from -[Tag](tag.md).[isFalsyOrLikeEmpty](tag.md#isfalsyorlikeempty) +[Tag](Tag.md).[isFalsyOrLikeEmpty](Tag.md#isfalsyorlikeempty) ___ @@ -2572,13 +2639,13 @@ A semicolon and space separated string containing the values from `group` #### Inherited from -[Tag](tag.md).[joinGroup](tag.md#joingroup) +[Tag](Tag.md).[joinGroup](Tag.md#joingroup) ___ ### pictureFromData -▸ `Static` **pictureFromData**(`data`): [`Picture`](picture.md) +▸ `Static` **pictureFromData**(`data`): [`Picture`](Picture.md) **`internal`** @@ -2586,17 +2653,17 @@ ___ | Name | Type | | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | +| `data` | [`ByteVector`](ByteVector.md) | #### Returns -[`Picture`](picture.md) +[`Picture`](Picture.md) ___ ### pictureToData -▸ `Static` **pictureToData**(`picture`): [`ByteVector`](bytevector.md) +▸ `Static` **pictureToData**(`picture`): [`ByteVector`](ByteVector.md) **`internal`** @@ -2604,28 +2671,28 @@ ___ | Name | Type | | :------ | :------ | -| `picture` | [`IPicture`](../interfaces/ipicture.md) | +| `picture` | [`IPicture`](../interfaces/IPicture.md) | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ___ ### tagTypeFlagsToArray -▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/tagtypes.md)[] +▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/TagTypes.md)[] #### Parameters | Name | Type | | :------ | :------ | -| `tagTypes` | [`TagTypes`](../enums/tagtypes.md) | +| `tagTypes` | [`TagTypes`](../enums/TagTypes.md) | #### Returns -[`TagTypes`](../enums/tagtypes.md)[] +[`TagTypes`](../enums/TagTypes.md)[] #### Inherited from -[Tag](tag.md).[tagTypeFlagsToArray](tag.md#tagtypeflagstoarray) +[Tag](Tag.md).[tagTypeFlagsToArray](Tag.md#tagtypeflagstoarray) diff --git a/docs/classes/asfunknownobject.md b/docs/classes/AsfUnknownObject.md similarity index 70% rename from docs/classes/asfunknownobject.md rename to docs/classes/AsfUnknownObject.md index e34a8f3c..b17a5654 100644 --- a/docs/classes/asfunknownobject.md +++ b/docs/classes/AsfUnknownObject.md @@ -7,7 +7,7 @@ be read from and written to disk. ## Hierarchy -- `BaseObject` +- `default` ↳ **`AsfUnknownObject`** @@ -15,30 +15,30 @@ be read from and written to disk. ### Accessors -- [data](asfunknownobject.md#data) -- [guid](asfunknownobject.md#guid) -- [objectType](asfunknownobject.md#objecttype) -- [originalSize](asfunknownobject.md#originalsize) +- [data](AsfUnknownObject.md#data) +- [guid](AsfUnknownObject.md#guid) +- [objectType](AsfUnknownObject.md#objecttype) +- [originalSize](AsfUnknownObject.md#originalsize) ### Methods -- [initializeFromFile](asfunknownobject.md#initializefromfile) -- [initializeFromGuid](asfunknownobject.md#initializefromguid) -- [render](asfunknownobject.md#render) -- [renderInternal](asfunknownobject.md#renderinternal) -- [fromFile](asfunknownobject.md#fromfile) +- [initializeFromFile](AsfUnknownObject.md#initializefromfile) +- [initializeFromGuid](AsfUnknownObject.md#initializefromguid) +- [render](AsfUnknownObject.md#render) +- [renderInternal](AsfUnknownObject.md#renderinternal) +- [fromFile](AsfUnknownObject.md#fromfile) ## Accessors ### data -• `get` **data**(): [`ByteVector`](bytevector.md) +• `get` **data**(): [`ByteVector`](ByteVector.md) Gets the data contained in the current instance. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) • `set` **data**(`value`): `void` @@ -48,7 +48,7 @@ Sets the data contained in the current instance. | Name | Type | Description | | :------ | :------ | :------ | -| `value` | [`ByteVector`](bytevector.md) | Data to store in the current instance. Must be truthy. | +| `value` | [`ByteVector`](ByteVector.md) | Data to store in the current instance. Must be truthy. | #### Returns @@ -66,16 +66,26 @@ Gets the GUID that identifies the current instance. `default` +#### Inherited from + +BaseObject.guid + ___ ### objectType • `get` **objectType**(): `ObjectType` +**`inheritdoc`** + #### Returns `ObjectType` +#### Overrides + +BaseObject.objectType + ___ ### originalSize @@ -88,6 +98,10 @@ Gets the original size of the current instance. `number` +#### Inherited from + +BaseObject.originalSize + ## Methods ### initializeFromFile @@ -101,7 +115,7 @@ file. | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File which contains the details of the new instance to create | +| `file` | [`File`](File.md) | File which contains the details of the new instance to create | | `position` | `number` | Position in `file` where the object begins | #### Returns @@ -138,13 +152,13 @@ ___ ### render -▸ **render**(): [`ByteVector`](bytevector.md) +▸ **render**(): [`ByteVector`](ByteVector.md) **`inheritdoc`** #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides @@ -154,7 +168,7 @@ ___ ### renderInternal -▸ `Protected` **renderInternal**(`data`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderInternal**(`data`): [`ByteVector`](ByteVector.md) Renders the current instance as a raw ASF object containing the specified data. @@ -165,11 +179,11 @@ Renders the current instance as a raw ASF object containing the specified data. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Data to store in the rendered version of the current instance. | +| `data` | [`ByteVector`](ByteVector.md) | Data to store in the rendered version of the current instance. | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from @@ -179,7 +193,7 @@ ___ ### fromFile -▸ `Static` **fromFile**(`file`, `position`): [`AsfUnknownObject`](asfunknownobject.md) +▸ `Static` **fromFile**(`file`, `position`): [`AsfUnknownObject`](AsfUnknownObject.md) Constructs and initializes a new instance by reading the contents from a specified file. @@ -187,9 +201,9 @@ Constructs and initializes a new instance by reading the contents from a specifi | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File from which the contents of the new instance will be read | +| `file` | [`File`](File.md) | File from which the contents of the new instance will be read | | `position` | `number` | Index into the file where the object begins | #### Returns -[`AsfUnknownObject`](asfunknownobject.md) +[`AsfUnknownObject`](AsfUnknownObject.md) diff --git a/docs/classes/avistream.md b/docs/classes/AviStream.md similarity index 78% rename from docs/classes/avistream.md rename to docs/classes/AviStream.md index 18c23317..d5764f97 100644 --- a/docs/classes/avistream.md +++ b/docs/classes/AviStream.md @@ -9,34 +9,34 @@ stream list. ### Constructors -- [constructor](avistream.md#constructor) +- [constructor](AviStream.md#constructor) ### Properties -- [formatChunkId](avistream.md#formatchunkid) -- [headerChunkId](avistream.md#headerchunkid) -- [listType](avistream.md#listtype) +- [FORMAT\_CHUNK\_ID](AviStream.md#format_chunk_id) +- [HEADER\_CHUNK\_ID](AviStream.md#header_chunk_id) +- [LIST\_TYPE](AviStream.md#list_type) ### Accessors -- [bottom](avistream.md#bottom) -- [codec](avistream.md#codec) -- [flags](avistream.md#flags) -- [handler](avistream.md#handler) -- [initialFrames](avistream.md#initialframes) -- [language](avistream.md#language) -- [left](avistream.md#left) -- [length](avistream.md#length) -- [priority](avistream.md#priority) -- [quality](avistream.md#quality) -- [rate](avistream.md#rate) -- [right](avistream.md#right) -- [sampleSize](avistream.md#samplesize) -- [scale](avistream.md#scale) -- [start](avistream.md#start) -- [suggestedSampleSize](avistream.md#suggestedsamplesize) -- [top](avistream.md#top) -- [type](avistream.md#type) +- [bottom](AviStream.md#bottom) +- [codec](AviStream.md#codec) +- [flags](AviStream.md#flags) +- [handler](AviStream.md#handler) +- [initialFrames](AviStream.md#initialframes) +- [language](AviStream.md#language) +- [left](AviStream.md#left) +- [length](AviStream.md#length) +- [priority](AviStream.md#priority) +- [quality](AviStream.md#quality) +- [rate](AviStream.md#rate) +- [right](AviStream.md#right) +- [sampleSize](AviStream.md#samplesize) +- [scale](AviStream.md#scale) +- [start](AviStream.md#start) +- [suggestedSampleSize](AviStream.md#suggestedsamplesize) +- [top](AviStream.md#top) +- [type](AviStream.md#type) ## Constructors @@ -50,25 +50,25 @@ Constructs and initializes a new instance with a specified stream header. | Name | Type | Description | | :------ | :------ | :------ | -| `list` | [`RiffList`](rifflist.md) | RiffList containing the stream headers | +| `list` | [`RiffList`](RiffList.md) | RiffList containing the stream headers | ## Properties -### formatChunkId +### FORMAT\_CHUNK\_ID -▪ `Static` `Readonly` **formatChunkId**: ``"strf"`` +▪ `Static` `Readonly` **FORMAT\_CHUNK\_ID**: ``"strf"`` ___ -### headerChunkId +### HEADER\_CHUNK\_ID -▪ `Static` `Readonly` **headerChunkId**: ``"strh"`` +▪ `Static` `Readonly` **HEADER\_CHUNK\_ID**: ``"strh"`` ___ -### listType +### LIST\_TYPE -▪ `Static` `Readonly` **listType**: ``"strl"`` +▪ `Static` `Readonly` **LIST\_TYPE**: ``"strl"`` ## Accessors @@ -87,13 +87,13 @@ ___ ### codec -• `get` **codec**(): [`ICodec`](../interfaces/icodec.md) +• `get` **codec**(): [`ICodec`](../interfaces/ICodec.md) Gets the codec information for this stream. #### Returns -[`ICodec`](../interfaces/icodec.md) +[`ICodec`](../interfaces/ICodec.md) ___ @@ -307,10 +307,10 @@ ___ ### type -• `get` **type**(): [`AviStreamType`](../enums/avistreamtype.md) +• `get` **type**(): [`AviStreamType`](../enums/AviStreamType.md) Gets a FOURCC that species the type of data contained in the stream. #### Returns -[`AviStreamType`](../enums/avistreamtype.md) +[`AviStreamType`](../enums/AviStreamType.md) diff --git a/docs/classes/ByteVector.md b/docs/classes/ByteVector.md new file mode 100644 index 00000000..84ef7acd --- /dev/null +++ b/docs/classes/ByteVector.md @@ -0,0 +1,1199 @@ +[node-taglib-sharp](../README.md) / [Exports](../modules.md) / ByteVector + +# Class: ByteVector + +Wrapper around a `Uint8Array` that provides functionality for reading and writing byte arrays. + +**`remarks`** Implementation of this class uses a single `Uint8Array` to store bytes. Due to + `Uint8Array`s being fixed length, any operation that inserts or removes values into the + instance will result in a copy of the internal array being made. If multiple additions will + be made, rather than using multiple inserts/adds, the [ByteVector.concatenate](ByteVector.md#concatenate) method + is provided to group additions/inserts and therefore improve performance. + + The original .NET implementation had an ubiquitous `mid` method that would return a subset + of the bytes in the current instance. In versions <5 of the node port, `mid` would make a + copy of the subset of the bytes. Since this was frequently done right before reading a + number or string, this copy was extremely wasteful. In version 5, the `mid` method was + replaced with `subarray` which behaves identically to `Uint8Array.subarray` and returns + an instance that is a 'view' of an existing instance - no copying involved. However, all + write operations make copies, instances that are backed by 'views' may waste memory by + referencing a `Uint8Array` that is much larger than the view. + + With this in mind, best practices for using `ByteVectors`: + * Calling [ByteVector.subarray](ByteVector.md#subarray) is cheap, use it when possible + * If storing a subset of a `ByteVector`, store a copy with [ByteVector.toByteVector](ByteVector.md#tobytevector) + * If building a `ByteVector`, use [ByteVector.concatenate](ByteVector.md#concatenate) when possible + * If the instance should be immutable, use [ByteVector.makeReadOnly](ByteVector.md#makereadonly) + +## Table of contents + +### Accessors + +- [checksum](ByteVector.md#checksum) +- [isEmpty](ByteVector.md#isempty) +- [isReadOnly](ByteVector.md#isreadonly) +- [isView](ByteVector.md#isview) +- [length](ByteVector.md#length) + +### Methods + +- [[iterator]](ByteVector.md#[iterator]) +- [addByte](ByteVector.md#addbyte) +- [addByteArray](ByteVector.md#addbytearray) +- [addByteVector](ByteVector.md#addbytevector) +- [clear](ByteVector.md#clear) +- [compareTo](ByteVector.md#compareto) +- [containsAt](ByteVector.md#containsat) +- [endsWith](ByteVector.md#endswith) +- [endsWithPartialMatch](ByteVector.md#endswithpartialmatch) +- [equals](ByteVector.md#equals) +- [find](ByteVector.md#find) +- [get](ByteVector.md#get) +- [indexOf](ByteVector.md#indexof) +- [makeReadOnly](ByteVector.md#makereadonly) +- [offsetFind](ByteVector.md#offsetfind) +- [rFind](ByteVector.md#rfind) +- [resize](ByteVector.md#resize) +- [set](ByteVector.md#set) +- [splice](ByteVector.md#splice) +- [split](ByteVector.md#split) +- [startsWith](ByteVector.md#startswith) +- [subarray](ByteVector.md#subarray) +- [toBase64String](ByteVector.md#tobase64string) +- [toByteArray](ByteVector.md#tobytearray) +- [toByteVector](ByteVector.md#tobytevector) +- [toDouble](ByteVector.md#todouble) +- [toFloat](ByteVector.md#tofloat) +- [toInt](ByteVector.md#toint) +- [toLong](ByteVector.md#tolong) +- [toShort](ByteVector.md#toshort) +- [toString](ByteVector.md#tostring) +- [toStrings](ByteVector.md#tostrings) +- [toUint](ByteVector.md#touint) +- [toUlong](ByteVector.md#toulong) +- [toUshort](ByteVector.md#toushort) +- [compare](ByteVector.md#compare) +- [concatenate](ByteVector.md#concatenate) +- [empty](ByteVector.md#empty) +- [equals](ByteVector.md#equals) +- [fromBase64String](ByteVector.md#frombase64string) +- [fromByteArray](ByteVector.md#frombytearray) +- [fromFileAbstraction](ByteVector.md#fromfileabstraction) +- [fromInt](ByteVector.md#fromint) +- [fromInternalStream](ByteVector.md#frominternalstream) +- [fromLong](ByteVector.md#fromlong) +- [fromPath](ByteVector.md#frompath) +- [fromShort](ByteVector.md#fromshort) +- [fromSize](ByteVector.md#fromsize) +- [fromStream](ByteVector.md#fromstream) +- [fromString](ByteVector.md#fromstring) +- [fromUint](ByteVector.md#fromuint) +- [fromUlong](ByteVector.md#fromulong) +- [fromUshort](ByteVector.md#fromushort) +- [getTextDelimiter](ByteVector.md#gettextdelimiter) + +## Accessors + +### checksum + +• `get` **checksum**(): `number` + +Calculates the CRC32 of the current instance. + +#### Returns + +`number` + +___ + +### isEmpty + +• `get` **isEmpty**(): `boolean` + +Whether the current instance has 0 bytes stored. + +#### Returns + +`boolean` + +___ + +### isReadOnly + +• `get` **isReadOnly**(): `boolean` + +Whether the current instance is read-only. If `true`, any call that will modify the instance +will throw. + +#### Returns + +`boolean` + +___ + +### isView + +• `get` **isView**(): `boolean` + +Whether the current instance is a 'view' of another byte vector. + +#### Returns + +`boolean` + +___ + +### length + +• `get` **length**(): `number` + +Number of bytes currently in this instance. + +#### Returns + +`number` + +## Methods + +### [iterator] + +▸ **[iterator]**(): `Iterator`<`number`, `any`, `undefined`\> + +Gets iterator for iterating over bytes in the current instance. + +#### Returns + +`Iterator`<`number`, `any`, `undefined`\> + +___ + +### addByte + +▸ **addByte**(`byte`): `void` + +Adds a single byte to the end of the current instance + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `byte` | `number` | Value to add to the end of the ByteVector. Must be positive 8-bit integer. | + +#### Returns + +`void` + +___ + +### addByteArray + +▸ **addByteArray**(`data`, `length?`): `void` + +Adds an array of bytes to the end of the current instance + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `data` | `Uint8Array` | Array of bytes to add to the end of the ByteVector | +| `length?` | `number` | Number of elements from `data` to copy into the current instance | + +#### Returns + +`void` + +___ + +### addByteVector + +▸ **addByteVector**(`data`): `void` + +Adds a [ByteVector](ByteVector.md) to the end of this ByteVector + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `data` | [`ByteVector`](ByteVector.md) | ByteVector to add to the end of this ByteVector | + +#### Returns + +`void` + +___ + +### clear + +▸ **clear**(): `void` + +Removes all elements from this [ByteVector](ByteVector.md) + +**`remarks`** This method replaces the internal byte array with a new one. + +#### Returns + +`void` + +___ + +### compareTo + +▸ **compareTo**(`other`): `number` + +Compares the current instance to another byte vector. Returns a numeric result. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `other` | [`ByteVector`](ByteVector.md) | Other byte vector to compare against the current instance. | + +#### Returns + +`number` + +___ + +### containsAt + +▸ **containsAt**(`pattern`, `offset?`): `boolean` + +Determines if `pattern` exists at a certain `offset` in this byte vector. + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | ByteVector to search for at in this byte vector | +| `offset` | `number` | `0` | Position in this byte vector to search for the pattern. If omitted, defaults to `0` | + +#### Returns + +`boolean` + +___ + +### endsWith + +▸ **endsWith**(`pattern`): `boolean` + +Determines whether this byte vector ends with the provided `pattern`. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `pattern` | [`ByteVector`](ByteVector.md) | ByteVector to look for at the end of this byte vector | + +#### Returns + +`boolean` + +___ + +### endsWithPartialMatch + +▸ **endsWithPartialMatch**(`pattern`): `number` + +Determines whether this byte vector ends with a part of the `pattern`. +NOTE: if this instance ends with `pattern` perfectly, it must end with n-1 or +fewer bytes. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `pattern` | [`ByteVector`](ByteVector.md) | ByteVector to look for at the end of this byte vector | + +#### Returns + +`number` + +___ + +### equals + +▸ **equals**(`other`): `boolean` + +Determines if this instance has identical contents to the `other` instance. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `other` | [`ByteVector`](ByteVector.md) | Other instance to compare against the current instance. | + +#### Returns + +`boolean` + +___ + +### find + +▸ **find**(`pattern`, `byteAlign?`): `number` + +Searches this instance for the `pattern`. Returns the index of the first instance +of the pattern, or `-1` if it was not found. Providing a `byteAlign` requires the +pattern to appear at an index that is a multiple of the byteAlign parameter. +Example: searching "abcd" for "ab" with byteAlign 1 will return 0. Searching "abcd" for +"ab" with byteAlign 2 will return 1. Searching "00ab" for "ab" with byteAlign 2 will return +2. Searching "0abc" with byteAlign 2 will return -1. + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern of bytes to search this instance for | +| `byteAlign` | `number` | `1` | Optional, byte alignment the pattern much align to | + +#### Returns + +`number` + +___ + +### get + +▸ **get**(`index`): `number` + +Gets the byte at the given `index`. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `index` | `number` | Element index to return | + +#### Returns + +`number` + +___ + +### indexOf + +▸ **indexOf**(`item`): `number` + +Gets the index of the first occurrence of the specified value. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `item` | `number` | A byte to find within the current instance. | + +#### Returns + +`number` + +An integer containing the first index at which the value was found, or -1 if it + was not found/ + +___ + +### makeReadOnly + +▸ **makeReadOnly**(): [`ByteVector`](ByteVector.md) + +Makes the current instance read-only, causing any call that would modify it or allow it to +be modified to throw. + +#### Returns + +[`ByteVector`](ByteVector.md) + +___ + +### offsetFind + +▸ **offsetFind**(`pattern`, `offset`, `byteAlign?`): `number` + +Searches this instance for the `pattern` occurring after a given offset. Returns the index +of the first instance of the pattern, relative to the start of the array, or `-1` if it was +not found. Providing a `byteAlign` requires the pattern to appear at an index that is a +multiple of the byteAlign parameter. Example: searching "abcd" for "ab" with byteAlign 1 +will return 0. Searching "abcd" for "ab" with byteAlign 2 will return 1. Searching "00ab" +for "ab" with byteAlign 2 will return 2. Searching "0abc" with byteAlign 2 will return -1. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `pattern` | [`ByteVector`](ByteVector.md) | Pattern of bytes to search this instance for | +| `offset` | `number` | Index into the instance to begin searching for `pattern` | +| `byteAlign?` | `number` | Optional, byte alignment the pattern much align to | + +#### Returns + +`number` + +___ + +### rFind + +▸ **rFind**(`pattern`, `byteAlign?`): `number` + +Finds a byte vector by searching from the end of this instance and working towards the +beginning of this instance. Returns the index of the first instance of the pattern, or `-1` +if it was not found. Providing a `byteAlign` requires the pattern to appear at an +index that is a multiple of the byteAlign parameter. +Example: searching "abcd" for "ab" with byteAlign 1 will return 0. Searching "abcd" for +"ab" with byteAlign 2 will return 1. Searching "00ab" for "ab" with byteAlign 2 will return +2. Searching "0abc" with byteAlign 2 will return -1. + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern of bytes to search this instance for | +| `byteAlign` | `number` | `1` | Optional, byte alignment the pattern must align to | + +#### Returns + +`number` + +___ + +### resize + +▸ **resize**(`size`, `padding?`): `void` + +Resizes this instance to the length specified in `size`. If the desired size is +longer than the current length, it will be filled with the byte value in +`padding`. If the desired size is shorter than the current length, bytes will be +removed. + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `size` | `number` | `undefined` | Length of the byte vector after resizing. Must be unsigned 32-bit integer | +| `padding` | `number` | `0x0` | Byte to fill any excess space created after resizing | + +#### Returns + +`void` + +___ + +### set + +▸ **set**(`index`, `value`): `void` + +Sets the value at a specified index + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `index` | `number` | Index to set the value of | +| `value` | `number` | Value to set at the index. Must be a valid integer betweenInclusive 0x0 and 0xff | + +#### Returns + +`void` + +___ + +### splice + +▸ **splice**(`start`, `deleteCount`, `items?`): `void` + +Changes the contents of the current instance by removing or replacing existing elements +and/or adding new elements. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `start` | `number` | Index at which to start changing the array. Must be less than the length of the instance | +| `deleteCount` | `number` | Number of elements in the array to remove from start. If greater than the remaining length of the element, it will be capped at the remaining length | +| `items?` | [`ByteVector`](ByteVector.md) \| `Uint8Array` \| `number`[] | Elements to add to the array beginning from start. If omitted, the method will only remove elements from the current instance. | + +#### Returns + +`void` + +___ + +### split + +▸ **split**(`separator`, `byteAlign?`, `max?`): [`ByteVector`](ByteVector.md)[] + +Splits this byte vector into a list of byte vectors using a separator + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `separator` | [`ByteVector`](ByteVector.md) | `undefined` | Object to use to split this byte vector | +| `byteAlign` | `number` | `1` | Byte align to use when splitting. in order to split when a pattern is encountered, the index at which it is found must be divisible by this value. | +| `max` | `number` | `0` | Maximum number of objects to return or 0 to not limit the number. If that number is reached, the last value will contain the remainder of the file even if it contains more instances of `separator`. | + +#### Returns + +[`ByteVector`](ByteVector.md)[] + +ByteVector[] The split contents of the current instance + +___ + +### startsWith + +▸ **startsWith**(`pattern`): `boolean` + +Checks whether or not a pattern appears at the beginning of the current instance. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `pattern` | [`ByteVector`](ByteVector.md) | ByteVector containing the pattern to check for in the current instance. | + +#### Returns + +`boolean` + +`true` if the pattern was found at the beginning of the current instance, `false` + otherwise. + +___ + +### subarray + +▸ **subarray**(`startIndex`, `length?`): [`ByteVector`](ByteVector.md) + +Returns a window over the current instance. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `startIndex` | `number` | Offset into this instance where the comprehension begins | +| `length` | `number` | Number of elements from the instance to include. If omitted, defaults to the remainder of the instance | + +#### Returns + +[`ByteVector`](ByteVector.md) + +___ + +### toBase64String + +▸ **toBase64String**(): `string` + +Returns the current instance as a base64 encoded string. + +#### Returns + +`string` + +___ + +### toByteArray + +▸ **toByteArray**(): `Uint8Array` + +Returns the bytes for the instance. Don't use it unless you need to. + +**`internal`** + +**`deprecated`** DON'T USE IT UNLESS YOU HAVE NO CHOICE. + +#### Returns + +`Uint8Array` + +___ + +### toByteVector + +▸ **toByteVector**(): [`ByteVector`](ByteVector.md) + +Returns a writable copy of the bytes represented by this instance. + +**`remarks`** This is a **copy** of the data. Use sparingly. + +#### Returns + +[`ByteVector`](ByteVector.md) + +___ + +### toDouble + +▸ **toDouble**(`mostSignificantByteFirst?`): `number` + +Converts the first eight bytes of the current instance to a double-precision floating-point +value. + +**`throws`** Error If there are less than eight bytes in the current instance. + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `mostSignificantByteFirst` | `boolean` | `true` | If `true` the most significant byte appears first (big endian format). | + +#### Returns + +`number` + +A double value containing the value read from the current instance. + +___ + +### toFloat + +▸ **toFloat**(`mostSignificantByteFirst?`): `number` + +Converts the first four bytes of the current instance to a single-precision floating-point +value. + +**`throws`** Error If there are less than four bytes in the current instance + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `mostSignificantByteFirst` | `boolean` | `true` | If `true` the most significant byte appears first (big endian format). | + +#### Returns + +`number` + +A float value containing the value read from the current instance. + +___ + +### toInt + +▸ **toInt**(`mostSignificantByteFirst?`): `number` + +Converts the first four bytes of the current instance to a signed integer. If the current +instance is less than four bytes, the most significant bytes will be filled with 0x00. + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `mostSignificantByteFirst` | `boolean` | `true` | If `true` the most significant byte appears first (big endian format) | + +#### Returns + +`number` + +A signed integer value containing the value read from the current instance + +___ + +### toLong + +▸ **toLong**(`mostSignificantByteFirst?`): `bigint` + +Converts the first eight bytes of the current instance to a signed long. If the current +instance is less than eight bytes, the most significant bytes will be filled with 0x00. + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `mostSignificantByteFirst` | `boolean` | `true` | If `true` the most significant byte appears first (big endian format) | + +#### Returns + +`bigint` + +A signed long value containing the value read from the current instance, + represented as a BigInt due to JavaScript's 52-bit integer limitation. + +___ + +### toShort + +▸ **toShort**(`mostSignificantByteFirst?`): `number` + +Converts the first two bytes of the current instance to a signed short. If the current +instance is less than two bytes, the most significant bytes will be filled with 0x00. + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `mostSignificantByteFirst` | `boolean` | `true` | If `true` the most significant byte appears first (big endian format) | + +#### Returns + +`number` + +A signed short value containing the value read from the current instance + +___ + +### toString + +▸ **toString**(`type`): `string` + +Converts a portion of the current instance to a string using a specified encoding + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `type` | [`StringType`](../enums/StringType.md) | Value indicating the encoding to use when converting to a string. | + +#### Returns + +`string` + +string String containing the converted bytes + +___ + +### toStrings + +▸ **toStrings**(`type`, `count?`): `string`[] + +Converts the current instance into an array of strings starting at the specified offset and +using the specified encoding, assuming the values are `null` separated and limiting it to a +specified number of items. + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `type` | [`StringType`](../enums/StringType.md) | `undefined` | A [StringType](../enums/StringType.md) value indicating the encoding to use when converting | +| `count` | `number` | `Number.MAX_SAFE_INTEGER` | Value specifying a limit to the number of strings to create. Once the limit has been reached, the last string will be filled by the remainder of the data | + +#### Returns + +`string`[] + +string[] Array of strings containing the converted text. + +___ + +### toUint + +▸ **toUint**(`mostSignificantByteFirst?`): `number` + +Converts the first four bytes of the current instance to an unsigned integer. If the current +instance is less than four bytes, the most significant bytes will be filled with 0x00. + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `mostSignificantByteFirst` | `boolean` | `true` | If `true` the most significant byte appears first (big endian format) | + +#### Returns + +`number` + +An unsigned integer value containing the value read from the current instance + +___ + +### toUlong + +▸ **toUlong**(`mostSignificantByteFirst?`): `bigint` + +Converts the first eight bytes of the current instance to an unsigned long. If the current +instance is less than eight bytes, the most significant bytes will be filled with 0x00. + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `mostSignificantByteFirst` | `boolean` | `true` | If `true` the most significant byte appears first (big endian format) | + +#### Returns + +`bigint` + +An unsigned short value containing the value read from the current instance, + represented as a BigInt due to JavaScript's 32-bit integer limitation + +___ + +### toUshort + +▸ **toUshort**(`mostSignificantByteFirst?`): `number` + +Converts the first two bytes of the current instance to an unsigned short. If the current +instance is less than two bytes, the most significant bytes will be filled with 0x00. + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `mostSignificantByteFirst` | `boolean` | `true` | If `true` the most significant byte appears first (big endian format) | + +#### Returns + +`number` + +An unsigned short value containing the value read from the current instance + +___ + +### compare + +▸ `Static` **compare**(`a`, `b`): `number` + +Compares two byte vectors. Returns a numeric value + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `a` | [`ByteVector`](ByteVector.md) | Byte vector to compare against `b` | +| `b` | [`ByteVector`](ByteVector.md) | Byte vector to compare against `a` | + +#### Returns + +`number` + +number `0` if the two vectors are the same. Any other value indicates the two are + different. If the two vectors differ by length, this will be the length of `a` minus the + length of `b`. If the lengths are the same it will be the difference between the first + element that differs. + +___ + +### concatenate + +▸ `Static` **concatenate**(...`vectors`): [`ByteVector`](ByteVector.md) + +Creates a [ByteVector](ByteVector.md) from a collection of bytes, byte arrays, and byte vectors. This +method is better to use when a known quantity of byte vectors will be concatenated together, +since doing multiple calls to [ByteVector.addByteVector](ByteVector.md#addbytevector) results in the entire byte +vector being copied for each call. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `...vectors` | (`number` \| [`ByteVector`](ByteVector.md) \| `Uint8Array`)[] | ByteVectors, byte arrays, or straight bytes to concatenate together into a new [ByteVector](ByteVector.md) | + +#### Returns + +[`ByteVector`](ByteVector.md) + +ByteVector Single byte vector with the contents of the byte vectors in + `vectors` concatenated together + +___ + +### empty + +▸ `Static` **empty**(): [`ByteVector`](ByteVector.md) + +Creates an empty [ByteVector](ByteVector.md) + +#### Returns + +[`ByteVector`](ByteVector.md) + +___ + +### equals + +▸ `Static` **equals**(`first`, `second`): `boolean` + +Returns `true` if the contents of the two [ByteVector](ByteVector.md)s are identical, returns `false` +otherwise + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `first` | [`ByteVector`](ByteVector.md) | ByteVector to compare with `second` | +| `second` | [`ByteVector`](ByteVector.md) | ByteVector to compare with `first` | + +#### Returns + +`boolean` + +___ + +### fromBase64String + +▸ `Static` **fromBase64String**(`str`): [`ByteVector`](ByteVector.md) + +Creates a [ByteVector](ByteVector.md) from a base64 string. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `str` | `string` | Base64 string to convert into a byte vector | + +#### Returns + +[`ByteVector`](ByteVector.md) + +___ + +### fromByteArray + +▸ `Static` **fromByteArray**(`bytes`, `length?`): [`ByteVector`](ByteVector.md) + +Creates a [ByteVector](ByteVector.md) from a `Uint8Array` or `Buffer` + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `bytes` | `Uint8Array` \| `Buffer` \| `number`[] | `undefined` | Uint8Array of the bytes to put in the ByteVector | +| `length` | `number` | `bytes.length` | Optionally, number of bytes to read. If this is not provided, it will default to the full length of `bytes`. If it is less than the length of `bytes`, `bytes` will be copied into the {@see ByteVector}. | + +#### Returns + +[`ByteVector`](ByteVector.md) + +___ + +### fromFileAbstraction + +▸ `Static` **fromFileAbstraction**(`abstraction`): [`ByteVector`](ByteVector.md) + +Creates a new instance by reading in the contents of a specified file abstraction. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `abstraction` | `IFileAbstraction` | File abstraction to read | + +#### Returns + +[`ByteVector`](ByteVector.md) + +___ + +### fromInt + +▸ `Static` **fromInt**(`value`, `isBigEndian?`): [`ByteVector`](ByteVector.md) + +Creates a 4 byte [ByteVector](ByteVector.md) with a signed 32-bit integer as the data + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `value` | `number` | `undefined` | Signed 32-bit integer to use as the data. | +| `isBigEndian` | `boolean` | `true` | If `true`, `value` will be stored in big endian format. If `false`, `value` will be stored in little endian format | + +#### Returns + +[`ByteVector`](ByteVector.md) + +___ + +### fromInternalStream + +▸ `Static` **fromInternalStream**(`stream`): [`ByteVector`](ByteVector.md) + +Creates a ByteVector using the contents of an TagLibSharp-node stream as the contents. This +method reads from the current offset of the stream, not the beginning of the stream + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `stream` | `IStream` | TagLibSharp-node internal stream object | + +#### Returns + +[`ByteVector`](ByteVector.md) + +___ + +### fromLong + +▸ `Static` **fromLong**(`value`, `isBigEndian?`): [`ByteVector`](ByteVector.md) + +Creates an 8 byte [ByteVector](ByteVector.md) with a signed 64-bit integer as the data + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `value` | `number` \| `bigint` | `undefined` | Signed 64-bit integer to use as the data. If using a `bigint`, it must fit within 8 bytes. If using a `number`, it must be a safe integer. | +| `isBigEndian` | `boolean` | `true` | If `true`, `value` will be stored in big endian format. If `false`, `value` will be stored in little endian format | + +#### Returns + +[`ByteVector`](ByteVector.md) + +___ + +### fromPath + +▸ `Static` **fromPath**(`path`): [`ByteVector`](ByteVector.md) + +Creates a [ByteVector](ByteVector.md) using the contents of a file as the data + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `path` | `string` | Path to the file to store in the ByteVector | + +#### Returns + +[`ByteVector`](ByteVector.md) + +___ + +### fromShort + +▸ `Static` **fromShort**(`value`, `isBigEndian?`): [`ByteVector`](ByteVector.md) + +Creates a 2 byte [ByteVector](ByteVector.md) with a signed 16-bit integer as the data + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `value` | `number` | `undefined` | Signed 16-bit integer to use as the data. | +| `isBigEndian` | `boolean` | `true` | If `true`, `value` will be stored in big endian format. If `false`, `value` will be stored in little endian format | + +#### Returns + +[`ByteVector`](ByteVector.md) + +___ + +### fromSize + +▸ `Static` **fromSize**(`size`, `fill?`): [`ByteVector`](ByteVector.md) + +Creates a [ByteVector](ByteVector.md) of a given length with a given value for all the elements + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `size` | `number` | `undefined` | Length of the ByteVector. Must be a positive safe integer | +| `fill` | `number` | `0x0` | Byte value to initialize all elements to. Must be a positive 8-bit integer | + +#### Returns + +[`ByteVector`](ByteVector.md) + +___ + +### fromStream + +▸ `Static` **fromStream**(`readStream`): `Promise`<[`ByteVector`](ByteVector.md)\> + +Creates [ByteVector](ByteVector.md) with the contents of a stream as the data. The stream will be read +to the end before the ByteVector is returned. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `readStream` | `ReadableStream` | Readable stream that will be read in entirety. | + +#### Returns + +`Promise`<[`ByteVector`](ByteVector.md)\> + +___ + +### fromString + +▸ `Static` **fromString**(`text`, `type`, `length?`): [`ByteVector`](ByteVector.md) + +Creates [ByteVector](ByteVector.md) with the byte representation of a string as the data. + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `text` | `string` | `undefined` | String to store in the ByteVector | +| `type` | [`StringType`](../enums/StringType.md) | `undefined` | StringType to use to encode the string. If [StringType.UTF16](../enums/StringType.md#utf16) is used, the string will be encoded as UTF16-LE. | +| `length` | `number` | `Number.MAX_SAFE_INTEGER` | Number of characters from the string to store in the ByteVector. Must be a positive 32-bit integer. | + +#### Returns + +[`ByteVector`](ByteVector.md) + +___ + +### fromUint + +▸ `Static` **fromUint**(`value`, `isBigEndian?`): [`ByteVector`](ByteVector.md) + +Creates a 4 byte [ByteVector](ByteVector.md) with a positive 32-bit integer as the data + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `value` | `number` | `undefined` | Positive 32-bit integer to use as the data | +| `isBigEndian` | `boolean` | `true` | If `true`, `value` will be stored in big endian format. If `false`, `value` will be stored in little endian format | + +#### Returns + +[`ByteVector`](ByteVector.md) + +___ + +### fromUlong + +▸ `Static` **fromUlong**(`value`, `isBigEndian?`): [`ByteVector`](ByteVector.md) + +Creates an 8 byte [ByteVector](ByteVector.md) with a positive 64-bit integer as the data + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `value` | `number` \| `bigint` | `undefined` | Positive 64-bit integer to use as the data. If using a `bigint` it must fit within 8 bytes. | +| `isBigEndian` | `boolean` | `true` | If `true`, `value` will be stored in big endian format. If `false`, `value` will be stored in little endian format | + +#### Returns + +[`ByteVector`](ByteVector.md) + +___ + +### fromUshort + +▸ `Static` **fromUshort**(`value`, `isBigEndian?`): [`ByteVector`](ByteVector.md) + +Creates a 2 byte [ByteVector](ByteVector.md) with a positive 16-bit integer as the data + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `value` | `number` | `undefined` | Positive 16-bit integer to use as the data. | +| `isBigEndian` | `boolean` | `true` | If `true`, `value` will be stored in big endian format. If `false`, `value` will be stored in little endian format | + +#### Returns + +[`ByteVector`](ByteVector.md) + +___ + +### getTextDelimiter + +▸ `Static` **getTextDelimiter**(`type`): [`ByteVector`](ByteVector.md) + +Gets the appropriate length null-byte text delimiter for the specified `type`. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `type` | [`StringType`](../enums/StringType.md) | String type to get delimiter for | + +#### Returns + +[`ByteVector`](ByteVector.md) diff --git a/docs/classes/CombinedTag.md b/docs/classes/CombinedTag.md new file mode 100644 index 00000000..0262deeb --- /dev/null +++ b/docs/classes/CombinedTag.md @@ -0,0 +1,2277 @@ +[node-taglib-sharp](../README.md) / [Exports](../modules.md) / CombinedTag + +# Class: CombinedTag + +This class provides a unified way of accessing tag data from multiple tag types. + +## Hierarchy + +- [`Tag`](Tag.md) + + ↳ **`CombinedTag`** + + ↳↳ [`FlacTag`](FlacTag.md) + + ↳↳ [`OggTag`](OggTag.md) + +## Table of contents + +### Constructors + +- [constructor](CombinedTag.md#constructor) + +### Accessors + +- [album](CombinedTag.md#album) +- [albumArtists](CombinedTag.md#albumartists) +- [albumArtistsSort](CombinedTag.md#albumartistssort) +- [albumSort](CombinedTag.md#albumsort) +- [amazonId](CombinedTag.md#amazonid) +- [beatsPerMinute](CombinedTag.md#beatsperminute) +- [comment](CombinedTag.md#comment) +- [composers](CombinedTag.md#composers) +- [composersSort](CombinedTag.md#composerssort) +- [conductor](CombinedTag.md#conductor) +- [copyright](CombinedTag.md#copyright) +- [dateTagged](CombinedTag.md#datetagged) +- [description](CombinedTag.md#description) +- [disc](CombinedTag.md#disc) +- [discCount](CombinedTag.md#disccount) +- [firstAlbumArtist](CombinedTag.md#firstalbumartist) +- [firstAlbumArtistSort](CombinedTag.md#firstalbumartistsort) +- [firstComposer](CombinedTag.md#firstcomposer) +- [firstComposerSort](CombinedTag.md#firstcomposersort) +- [firstGenre](CombinedTag.md#firstgenre) +- [firstPerformer](CombinedTag.md#firstperformer) +- [firstPerformerSort](CombinedTag.md#firstperformersort) +- [genres](CombinedTag.md#genres) +- [grouping](CombinedTag.md#grouping) +- [initialKey](CombinedTag.md#initialkey) +- [isCompilation](CombinedTag.md#iscompilation) +- [isEmpty](CombinedTag.md#isempty) +- [isrc](CombinedTag.md#isrc) +- [joinedAlbumArtists](CombinedTag.md#joinedalbumartists) +- [joinedComposers](CombinedTag.md#joinedcomposers) +- [joinedGenres](CombinedTag.md#joinedgenres) +- [joinedPerformers](CombinedTag.md#joinedperformers) +- [joinedPerformersSort](CombinedTag.md#joinedperformerssort) +- [lyrics](CombinedTag.md#lyrics) +- [musicBrainzArtistId](CombinedTag.md#musicbrainzartistid) +- [musicBrainzDiscId](CombinedTag.md#musicbrainzdiscid) +- [musicBrainzReleaseArtistId](CombinedTag.md#musicbrainzreleaseartistid) +- [musicBrainzReleaseCountry](CombinedTag.md#musicbrainzreleasecountry) +- [musicBrainzReleaseGroupId](CombinedTag.md#musicbrainzreleasegroupid) +- [musicBrainzReleaseId](CombinedTag.md#musicbrainzreleaseid) +- [musicBrainzReleaseStatus](CombinedTag.md#musicbrainzreleasestatus) +- [musicBrainzReleaseType](CombinedTag.md#musicbrainzreleasetype) +- [musicBrainzTrackId](CombinedTag.md#musicbrainztrackid) +- [musicIpId](CombinedTag.md#musicipid) +- [performers](CombinedTag.md#performers) +- [performersRole](CombinedTag.md#performersrole) +- [performersSort](CombinedTag.md#performerssort) +- [pictures](CombinedTag.md#pictures) +- [publisher](CombinedTag.md#publisher) +- [remixedBy](CombinedTag.md#remixedby) +- [replayGainAlbumGain](CombinedTag.md#replaygainalbumgain) +- [replayGainAlbumPeak](CombinedTag.md#replaygainalbumpeak) +- [replayGainTrackGain](CombinedTag.md#replaygaintrackgain) +- [replayGainTrackPeak](CombinedTag.md#replaygaintrackpeak) +- [sizeOnDisk](CombinedTag.md#sizeondisk) +- [subtitle](CombinedTag.md#subtitle) +- [supportedTagTypes](CombinedTag.md#supportedtagtypes) +- [tagTypes](CombinedTag.md#tagtypes) +- [tags](CombinedTag.md#tags) +- [title](CombinedTag.md#title) +- [titleSort](CombinedTag.md#titlesort) +- [track](CombinedTag.md#track) +- [trackCount](CombinedTag.md#trackcount) +- [year](CombinedTag.md#year) + +### Methods + +- [addTag](CombinedTag.md#addtag) +- [clear](CombinedTag.md#clear) +- [copyTo](CombinedTag.md#copyto) +- [createTag](CombinedTag.md#createtag) +- [getTag](CombinedTag.md#gettag) +- [removeTags](CombinedTag.md#removetags) +- [replaceTag](CombinedTag.md#replacetag) +- [setInfoTag](CombinedTag.md#setinfotag) +- [validateTagCreation](CombinedTag.md#validatetagcreation) +- [firstInGroup](CombinedTag.md#firstingroup) +- [isFalsyOrLikeEmpty](CombinedTag.md#isfalsyorlikeempty) +- [joinGroup](CombinedTag.md#joingroup) +- [tagTypeFlagsToArray](CombinedTag.md#tagtypeflagstoarray) + +## Constructors + +### constructor + +• `Protected` **new CombinedTag**(`supportedTagTypes`, `writeToAllTags`, `tags?`) + +Constructs and initializes a new instance of [CombinedTag](CombinedTag.md). + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `supportedTagTypes` | [`TagTypes`](../enums/TagTypes.md) | Types of tags that are supported by this instance of the combined | +| `writeToAllTags` | `boolean` | Whether to write to all tags in the instance (`true`) or to the first tag in the instance (`false`). | +| `tags?` | [`Tag`](Tag.md)[] | Optionally, a list of tags to combine in the new instance. | + +#### Overrides + +[Tag](Tag.md).[constructor](Tag.md#constructor) + +## Accessors + +### album + +• `get` **album**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.album + +• `set` **album**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.album + +___ + +### albumArtists + +• `get` **albumArtists**(): `string`[] + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Overrides + +Tag.albumArtists + +• `set` **albumArtists**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Overrides + +Tag.albumArtists + +___ + +### albumArtistsSort + +• `get` **albumArtistsSort**(): `string`[] + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Overrides + +Tag.albumArtistsSort + +• `set` **albumArtistsSort**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Overrides + +Tag.albumArtistsSort + +___ + +### albumSort + +• `get` **albumSort**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.albumSort + +• `set` **albumSort**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.albumSort + +___ + +### amazonId + +• `get` **amazonId**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.amazonId + +• `set` **amazonId**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.amazonId + +___ + +### beatsPerMinute + +• `get` **beatsPerMinute**(): `number` + +**`inheritdoc`** + +#### Returns + +`number` + +#### Overrides + +Tag.beatsPerMinute + +• `set` **beatsPerMinute**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Overrides + +Tag.beatsPerMinute + +___ + +### comment + +• `get` **comment**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.comment + +• `set` **comment**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.comment + +___ + +### composers + +• `get` **composers**(): `string`[] + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Overrides + +Tag.composers + +• `set` **composers**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Overrides + +Tag.composers + +___ + +### composersSort + +• `get` **composersSort**(): `string`[] + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Overrides + +Tag.composersSort + +• `set` **composersSort**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Overrides + +Tag.composersSort + +___ + +### conductor + +• `get` **conductor**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.conductor + +• `set` **conductor**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.conductor + +___ + +### copyright + +• `get` **copyright**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.copyright + +• `set` **copyright**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.copyright + +___ + +### dateTagged + +• `get` **dateTagged**(): `Date` + +**`inheritdoc`** + +#### Returns + +`Date` + +#### Overrides + +Tag.dateTagged + +• `set` **dateTagged**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `Date` | + +#### Returns + +`void` + +#### Overrides + +Tag.dateTagged + +___ + +### description + +• `get` **description**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.description + +• `set` **description**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.description + +___ + +### disc + +• `get` **disc**(): `number` + +**`inheritdoc`** + +#### Returns + +`number` + +#### Overrides + +Tag.disc + +• `set` **disc**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Overrides + +Tag.disc + +___ + +### discCount + +• `get` **discCount**(): `number` + +**`inheritdoc`** + +#### Returns + +`number` + +#### Overrides + +Tag.discCount + +• `set` **discCount**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Overrides + +Tag.discCount + +___ + +### firstAlbumArtist + +• `get` **firstAlbumArtist**(): `string` + +Gets the first value contained in [albumArtists](CombinedTag.md#albumartists). + +#### Returns + +`string` + +#### Inherited from + +Tag.firstAlbumArtist + +___ + +### firstAlbumArtistSort + +• `get` **firstAlbumArtistSort**(): `string` + +Gets the first value contained in [albumArtistsSort](CombinedTag.md#albumartistssort) + +#### Returns + +`string` + +#### Inherited from + +Tag.firstAlbumArtistSort + +___ + +### firstComposer + +• `get` **firstComposer**(): `string` + +Gets the first value contained in [composers](CombinedTag.md#composers) + +#### Returns + +`string` + +#### Inherited from + +Tag.firstComposer + +___ + +### firstComposerSort + +• `get` **firstComposerSort**(): `string` + +Gets the first value contained in [composersSort](CombinedTag.md#composerssort) + +#### Returns + +`string` + +#### Inherited from + +Tag.firstComposerSort + +___ + +### firstGenre + +• `get` **firstGenre**(): `string` + +Gets the first value contained in [genres](CombinedTag.md#genres) + +#### Returns + +`string` + +#### Inherited from + +Tag.firstGenre + +___ + +### firstPerformer + +• `get` **firstPerformer**(): `string` + +Gets the first value contained in [performers](CombinedTag.md#performers) + +#### Returns + +`string` + +#### Inherited from + +Tag.firstPerformer + +___ + +### firstPerformerSort + +• `get` **firstPerformerSort**(): `string` + +Gets the first value contained in [performersSort](CombinedTag.md#performerssort) + +#### Returns + +`string` + +#### Inherited from + +Tag.firstPerformerSort + +___ + +### genres + +• `get` **genres**(): `string`[] + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Overrides + +Tag.genres + +• `set` **genres**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Overrides + +Tag.genres + +___ + +### grouping + +• `get` **grouping**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.grouping + +• `set` **grouping**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.grouping + +___ + +### initialKey + +• `get` **initialKey**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.initialKey + +• `set` **initialKey**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.initialKey + +___ + +### isCompilation + +• `get` **isCompilation**(): `boolean` + +**`inheritdoc`** + +#### Returns + +`boolean` + +#### Overrides + +Tag.isCompilation + +• `set` **isCompilation**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `boolean` | + +#### Returns + +`void` + +#### Overrides + +Tag.isCompilation + +___ + +### isEmpty + +• `get` **isEmpty**(): `boolean` + +**`inheritdoc`** + +#### Returns + +`boolean` + +#### Overrides + +Tag.isEmpty + +___ + +### isrc + +• `get` **isrc**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.isrc + +• `set` **isrc**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.isrc + +___ + +### joinedAlbumArtists + +• `get` **joinedAlbumArtists**(): `string` + +Gets a semicolon and space separated string containing the values in [albumArtists](CombinedTag.md#albumartists) + +#### Returns + +`string` + +#### Inherited from + +Tag.joinedAlbumArtists + +___ + +### joinedComposers + +• `get` **joinedComposers**(): `string` + +Gets a semicolon and space separated string containing the values in [composers](CombinedTag.md#composers) + +#### Returns + +`string` + +#### Inherited from + +Tag.joinedComposers + +___ + +### joinedGenres + +• `get` **joinedGenres**(): `string` + +Gets a semicolon and space separated string containing the values in [genres](CombinedTag.md#genres) + +#### Returns + +`string` + +#### Inherited from + +Tag.joinedGenres + +___ + +### joinedPerformers + +• `get` **joinedPerformers**(): `string` + +Gets a semicolon and space separated string containing the values in [performers](CombinedTag.md#performers) + +#### Returns + +`string` + +#### Inherited from + +Tag.joinedPerformers + +___ + +### joinedPerformersSort + +• `get` **joinedPerformersSort**(): `string` + +Gets a semicolon and space separated string containing the values in [performersSort](CombinedTag.md#performerssort) + +#### Returns + +`string` + +#### Inherited from + +Tag.joinedPerformersSort + +___ + +### lyrics + +• `get` **lyrics**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.lyrics + +• `set` **lyrics**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.lyrics + +___ + +### musicBrainzArtistId + +• `get` **musicBrainzArtistId**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.musicBrainzArtistId + +• `set` **musicBrainzArtistId**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.musicBrainzArtistId + +___ + +### musicBrainzDiscId + +• `get` **musicBrainzDiscId**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.musicBrainzDiscId + +• `set` **musicBrainzDiscId**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.musicBrainzDiscId + +___ + +### musicBrainzReleaseArtistId + +• `get` **musicBrainzReleaseArtistId**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.musicBrainzReleaseArtistId + +• `set` **musicBrainzReleaseArtistId**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.musicBrainzReleaseArtistId + +___ + +### musicBrainzReleaseCountry + +• `get` **musicBrainzReleaseCountry**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.musicBrainzReleaseCountry + +• `set` **musicBrainzReleaseCountry**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.musicBrainzReleaseCountry + +___ + +### musicBrainzReleaseGroupId + +• `get` **musicBrainzReleaseGroupId**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.musicBrainzReleaseGroupId + +• `set` **musicBrainzReleaseGroupId**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.musicBrainzReleaseGroupId + +___ + +### musicBrainzReleaseId + +• `get` **musicBrainzReleaseId**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.musicBrainzReleaseId + +• `set` **musicBrainzReleaseId**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.musicBrainzReleaseId + +___ + +### musicBrainzReleaseStatus + +• `get` **musicBrainzReleaseStatus**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.musicBrainzReleaseStatus + +• `set` **musicBrainzReleaseStatus**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.musicBrainzReleaseStatus + +___ + +### musicBrainzReleaseType + +• `get` **musicBrainzReleaseType**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.musicBrainzReleaseType + +• `set` **musicBrainzReleaseType**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.musicBrainzReleaseType + +___ + +### musicBrainzTrackId + +• `get` **musicBrainzTrackId**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.musicBrainzTrackId + +• `set` **musicBrainzTrackId**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.musicBrainzTrackId + +___ + +### musicIpId + +• `get` **musicIpId**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.musicIpId + +• `set` **musicIpId**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.musicIpId + +___ + +### performers + +• `get` **performers**(): `string`[] + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Overrides + +Tag.performers + +• `set` **performers**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Overrides + +Tag.performers + +___ + +### performersRole + +• `get` **performersRole**(): `string`[] + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Overrides + +Tag.performersRole + +• `set` **performersRole**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Overrides + +Tag.performersRole + +___ + +### performersSort + +• `get` **performersSort**(): `string`[] + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Overrides + +Tag.performersSort + +• `set` **performersSort**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Overrides + +Tag.performersSort + +___ + +### pictures + +• `get` **pictures**(): [`IPicture`](../interfaces/IPicture.md)[] + +**`inheritdoc`** + +#### Returns + +[`IPicture`](../interfaces/IPicture.md)[] + +#### Overrides + +Tag.pictures + +• `set` **pictures**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | [`IPicture`](../interfaces/IPicture.md)[] | + +#### Returns + +`void` + +#### Overrides + +Tag.pictures + +___ + +### publisher + +• `get` **publisher**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.publisher + +• `set` **publisher**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.publisher + +___ + +### remixedBy + +• `get` **remixedBy**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.remixedBy + +• `set` **remixedBy**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.remixedBy + +___ + +### replayGainAlbumGain + +• `get` **replayGainAlbumGain**(): `number` + +**`inheritdoc`** + +#### Returns + +`number` + +#### Overrides + +Tag.replayGainAlbumGain + +• `set` **replayGainAlbumGain**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Overrides + +Tag.replayGainAlbumGain + +___ + +### replayGainAlbumPeak + +• `get` **replayGainAlbumPeak**(): `number` + +**`inheritdoc`** + +#### Returns + +`number` + +#### Overrides + +Tag.replayGainAlbumPeak + +• `set` **replayGainAlbumPeak**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Overrides + +Tag.replayGainAlbumPeak + +___ + +### replayGainTrackGain + +• `get` **replayGainTrackGain**(): `number` + +**`inheritdoc`** + +#### Returns + +`number` + +#### Overrides + +Tag.replayGainTrackGain + +• `set` **replayGainTrackGain**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Overrides + +Tag.replayGainTrackGain + +___ + +### replayGainTrackPeak + +• `get` **replayGainTrackPeak**(): `number` + +**`inheritdoc`** + +#### Returns + +`number` + +#### Overrides + +Tag.replayGainTrackPeak + +• `set` **replayGainTrackPeak**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Overrides + +Tag.replayGainTrackPeak + +___ + +### sizeOnDisk + +• `get` **sizeOnDisk**(): `number` + +**`inheritdoc`** + +**`remarks`** Note that tags may not appear contiguously in a file. Access the [tags](CombinedTag.md#tags) + contained in this object to see the size of each tag on the disk. + +#### Returns + +`number` + +#### Overrides + +Tag.sizeOnDisk + +___ + +### subtitle + +• `get` **subtitle**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.subtitle + +• `set` **subtitle**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.subtitle + +___ + +### supportedTagTypes + +• `get` **supportedTagTypes**(): [`TagTypes`](../enums/TagTypes.md) + +Gets the types of tags that are supported by this instance of a combined tag. Only these tag +types can be added to the instance. + +#### Returns + +[`TagTypes`](../enums/TagTypes.md) + +___ + +### tagTypes + +• `get` **tagTypes**(): [`TagTypes`](../enums/TagTypes.md) + +**`inheritdoc`** + +#### Returns + +[`TagTypes`](../enums/TagTypes.md) + +#### Overrides + +Tag.tagTypes + +___ + +### tags + +• `get` **tags**(): [`Tag`](Tag.md)[] + +Gets all tags contained within the current instance. If the tags within this tag are also +[CombinedTag](CombinedTag.md)s, the retrieval will recurse and return a flat list of nested tags. + +**`remarks`** Modifications of the returned array will not be retained. + +#### Returns + +[`Tag`](Tag.md)[] + +___ + +### title + +• `get` **title**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.title + +• `set` **title**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.title + +___ + +### titleSort + +• `get` **titleSort**(): `string` + +**`inheritdoc`** + +#### Returns + +`string` + +#### Overrides + +Tag.titleSort + +• `set` **titleSort**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.titleSort + +___ + +### track + +• `get` **track**(): `number` + +**`inheritdoc`** + +#### Returns + +`number` + +#### Overrides + +Tag.track + +• `set` **track**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Overrides + +Tag.track + +___ + +### trackCount + +• `get` **trackCount**(): `number` + +**`inheritdoc`** + +#### Returns + +`number` + +#### Overrides + +Tag.trackCount + +• `set` **trackCount**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Overrides + +Tag.trackCount + +___ + +### year + +• `get` **year**(): `number` + +**`inheritdoc`** + +#### Returns + +`number` + +#### Overrides + +Tag.year + +• `set` **year**(`val`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Overrides + +Tag.year + +## Methods + +### addTag + +▸ `Protected` **addTag**(`tag`): `void` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `tag` | [`Tag`](Tag.md) | + +#### Returns + +`void` + +___ + +### clear + +▸ **clear**(): `void` + +Clears all values stored in the current instance. + +**`remarks`** The clearing procedure is format specific and should clear all values. + +#### Returns + +`void` + +#### Overrides + +[Tag](Tag.md).[clear](Tag.md#clear) + +___ + +### copyTo + +▸ **copyTo**(`target`, `overwrite`): `void` + +Copies the values from the current instance to another [Tag](Tag.md), optionally overwriting + existing values. + +**`remarks`** This method only copies the most basic values when copying between different tag + formats. However, if `target` is of the same type as the current instance, + more advanced copying may be done. For example if both `this` and `target` are + [Id3v2Tag](Id3v2Tag.md), all frames will be copied to the target. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `target` | [`Tag`](Tag.md) | Target tag to copy values to | +| `overwrite` | `boolean` | Whether or not to copy values over existing ones | + +#### Returns + +`void` + +#### Inherited from + +[Tag](Tag.md).[copyTo](Tag.md#copyto) + +___ + +### createTag + +▸ `Abstract` **createTag**(`tagType`, `copy`): [`Tag`](Tag.md) + +Creates a new instance of the desired tag type and adds it to the current instance. If the +tag type is unsupported in the current context or the tag type already exists, an error will +be thrown. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `tagType` | [`TagTypes`](../enums/TagTypes.md) | Type of tag to create | +| `copy` | `boolean` | Whether or not to copy the contents of the current instance to the newly created tag instance | + +#### Returns + +[`Tag`](Tag.md) + +Tag The newly created tag + +___ + +### getTag + +▸ **getTag**<`TTag`\>(`tagType`): `TTag` + +Gets a tag of the specified tag type if a matching tag exists in the current instance. + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `TTag` | extends [`Tag`](Tag.md)<`TTag`\> | + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `tagType` | [`TagTypes`](../enums/TagTypes.md) | Type of tag to retrieve | + +#### Returns + +`TTag` + +Tag Tag with specified type, if it exists. `undefined` otherwise. + +___ + +### removeTags + +▸ **removeTags**(`tagTypes`): `void` + +Remove all tags that match the specified tagTypes. This is performed recursively. Any nested +`CombinedTag` instances are left in place. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `tagTypes` | [`TagTypes`](../enums/TagTypes.md) | Types of tags to remove | + +#### Returns + +`void` + +___ + +### replaceTag + +▸ `Protected` **replaceTag**(`oldTag`, `newTag`): `void` + +This is used for special cases where the order of tags is important. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `oldTag` | [`Tag`](Tag.md) | +| `newTag` | [`Tag`](Tag.md) | + +#### Returns + +`void` + +___ + +### setInfoTag + +▸ **setInfoTag**(): `void` + +Set the tags that represent the tagger software (node-taglib-sharp) itself. + +**`remarks`** This is typically a method to call just before saving a tag. + +#### Returns + +`void` + +#### Inherited from + +[Tag](Tag.md).[setInfoTag](Tag.md#setinfotag) + +___ + +### validateTagCreation + +▸ `Protected` **validateTagCreation**(`tagType`): `void` + +Verifies if a tag can be added to the current instance. The criteria for validation are: +* A tag of the given tag type does not already exist +* The given tag type is supported by the current instance + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `tagType` | [`TagTypes`](../enums/TagTypes.md) | Tag type that the caller wants to create | + +#### Returns + +`void` + +___ + +### firstInGroup + +▸ `Static` `Protected` **firstInGroup**(`group`): `string` + +Gets the first string in an array. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `group` | `string`[] | Array of strings to get the first string from. | + +#### Returns + +`string` + +First string contained in `group` or `undefined` if the array is + `undefined` or empty + +#### Inherited from + +[Tag](Tag.md).[firstInGroup](Tag.md#firstingroup) + +___ + +### isFalsyOrLikeEmpty + +▸ `Static` `Protected` **isFalsyOrLikeEmpty**(`value`): `boolean` + +Checks if a value is falsy or empty. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | `string` \| `string`[] | Object to check | + +#### Returns + +`boolean` + +If `value` is a string, `true` is returned if the value is falsy or all + whitespace, `false` is returned otherwise. If `value` is an array of strings, + the array must be falsy or all elements must be falsy or whitespace to return `true`. + +#### Inherited from + +[Tag](Tag.md).[isFalsyOrLikeEmpty](Tag.md#isfalsyorlikeempty) + +___ + +### joinGroup + +▸ `Static` `Protected` **joinGroup**(`group`): `string` + +Joins an array of string into a single, semicolon and space separated string. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `group` | `string`[] | Array of string to join | + +#### Returns + +`string` + +A semicolon and space separated string containing the values from `group` + or undefined if the array is `undefined` or empty. + +#### Inherited from + +[Tag](Tag.md).[joinGroup](Tag.md#joingroup) + +___ + +### tagTypeFlagsToArray + +▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/TagTypes.md)[] + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `tagTypes` | [`TagTypes`](../enums/TagTypes.md) | + +#### Returns + +[`TagTypes`](../enums/TagTypes.md)[] + +#### Inherited from + +[Tag](Tag.md).[tagTypeFlagsToArray](Tag.md#tagtypeflagstoarray) diff --git a/docs/classes/corruptfileerror.md b/docs/classes/CorruptFileError.md similarity index 70% rename from docs/classes/corruptfileerror.md rename to docs/classes/CorruptFileError.md index 3c64575a..42ee0857 100644 --- a/docs/classes/corruptfileerror.md +++ b/docs/classes/CorruptFileError.md @@ -12,21 +12,21 @@ ### Constructors -- [constructor](corruptfileerror.md#constructor) +- [constructor](CorruptFileError.md#constructor) ### Properties -- [isCorruptFileError](corruptfileerror.md#iscorruptfileerror) -- [message](corruptfileerror.md#message) -- [name](corruptfileerror.md#name) -- [stack](corruptfileerror.md#stack) -- [prepareStackTrace](corruptfileerror.md#preparestacktrace) -- [stackTraceLimit](corruptfileerror.md#stacktracelimit) +- [isCorruptFileError](CorruptFileError.md#iscorruptfileerror) +- [message](CorruptFileError.md#message) +- [name](CorruptFileError.md#name) +- [stack](CorruptFileError.md#stack) +- [stackTraceLimit](CorruptFileError.md#stacktracelimit) ### Methods -- [captureStackTrace](corruptfileerror.md#capturestacktrace) -- [errorIs](corruptfileerror.md#erroris) +- [captureStackTrace](CorruptFileError.md#capturestacktrace) +- [errorIs](CorruptFileError.md#erroris) +- [prepareStackTrace](CorruptFileError.md#preparestacktrace) ## Constructors @@ -82,33 +82,6 @@ Error.stack ___ -### prepareStackTrace - -▪ `Static` `Optional` **prepareStackTrace**: (`err`: `Error`, `stackTraces`: `CallSite`[]) => `any` - -#### Type declaration - -▸ (`err`, `stackTraces`): `any` - -Optional override for formatting stack traces - -##### Parameters - -| Name | Type | -| :------ | :------ | -| `err` | `Error` | -| `stackTraces` | `CallSite`[] | - -##### Returns - -`any` - -#### Inherited from - -Error.prepareStackTrace - -___ - ### stackTraceLimit ▪ `Static` **stackTraceLimit**: `number` @@ -150,8 +123,33 @@ ___ | Name | Type | | :------ | :------ | -| `e` | `Error` | +| `e` | `unknown` | #### Returns `boolean` + +___ + +### prepareStackTrace + +▸ `Static` `Optional` **prepareStackTrace**(`err`, `stackTraces`): `any` + +Optional override for formatting stack traces + +**`see`** https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `err` | `Error` | +| `stackTraces` | `CallSite`[] | + +#### Returns + +`any` + +#### Inherited from + +Error.prepareStackTrace diff --git a/docs/classes/divxtag.md b/docs/classes/DivxTag.md similarity index 82% rename from docs/classes/divxtag.md rename to docs/classes/DivxTag.md index 91acdc55..e2033bca 100644 --- a/docs/classes/divxtag.md +++ b/docs/classes/DivxTag.md @@ -6,7 +6,7 @@ Represents a DivX tag that behaves similar to an ID3v1 tag. ## Hierarchy -- [`Tag`](tag.md) +- [`Tag`](Tag.md) ↳ **`DivxTag`** @@ -14,86 +14,87 @@ Represents a DivX tag that behaves similar to an ID3v1 tag. ### Properties -- [CHUNK\_FOURCC](divxtag.md#chunk_fourcc) -- [FILE\_IDENTIFIER](divxtag.md#file_identifier) -- [SIZE](divxtag.md#size) +- [CHUNK\_FOURCC](DivxTag.md#chunk_fourcc) +- [FILE\_IDENTIFIER](DivxTag.md#file_identifier) +- [SIZE](DivxTag.md#size) ### Accessors -- [album](divxtag.md#album) -- [albumArtists](divxtag.md#albumartists) -- [albumArtistsSort](divxtag.md#albumartistssort) -- [albumSort](divxtag.md#albumsort) -- [amazonId](divxtag.md#amazonid) -- [beatsPerMinute](divxtag.md#beatsperminute) -- [comment](divxtag.md#comment) -- [composers](divxtag.md#composers) -- [composersSort](divxtag.md#composerssort) -- [conductor](divxtag.md#conductor) -- [copyright](divxtag.md#copyright) -- [dateTagged](divxtag.md#datetagged) -- [description](divxtag.md#description) -- [disc](divxtag.md#disc) -- [discCount](divxtag.md#disccount) -- [firstAlbumArtist](divxtag.md#firstalbumartist) -- [firstAlbumArtistSort](divxtag.md#firstalbumartistsort) -- [firstComposer](divxtag.md#firstcomposer) -- [firstComposerSort](divxtag.md#firstcomposersort) -- [firstGenre](divxtag.md#firstgenre) -- [firstPerformer](divxtag.md#firstperformer) -- [firstPerformerSort](divxtag.md#firstperformersort) -- [genres](divxtag.md#genres) -- [grouping](divxtag.md#grouping) -- [initialKey](divxtag.md#initialkey) -- [isEmpty](divxtag.md#isempty) -- [isrc](divxtag.md#isrc) -- [joinedAlbumArtists](divxtag.md#joinedalbumartists) -- [joinedComposers](divxtag.md#joinedcomposers) -- [joinedGenres](divxtag.md#joinedgenres) -- [joinedPerformers](divxtag.md#joinedperformers) -- [joinedPerformersSort](divxtag.md#joinedperformerssort) -- [lyrics](divxtag.md#lyrics) -- [musicBrainzArtistId](divxtag.md#musicbrainzartistid) -- [musicBrainzDiscId](divxtag.md#musicbrainzdiscid) -- [musicBrainzReleaseArtistId](divxtag.md#musicbrainzreleaseartistid) -- [musicBrainzReleaseCountry](divxtag.md#musicbrainzreleasecountry) -- [musicBrainzReleaseGroupId](divxtag.md#musicbrainzreleasegroupid) -- [musicBrainzReleaseId](divxtag.md#musicbrainzreleaseid) -- [musicBrainzReleaseStatus](divxtag.md#musicbrainzreleasestatus) -- [musicBrainzReleaseType](divxtag.md#musicbrainzreleasetype) -- [musicBrainzTrackId](divxtag.md#musicbrainztrackid) -- [musicIpId](divxtag.md#musicipid) -- [performers](divxtag.md#performers) -- [performersRole](divxtag.md#performersrole) -- [performersSort](divxtag.md#performerssort) -- [pictures](divxtag.md#pictures) -- [publisher](divxtag.md#publisher) -- [remixedBy](divxtag.md#remixedby) -- [replayGainAlbumGain](divxtag.md#replaygainalbumgain) -- [replayGainAlbumPeak](divxtag.md#replaygainalbumpeak) -- [replayGainTrackGain](divxtag.md#replaygaintrackgain) -- [replayGainTrackPeak](divxtag.md#replaygaintrackpeak) -- [sizeOnDisk](divxtag.md#sizeondisk) -- [subtitle](divxtag.md#subtitle) -- [tagTypes](divxtag.md#tagtypes) -- [title](divxtag.md#title) -- [titleSort](divxtag.md#titlesort) -- [track](divxtag.md#track) -- [trackCount](divxtag.md#trackcount) -- [year](divxtag.md#year) +- [album](DivxTag.md#album) +- [albumArtists](DivxTag.md#albumartists) +- [albumArtistsSort](DivxTag.md#albumartistssort) +- [albumSort](DivxTag.md#albumsort) +- [amazonId](DivxTag.md#amazonid) +- [beatsPerMinute](DivxTag.md#beatsperminute) +- [comment](DivxTag.md#comment) +- [composers](DivxTag.md#composers) +- [composersSort](DivxTag.md#composerssort) +- [conductor](DivxTag.md#conductor) +- [copyright](DivxTag.md#copyright) +- [dateTagged](DivxTag.md#datetagged) +- [description](DivxTag.md#description) +- [disc](DivxTag.md#disc) +- [discCount](DivxTag.md#disccount) +- [firstAlbumArtist](DivxTag.md#firstalbumartist) +- [firstAlbumArtistSort](DivxTag.md#firstalbumartistsort) +- [firstComposer](DivxTag.md#firstcomposer) +- [firstComposerSort](DivxTag.md#firstcomposersort) +- [firstGenre](DivxTag.md#firstgenre) +- [firstPerformer](DivxTag.md#firstperformer) +- [firstPerformerSort](DivxTag.md#firstperformersort) +- [genres](DivxTag.md#genres) +- [grouping](DivxTag.md#grouping) +- [initialKey](DivxTag.md#initialkey) +- [isCompilation](DivxTag.md#iscompilation) +- [isEmpty](DivxTag.md#isempty) +- [isrc](DivxTag.md#isrc) +- [joinedAlbumArtists](DivxTag.md#joinedalbumartists) +- [joinedComposers](DivxTag.md#joinedcomposers) +- [joinedGenres](DivxTag.md#joinedgenres) +- [joinedPerformers](DivxTag.md#joinedperformers) +- [joinedPerformersSort](DivxTag.md#joinedperformerssort) +- [lyrics](DivxTag.md#lyrics) +- [musicBrainzArtistId](DivxTag.md#musicbrainzartistid) +- [musicBrainzDiscId](DivxTag.md#musicbrainzdiscid) +- [musicBrainzReleaseArtistId](DivxTag.md#musicbrainzreleaseartistid) +- [musicBrainzReleaseCountry](DivxTag.md#musicbrainzreleasecountry) +- [musicBrainzReleaseGroupId](DivxTag.md#musicbrainzreleasegroupid) +- [musicBrainzReleaseId](DivxTag.md#musicbrainzreleaseid) +- [musicBrainzReleaseStatus](DivxTag.md#musicbrainzreleasestatus) +- [musicBrainzReleaseType](DivxTag.md#musicbrainzreleasetype) +- [musicBrainzTrackId](DivxTag.md#musicbrainztrackid) +- [musicIpId](DivxTag.md#musicipid) +- [performers](DivxTag.md#performers) +- [performersRole](DivxTag.md#performersrole) +- [performersSort](DivxTag.md#performerssort) +- [pictures](DivxTag.md#pictures) +- [publisher](DivxTag.md#publisher) +- [remixedBy](DivxTag.md#remixedby) +- [replayGainAlbumGain](DivxTag.md#replaygainalbumgain) +- [replayGainAlbumPeak](DivxTag.md#replaygainalbumpeak) +- [replayGainTrackGain](DivxTag.md#replaygaintrackgain) +- [replayGainTrackPeak](DivxTag.md#replaygaintrackpeak) +- [sizeOnDisk](DivxTag.md#sizeondisk) +- [subtitle](DivxTag.md#subtitle) +- [tagTypes](DivxTag.md#tagtypes) +- [title](DivxTag.md#title) +- [titleSort](DivxTag.md#titlesort) +- [track](DivxTag.md#track) +- [trackCount](DivxTag.md#trackcount) +- [year](DivxTag.md#year) ### Methods -- [clear](divxtag.md#clear) -- [copyTo](divxtag.md#copyto) -- [render](divxtag.md#render) -- [setInfoTag](divxtag.md#setinfotag) -- [firstInGroup](divxtag.md#firstingroup) -- [fromData](divxtag.md#fromdata) -- [fromEmpty](divxtag.md#fromempty) -- [isFalsyOrLikeEmpty](divxtag.md#isfalsyorlikeempty) -- [joinGroup](divxtag.md#joingroup) -- [tagTypeFlagsToArray](divxtag.md#tagtypeflagstoarray) +- [clear](DivxTag.md#clear) +- [copyTo](DivxTag.md#copyto) +- [render](DivxTag.md#render) +- [setInfoTag](DivxTag.md#setinfotag) +- [firstInGroup](DivxTag.md#firstingroup) +- [fromData](DivxTag.md#fromdata) +- [fromEmpty](DivxTag.md#fromempty) +- [isFalsyOrLikeEmpty](DivxTag.md#isfalsyorlikeempty) +- [joinGroup](DivxTag.md#joingroup) +- [tagTypeFlagsToArray](DivxTag.md#tagtypeflagstoarray) ## Properties @@ -107,7 +108,7 @@ ___ ### FILE\_IDENTIFIER -▪ `Static` `Readonly` **FILE\_IDENTIFIER**: [`ByteVector`](bytevector.md) +▪ `Static` `Readonly` **FILE\_IDENTIFIER**: [`ByteVector`](ByteVector.md) Identifier used to recognize DivX tags. @@ -142,6 +143,10 @@ represents the collection the video belongs to. Album of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.album + • `set` **album**(`value`): `void` Sets the album of the media represented by the current instance. For video media, this @@ -167,6 +172,10 @@ represents the collection the video belongs to. Album of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.album + ___ ### albumArtists @@ -181,7 +190,7 @@ collection containing the media described by the current instance. will split up albums by the same artist. Having a single album artist for an entire album solves this problem. As this value is to be used as a sorting key, it should be used with less variation - than [performers](divxtag.md#performers). Where performers can be broken into multiple artists, it is + than [performers](DivxTag.md#performers). Where performers can be broken into multiple artists, it is best to stick to a single name. Eg, "Super8 & Tab" #### Returns @@ -192,6 +201,10 @@ Band or artist credited with the creation of the entire album or collection containing the media described by the current instance or an empty array if no value is present +#### Inherited from + +Tag.albumArtists + • `set` **albumArtists**(`value`): `void` Sets the bands or artists who is credited credited in the creation of the entire album or @@ -202,7 +215,7 @@ collection containing the media described by the current instance. will split up albums by the same artist. Having a single album artist for an entire album solves this problem. As this value is to be used as a sorting key, it should be used with less variation - than [performers](divxtag.md#performers). Where performers can be broken into multiple artists, it is + than [performers](DivxTag.md#performers). Where performers can be broken into multiple artists, it is best to stick to a single name. Eg, "Super8 & Tab" #### Parameters @@ -219,6 +232,10 @@ Band or artist credited with the creation of the entire album or collection containing the media described by the current instance or an empty array if no value is present +#### Inherited from + +Tag.albumArtists + ___ ### albumArtistsSort @@ -234,7 +251,7 @@ album or collection containing the media described by the current instance. skip articles or sort by last by last name. For example "Ben Folds" might be sorted as "Folds, Ben". As this value is to be used as a sorting key, it should be used with less variation than - [performers](divxtag.md#performers). Where [performers](divxtag.md#performers) can be broken into multiple performers, it is + [performers](DivxTag.md#performers). Where [performers](DivxTag.md#performers) can be broken into multiple performers, it is best to stick to a single album artist. Eg, "Van Buuren, Armin" #### Returns @@ -245,6 +262,10 @@ Sortable names for the bands/artists are credited with the creation of the entir album or collection containing the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +Tag.albumArtistsSort + • `set` **albumArtistsSort**(`value`): `void` Sets the sortable names of the bands/artists who are credited with creating the entire @@ -256,7 +277,7 @@ album or collection containing the media described by the current instance. skip articles or sort by last by last name. For example "Ben Folds" might be sorted as "Folds, Ben". As this value is to be used as a sorting key, it should be used with less variation than - [performers](divxtag.md#performers). Where [performers](divxtag.md#performers) can be broken into multiple performers, it is + [performers](DivxTag.md#performers). Where [performers](DivxTag.md#performers) can be broken into multiple performers, it is best to stick to a single album artist. Eg, "Van Buuren, Armin" #### Parameters @@ -273,6 +294,10 @@ Sortable names for the bands/artists are credited with the creation of the entir album or collection containing the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +Tag.albumArtistsSort + ___ ### albumSort @@ -293,6 +318,10 @@ Gets the sortable name of the album title of the media represented by the curren Sortable name for the album title of the media or `undefined` if the value is not present +#### Inherited from + +Tag.albumSort + • `set` **albumSort**(`value`): `void` Sets the sortable name of the album title of the media represented by the current instance. @@ -315,6 +344,10 @@ Sets the sortable name of the album title of the media represented by the curren Sortable name for the album title of the media or `undefined` if the value is not present +#### Inherited from + +Tag.albumSort + ___ ### amazonId @@ -333,6 +366,10 @@ Gets the Amazon ID of the media represented by the current instance. Amazon ID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.amazonId + • `set` **amazonId**(`value`): `void` Sets the Amazon ID of the media represented by the current instance. @@ -353,6 +390,10 @@ Sets the Amazon ID of the media represented by the current instance. Amazon ID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.amazonId + ___ ### beatsPerMinute @@ -372,6 +413,10 @@ instance. Beats per minute of the audio in the media represented by the current instance, or `0` if not specified +#### Inherited from + +Tag.beatsPerMinute + • `set` **beatsPerMinute**(`value`): `void` Sets the number of beats per minute in the audio of the media represented by the current @@ -393,26 +438,27 @@ instance. Beats per minute of the audio in the media represented by the current instance, or `0` if not specified +#### Inherited from + +Tag.beatsPerMinute + ___ ### comment • `get` **comment**(): `string` -Gets a user comment on the media represented by the current instance. - **`inheritdoc`** #### Returns `string` -User comments on the media represented by the current instance or `undefined` if - the value is not present +#### Overrides -• `set` **comment**(`value`): `void` +Tag.comment -Gets a user comment on the media represented by the current instance. +• `set` **comment**(`value`): `void` **`inheritdoc`** @@ -426,8 +472,9 @@ Gets a user comment on the media represented by the current instance. `void` -User comments on the media represented by the current instance or `undefined` if - the value is not present +#### Overrides + +Tag.comment ___ @@ -447,6 +494,10 @@ Gets the composers of the media represented by the current instance. Composers of the media represented by the current instance of an empty array if no value is present. +#### Inherited from + +Tag.composers + • `set` **composers**(`value`): `void` Sets the composers of the media represented by the current instance. @@ -467,6 +518,10 @@ Sets the composers of the media represented by the current instance. Composers of the media represented by the current instance of an empty array if no value is present. +#### Inherited from + +Tag.composers + ___ ### composersSort @@ -487,6 +542,10 @@ Gets the sortable names of the composers of the media represented by the current Sortable names for the composers of the media represented by the current instance or an empty array if no value is present. +#### Inherited from + +Tag.composersSort + • `set` **composersSort**(`value`): `void` Sets the sortable names of the composers of the media represented by the current instance. @@ -509,6 +568,10 @@ Sets the sortable names of the composers of the media represented by the current Sortable names for the composers of the media represented by the current instance or an empty array if no value is present. +#### Inherited from + +Tag.composersSort + ___ ### conductor @@ -526,6 +589,10 @@ Gets the conductor or director of the media represented by the current instance. Conductor or director of the media represented by the current instance or `undefined` if no value present. +#### Inherited from + +Tag.conductor + • `set` **conductor**(`value`): `void` Sets the conductor or director of the media represented by the current instance. @@ -545,6 +612,10 @@ Sets the conductor or director of the media represented by the current instance. Conductor or director of the media represented by the current instance or `undefined` if no value present. +#### Inherited from + +Tag.conductor + ___ ### copyright @@ -565,6 +636,10 @@ Gets the copyright information for the media represented by the current instance Copyright information for the media represented by the current instance or `undefined` if no value is present. +#### Inherited from + +Tag.copyright + • `set` **copyright**(`value`): `void` Sets the copyright information for the media represented by the current instance. @@ -587,6 +662,10 @@ Sets the copyright information for the media represented by the current instance Copyright information for the media represented by the current instance or `undefined` if no value is present. +#### Inherited from + +Tag.copyright + ___ ### dateTagged @@ -601,6 +680,10 @@ Gets the date and time at which the tag has been written. Date/time at which the tag has been written, or `undefined` if no value is present +#### Inherited from + +Tag.dateTagged + • `set` **dateTagged**(`value`): `void` Sets the date and time at which the tag has been written. @@ -617,6 +700,10 @@ Sets the date and time at which the tag has been written. Date/time at which the tag has been written, or `undefined` if no value is present +#### Inherited from + +Tag.dateTagged + ___ ### description @@ -638,6 +725,10 @@ generally no spoliers. This should give the impression of what to expect in the Description of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.description + • `set` **description**(`value`): `void` Sets a short description of the media. For music, this could be the comment that the artist @@ -661,6 +752,10 @@ generally no spoliers. This should give the impression of what to expect in the Description of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.description + ___ ### disc @@ -672,7 +767,7 @@ boxed set. For a series, this represents the season number. **`remarks`** This value should be the same as the number that appears on the disc. For example, if the disc is the first of three, the value should be `1`. It should be no more than - [discCount](divxtag.md#disccount) if [discCount](divxtag.md#disccount) is non-zero. + [discCount](DivxTag.md#disccount) if [discCount](DivxTag.md#disccount) is non-zero. #### Returns @@ -681,6 +776,10 @@ boxed set. For a series, this represents the season number. Number of the disc or season of the media represented by the current instance in a boxed set. +#### Inherited from + +Tag.disc + • `set` **disc**(`value`): `void` Sets the number of the disc containing the media represented by the current instance in the @@ -688,7 +787,7 @@ boxed set. For a series, this represents the season number. **`remarks`** This value should be the same as the number that appears on the disc. For example, if the disc is the first of three, the value should be `1`. It should be no more than - [discCount](divxtag.md#disccount) if [discCount](divxtag.md#disccount) is non-zero. + [discCount](DivxTag.md#disccount) if [discCount](DivxTag.md#disccount) is non-zero. #### Parameters @@ -703,6 +802,10 @@ boxed set. For a series, this represents the season number. Number of the disc or season of the media represented by the current instance in a boxed set. +#### Inherited from + +Tag.disc + ___ ### discCount @@ -712,7 +815,7 @@ ___ Gets the number of discs or seasons in the boxed set containing the media represented by the current instance. -**`remarks`** If non-zero, this should be at least equal to [disc](divxtag.md#disc). If [disc](divxtag.md#disc) is zero, +**`remarks`** If non-zero, this should be at least equal to [disc](DivxTag.md#disc). If [disc](DivxTag.md#disc) is zero, this value should also be zero. #### Returns @@ -722,12 +825,16 @@ current instance. Number of discs or seasons in the boxed set containing the media represented by the current instance or `0` if not specified. +#### Inherited from + +Tag.discCount + • `set` **discCount**(`value`): `void` Sets the number of discs or seasons in the boxed set containing the media represented by the current instance. -**`remarks`** If non-zero, this should be at least equal to [disc](divxtag.md#disc). If [disc](divxtag.md#disc) is zero, +**`remarks`** If non-zero, this should be at least equal to [disc](DivxTag.md#disc). If [disc](DivxTag.md#disc) is zero, this value should also be zero. #### Parameters @@ -743,117 +850,146 @@ current instance. Number of discs or seasons in the boxed set containing the media represented by the current instance or `0` if not specified. +#### Inherited from + +Tag.discCount + ___ ### firstAlbumArtist • `get` **firstAlbumArtist**(): `string` -Gets the the first value contained in [albumArtists](divxtag.md#albumartists). +Gets the first value contained in [albumArtists](DivxTag.md#albumartists). #### Returns `string` +#### Inherited from + +Tag.firstAlbumArtist + ___ ### firstAlbumArtistSort • `get` **firstAlbumArtistSort**(): `string` -Gets the first value contained in [albumArtistsSort](divxtag.md#albumartistssort) +Gets the first value contained in [albumArtistsSort](DivxTag.md#albumartistssort) #### Returns `string` +#### Inherited from + +Tag.firstAlbumArtistSort + ___ ### firstComposer • `get` **firstComposer**(): `string` -Gets the first value contained in [composers](divxtag.md#composers) +Gets the first value contained in [composers](DivxTag.md#composers) #### Returns `string` +#### Inherited from + +Tag.firstComposer + ___ ### firstComposerSort • `get` **firstComposerSort**(): `string` -Gets the first value contained in [composersSort](divxtag.md#composerssort) +Gets the first value contained in [composersSort](DivxTag.md#composerssort) #### Returns `string` +#### Inherited from + +Tag.firstComposerSort + ___ ### firstGenre • `get` **firstGenre**(): `string` -Gets the first value contained in [genres](divxtag.md#genres) +Gets the first value contained in [genres](DivxTag.md#genres) #### Returns `string` +#### Inherited from + +Tag.firstGenre + ___ ### firstPerformer • `get` **firstPerformer**(): `string` -Gets the first value contained in [performers](divxtag.md#performers) +Gets the first value contained in [performers](DivxTag.md#performers) #### Returns `string` +#### Inherited from + +Tag.firstPerformer + ___ ### firstPerformerSort • `get` **firstPerformerSort**(): `string` -Gets the first value contained in [performersSort](divxtag.md#performerssort) +Gets the first value contained in [performersSort](DivxTag.md#performerssort) #### Returns `string` +#### Inherited from + +Tag.firstPerformerSort + ___ ### genres • `get` **genres**(): `string`[] -Gets the genres of the media represented by the current instance. - **`inheritdoc`** -**`remarks`** Genre is stored as an numeric genre. This is translated into the human- +**`remarks`** Genre is stored as a numeric genre. This is translated into the human- readable genre. #### Returns `string`[] -Genres of the media represented by the current instance or an empty array if no - value is present. +#### Overrides -• `set` **genres**(`value`): `void` +Tag.genres -Gets the genres of the media represented by the current instance. +• `set` **genres**(`value`): `void` **`inheritdoc`** -**`remarks`** Genre is stored as an numeric genre, so only video genres are supported. Only +**`remarks`** Genre is stored as a numeric genre, so only video genres are supported. Only one genre can be stored. #### Parameters @@ -866,8 +1002,9 @@ Gets the genres of the media represented by the current instance. `void` -Genres of the media represented by the current instance or an empty array if no - value is present. +#### Overrides + +Tag.genres ___ @@ -888,6 +1025,10 @@ Gets the grouping on the album which the media in the current instance belongs t Grouping on the album which the media in the current instance belongs to or `undefined` if no value is present. +#### Inherited from + +Tag.grouping + • `set` **grouping**(`value`): `void` Sets the grouping on the album which the media in the current instance belongs to. @@ -909,6 +1050,10 @@ Sets the grouping on the album which the media in the current instance belongs t Grouping on the album which the media in the current instance belongs to or `undefined` if no value is present. +#### Inherited from + +Tag.grouping + ___ ### initialKey @@ -923,6 +1068,10 @@ Gets the initial key of the track. Initial key of the track or `undefined` if no value is set +#### Inherited from + +Tag.initialKey + • `set` **initialKey**(`value`): `void` Sets the initial key of the track. @@ -939,6 +1088,44 @@ Sets the initial key of the track. Initial key of the track or `undefined` if no value is set +#### Inherited from + +Tag.initialKey + +___ + +### isCompilation + +• `get` **isCompilation**(): `boolean` + +Gets whether or not the album described by the current instance is a compilation. + +#### Returns + +`boolean` + +#### Inherited from + +Tag.isCompilation + +• `set` **isCompilation**(`value`): `void` + +Gets whether or not the album described by the current instance is a compilation. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | `boolean` | Whether or not the album described by the current instance is a compilation | + +#### Returns + +`void` + +#### Inherited from + +Tag.isCompilation + ___ ### isEmpty @@ -947,7 +1134,7 @@ ___ Gets whether or not the current instance is empty. -**`remarks`** In the default implementation, this checks the values supported by [Tag](tag.md), but it +**`remarks`** In the default implementation, this checks the values supported by [Tag](Tag.md), but it may be extended by child classes to support other values. #### Returns @@ -956,6 +1143,10 @@ Gets whether or not the current instance is empty. `true` if the current instance does not contain any values. `false` otherwise +#### Inherited from + +Tag.isEmpty + ___ ### isrc @@ -970,6 +1161,10 @@ Gets the ISRC (International Standard Recording Code) of the track. the ISRC of the track or `undefined` if no value is set +#### Inherited from + +Tag.isrc + • `set` **isrc**(`value`): `void` Sets the ISRC (International Standard Recording Code) of the track. @@ -986,66 +1181,90 @@ Sets the ISRC (International Standard Recording Code) of the track. the ISRC of the track or `undefined` if no value is set +#### Inherited from + +Tag.isrc + ___ ### joinedAlbumArtists • `get` **joinedAlbumArtists**(): `string` -Gets a semicolon and space separated string containing the values in [albumArtists](divxtag.md#albumartists) +Gets a semicolon and space separated string containing the values in [albumArtists](DivxTag.md#albumartists) #### Returns `string` +#### Inherited from + +Tag.joinedAlbumArtists + ___ ### joinedComposers • `get` **joinedComposers**(): `string` -Gets a semicolon and space separated string containing the values in [composers](divxtag.md#composers) +Gets a semicolon and space separated string containing the values in [composers](DivxTag.md#composers) #### Returns `string` +#### Inherited from + +Tag.joinedComposers + ___ ### joinedGenres • `get` **joinedGenres**(): `string` -Gets a semicolon and space separated string containing the values in [genres](divxtag.md#genres) +Gets a semicolon and space separated string containing the values in [genres](DivxTag.md#genres) #### Returns `string` +#### Inherited from + +Tag.joinedGenres + ___ ### joinedPerformers • `get` **joinedPerformers**(): `string` -Gets a semicolon and space separated string containing the values in [performers](divxtag.md#performers) +Gets a semicolon and space separated string containing the values in [performers](DivxTag.md#performers) #### Returns `string` +#### Inherited from + +Tag.joinedPerformers + ___ ### joinedPerformersSort • `get` **joinedPerformersSort**(): `string` -Gets a semicolon and space separated string containing the values in [performersSort](divxtag.md#performerssort) +Gets a semicolon and space separated string containing the values in [performersSort](DivxTag.md#performerssort) #### Returns `string` +#### Inherited from + +Tag.joinedPerformersSort + ___ ### lyrics @@ -1066,6 +1285,10 @@ Gets the lyrics or script of the media represented by the current instance. Lyrics or script of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.lyrics + • `set` **lyrics**(`value`): `void` Sets the lyrics or script of the media represented by the current instance. @@ -1088,6 +1311,10 @@ Sets the lyrics or script of the media represented by the current instance. Lyrics or script of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.lyrics + ___ ### musicBrainzArtistId @@ -1106,6 +1333,10 @@ Gets the MusicBrainz artist ID of the media represented by the current instance. MusicBrainz ArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzArtistId + • `set` **musicBrainzArtistId**(`value`): `void` Sets the MusicBrainz artist ID of the media represented by the current instance. @@ -1126,6 +1357,10 @@ Sets the MusicBrainz artist ID of the media represented by the current instance. MusicBrainz ArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzArtistId + ___ ### musicBrainzDiscId @@ -1144,6 +1379,10 @@ Gets the MusicBrainz disc ID of the media represented by the current instance. MusicBrainz DiscID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzDiscId + • `set` **musicBrainzDiscId**(`value`): `void` Sets the MusicBrainz disc ID of the media represented by the current instance. @@ -1164,6 +1403,10 @@ Sets the MusicBrainz disc ID of the media represented by the current instance. MusicBrainz DiscID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzDiscId + ___ ### musicBrainzReleaseArtistId @@ -1182,6 +1425,10 @@ Gets the MusicBrainz release artist ID of the media represented by the current i MusicBrainz ReleaseArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseArtistId + • `set` **musicBrainzReleaseArtistId**(`value`): `void` Sets the MusicBrainz release artist ID of the media represented by the current instance. @@ -1202,6 +1449,10 @@ Sets the MusicBrainz release artist ID of the media represented by the current i MusicBrainz ReleaseArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseArtistId + ___ ### musicBrainzReleaseCountry @@ -1223,6 +1474,10 @@ Gets the MusicBrainz release country of the media represented by the current ins MusicBrainz ReleaseCountry of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseCountry + • `set` **musicBrainzReleaseCountry**(`value`): `void` Sets the MusicBrainz release country of the media represented by the current instance. @@ -1246,6 +1501,10 @@ Sets the MusicBrainz release country of the media represented by the current ins MusicBrainz ReleaseCountry of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseCountry + ___ ### musicBrainzReleaseGroupId @@ -1264,6 +1523,10 @@ Gets the MusicBrainz release group ID of the media represented by the current in MusicBrainz ReleaseGroupID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseGroupId + • `set` **musicBrainzReleaseGroupId**(`value`): `void` Sets the MusicBrainz release group ID of the media represented by the current instance. @@ -1284,6 +1547,10 @@ Sets the MusicBrainz release group ID of the media represented by the current in MusicBrainz ReleaseGroupID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseGroupId + ___ ### musicBrainzReleaseId @@ -1302,6 +1569,10 @@ Gets the MusicBrainz release ID of the media represented by the current instance MusicBrainz ReleaseID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseId + • `set` **musicBrainzReleaseId**(`value`): `void` Sets the MusicBrainz release ID of the media represented by the current instance. @@ -1322,6 +1593,10 @@ Sets the MusicBrainz release ID of the media represented by the current instance MusicBrainz ReleaseID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseId + ___ ### musicBrainzReleaseStatus @@ -1340,6 +1615,10 @@ Gets the MusicBrainz release status of the media represented by the current inst MusicBrainz ReleaseStatus of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseStatus + • `set` **musicBrainzReleaseStatus**(`value`): `void` Sets the MusicBrainz release status of the media represented by the current instance. @@ -1360,6 +1639,10 @@ Sets the MusicBrainz release status of the media represented by the current inst MusicBrainz ReleaseStatus of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseStatus + ___ ### musicBrainzReleaseType @@ -1380,6 +1663,10 @@ Gets the MusicBrainz release type of the media represented by the current instan MusicBrainz ReleaseType of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseType + • `set` **musicBrainzReleaseType**(`value`): `void` Sets the MusicBrainz release type of the media represented by the current instance. @@ -1402,6 +1689,10 @@ Sets the MusicBrainz release type of the media represented by the current instan MusicBrainz ReleaseType of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseType + ___ ### musicBrainzTrackId @@ -1421,6 +1712,10 @@ current instance. MusicBrainz TrackID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzTrackId + • `set` **musicBrainzTrackId**(`value`): `void` Sets the MusicBrainz track ID of the media represented by the media represented by the @@ -1442,6 +1737,10 @@ current instance. MusicBrainz TrackID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzTrackId + ___ ### musicIpId @@ -1460,6 +1759,10 @@ Gets the MusicIP PUID of the media represented by the current instance. MusicIP PUID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicIpId + • `set` **musicIpId**(`value`): `void` Sets the MusicIP PUID of the media represented by the current instance. @@ -1480,26 +1783,27 @@ Sets the MusicIP PUID of the media represented by the current instance. MusicIP PUID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicIpId + ___ ### performers • `get` **performers**(): `string`[] -Gets the performers or artists who performed in the media described by the current instance. - **`inheritdoc`** #### Returns `string`[] -Performers who performed in the media described by the current instance or an empty - array if no value is present. +#### Overrides -• `set` **performers**(`value`): `void` +Tag.performers -Gets the performers or artists who performed in the media described by the current instance. +• `set` **performers**(`value`): `void` **`inheritdoc`** @@ -1513,8 +1817,9 @@ Gets the performers or artists who performed in the media described by the curre `void` -Performers who performed in the media described by the current instance or an empty - array if no value is present. +#### Overrides + +Tag.performers ___ @@ -1523,12 +1828,12 @@ ___ • `get` **performersRole**(): `string`[] Gets the characters portrayed by an actor for a video or instruments played by a musician -for music. This must match the [performers](divxtag.md#performers) array (for each person, correspond one/more +for music. This must match the [performers](DivxTag.md#performers) array (for each person, correspond one/more role). Several roles for the same artist/actor can be separated with semicolons. For example: "Bass; Backing Vocals; Vibraphone". **`remarks`** It is highly important to match each role to the performers. This means that an entry - in the [performersRole](divxtag.md#performersrole) array is `undefined` to maintain the relationship between + in the [performersRole](DivxTag.md#performersrole) array is `undefined` to maintain the relationship between `performers[i]` and `performersRole[i]`. #### Returns @@ -1538,15 +1843,19 @@ example: "Bass; Backing Vocals; Vibraphone". Array containing the roles played by the performers in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +Tag.performersRole + • `set` **performersRole**(`value`): `void` Sets the characters portrayed by an actor for a video or instruments played by a musician -for music. This must match the [performers](divxtag.md#performers) array (for each person, correspond one/more +for music. This must match the [performers](DivxTag.md#performers) array (for each person, correspond one/more role). Several roles for the same artist/actor can be separated with semicolons. For example: "Bass; Backing Vocals; Vibraphone". **`remarks`** It is highly important to match each role to the performers. This means that an entry - in the [performersRole](divxtag.md#performersrole) array is `undefined` to maintain the relationship between + in the [performersRole](DivxTag.md#performersrole) array is `undefined` to maintain the relationship between `performers[i]` and `performersRole[i]`. #### Parameters @@ -1562,6 +1871,10 @@ example: "Bass; Backing Vocals; Vibraphone". Array containing the roles played by the performers in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +Tag.performersRole + ___ ### performersSort @@ -1584,6 +1897,10 @@ the current instance. Sortable names for the performers who performed in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +Tag.performersSort + • `set` **performersSort**(`value`): `void` Gets the sortable names of the performers or artists who performed in the media described by @@ -1608,11 +1925,15 @@ the current instance. Sortable names for the performers who performed in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +Tag.performersSort + ___ ### pictures -• `get` **pictures**(): [`IPicture`](../interfaces/ipicture.md)[] +• `get` **pictures**(): [`IPicture`](../interfaces/IPicture.md)[] Gets a collection of pictures associated with the media represented by the current instance. @@ -1622,11 +1943,15 @@ Gets a collection of pictures associated with the media represented by the curre #### Returns -[`IPicture`](../interfaces/ipicture.md)[] +[`IPicture`](../interfaces/IPicture.md)[] Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. +#### Inherited from + +Tag.pictures + • `set` **pictures**(`value`): `void` Sets a collection of pictures associated with the media represented by the current instance. @@ -1639,7 +1964,7 @@ Sets a collection of pictures associated with the media represented by the curre | Name | Type | Description | | :------ | :------ | :------ | -| `value` | [`IPicture`](../interfaces/ipicture.md)[] | Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. | +| `value` | [`IPicture`](../interfaces/IPicture.md)[] | Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. | #### Returns @@ -1648,6 +1973,10 @@ Sets a collection of pictures associated with the media represented by the curre Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. +#### Inherited from + +Tag.pictures + ___ ### publisher @@ -1662,6 +1991,10 @@ Gets the publisher of the track. Publisher of the track or `undefined` if no value is set +#### Inherited from + +Tag.publisher + • `set` **publisher**(`value`): `void` Sets the publisher of the track. @@ -1678,6 +2011,10 @@ Sets the publisher of the track. Publisher of the track or `undefined` if no value is set +#### Inherited from + +Tag.publisher + ___ ### remixedBy @@ -1692,6 +2029,10 @@ Gets the remixer of the track. Remixer of the track or `undefined` if no value is set +#### Inherited from + +Tag.remixedBy + • `set` **remixedBy**(`value`): `void` Sets the remixer of the track. @@ -1708,6 +2049,10 @@ Sets the remixer of the track. Remixer of the track or `undefined` if no value is set +#### Inherited from + +Tag.remixedBy + ___ ### replayGainAlbumGain @@ -1722,6 +2067,10 @@ Gets the ReplayGain album gain in dB. Album gain as per the ReplayGain specifications, in dB, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainAlbumGain + • `set` **replayGainAlbumGain**(`value`): `void` Sets the ReplayGain album gain in dB. @@ -1738,6 +2087,10 @@ Sets the ReplayGain album gain in dB. Album gain as per the ReplayGain specifications, in dB, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainAlbumGain + ___ ### replayGainAlbumPeak @@ -1752,6 +2105,10 @@ Gets the ReplayGain album peak sample. Album peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainAlbumPeak + • `set` **replayGainAlbumPeak**(`value`): `void` Sets the ReplayGain album peak sample. @@ -1768,6 +2125,10 @@ Sets the ReplayGain album peak sample. Album peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainAlbumPeak + ___ ### replayGainTrackGain @@ -1782,6 +2143,10 @@ Gets the ReplayGain track gain in dB. Track gain as per ReplayGain specifications, in dB, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainTrackGain + • `set` **replayGainTrackGain**(`value`): `void` Sets the ReplayGain track gain in dB. @@ -1798,6 +2163,10 @@ Sets the ReplayGain track gain in dB. Track gain as per ReplayGain specifications, in dB, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainTrackGain + ___ ### replayGainTrackPeak @@ -1812,6 +2181,10 @@ Gets the ReplayGain track peak sample. Track peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainTrackPeak + • `set` **replayGainTrackPeak**(`value`): `void` Sets the ReplayGain track peak sample. @@ -1828,20 +2201,26 @@ Sets the ReplayGain track peak sample. Track peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainTrackPeak + ___ ### sizeOnDisk • `get` **sizeOnDisk**(): `number` -Gets the size of the tag in bytes on disk as it was read from disk. - **`inheritdoc`** #### Returns `number` +#### Overrides + +Tag.sizeOnDisk + ___ ### subtitle @@ -1861,6 +2240,10 @@ Gets a description, one-line. It represents the tagline of the vide/music. Subtitle of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.subtitle + • `set` **subtitle**(`value`): `void` Sets a description, one-line. It represents the tagline of the vide/music. @@ -1882,20 +2265,28 @@ Sets a description, one-line. It represents the tagline of the vide/music. Subtitle of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.subtitle + ___ ### tagTypes -• `get` **tagTypes**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypes**(): [`TagTypes`](../enums/TagTypes.md) -Gets the tag types contained in the current instance. A bit wise combined [TagTypes](../enums/tagtypes.md) +Gets the tag types contained in the current instance. A bit wise combined [TagTypes](../enums/TagTypes.md) containing the tag types contained in the current instance. **`inheritdoc`** #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) + +#### Overrides + +Tag.tagTypes ___ @@ -1903,21 +2294,18 @@ ___ • `get` **title**(): `string` -Gets the title for the media described by the current instance. - **`inheritdoc`** #### Returns `string` -Title of the media described by the current instance or `undefined` if no value is - present. +#### Overrides + +Tag.title • `set` **title**(`value`): `void` -Gets the title for the media described by the current instance. - **`inheritdoc`** #### Parameters @@ -1930,8 +2318,9 @@ Gets the title for the media described by the current instance. `void` -Title of the media described by the current instance or `undefined` if no value is - present. +#### Overrides + +Tag.title ___ @@ -1950,6 +2339,10 @@ Gets the sortable name for the title of the media described by the current insta Sortable name of the media described by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.titleSort + • `set` **titleSort**(`value`): `void` Sets the sortable name for the title of the media described by the current instance. @@ -1969,6 +2362,10 @@ Sets the sortable name for the title of the media described by the current insta Sortable name of the media described by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.titleSort + ___ ### track @@ -1979,7 +2376,7 @@ Gets the position of the media represented by the current instance in its contai or season (for a series). **`remarks`** This value should be the same as is listed on the album cover and no more than - [trackCount](divxtag.md#trackcount), if [trackCount](divxtag.md#trackcount) is non-zero. + [trackCount](DivxTag.md#trackcount), if [trackCount](DivxTag.md#trackcount) is non-zero. Most tagging formats store this as a string. To help sorting, a two-digit zero-padded value is used in the resulting tag. For a series, this property represents the episodes in a season of the series. @@ -1991,13 +2388,17 @@ or season (for a series). Position of the media represented by the current instance in its containing album or `0` if not specified. +#### Inherited from + +Tag.track + • `set` **track**(`value`): `void` Sets the position of the media represented by the current instance in its containing album or season (for a series). **`remarks`** This value should be the same as is listed on the album cover and no more than - [trackCount](divxtag.md#trackcount), if [trackCount](divxtag.md#trackcount) is non-zero. + [trackCount](DivxTag.md#trackcount), if [trackCount](DivxTag.md#trackcount) is non-zero. Most tagging formats store this as a string. To help sorting, a two-digit zero-padded value is used in the resulting tag. For a series, this property represents the episodes in a season of the series. @@ -2015,6 +2416,10 @@ or season (for a series). Position of the media represented by the current instance in its containing album or `0` if not specified. +#### Inherited from + +Tag.track + ___ ### trackCount @@ -2024,8 +2429,8 @@ ___ Gets the number of tracks in the album or the number of episodes in a series of the media represented by the current instance. -**`remarks`** If non-zero, this value should be equal to or greater than [track](divxtag.md#track). If - [track](divxtag.md#track) is `0`, this value should also be `0`. +**`remarks`** If non-zero, this value should be equal to or greater than [track](DivxTag.md#track). If + [track](DivxTag.md#track) is `0`, this value should also be `0`. #### Returns @@ -2034,13 +2439,17 @@ represented by the current instance. Number of tracks in the album or number of episodes in a series of the media represented by the current instance or `0` if not specified. +#### Inherited from + +Tag.trackCount + • `set` **trackCount**(`value`): `void` Sets the number of tracks in the album or the number of episodes in a series of the media represented by the current instance. -**`remarks`** If non-zero, this value should be equal to or greater than [track](divxtag.md#track). If - [track](divxtag.md#track) is `0`, this value should also be `0`. +**`remarks`** If non-zero, this value should be equal to or greater than [track](DivxTag.md#track). If + [track](DivxTag.md#track) is `0`, this value should also be `0`. #### Parameters @@ -2055,26 +2464,27 @@ represented by the current instance. Number of tracks in the album or number of episodes in a series of the media represented by the current instance or `0` if not specified. +#### Inherited from + +Tag.trackCount + ___ ### year • `get` **year**(): `number` -Gets the year that the media represented by the current instance was recorded. - **`inheritdoc`** #### Returns `number` -Year that the media represented by the current instance was created or `0` if no - value is present. +#### Overrides -• `set` **year**(`value`): `void` +Tag.year -Gets the year that the media represented by the current instance was recorded. +• `set` **year**(`value`): `void` **`inheritdoc`** @@ -2088,8 +2498,9 @@ Gets the year that the media represented by the current instance was recorded. `void` -Year that the media represented by the current instance was created or `0` if no - value is present. +#### Overrides + +Tag.year ## Methods @@ -2107,7 +2518,7 @@ Clears all values stored in the current instance. #### Overrides -[Tag](tag.md).[clear](tag.md#clear) +[Tag](Tag.md).[clear](Tag.md#clear) ___ @@ -2115,19 +2526,19 @@ ___ ▸ **copyTo**(`target`, `overwrite`): `void` -Copies the values from the current instance to another [Tag](tag.md), optionally overwriting +Copies the values from the current instance to another [Tag](Tag.md), optionally overwriting existing values. **`remarks`** This method only copies the most basic values when copying between different tag formats. However, if `target` is of the same type as the current instance, more advanced copying may be done. For example if both `this` and `target` are - [Id3v2Tag](id3v2tag.md), all frames will be copied to the target. + [Id3v2Tag](Id3v2Tag.md), all frames will be copied to the target. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `target` | [`Tag`](tag.md) | Target tag to copy values to | +| `target` | [`Tag`](Tag.md) | Target tag to copy values to | | `overwrite` | `boolean` | Whether or not to copy values over existing ones | #### Returns @@ -2136,19 +2547,19 @@ Copies the values from the current instance to another [Tag](tag.md), optionally #### Inherited from -[Tag](tag.md).[copyTo](tag.md#copyto) +[Tag](Tag.md).[copyTo](Tag.md#copyto) ___ ### render -▸ **render**(): [`ByteVector`](bytevector.md) +▸ **render**(): [`ByteVector`](ByteVector.md) Renders the current instance as a raw DivX tag. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ___ @@ -2166,7 +2577,7 @@ Set the tags that represent the tagger software (node-taglib-sharp) itself. #### Inherited from -[Tag](tag.md).[setInfoTag](tag.md#setinfotag) +[Tag](Tag.md).[setInfoTag](Tag.md#setinfotag) ___ @@ -2191,38 +2602,38 @@ First string contained in `group` or `undefined` if the array is #### Inherited from -[Tag](tag.md).[firstInGroup](tag.md#firstingroup) +[Tag](Tag.md).[firstInGroup](Tag.md#firstingroup) ___ ### fromData -▸ `Static` **fromData**(`data`): [`DivxTag`](divxtag.md) +▸ `Static` **fromData**(`data`): [`DivxTag`](DivxTag.md) Constructs and initializes a new instance by reading the raw tag data stored in a specified -[ByteVector](bytevector.md) object. +[ByteVector](ByteVector.md) object. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | [ByteVector](bytevector.md) that contains the raw tag data | +| `data` | [`ByteVector`](ByteVector.md) | [ByteVector](ByteVector.md) that contains the raw tag data | #### Returns -[`DivxTag`](divxtag.md) +[`DivxTag`](DivxTag.md) ___ ### fromEmpty -▸ `Static` **fromEmpty**(): [`DivxTag`](divxtag.md) +▸ `Static` **fromEmpty**(): [`DivxTag`](DivxTag.md) Constructs and initializes a new instance with no contents. #### Returns -[`DivxTag`](divxtag.md) +[`DivxTag`](DivxTag.md) ___ @@ -2248,7 +2659,7 @@ If `value` is a string, `true` is returned if the value is falsy or all #### Inherited from -[Tag](tag.md).[isFalsyOrLikeEmpty](tag.md#isfalsyorlikeempty) +[Tag](Tag.md).[isFalsyOrLikeEmpty](Tag.md#isfalsyorlikeempty) ___ @@ -2273,24 +2684,24 @@ A semicolon and space separated string containing the values from `group` #### Inherited from -[Tag](tag.md).[joinGroup](tag.md#joingroup) +[Tag](Tag.md).[joinGroup](Tag.md#joingroup) ___ ### tagTypeFlagsToArray -▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/tagtypes.md)[] +▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/TagTypes.md)[] #### Parameters | Name | Type | | :------ | :------ | -| `tagTypes` | [`TagTypes`](../enums/tagtypes.md) | +| `tagTypes` | [`TagTypes`](../enums/TagTypes.md) | #### Returns -[`TagTypes`](../enums/tagtypes.md)[] +[`TagTypes`](../enums/TagTypes.md)[] #### Inherited from -[Tag](tag.md).[tagTypeFlagsToArray](tag.md#tagtypeflagstoarray) +[Tag](Tag.md).[tagTypeFlagsToArray](Tag.md#tagtypeflagstoarray) diff --git a/docs/classes/file.md b/docs/classes/File.md similarity index 67% rename from docs/classes/file.md rename to docs/classes/File.md index 4b7c51e3..c5a57ea0 100644 --- a/docs/classes/file.md +++ b/docs/classes/File.md @@ -9,72 +9,73 @@ accessing basic tagging and media properties. hand, support the intricacies of different media and tagging formats. For example {@link Mpeg4File} supports the MPEG-4 specification and Apple's tagging format. Each file type can be created using its format specific constructors, but the preferred method is to - use [File.createFromPath](file.md#createfrompath) or [File.createFromAbstraction](file.md#createfromabstraction) as it automatically + use [File.createFromPath](File.md#createfrompath) or [File.createFromAbstraction](File.md#createfromabstraction) as it automatically detects the appropriate class from the file extension or provided MimeType. ## Hierarchy - **`File`** - ↳ [`AiffFile`](aifffile.md) + ↳ [`AiffFile`](AiffFile.md) - ↳ [`AsfFile`](asffile.md) + ↳ [`AsfFile`](AsfFile.md) - ↳ [`FlacFile`](flacfile.md) + ↳ [`FlacFile`](FlacFile.md) - ↳ [`RiffFile`](rifffile.md) + ↳ [`OggFile`](OggFile.md) -## Table of contents + ↳ [`RiffFile`](RiffFile.md) -### Constructors +## Implements -- [constructor](file.md#constructor) +- `IDisposable` -### Properties +## Table of contents -- [\_fileAbstraction](file.md#_fileabstraction) -- [\_fileStream](file.md#_filestream) -- [\_tagTypesOnDisk](file.md#_tagtypesondisk) +### Constructors + +- [constructor](File.md#constructor) ### Accessors -- [corruptionReasons](file.md#corruptionreasons) -- [fileAbstraction](file.md#fileabstraction) -- [isPossiblyCorrupt](file.md#ispossiblycorrupt) -- [isWritable](file.md#iswritable) -- [length](file.md#length) -- [mimeType](file.md#mimetype) -- [mode](file.md#mode) -- [name](file.md#name) -- [position](file.md#position) -- [properties](file.md#properties) -- [tag](file.md#tag) -- [tagTypes](file.md#tagtypes) -- [tagTypesOnDisk](file.md#tagtypesondisk) -- [bufferSize](file.md#buffersize) +- [corruptionReasons](File.md#corruptionreasons) +- [fileAbstraction](File.md#fileabstraction) +- [hasTags](File.md#hastags) +- [isPossiblyCorrupt](File.md#ispossiblycorrupt) +- [isWritable](File.md#iswritable) +- [length](File.md#length) +- [mimeType](File.md#mimetype) +- [mode](File.md#mode) +- [name](File.md#name) +- [position](File.md#position) +- [properties](File.md#properties) +- [tag](File.md#tag) +- [tagTypes](File.md#tagtypes) +- [tagTypesOnDisk](File.md#tagtypesondisk) +- [bufferSize](File.md#buffersize) ### Methods -- [dispose](file.md#dispose) -- [find](file.md#find) -- [getTag](file.md#gettag) -- [insert](file.md#insert) -- [markAsCorrupt](file.md#markascorrupt) -- [preSave](file.md#presave) -- [rFind](file.md#rfind) -- [readBlock](file.md#readblock) -- [removeBlock](file.md#removeblock) -- [removeTags](file.md#removetags) -- [save](file.md#save) -- [seek](file.md#seek) -- [truncate](file.md#truncate) -- [writeBlock](file.md#writeblock) -- [addFileType](file.md#addfiletype) -- [addFileTypeResolver](file.md#addfiletyperesolver) -- [createFromAbstraction](file.md#createfromabstraction) -- [createFromPath](file.md#createfrompath) -- [removeFileType](file.md#removefiletype) -- [removeFileTypeResolver](file.md#removefiletyperesolver) +- [dispose](File.md#dispose) +- [find](File.md#find) +- [getTag](File.md#gettag) +- [insert](File.md#insert) +- [markAsCorrupt](File.md#markascorrupt) +- [preSave](File.md#presave) +- [rFind](File.md#rfind) +- [readBlock](File.md#readblock) +- [removeBlock](File.md#removeblock) +- [removeTags](File.md#removetags) +- [save](File.md#save) +- [seek](File.md#seek) +- [truncate](File.md#truncate) +- [writeBlock](File.md#writeblock) +- [addFileType](File.md#addfiletype) +- [addFileTypeResolver](File.md#addfiletyperesolver) +- [createFromAbstraction](File.md#createfromabstraction) +- [createFromPath](File.md#createfrompath) +- [removeFileType](File.md#removefiletype) +- [removeFileTypeResolver](File.md#removefiletyperesolver) ## Constructors @@ -88,24 +89,6 @@ accessing basic tagging and media properties. | :------ | :------ | | `file` | `string` \| `IFileAbstraction` | -## Properties - -### \_fileAbstraction - -• `Protected` **\_fileAbstraction**: `IFileAbstraction` - -___ - -### \_fileStream - -• `Protected` **\_fileStream**: `IStream` - -___ - -### \_tagTypesOnDisk - -• `Protected` **\_tagTypesOnDisk**: [`TagTypes`](../enums/tagtypes.md) - ## Accessors ### corruptionReasons @@ -132,6 +115,19 @@ Gets the {@link IFileAbstraction} representing the file. ___ +### hasTags + +• `get` **hasTags**(): `boolean` + +Shortcut property to determine if a file has tags in memory. +NOTE: Just because `tag !== undefined` does not mean there are tags in memory. + +#### Returns + +`boolean` + +___ + ### isPossiblyCorrupt • `get` **isPossiblyCorrupt**(): `boolean` @@ -184,25 +180,25 @@ ___ ### mode -• `get` **mode**(): [`FileAccessMode`](../enums/fileaccessmode.md) +• `get` **mode**(): [`FileAccessMode`](../enums/FileAccessMode.md) Gets the file access mode in use by the current instance. #### Returns -[`FileAccessMode`](../enums/fileaccessmode.md) +[`FileAccessMode`](../enums/FileAccessMode.md) • `set` **mode**(`val`): `void` Sets the file access mode in use by the current instance. Changing the value will cause the stream currently in use to be closed, except when a change is made from -[FileAccessMode.Write](../enums/fileaccessmode.md#write) to [FileAccessMode.Read](../enums/fileaccessmode.md#read) which has no effect. +[FileAccessMode.Write](../enums/FileAccessMode.md#write) to [FileAccessMode.Read](../enums/FileAccessMode.md#read) which has no effect. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `val` | [`FileAccessMode`](../enums/fileaccessmode.md) | File access mode to change to | +| `val` | [`FileAccessMode`](../enums/FileAccessMode.md) | File access mode to change to | #### Returns @@ -237,53 +233,67 @@ ___ ### properties -• `Abstract` `get` **properties**(): [`Properties`](properties.md) +• `Abstract` `get` **properties**(): [`Properties`](Properties.md) Gets the media properties of the file represented by the current instance. #### Returns -[`Properties`](properties.md) +[`Properties`](Properties.md) ___ ### tag -• `Abstract` `get` **tag**(): [`Tag`](tag.md) +• `Abstract` `get` **tag**(): [`Tag`](Tag.md) Gets an abstract representation of all tags stored in the current instance. **`remarks`** This property provides generic and general access to the most common tagging features of a file. To access or add a specific type of tag in the file, use - [File.getTag](file.md#gettag). + [File.getTag](File.md#gettag). #### Returns -[`Tag`](tag.md) +[`Tag`](Tag.md) ___ ### tagTypes -• `get` **tagTypes**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypes**(): [`TagTypes`](../enums/TagTypes.md) Gets the tag types contained in the current instance. #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) ___ ### tagTypesOnDisk -• `get` **tagTypesOnDisk**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypesOnDisk**(): [`TagTypes`](../enums/TagTypes.md) Gets the tag types contained in the physical file represented by the current instance. #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) + +• `set` **tagTypesOnDisk**(`value`): `void` + +Gets the tag types contained in the physical file represented by the current instance. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | [`TagTypes`](../enums/TagTypes.md) | + +#### Returns + +`void` ___ @@ -309,6 +319,10 @@ Dispose the current instance. Equivalent to setting the mode to closed. `void` +#### Implementation of + +IDisposable.dispose + ___ ### find @@ -324,9 +338,9 @@ Searches forward through a file for a specified pattern, starting at a specified | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | `undefined` | Pattern to search for in the current instance. Must be smaller than the | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern to search for in the current instance. Must be smaller than the | | `startPosition` | `number` | `0` | Seek position to start searching. Must be positive, safe integer. | -| `before?` | [`ByteVector`](bytevector.md) | `undefined` | Optional pattern that the searched for pattern must appear before. If this pattern is found first, `-1` is returned. | +| `before?` | [`ByteVector`](ByteVector.md) | `undefined` | Optional pattern that the searched for pattern must appear before. If this pattern is found first, `-1` is returned. | #### Returns @@ -338,7 +352,7 @@ ___ ### getTag -▸ `Abstract` **getTag**(`types`, `create`): [`Tag`](tag.md) +▸ `Abstract` **getTag**(`types`, `create`): [`Tag`](Tag.md) Gets a tag of the specified type from the current instance, optionally creating a new tag if possible. @@ -358,12 +372,12 @@ possible. | Name | Type | Description | | :------ | :------ | :------ | -| `types` | [`TagTypes`](../enums/tagtypes.md) | Type of tag to read. | +| `types` | [`TagTypes`](../enums/TagTypes.md) | Type of tag to read. | | `create` | `boolean` | Whether or not to try and create the tag if one is not found. `true` does not guarantee the tag will be created. For example, trying to create an ID3v2 tag on an OGG Vorbis file will always fail. | #### Returns -[`Tag`](tag.md) +[`Tag`](Tag.md) Tag object containing the tag that was found in or added to the current instance. If no matching tag was found and none was created, `undefined` is returned. It is safe @@ -386,7 +400,7 @@ specified location, replacing a specified number of bytes. | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | `undefined` | Data to insert into the file. | +| `data` | [`ByteVector`](ByteVector.md) | `undefined` | Data to insert into the file. | | `start` | `number` | `undefined` | Index into the file at which to insert the data. Must be safe positive integer. | | `replace` | `number` | `0` | Number of bytes to replace. Typically this is the original size of the data block so that a new block will replace the old one. | @@ -439,7 +453,7 @@ Searches backwards through a file for a specified pattern, starting at a specifi | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | `undefined` | Pattern to search for in the current instance. Must be shorter than the [bufferSize](file.md#buffersize) | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern to search for in the current instance. Must be shorter than the [bufferSize](File.md#buffersize) | | `startPosition` | `number` | `0` | Number of bytes from end of the file to begin searching. | #### Returns @@ -452,11 +466,11 @@ ___ ### readBlock -▸ **readBlock**(`length`): [`ByteVector`](bytevector.md) +▸ **readBlock**(`length`): [`ByteVector`](ByteVector.md) Reads a specified number of bytes at the current seek position from the current position. This method reads the block of data at the current seek position. To change the seek -position, use [File.seek](file.md#seek). +position, use [File.seek](File.md#seek). **`throws`** Error Thrown when `length` is not a positive, safe integer. @@ -468,7 +482,7 @@ position, use [File.seek](file.md#seek). #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ByteVector Object containing the data read from the current instance. @@ -501,13 +515,13 @@ ___ ▸ `Abstract` **removeTags**(`types`): `void` Removes a set of tag types from the current instance. In order to remove all tags from a -file, pass [TagTypes.AllTags](../enums/tagtypes.md#alltags) as `types` +file, pass [TagTypes.AllTags](../enums/TagTypes.md#alltags) as `types` #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `types` | [`TagTypes`](../enums/tagtypes.md) | Bitwise combined [TagTypes](../enums/tagtypes.md) value containing the tag types to be removed from the file | +| `types` | [`TagTypes`](../enums/TagTypes.md) | Bitwise combined [TagTypes](../enums/TagTypes.md) value containing the tag types to be removed from the file | #### Returns @@ -536,10 +550,10 @@ specified origin. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `offset` | `number` | Byte offset to seek to. Must be a safe, positive integer. | -| `origin` | `SeekOrigin` | Origin from which to seek | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `offset` | `number` | `undefined` | Byte offset to seek to. Must be a safe, positive integer. | +| `origin` | `SeekOrigin` | `SeekOrigin.Begin` | Origin from which to seek | #### Returns @@ -579,7 +593,7 @@ the file if writing past the current end. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | ByteVector containing data to the current instance. | +| `data` | [`ByteVector`](ByteVector.md) | ByteVector containing data to the current instance. | #### Returns @@ -591,7 +605,7 @@ ___ ▸ `Static` **addFileType**(`mimeType`, `constructor`, `override?`): `void` -Registers the constructor for a subclass of [File](file.md) with the MimeType it is associated +Registers the constructor for a subclass of [File](File.md) with the MimeType it is associated with. Optionally, the MimeType can be forcefully overridden if it was already registered. #### Parameters @@ -599,8 +613,8 @@ with. Optionally, the MimeType can be forcefully overridden if it was already re | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | | `mimeType` | `string` | `undefined` | MimeType to register this subclass constructor to. | -| `constructor` | [`FileTypeConstructor`](../modules.md#filetypeconstructor) | `undefined` | Constructor for a subclass of [File](file.md) that will be called if a file with a MimeType of `mimeType` is created. | -| `override` | `boolean` | `false` | If `true` and a subclass of [File](file.md) was already registered to `mimeType`, it will be forcefully overridden. If `false`, an {@link Error} will be thrown if a subclass already registered to the MimeType.} | +| `constructor` | [`FileTypeConstructor`](../modules.md#filetypeconstructor) | `undefined` | Constructor for a subclass of [File](File.md) that will be called if a file with a MimeType of `mimeType` is created. | +| `override` | `boolean` | `false` | If `true` and a subclass of [File](File.md) was already registered to `mimeType`, it will be forcefully overridden. If `false`, an {@link Error} will be thrown if a subclass already registered to the MimeType.} | #### Returns @@ -618,7 +632,7 @@ Registers a [FileTypeResolver](../modules.md#filetyperesolver) to the front of t | Name | Type | Description | | :------ | :------ | :------ | -| `resolver` | [`FileTypeResolver`](../modules.md#filetyperesolver) | Function to handle resolving a subclass of [File](file.md) from an {@link IFileAbstraction} | +| `resolver` | [`FileTypeResolver`](../modules.md#filetyperesolver) | Function to handle resolving a subclass of [File](File.md) from an {@link IFileAbstraction} | #### Returns @@ -628,47 +642,47 @@ ___ ### createFromAbstraction -▸ `Static` **createFromAbstraction**(`abstraction`, `mimeType?`, `propertiesStyle?`): [`File`](file.md) +▸ `Static` **createFromAbstraction**(`abstraction`, `mimeType?`, `propertiesStyle?`): [`File`](File.md) -Creates a new instance of a [File](file.md) subclass for a specified file abstraction, MimeType, +Creates a new instance of a [File](File.md) subclass for a specified file abstraction, MimeType, and property read style. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `abstraction` | `IFileAbstraction` | Object to use when reading/writing from the current instance. | -| `mimeType?` | `string` | Optional, MimeType to use for determining the subclass of [File](file.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | Optional, level of detail to use when reading the media information from the new instance. If omitted, [ReadStyle.Average](../enums/readstyle.md#average) is used. | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `abstraction` | `IFileAbstraction` | `undefined` | Object to use when reading/writing from the current instance. | +| `mimeType?` | `string` | `undefined` | Optional, MimeType to use for determining the subclass of [File](File.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | `ReadStyle.Average` | Optional, level of detail to use when reading the media information from the new instance. If omitted, [ReadStyle.Average](../enums/ReadStyle.md#average) is used. | #### Returns -[`File`](file.md) +[`File`](File.md) -New instance of [File](file.md) as read from the specified abstraction. +New instance of [File](File.md) as read from the specified abstraction. ___ ### createFromPath -▸ `Static` **createFromPath**(`filePath`, `mimeType?`, `propertiesStyle?`): [`File`](file.md) +▸ `Static` **createFromPath**(`filePath`, `mimeType?`, `propertiesStyle?`): [`File`](File.md) -Creates a new instance of [File](file.md) subclass for a specified file path, MimeType, and +Creates a new instance of [File](File.md) subclass for a specified file path, MimeType, and property read style. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `filePath` | `string` | Path to the file to read/write. | -| `mimeType?` | `string` | Optional, MimeType to use for determining the subclass of [File](file.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | Optional, level of detail to use when reading the media information from the new instance. If omitted [ReadStyle.Average](../enums/readstyle.md#average) is used. | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `filePath` | `string` | `undefined` | Path to the file to read/write. | +| `mimeType?` | `string` | `undefined` | Optional, MimeType to use for determining the subclass of [File](File.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | `ReadStyle.Average` | Optional, level of detail to use when reading the media information from the new instance. If omitted [ReadStyle.Average](../enums/ReadStyle.md#average) is used. | #### Returns -[`File`](file.md) +[`File`](File.md) -New instance of [File](file.md) as read from the specified path. +New instance of [File](File.md) as read from the specified path. ___ diff --git a/docs/classes/flacblock.md b/docs/classes/FlacBlock.md similarity index 73% rename from docs/classes/flacblock.md rename to docs/classes/FlacBlock.md index 8dbfd687..108049d5 100644 --- a/docs/classes/flacblock.md +++ b/docs/classes/FlacBlock.md @@ -12,30 +12,30 @@ Represents a FLAC metadata block ### Properties -- [headerSize](flacblock.md#headersize) +- [HEADER\_SIZE](FlacBlock.md#header_size) ### Accessors -- [blockStart](flacblock.md#blockstart) -- [data](flacblock.md#data) -- [dataSize](flacblock.md#datasize) -- [isLastBlock](flacblock.md#islastblock) -- [isLoaded](flacblock.md#isloaded) -- [totalSize](flacblock.md#totalsize) -- [type](flacblock.md#type) +- [blockStart](FlacBlock.md#blockstart) +- [data](FlacBlock.md#data) +- [dataSize](FlacBlock.md#datasize) +- [isLastBlock](FlacBlock.md#islastblock) +- [isLoaded](FlacBlock.md#isloaded) +- [totalSize](FlacBlock.md#totalsize) +- [type](FlacBlock.md#type) ### Methods -- [load](flacblock.md#load) -- [render](flacblock.md#render) -- [fromData](flacblock.md#fromdata) -- [fromFile](flacblock.md#fromfile) +- [load](FlacBlock.md#load) +- [render](FlacBlock.md#render) +- [fromData](FlacBlock.md#fromdata) +- [fromFile](FlacBlock.md#fromfile) ## Properties -### headerSize +### HEADER\_SIZE -▪ `Static` `Readonly` **headerSize**: ``4`` +▪ `Static` `Readonly` **HEADER\_SIZE**: ``4`` ## Accessors @@ -71,13 +71,13 @@ ___ ### data -• `get` **data**(): [`ByteVector`](bytevector.md) +• `get` **data**(): [`ByteVector`](ByteVector.md) Gets the data contained in the current instance. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ___ @@ -120,6 +120,10 @@ ___ `boolean` +#### Implementation of + +ILazy.isLoaded + ___ ### totalSize @@ -165,7 +169,7 @@ ___ ### render -▸ **render**(`isLastBlock`): [`ByteVector`](bytevector.md) +▸ **render**(`isLastBlock`): [`ByteVector`](ByteVector.md) Renders the current instance as a raw FLAC metadata block. @@ -177,13 +181,13 @@ Renders the current instance as a raw FLAC metadata block. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ___ ### fromData -▸ `Static` **fromData**(`type`, `data`): [`FlacBlock`](flacblock.md) +▸ `Static` **fromData**(`type`, `data`): [`FlacBlock`](FlacBlock.md) Constructs and initializes a new instance using the type of the block and the data contained in the block. @@ -193,17 +197,17 @@ contained in the block. | Name | Type | Description | | :------ | :------ | :------ | | `type` | `FlacBlockType` | Type of the block to construct | -| `data` | [`ByteVector`](bytevector.md) | Data the block will contain | +| `data` | [`ByteVector`](ByteVector.md) | Data the block will contain | #### Returns -[`FlacBlock`](flacblock.md) +[`FlacBlock`](FlacBlock.md) ___ ### fromFile -▸ `Static` **fromFile**(`file`, `position`): [`FlacBlock`](flacblock.md) +▸ `Static` **fromFile**(`file`, `position`): [`FlacBlock`](FlacBlock.md) Constructs and initializes a new instance, lazily, by reading it from a file. @@ -211,9 +215,9 @@ Constructs and initializes a new instance, lazily, by reading it from a file. | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File from which to read the current instance | +| `file` | [`File`](File.md) | File from which to read the current instance | | `position` | `number` | Offset into the file where the block begins | #### Returns -[`FlacBlock`](flacblock.md) +[`FlacBlock`](FlacBlock.md) diff --git a/docs/classes/flacfile.md b/docs/classes/FlacFile.md similarity index 61% rename from docs/classes/flacfile.md rename to docs/classes/FlacFile.md index dc6608a0..1910e957 100644 --- a/docs/classes/flacfile.md +++ b/docs/classes/FlacFile.md @@ -2,17 +2,17 @@ # Class: FlacFile -This class extends [File](file.md) to provide tagging and properties for FLAC audio files. +This class extends [File](File.md) to provide tagging and properties for FLAC audio files. **`remarks`** A FLAC file is usually tagged using a Xiph comment block with pictures stored in special FLAC picture blocks. Additionally, like many other file types, ID3v1, ID3v2, and APE tags can be added to used to tag a FLAC file by storing them at the beginning or end of the file. To control the type of tags that are created by default when opening the file, see - [FlacFileSettings](flacfilesettings.md). + [FlacFileSettings](FlacFileSettings.md). ## Hierarchy -- [`File`](file.md) +- [`File`](File.md) ↳ **`FlacFile`** @@ -24,56 +24,54 @@ This class extends [File](file.md) to provide tagging and properties for FLAC au ### Constructors -- [constructor](flacfile.md#constructor) +- [constructor](FlacFile.md#constructor) ### Properties -- [\_fileAbstraction](flacfile.md#_fileabstraction) -- [\_fileStream](flacfile.md#_filestream) -- [\_tagTypesOnDisk](flacfile.md#_tagtypesondisk) -- [fileIdentifier](flacfile.md#fileidentifier) +- [FILE\_IDENTIFIER](FlacFile.md#file_identifier) ### Accessors -- [corruptionReasons](flacfile.md#corruptionreasons) -- [fileAbstraction](flacfile.md#fileabstraction) -- [isPossiblyCorrupt](flacfile.md#ispossiblycorrupt) -- [isWritable](flacfile.md#iswritable) -- [length](flacfile.md#length) -- [mediaEndPosition](flacfile.md#mediaendposition) -- [mediaStartPosition](flacfile.md#mediastartposition) -- [mimeType](flacfile.md#mimetype) -- [mode](flacfile.md#mode) -- [name](flacfile.md#name) -- [position](flacfile.md#position) -- [properties](flacfile.md#properties) -- [tag](flacfile.md#tag) -- [tagTypes](flacfile.md#tagtypes) -- [tagTypesOnDisk](flacfile.md#tagtypesondisk) -- [bufferSize](flacfile.md#buffersize) +- [corruptionReasons](FlacFile.md#corruptionreasons) +- [fileAbstraction](FlacFile.md#fileabstraction) +- [hasTags](FlacFile.md#hastags) +- [isPossiblyCorrupt](FlacFile.md#ispossiblycorrupt) +- [isWritable](FlacFile.md#iswritable) +- [length](FlacFile.md#length) +- [mediaEndPosition](FlacFile.md#mediaendposition) +- [mediaStartPosition](FlacFile.md#mediastartposition) +- [mimeType](FlacFile.md#mimetype) +- [mode](FlacFile.md#mode) +- [name](FlacFile.md#name) +- [position](FlacFile.md#position) +- [properties](FlacFile.md#properties) +- [tag](FlacFile.md#tag) +- [tagTypes](FlacFile.md#tagtypes) +- [tagTypesOnDisk](FlacFile.md#tagtypesondisk) +- [bufferSize](FlacFile.md#buffersize) ### Methods -- [dispose](flacfile.md#dispose) -- [find](flacfile.md#find) -- [getTag](flacfile.md#gettag) -- [insert](flacfile.md#insert) -- [markAsCorrupt](flacfile.md#markascorrupt) -- [preSave](flacfile.md#presave) -- [rFind](flacfile.md#rfind) -- [readBlock](flacfile.md#readblock) -- [removeBlock](flacfile.md#removeblock) -- [removeTags](flacfile.md#removetags) -- [save](flacfile.md#save) -- [seek](flacfile.md#seek) -- [truncate](flacfile.md#truncate) -- [writeBlock](flacfile.md#writeblock) -- [addFileType](flacfile.md#addfiletype) -- [addFileTypeResolver](flacfile.md#addfiletyperesolver) -- [createFromAbstraction](flacfile.md#createfromabstraction) -- [createFromPath](flacfile.md#createfrompath) -- [removeFileType](flacfile.md#removefiletype) -- [removeFileTypeResolver](flacfile.md#removefiletyperesolver) +- [dispose](FlacFile.md#dispose) +- [find](FlacFile.md#find) +- [getTag](FlacFile.md#gettag) +- [insert](FlacFile.md#insert) +- [markAsCorrupt](FlacFile.md#markascorrupt) +- [preSave](FlacFile.md#presave) +- [rFind](FlacFile.md#rfind) +- [readBlock](FlacFile.md#readblock) +- [removeBlock](FlacFile.md#removeblock) +- [removeTags](FlacFile.md#removetags) +- [save](FlacFile.md#save) +- [seek](FlacFile.md#seek) +- [truncate](FlacFile.md#truncate) +- [writeBlock](FlacFile.md#writeblock) +- [addFileType](FlacFile.md#addfiletype) +- [addFileTypeResolver](FlacFile.md#addfiletyperesolver) +- [createFromAbstraction](FlacFile.md#createfromabstraction) +- [createFromPath](FlacFile.md#createfrompath) +- [removeFileType](FlacFile.md#removefiletype) +- [removeFileTypeResolver](FlacFile.md#removefiletyperesolver) ## Constructors @@ -88,71 +86,66 @@ Constructs and initializes a new instance of a FLAC file based on the provided f | Name | Type | Description | | :------ | :------ | :------ | | `file` | `string` \| `IFileAbstraction` | File abstraction or path to a file to open as a FLAC file | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | How in-depth to read the properties of the file | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | How in-depth to read the properties of the file | #### Overrides -[File](file.md).[constructor](file.md#constructor) +[File](File.md).[constructor](File.md#constructor) ## Properties -### \_fileAbstraction +### FILE\_IDENTIFIER -• `Protected` **\_fileAbstraction**: `IFileAbstraction` +▪ `Static` `Readonly` **FILE\_IDENTIFIER**: [`ByteVector`](ByteVector.md) -#### Inherited from - -[File](file.md).[_fileAbstraction](file.md#_fileabstraction) - -___ - -### \_fileStream - -• `Protected` **\_fileStream**: `IStream` +## Accessors -#### Inherited from +### corruptionReasons -[File](file.md).[_fileStream](file.md#_filestream) +• `get` **corruptionReasons**(): `string`[] -___ +Reasons for which this file is marked as corrupt. -### \_tagTypesOnDisk +#### Returns -• `Protected` **\_tagTypesOnDisk**: [`TagTypes`](../enums/tagtypes.md) +`string`[] #### Inherited from -[File](file.md).[_tagTypesOnDisk](file.md#_tagtypesondisk) +File.corruptionReasons ___ -### fileIdentifier - -▪ `Static` `Readonly` **fileIdentifier**: [`ByteVector`](bytevector.md) +### fileAbstraction -## Accessors +• `get` **fileAbstraction**(): `IFileAbstraction` -### corruptionReasons +Gets the {@link IFileAbstraction} representing the file. -• `get` **corruptionReasons**(): `string`[] +#### Returns -Reasons for which this file is marked as corrupt. +`IFileAbstraction` -#### Returns +#### Inherited from -`string`[] +File.fileAbstraction ___ -### fileAbstraction +### hasTags -• `get` **fileAbstraction**(): `IFileAbstraction` +• `get` **hasTags**(): `boolean` -Gets the {@link IFileAbstraction} representing the file. +Shortcut property to determine if a file has tags in memory. +NOTE: Just because `tag !== undefined` does not mean there are tags in memory. #### Returns -`IFileAbstraction` +`boolean` + +#### Inherited from + +File.hasTags ___ @@ -167,6 +160,10 @@ be written. `boolean` +#### Inherited from + +File.isPossiblyCorrupt + ___ ### isWritable @@ -179,6 +176,10 @@ Indicates whether or not tags can be written back to the current file. `boolean` +#### Inherited from + +File.isWritable + ___ ### length @@ -192,6 +193,10 @@ is not open for reading; `number` +#### Inherited from + +File.length + ___ ### mediaEndPosition @@ -202,6 +207,10 @@ ___ `number` +#### Implementation of + +ISandwichFile.mediaEndPosition + ___ ### mediaStartPosition @@ -212,6 +221,10 @@ ___ `number` +#### Implementation of + +ISandwichFile.mediaStartPosition + ___ ### mimeType @@ -224,34 +237,46 @@ Gets the MimeType of the file as determined during creation of the instance. `string` +#### Inherited from + +File.mimeType + ___ ### mode -• `get` **mode**(): [`FileAccessMode`](../enums/fileaccessmode.md) +• `get` **mode**(): [`FileAccessMode`](../enums/FileAccessMode.md) Gets the file access mode in use by the current instance. #### Returns -[`FileAccessMode`](../enums/fileaccessmode.md) +[`FileAccessMode`](../enums/FileAccessMode.md) + +#### Inherited from + +File.mode • `set` **mode**(`val`): `void` Sets the file access mode in use by the current instance. Changing the value will cause the stream currently in use to be closed, except when a change is made from -[FileAccessMode.Write](../enums/fileaccessmode.md#write) to [FileAccessMode.Read](../enums/fileaccessmode.md#read) which has no effect. +[FileAccessMode.Write](../enums/FileAccessMode.md#write) to [FileAccessMode.Read](../enums/FileAccessMode.md#read) which has no effect. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `val` | [`FileAccessMode`](../enums/fileaccessmode.md) | File access mode to change to | +| `val` | [`FileAccessMode`](../enums/FileAccessMode.md) | File access mode to change to | #### Returns `void` +#### Inherited from + +File.mode + ___ ### name @@ -264,6 +289,10 @@ Gets the name of the file as stored in its file abstraction. `string` +#### Inherited from + +File.name + ___ ### position @@ -277,53 +306,87 @@ if the file is not open for reading `number` +#### Inherited from + +File.position + ___ ### properties -• `get` **properties**(): [`Properties`](properties.md) - -Gets the media properties of the file represented by the current instance. +• `get` **properties**(): [`Properties`](Properties.md) #### Returns -[`Properties`](properties.md) +[`Properties`](Properties.md) + +#### Overrides + +File.properties ___ ### tag -• `get` **tag**(): [`FlacTag`](flactag.md) - -Gets an abstract representation of all tags stored in the current instance. +• `get` **tag**(): [`FlacTag`](FlacTag.md) #### Returns -[`FlacTag`](flactag.md) +[`FlacTag`](FlacTag.md) + +#### Overrides + +File.tag ___ ### tagTypes -• `get` **tagTypes**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypes**(): [`TagTypes`](../enums/TagTypes.md) Gets the tag types contained in the current instance. #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) + +#### Inherited from + +File.tagTypes ___ ### tagTypesOnDisk -• `get` **tagTypesOnDisk**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypesOnDisk**(): [`TagTypes`](../enums/TagTypes.md) Gets the tag types contained in the physical file represented by the current instance. #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) + +#### Inherited from + +File.tagTypesOnDisk + +• `set` **tagTypesOnDisk**(`value`): `void` + +Gets the tag types contained in the physical file represented by the current instance. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | [`TagTypes`](../enums/TagTypes.md) | + +#### Returns + +`void` + +#### Inherited from + +File.tagTypesOnDisk ___ @@ -337,6 +400,10 @@ Gets the buffer size to use when reading large blocks of data `number` +#### Inherited from + +File.bufferSize + ## Methods ### dispose @@ -351,7 +418,7 @@ Dispose the current instance. Equivalent to setting the mode to closed. #### Inherited from -[File](file.md).[dispose](file.md#dispose) +[File](File.md).[dispose](File.md#dispose) ___ @@ -368,9 +435,9 @@ Searches forward through a file for a specified pattern, starting at a specified | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | `undefined` | Pattern to search for in the current instance. Must be smaller than the | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern to search for in the current instance. Must be smaller than the | | `startPosition` | `number` | `0` | Seek position to start searching. Must be positive, safe integer. | -| `before?` | [`ByteVector`](bytevector.md) | `undefined` | Optional pattern that the searched for pattern must appear before. If this pattern is found first, `-1` is returned. | +| `before?` | [`ByteVector`](ByteVector.md) | `undefined` | Optional pattern that the searched for pattern must appear before. If this pattern is found first, `-1` is returned. | #### Returns @@ -380,13 +447,13 @@ Index at which the value was found. If not found, `-1` is returned. #### Inherited from -[File](file.md).[find](file.md#find) +[File](File.md).[find](File.md#find) ___ ### getTag -▸ **getTag**(`type`, `create`): [`Tag`](tag.md) +▸ **getTag**(`type`, `create`): [`Tag`](Tag.md) Gets a tag of the specified type from the current instance, optionally creating a new tag if possible. @@ -395,12 +462,12 @@ possible. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`TagTypes`](../enums/tagtypes.md) | Type of tag to read. | +| `type` | [`TagTypes`](../enums/TagTypes.md) | Type of tag to read. | | `create` | `boolean` | Whether or not to try and create the tag if one is not found. `true` does not guarantee the tag will be created. For example, trying to create an ID3v2 tag on an OGG Vorbis file will always fail. | #### Returns -[`Tag`](tag.md) +[`Tag`](Tag.md) Tag object containing the tag that was found in or added to the current instance. If no matching tag was found and none was created, `undefined` is returned. It is safe @@ -409,7 +476,7 @@ Tag object containing the tag that was found in or added to the current instance #### Overrides -[File](file.md).[getTag](file.md#gettag) +[File](File.md).[getTag](File.md#gettag) ___ @@ -427,7 +494,7 @@ specified location, replacing a specified number of bytes. | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | `undefined` | Data to insert into the file. | +| `data` | [`ByteVector`](ByteVector.md) | `undefined` | Data to insert into the file. | | `start` | `number` | `undefined` | Index into the file at which to insert the data. Must be safe positive integer. | | `replace` | `number` | `0` | Number of bytes to replace. Typically this is the original size of the data block so that a new block will replace the old one. | @@ -437,7 +504,7 @@ specified location, replacing a specified number of bytes. #### Inherited from -[File](file.md).[insert](file.md#insert) +[File](File.md).[insert](File.md#insert) ___ @@ -459,7 +526,7 @@ Mark the current instance as corrupt. NOTE: Not intended to be used outside of t #### Inherited from -[File](file.md).[markAsCorrupt](file.md#markascorrupt) +[File](File.md).[markAsCorrupt](File.md#markascorrupt) ___ @@ -475,7 +542,7 @@ Prepares to save the file. This must be called at the beginning of every File.sa #### Inherited from -[File](file.md).[preSave](file.md#presave) +[File](File.md).[preSave](File.md#presave) ___ @@ -492,7 +559,7 @@ Searches backwards through a file for a specified pattern, starting at a specifi | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | `undefined` | Pattern to search for in the current instance. Must be shorter than the [bufferSize](flacfile.md#buffersize) | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern to search for in the current instance. Must be shorter than the [bufferSize](FlacFile.md#buffersize) | | `startPosition` | `number` | `0` | Number of bytes from end of the file to begin searching. | #### Returns @@ -503,17 +570,17 @@ Index at which the value wa found. If not found, `-1` is returned. #### Inherited from -[File](file.md).[rFind](file.md#rfind) +[File](File.md).[rFind](File.md#rfind) ___ ### readBlock -▸ **readBlock**(`length`): [`ByteVector`](bytevector.md) +▸ **readBlock**(`length`): [`ByteVector`](ByteVector.md) Reads a specified number of bytes at the current seek position from the current position. This method reads the block of data at the current seek position. To change the seek -position, use [File.seek](file.md#seek). +position, use [File.seek](File.md#seek). **`throws`** Error Thrown when `length` is not a positive, safe integer. @@ -525,13 +592,13 @@ position, use [File.seek](file.md#seek). #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ByteVector Object containing the data read from the current instance. #### Inherited from -[File](file.md).[readBlock](file.md#readblock) +[File](File.md).[readBlock](File.md#readblock) ___ @@ -557,7 +624,7 @@ Removes a specified block of data from the file represented by the current insta #### Inherited from -[File](file.md).[removeBlock](file.md#removeblock) +[File](File.md).[removeBlock](File.md#removeblock) ___ @@ -566,13 +633,13 @@ ___ ▸ **removeTags**(`types`): `void` Removes a set of tag types from the current instance. In order to remove all tags from a -file, pass [TagTypes.AllTags](../enums/tagtypes.md#alltags) as `types` +file, pass [TagTypes.AllTags](../enums/TagTypes.md#alltags) as `types` #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `types` | [`TagTypes`](../enums/tagtypes.md) | Bitwise combined [TagTypes](../enums/tagtypes.md) value containing the tag types to be removed from the file | +| `types` | [`TagTypes`](../enums/TagTypes.md) | Bitwise combined [TagTypes](../enums/TagTypes.md) value containing the tag types to be removed from the file | #### Returns @@ -580,7 +647,7 @@ file, pass [TagTypes.AllTags](../enums/tagtypes.md#alltags) as `types` #### Overrides -[File](file.md).[removeTags](file.md#removetags) +[File](File.md).[removeTags](File.md#removetags) ___ @@ -596,7 +663,7 @@ Saves the changes made in the current instance to the file it represents. #### Overrides -[File](file.md).[save](file.md#save) +[File](File.md).[save](File.md#save) ___ @@ -609,10 +676,10 @@ specified origin. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `offset` | `number` | Byte offset to seek to. Must be a safe, positive integer. | -| `origin` | `SeekOrigin` | Origin from which to seek | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `offset` | `number` | `undefined` | Byte offset to seek to. Must be a safe, positive integer. | +| `origin` | `SeekOrigin` | `SeekOrigin.Begin` | Origin from which to seek | #### Returns @@ -620,7 +687,7 @@ specified origin. #### Inherited from -[File](file.md).[seek](file.md#seek) +[File](File.md).[seek](File.md#seek) ___ @@ -642,7 +709,7 @@ Resizes the current instance to a specific number of bytes. #### Inherited from -[File](file.md).[truncate](file.md#truncate) +[File](File.md).[truncate](File.md#truncate) ___ @@ -660,7 +727,7 @@ the file if writing past the current end. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | ByteVector containing data to the current instance. | +| `data` | [`ByteVector`](ByteVector.md) | ByteVector containing data to the current instance. | #### Returns @@ -668,7 +735,7 @@ the file if writing past the current end. #### Inherited from -[File](file.md).[writeBlock](file.md#writeblock) +[File](File.md).[writeBlock](File.md#writeblock) ___ @@ -676,7 +743,7 @@ ___ ▸ `Static` **addFileType**(`mimeType`, `constructor`, `override?`): `void` -Registers the constructor for a subclass of [File](file.md) with the MimeType it is associated +Registers the constructor for a subclass of [File](File.md) with the MimeType it is associated with. Optionally, the MimeType can be forcefully overridden if it was already registered. #### Parameters @@ -684,8 +751,8 @@ with. Optionally, the MimeType can be forcefully overridden if it was already re | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | | `mimeType` | `string` | `undefined` | MimeType to register this subclass constructor to. | -| `constructor` | [`FileTypeConstructor`](../modules.md#filetypeconstructor) | `undefined` | Constructor for a subclass of [File](file.md) that will be called if a file with a MimeType of `mimeType` is created. | -| `override` | `boolean` | `false` | If `true` and a subclass of [File](file.md) was already registered to `mimeType`, it will be forcefully overridden. If `false`, an {@link Error} will be thrown if a subclass already registered to the MimeType.} | +| `constructor` | [`FileTypeConstructor`](../modules.md#filetypeconstructor) | `undefined` | Constructor for a subclass of [File](File.md) that will be called if a file with a MimeType of `mimeType` is created. | +| `override` | `boolean` | `false` | If `true` and a subclass of [File](File.md) was already registered to `mimeType`, it will be forcefully overridden. If `false`, an {@link Error} will be thrown if a subclass already registered to the MimeType.} | #### Returns @@ -693,7 +760,7 @@ with. Optionally, the MimeType can be forcefully overridden if it was already re #### Inherited from -[File](file.md).[addFileType](file.md#addfiletype) +[File](File.md).[addFileType](File.md#addfiletype) ___ @@ -707,7 +774,7 @@ Registers a [FileTypeResolver](../modules.md#filetyperesolver) to the front of t | Name | Type | Description | | :------ | :------ | :------ | -| `resolver` | [`FileTypeResolver`](../modules.md#filetyperesolver) | Function to handle resolving a subclass of [File](file.md) from an {@link IFileAbstraction} | +| `resolver` | [`FileTypeResolver`](../modules.md#filetyperesolver) | Function to handle resolving a subclass of [File](File.md) from an {@link IFileAbstraction} | #### Returns @@ -715,61 +782,61 @@ Registers a [FileTypeResolver](../modules.md#filetyperesolver) to the front of t #### Inherited from -[File](file.md).[addFileTypeResolver](file.md#addfiletyperesolver) +[File](File.md).[addFileTypeResolver](File.md#addfiletyperesolver) ___ ### createFromAbstraction -▸ `Static` **createFromAbstraction**(`abstraction`, `mimeType?`, `propertiesStyle?`): [`File`](file.md) +▸ `Static` **createFromAbstraction**(`abstraction`, `mimeType?`, `propertiesStyle?`): [`File`](File.md) -Creates a new instance of a [File](file.md) subclass for a specified file abstraction, MimeType, +Creates a new instance of a [File](File.md) subclass for a specified file abstraction, MimeType, and property read style. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `abstraction` | `IFileAbstraction` | Object to use when reading/writing from the current instance. | -| `mimeType?` | `string` | Optional, MimeType to use for determining the subclass of [File](file.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | Optional, level of detail to use when reading the media information from the new instance. If omitted, [ReadStyle.Average](../enums/readstyle.md#average) is used. | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `abstraction` | `IFileAbstraction` | `undefined` | Object to use when reading/writing from the current instance. | +| `mimeType?` | `string` | `undefined` | Optional, MimeType to use for determining the subclass of [File](File.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | `ReadStyle.Average` | Optional, level of detail to use when reading the media information from the new instance. If omitted, [ReadStyle.Average](../enums/ReadStyle.md#average) is used. | #### Returns -[`File`](file.md) +[`File`](File.md) -New instance of [File](file.md) as read from the specified abstraction. +New instance of [File](File.md) as read from the specified abstraction. #### Inherited from -[File](file.md).[createFromAbstraction](file.md#createfromabstraction) +[File](File.md).[createFromAbstraction](File.md#createfromabstraction) ___ ### createFromPath -▸ `Static` **createFromPath**(`filePath`, `mimeType?`, `propertiesStyle?`): [`File`](file.md) +▸ `Static` **createFromPath**(`filePath`, `mimeType?`, `propertiesStyle?`): [`File`](File.md) -Creates a new instance of [File](file.md) subclass for a specified file path, MimeType, and +Creates a new instance of [File](File.md) subclass for a specified file path, MimeType, and property read style. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `filePath` | `string` | Path to the file to read/write. | -| `mimeType?` | `string` | Optional, MimeType to use for determining the subclass of [File](file.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | Optional, level of detail to use when reading the media information from the new instance. If omitted [ReadStyle.Average](../enums/readstyle.md#average) is used. | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `filePath` | `string` | `undefined` | Path to the file to read/write. | +| `mimeType?` | `string` | `undefined` | Optional, MimeType to use for determining the subclass of [File](File.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | `ReadStyle.Average` | Optional, level of detail to use when reading the media information from the new instance. If omitted [ReadStyle.Average](../enums/ReadStyle.md#average) is used. | #### Returns -[`File`](file.md) +[`File`](File.md) -New instance of [File](file.md) as read from the specified path. +New instance of [File](File.md) as read from the specified path. #### Inherited from -[File](file.md).[createFromPath](file.md#createfrompath) +[File](File.md).[createFromPath](File.md#createfrompath) ___ @@ -791,7 +858,7 @@ Used for removing a file type constructor during unit testing #### Inherited from -[File](file.md).[removeFileType](file.md#removefiletype) +[File](File.md).[removeFileType](File.md#removefiletype) ___ @@ -813,4 +880,4 @@ Used for removing a file type resolver during unit testing #### Inherited from -[File](file.md).[removeFileTypeResolver](file.md#removefiletyperesolver) +[File](File.md).[removeFileTypeResolver](File.md#removefiletyperesolver) diff --git a/docs/classes/flacfilesettings.md b/docs/classes/FlacFileSettings.md similarity index 83% rename from docs/classes/flacfilesettings.md rename to docs/classes/FlacFileSettings.md index 60952e2b..9252b0b1 100644 --- a/docs/classes/flacfilesettings.md +++ b/docs/classes/FlacFileSettings.md @@ -9,17 +9,17 @@ re-read in order for changes to take effect. ### Constructors -- [constructor](flacfilesettings.md#constructor) +- [constructor](FlacFileSettings.md#constructor) ### Properties -- [supportedTagTypes](flacfilesettings.md#supportedtagtypes) +- [SUPPORTED\_TAG\_TYPES](FlacFileSettings.md#supported_tag_types) ### Accessors -- [defaultTagTypes](flacfilesettings.md#defaulttagtypes) -- [preferApeTagAtFileEnd](flacfilesettings.md#preferapetagatfileend) -- [preferId3v2TagAtFileEnd](flacfilesettings.md#preferid3v2tagatfileend) +- [defaultTagTypes](FlacFileSettings.md#defaulttagtypes) +- [preferApeTagAtFileEnd](FlacFileSettings.md#preferapetagatfileend) +- [preferId3v2TagAtFileEnd](FlacFileSettings.md#preferid3v2tagatfileend) ## Constructors @@ -29,34 +29,34 @@ re-read in order for changes to take effect. ## Properties -### supportedTagTypes +### SUPPORTED\_TAG\_TYPES -▪ `Static` `Readonly` **supportedTagTypes**: `number` +▪ `Static` `Readonly` **SUPPORTED\_TAG\_TYPES**: `number` ## Accessors ### defaultTagTypes -• `Static` `get` **defaultTagTypes**(): [`TagTypes`](../enums/tagtypes.md) +• `Static` `get` **defaultTagTypes**(): [`TagTypes`](../enums/TagTypes.md) Gets the default types of tags for an MPEG audio file. When opening a file, if these tag types do not exist on the file, they will be created. #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) • `Static` `set` **defaultTagTypes**(`value`): `void` Sets the default types of tags for an MPEG audio file. When opening a file, if these tag -types do not exist on the file, they will be created. See [supportedTagTypes](flacfilesettings.md#supportedtagtypes) for a -list of tag types that are supported by node-taglib-sharp for MPEG container files. +types do not exist on the file, they will be created. See [SUPPORTED_TAG_TYPES](FlacFileSettings.md#supported_tag_types) for a +list of tag types that are supported by node-taglib-sharp for FLAC files. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`TagTypes`](../enums/tagtypes.md) | +| `value` | [`TagTypes`](../enums/TagTypes.md) | #### Returns diff --git a/docs/classes/FlacTag.md b/docs/classes/FlacTag.md new file mode 100644 index 00000000..fce78a49 --- /dev/null +++ b/docs/classes/FlacTag.md @@ -0,0 +1,2580 @@ +[node-taglib-sharp](../README.md) / [Exports](../modules.md) / FlacTag + +# Class: FlacTag + +Collection of tags that can be stored in a FLAC file. + +**`remarks`** The FLAC file specification states that tagging should be done via a XIPH comment block + and any pictures should be stored in a FLAC picture block. However, tagging can be done via + ID3 and APE tags at the beginning or end of the file, same as MP3 and other files. This + class provides a unified access into all the tags a FLAC file may contain. + +## Hierarchy + +- [`CombinedTag`](CombinedTag.md) + + ↳ **`FlacTag`** + +## Table of contents + +### Constructors + +- [constructor](FlacTag.md#constructor) + +### Accessors + +- [album](FlacTag.md#album) +- [albumArtists](FlacTag.md#albumartists) +- [albumArtistsSort](FlacTag.md#albumartistssort) +- [albumSort](FlacTag.md#albumsort) +- [amazonId](FlacTag.md#amazonid) +- [beatsPerMinute](FlacTag.md#beatsperminute) +- [comment](FlacTag.md#comment) +- [composers](FlacTag.md#composers) +- [composersSort](FlacTag.md#composerssort) +- [conductor](FlacTag.md#conductor) +- [copyright](FlacTag.md#copyright) +- [dateTagged](FlacTag.md#datetagged) +- [description](FlacTag.md#description) +- [disc](FlacTag.md#disc) +- [discCount](FlacTag.md#disccount) +- [endTag](FlacTag.md#endtag) +- [firstAlbumArtist](FlacTag.md#firstalbumartist) +- [firstAlbumArtistSort](FlacTag.md#firstalbumartistsort) +- [firstComposer](FlacTag.md#firstcomposer) +- [firstComposerSort](FlacTag.md#firstcomposersort) +- [firstGenre](FlacTag.md#firstgenre) +- [firstPerformer](FlacTag.md#firstperformer) +- [firstPerformerSort](FlacTag.md#firstperformersort) +- [genres](FlacTag.md#genres) +- [grouping](FlacTag.md#grouping) +- [initialKey](FlacTag.md#initialkey) +- [isCompilation](FlacTag.md#iscompilation) +- [isEmpty](FlacTag.md#isempty) +- [isrc](FlacTag.md#isrc) +- [joinedAlbumArtists](FlacTag.md#joinedalbumartists) +- [joinedComposers](FlacTag.md#joinedcomposers) +- [joinedGenres](FlacTag.md#joinedgenres) +- [joinedPerformers](FlacTag.md#joinedperformers) +- [joinedPerformersSort](FlacTag.md#joinedperformerssort) +- [lyrics](FlacTag.md#lyrics) +- [musicBrainzArtistId](FlacTag.md#musicbrainzartistid) +- [musicBrainzDiscId](FlacTag.md#musicbrainzdiscid) +- [musicBrainzReleaseArtistId](FlacTag.md#musicbrainzreleaseartistid) +- [musicBrainzReleaseCountry](FlacTag.md#musicbrainzreleasecountry) +- [musicBrainzReleaseGroupId](FlacTag.md#musicbrainzreleasegroupid) +- [musicBrainzReleaseId](FlacTag.md#musicbrainzreleaseid) +- [musicBrainzReleaseStatus](FlacTag.md#musicbrainzreleasestatus) +- [musicBrainzReleaseType](FlacTag.md#musicbrainzreleasetype) +- [musicBrainzTrackId](FlacTag.md#musicbrainztrackid) +- [musicIpId](FlacTag.md#musicipid) +- [performers](FlacTag.md#performers) +- [performersRole](FlacTag.md#performersrole) +- [performersSort](FlacTag.md#performerssort) +- [pictures](FlacTag.md#pictures) +- [publisher](FlacTag.md#publisher) +- [remixedBy](FlacTag.md#remixedby) +- [replayGainAlbumGain](FlacTag.md#replaygainalbumgain) +- [replayGainAlbumPeak](FlacTag.md#replaygainalbumpeak) +- [replayGainTrackGain](FlacTag.md#replaygaintrackgain) +- [replayGainTrackPeak](FlacTag.md#replaygaintrackpeak) +- [sizeOnDisk](FlacTag.md#sizeondisk) +- [startTag](FlacTag.md#starttag) +- [subtitle](FlacTag.md#subtitle) +- [supportedTagTypes](FlacTag.md#supportedtagtypes) +- [tagTypes](FlacTag.md#tagtypes) +- [tags](FlacTag.md#tags) +- [title](FlacTag.md#title) +- [titleSort](FlacTag.md#titlesort) +- [track](FlacTag.md#track) +- [trackCount](FlacTag.md#trackcount) +- [xiphComment](FlacTag.md#xiphcomment) +- [year](FlacTag.md#year) + +### Methods + +- [addTag](FlacTag.md#addtag) +- [clear](FlacTag.md#clear) +- [copyTo](FlacTag.md#copyto) +- [createTag](FlacTag.md#createtag) +- [getTag](FlacTag.md#gettag) +- [removeTags](FlacTag.md#removetags) +- [replaceTag](FlacTag.md#replacetag) +- [setInfoTag](FlacTag.md#setinfotag) +- [validateTagCreation](FlacTag.md#validatetagcreation) +- [firstInGroup](FlacTag.md#firstingroup) +- [isFalsyOrLikeEmpty](FlacTag.md#isfalsyorlikeempty) +- [joinGroup](FlacTag.md#joingroup) +- [tagTypeFlagsToArray](FlacTag.md#tagtypeflagstoarray) + +## Constructors + +### constructor + +• **new FlacTag**(`startTag`, `endTag`, `xiphTag`, `flacPictures`) + +Constructs and initializes a new FLAC tag using the component tags provided. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `startTag` | `default` | Required, collection of tags at the start of the file | +| `endTag` | `default` | Required, collection of tags at the end of the file | +| `xiphTag` | [`XiphComment`](XiphComment.md) | Optional, Xiph comment tag from the FLAC file | +| `flacPictures` | [`XiphPicture`](XiphPicture.md)[] | Optional, array of pictures found in the file | + +#### Overrides + +[CombinedTag](CombinedTag.md).[constructor](CombinedTag.md#constructor) + +## Accessors + +### album + +• `get` **album**(): `string` + +Gets the album of the media represented by the current instance. For video media, this +represents the collection the video belongs to. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.album + +• `set` **album**(`val`): `void` + +Gets the album of the media represented by the current instance. For video media, this +represents the collection the video belongs to. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.album + +___ + +### albumArtists + +• `get` **albumArtists**(): `string`[] + +Gets the band or artist who is credited credited in the creation of the entire album or +collection containing the media described by the current instance. + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Inherited from + +CombinedTag.albumArtists + +• `set` **albumArtists**(`val`): `void` + +Gets the band or artist who is credited credited in the creation of the entire album or +collection containing the media described by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.albumArtists + +___ + +### albumArtistsSort + +• `get` **albumArtistsSort**(): `string`[] + +Gets the sortable names of the bands/artists who are credited with creating the entire +album or collection containing the media described by the current instance. + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Inherited from + +CombinedTag.albumArtistsSort + +• `set` **albumArtistsSort**(`val`): `void` + +Gets the sortable names of the bands/artists who are credited with creating the entire +album or collection containing the media described by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.albumArtistsSort + +___ + +### albumSort + +• `get` **albumSort**(): `string` + +Gets the sortable name of the album title of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.albumSort + +• `set` **albumSort**(`val`): `void` + +Gets the sortable name of the album title of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.albumSort + +___ + +### amazonId + +• `get` **amazonId**(): `string` + +Gets the Amazon ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.amazonId + +• `set` **amazonId**(`val`): `void` + +Gets the Amazon ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.amazonId + +___ + +### beatsPerMinute + +• `get` **beatsPerMinute**(): `number` + +Gets the number of beats per minute in the audio of the media represented by the current +instance. + +**`inheritdoc`** + +#### Returns + +`number` + +#### Inherited from + +CombinedTag.beatsPerMinute + +• `set` **beatsPerMinute**(`val`): `void` + +Gets the number of beats per minute in the audio of the media represented by the current +instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.beatsPerMinute + +___ + +### comment + +• `get` **comment**(): `string` + +Gets a user comment on the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.comment + +• `set` **comment**(`val`): `void` + +Gets a user comment on the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.comment + +___ + +### composers + +• `get` **composers**(): `string`[] + +Gets the composers of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Inherited from + +CombinedTag.composers + +• `set` **composers**(`val`): `void` + +Gets the composers of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.composers + +___ + +### composersSort + +• `get` **composersSort**(): `string`[] + +Gets the sortable names of the composers of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Inherited from + +CombinedTag.composersSort + +• `set` **composersSort**(`val`): `void` + +Gets the sortable names of the composers of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.composersSort + +___ + +### conductor + +• `get` **conductor**(): `string` + +Gets the conductor or director of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.conductor + +• `set` **conductor**(`val`): `void` + +Gets the conductor or director of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.conductor + +___ + +### copyright + +• `get` **copyright**(): `string` + +Gets the copyright information for the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.copyright + +• `set` **copyright**(`val`): `void` + +Gets the copyright information for the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.copyright + +___ + +### dateTagged + +• `get` **dateTagged**(): `Date` + +Gets the date and time at which the tag has been written. + +**`inheritdoc`** + +#### Returns + +`Date` + +#### Inherited from + +CombinedTag.dateTagged + +• `set` **dateTagged**(`val`): `void` + +Gets the date and time at which the tag has been written. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `Date` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.dateTagged + +___ + +### description + +• `get` **description**(): `string` + +Gets a short description of the media. For music, this could be the comment that the artist +made of his/her work. For a video, this should be a short summary of the story/plot, but +generally no spoliers. This should give the impression of what to expect in the media. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.description + +• `set` **description**(`val`): `void` + +Gets a short description of the media. For music, this could be the comment that the artist +made of his/her work. For a video, this should be a short summary of the story/plot, but +generally no spoliers. This should give the impression of what to expect in the media. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.description + +___ + +### disc + +• `get` **disc**(): `number` + +Gets the number of the disc containing the media represented by the current instance in the +boxed set. For a series, this represents the season number. + +**`inheritdoc`** + +#### Returns + +`number` + +#### Inherited from + +CombinedTag.disc + +• `set` **disc**(`val`): `void` + +Gets the number of the disc containing the media represented by the current instance in the +boxed set. For a series, this represents the season number. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.disc + +___ + +### discCount + +• `get` **discCount**(): `number` + +Gets the number of discs or seasons in the boxed set containing the media represented by the +current instance. + +**`inheritdoc`** + +#### Returns + +`number` + +#### Inherited from + +CombinedTag.discCount + +• `set` **discCount**(`val`): `void` + +Gets the number of discs or seasons in the boxed set containing the media represented by the +current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.discCount + +___ + +### endTag + +• `get` **endTag**(): `default` + +Gets the collection of tags appearing at the end of the file. + +#### Returns + +`default` + +___ + +### firstAlbumArtist + +• `get` **firstAlbumArtist**(): `string` + +Gets the first value contained in [albumArtists](FlacTag.md#albumartists). + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.firstAlbumArtist + +___ + +### firstAlbumArtistSort + +• `get` **firstAlbumArtistSort**(): `string` + +Gets the first value contained in [albumArtistsSort](FlacTag.md#albumartistssort) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.firstAlbumArtistSort + +___ + +### firstComposer + +• `get` **firstComposer**(): `string` + +Gets the first value contained in [composers](FlacTag.md#composers) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.firstComposer + +___ + +### firstComposerSort + +• `get` **firstComposerSort**(): `string` + +Gets the first value contained in [composersSort](FlacTag.md#composerssort) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.firstComposerSort + +___ + +### firstGenre + +• `get` **firstGenre**(): `string` + +Gets the first value contained in [genres](FlacTag.md#genres) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.firstGenre + +___ + +### firstPerformer + +• `get` **firstPerformer**(): `string` + +Gets the first value contained in [performers](FlacTag.md#performers) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.firstPerformer + +___ + +### firstPerformerSort + +• `get` **firstPerformerSort**(): `string` + +Gets the first value contained in [performersSort](FlacTag.md#performerssort) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.firstPerformerSort + +___ + +### genres + +• `get` **genres**(): `string`[] + +Gets the genres of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Inherited from + +CombinedTag.genres + +• `set` **genres**(`val`): `void` + +Gets the genres of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.genres + +___ + +### grouping + +• `get` **grouping**(): `string` + +Gets the grouping on the album which the media in the current instance belongs to. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.grouping + +• `set` **grouping**(`val`): `void` + +Gets the grouping on the album which the media in the current instance belongs to. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.grouping + +___ + +### initialKey + +• `get` **initialKey**(): `string` + +Gets the initial key of the track. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.initialKey + +• `set` **initialKey**(`val`): `void` + +Gets the initial key of the track. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.initialKey + +___ + +### isCompilation + +• `get` **isCompilation**(): `boolean` + +Gets whether or not the album described by the current instance is a compilation. + +**`inheritdoc`** + +#### Returns + +`boolean` + +#### Inherited from + +CombinedTag.isCompilation + +• `set` **isCompilation**(`val`): `void` + +Gets whether or not the album described by the current instance is a compilation. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `boolean` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.isCompilation + +___ + +### isEmpty + +• `get` **isEmpty**(): `boolean` + +Gets whether or not the current instance is empty. + +**`inheritdoc`** + +#### Returns + +`boolean` + +#### Inherited from + +CombinedTag.isEmpty + +___ + +### isrc + +• `get` **isrc**(): `string` + +Gets the ISRC (International Standard Recording Code) of the track. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.isrc + +• `set` **isrc**(`val`): `void` + +Gets the ISRC (International Standard Recording Code) of the track. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.isrc + +___ + +### joinedAlbumArtists + +• `get` **joinedAlbumArtists**(): `string` + +Gets a semicolon and space separated string containing the values in [albumArtists](FlacTag.md#albumartists) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.joinedAlbumArtists + +___ + +### joinedComposers + +• `get` **joinedComposers**(): `string` + +Gets a semicolon and space separated string containing the values in [composers](FlacTag.md#composers) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.joinedComposers + +___ + +### joinedGenres + +• `get` **joinedGenres**(): `string` + +Gets a semicolon and space separated string containing the values in [genres](FlacTag.md#genres) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.joinedGenres + +___ + +### joinedPerformers + +• `get` **joinedPerformers**(): `string` + +Gets a semicolon and space separated string containing the values in [performers](FlacTag.md#performers) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.joinedPerformers + +___ + +### joinedPerformersSort + +• `get` **joinedPerformersSort**(): `string` + +Gets a semicolon and space separated string containing the values in [performersSort](FlacTag.md#performerssort) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.joinedPerformersSort + +___ + +### lyrics + +• `get` **lyrics**(): `string` + +Gets the lyrics or script of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.lyrics + +• `set` **lyrics**(`val`): `void` + +Gets the lyrics or script of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.lyrics + +___ + +### musicBrainzArtistId + +• `get` **musicBrainzArtistId**(): `string` + +Gets the MusicBrainz artist ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.musicBrainzArtistId + +• `set` **musicBrainzArtistId**(`val`): `void` + +Gets the MusicBrainz artist ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.musicBrainzArtistId + +___ + +### musicBrainzDiscId + +• `get` **musicBrainzDiscId**(): `string` + +Gets the MusicBrainz disc ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.musicBrainzDiscId + +• `set` **musicBrainzDiscId**(`val`): `void` + +Gets the MusicBrainz disc ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.musicBrainzDiscId + +___ + +### musicBrainzReleaseArtistId + +• `get` **musicBrainzReleaseArtistId**(): `string` + +Gets the MusicBrainz release artist ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.musicBrainzReleaseArtistId + +• `set` **musicBrainzReleaseArtistId**(`val`): `void` + +Gets the MusicBrainz release artist ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.musicBrainzReleaseArtistId + +___ + +### musicBrainzReleaseCountry + +• `get` **musicBrainzReleaseCountry**(): `string` + +Gets the MusicBrainz release country of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.musicBrainzReleaseCountry + +• `set` **musicBrainzReleaseCountry**(`val`): `void` + +Gets the MusicBrainz release country of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.musicBrainzReleaseCountry + +___ + +### musicBrainzReleaseGroupId + +• `get` **musicBrainzReleaseGroupId**(): `string` + +Gets the MusicBrainz release group ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.musicBrainzReleaseGroupId + +• `set` **musicBrainzReleaseGroupId**(`val`): `void` + +Gets the MusicBrainz release group ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.musicBrainzReleaseGroupId + +___ + +### musicBrainzReleaseId + +• `get` **musicBrainzReleaseId**(): `string` + +Gets the MusicBrainz release ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.musicBrainzReleaseId + +• `set` **musicBrainzReleaseId**(`val`): `void` + +Gets the MusicBrainz release ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.musicBrainzReleaseId + +___ + +### musicBrainzReleaseStatus + +• `get` **musicBrainzReleaseStatus**(): `string` + +Gets the MusicBrainz release status of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.musicBrainzReleaseStatus + +• `set` **musicBrainzReleaseStatus**(`val`): `void` + +Gets the MusicBrainz release status of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.musicBrainzReleaseStatus + +___ + +### musicBrainzReleaseType + +• `get` **musicBrainzReleaseType**(): `string` + +Gets the MusicBrainz release type of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.musicBrainzReleaseType + +• `set` **musicBrainzReleaseType**(`val`): `void` + +Gets the MusicBrainz release type of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.musicBrainzReleaseType + +___ + +### musicBrainzTrackId + +• `get` **musicBrainzTrackId**(): `string` + +Gets the MusicBrainz track ID of the media represented by the media represented by the +current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.musicBrainzTrackId + +• `set` **musicBrainzTrackId**(`val`): `void` + +Gets the MusicBrainz track ID of the media represented by the media represented by the +current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.musicBrainzTrackId + +___ + +### musicIpId + +• `get` **musicIpId**(): `string` + +Gets the MusicIP PUID of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.musicIpId + +• `set` **musicIpId**(`val`): `void` + +Gets the MusicIP PUID of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.musicIpId + +___ + +### performers + +• `get` **performers**(): `string`[] + +Gets the performers or artists who performed in the media described by the current instance. + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Inherited from + +CombinedTag.performers + +• `set` **performers**(`val`): `void` + +Gets the performers or artists who performed in the media described by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.performers + +___ + +### performersRole + +• `get` **performersRole**(): `string`[] + +Gets the characters portrayed by an actor for a video or instruments played by a musician +for music. This must match the [performers](FlacTag.md#performers) array (for each person, correspond one/more +role). Several roles for the same artist/actor can be separated with semicolons. For +example: "Bass; Backing Vocals; Vibraphone". + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Inherited from + +CombinedTag.performersRole + +• `set` **performersRole**(`val`): `void` + +Gets the characters portrayed by an actor for a video or instruments played by a musician +for music. This must match the [performers](FlacTag.md#performers) array (for each person, correspond one/more +role). Several roles for the same artist/actor can be separated with semicolons. For +example: "Bass; Backing Vocals; Vibraphone". + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.performersRole + +___ + +### performersSort + +• `get` **performersSort**(): `string`[] + +Gets the sortable names of the performers or artists who performed in the media described by +the current instance. + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Inherited from + +CombinedTag.performersSort + +• `set` **performersSort**(`val`): `void` + +Gets the sortable names of the performers or artists who performed in the media described by +the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.performersSort + +___ + +### pictures + +• `get` **pictures**(): [`IPicture`](../interfaces/IPicture.md)[] + +Gets a collection of pictures associated with the media represented by the current instance. + +**`inheritdoc`** +For FLAC files, FLAC-style pictures are preferentially returned. If those don't exist the +pictures that are stored in the + +#### Returns + +[`IPicture`](../interfaces/IPicture.md)[] + +#### Overrides + +CombinedTag.pictures + +• `set` **pictures**(`value`): `void` + +Gets a collection of pictures associated with the media represented by the current instance. + +**`inheritdoc`** +For FLAC files, pictures are preferentially stored in FLAC-style picture blocks. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | [`IPicture`](../interfaces/IPicture.md)[] | + +#### Returns + +`void` + +#### Overrides + +CombinedTag.pictures + +___ + +### publisher + +• `get` **publisher**(): `string` + +Gets the publisher of the track. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.publisher + +• `set` **publisher**(`val`): `void` + +Gets the publisher of the track. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.publisher + +___ + +### remixedBy + +• `get` **remixedBy**(): `string` + +Gets the remixer of the track. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.remixedBy + +• `set` **remixedBy**(`val`): `void` + +Gets the remixer of the track. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.remixedBy + +___ + +### replayGainAlbumGain + +• `get` **replayGainAlbumGain**(): `number` + +Gets the ReplayGain album gain in dB. + +**`inheritdoc`** + +#### Returns + +`number` + +#### Inherited from + +CombinedTag.replayGainAlbumGain + +• `set` **replayGainAlbumGain**(`val`): `void` + +Gets the ReplayGain album gain in dB. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.replayGainAlbumGain + +___ + +### replayGainAlbumPeak + +• `get` **replayGainAlbumPeak**(): `number` + +Gets the ReplayGain album peak sample. + +**`inheritdoc`** + +#### Returns + +`number` + +#### Inherited from + +CombinedTag.replayGainAlbumPeak + +• `set` **replayGainAlbumPeak**(`val`): `void` + +Gets the ReplayGain album peak sample. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.replayGainAlbumPeak + +___ + +### replayGainTrackGain + +• `get` **replayGainTrackGain**(): `number` + +Gets the ReplayGain track gain in dB. + +**`inheritdoc`** + +#### Returns + +`number` + +#### Inherited from + +CombinedTag.replayGainTrackGain + +• `set` **replayGainTrackGain**(`val`): `void` + +Gets the ReplayGain track gain in dB. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.replayGainTrackGain + +___ + +### replayGainTrackPeak + +• `get` **replayGainTrackPeak**(): `number` + +Gets the ReplayGain track peak sample. + +**`inheritdoc`** + +#### Returns + +`number` + +#### Inherited from + +CombinedTag.replayGainTrackPeak + +• `set` **replayGainTrackPeak**(`val`): `void` + +Gets the ReplayGain track peak sample. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.replayGainTrackPeak + +___ + +### sizeOnDisk + +• `get` **sizeOnDisk**(): `number` + +Gets the size of the tag in bytes on disk as it was read from disk. + +**`inheritdoc`** + +**`remarks`** Note that tags may not appear contiguously in a file. Access the [tags](FlacTag.md#tags) + contained in this object to see the size of each tag on the disk. + +#### Returns + +`number` + +#### Inherited from + +CombinedTag.sizeOnDisk + +___ + +### startTag + +• `get` **startTag**(): `default` + +Gets the collection of tags appearing at the start of the file. + +#### Returns + +`default` + +___ + +### subtitle + +• `get` **subtitle**(): `string` + +Gets a description, one-line. It represents the tagline of the vide/music. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.subtitle + +• `set` **subtitle**(`val`): `void` + +Gets a description, one-line. It represents the tagline of the vide/music. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.subtitle + +___ + +### supportedTagTypes + +• `get` **supportedTagTypes**(): [`TagTypes`](../enums/TagTypes.md) + +Gets the types of tags that are supported by this instance of a combined tag. Only these tag +types can be added to the instance. + +#### Returns + +[`TagTypes`](../enums/TagTypes.md) + +#### Inherited from + +CombinedTag.supportedTagTypes + +___ + +### tagTypes + +• `get` **tagTypes**(): [`TagTypes`](../enums/TagTypes.md) + +Gets the tag types contained in the current instance. A bit wise combined [TagTypes](../enums/TagTypes.md) +containing the tag types contained in the current instance. + +**`remarks`** For a standard tag, the value should be intuitive. For example, Id3v2Tag objects have + a value of [TagTypes.Id3v2](../enums/TagTypes.md#id3v2). However, for CombinedTag type objects, they may + contain multiple or no types. + +#### Returns + +[`TagTypes`](../enums/TagTypes.md) + +#### Overrides + +CombinedTag.tagTypes + +___ + +### tags + +• `get` **tags**(): [`Tag`](Tag.md)[] + +Gets all tags contained within the current instance. If the tags within this tag are also +[CombinedTag](CombinedTag.md)s, the retrieval will recurse and return a flat list of nested tags. + +**`remarks`** Modifications of the returned array will not be retained. + +#### Returns + +[`Tag`](Tag.md)[] + +#### Inherited from + +CombinedTag.tags + +___ + +### title + +• `get` **title**(): `string` + +Gets the title for the media described by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.title + +• `set` **title**(`val`): `void` + +Gets the title for the media described by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.title + +___ + +### titleSort + +• `get` **titleSort**(): `string` + +Gets the sortable name for the title of the media described by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.titleSort + +• `set` **titleSort**(`val`): `void` + +Gets the sortable name for the title of the media described by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.titleSort + +___ + +### track + +• `get` **track**(): `number` + +Gets the position of the media represented by the current instance in its containing album +or season (for a series). + +**`inheritdoc`** + +#### Returns + +`number` + +#### Inherited from + +CombinedTag.track + +• `set` **track**(`val`): `void` + +Gets the position of the media represented by the current instance in its containing album +or season (for a series). + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.track + +___ + +### trackCount + +• `get` **trackCount**(): `number` + +Gets the number of tracks in the album or the number of episodes in a series of the media +represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`number` + +#### Inherited from + +CombinedTag.trackCount + +• `set` **trackCount**(`val`): `void` + +Gets the number of tracks in the album or the number of episodes in a series of the media +represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.trackCount + +___ + +### xiphComment + +• `get` **xiphComment**(): [`XiphComment`](XiphComment.md) + +Gets the Xiph comment that is stored in the current instance. + +#### Returns + +[`XiphComment`](XiphComment.md) + +___ + +### year + +• `get` **year**(): `number` + +Gets the year that the media represented by the current instance was recorded. + +**`inheritdoc`** + +#### Returns + +`number` + +#### Inherited from + +CombinedTag.year + +• `set` **year**(`val`): `void` + +Gets the year that the media represented by the current instance was recorded. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.year + +## Methods + +### addTag + +▸ `Protected` **addTag**(`tag`): `void` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `tag` | [`Tag`](Tag.md) | + +#### Returns + +`void` + +#### Inherited from + +[CombinedTag](CombinedTag.md).[addTag](CombinedTag.md#addtag) + +___ + +### clear + +▸ **clear**(): `void` + +Clears all values stored in the current instance. + +**`remarks`** The clearing procedure is format specific and should clear all values. + +#### Returns + +`void` + +#### Overrides + +[CombinedTag](CombinedTag.md).[clear](CombinedTag.md#clear) + +___ + +### copyTo + +▸ **copyTo**(`target`, `overwrite`): `void` + +Copies the values from the current instance to another [Tag](Tag.md), optionally overwriting + existing values. + +**`remarks`** This method only copies the most basic values when copying between different tag + formats. However, if `target` is of the same type as the current instance, + more advanced copying may be done. For example if both `this` and `target` are + [Id3v2Tag](Id3v2Tag.md), all frames will be copied to the target. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `target` | [`Tag`](Tag.md) | Target tag to copy values to | +| `overwrite` | `boolean` | Whether or not to copy values over existing ones | + +#### Returns + +`void` + +#### Inherited from + +[CombinedTag](CombinedTag.md).[copyTo](CombinedTag.md#copyto) + +___ + +### createTag + +▸ **createTag**(`tagType`, `copy`): [`Tag`](Tag.md) + +Creates a new instance of the desired tag type and adds it to the current instance. If the +tag type is unsupported in the current context or the tag type already exists, an error will +be thrown. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `tagType` | [`TagTypes`](../enums/TagTypes.md) | Type of tag to create | +| `copy` | `boolean` | Whether or not to copy the contents of the current instance to the newly created tag instance | + +#### Returns + +[`Tag`](Tag.md) + +Tag The newly created tag + +#### Overrides + +[CombinedTag](CombinedTag.md).[createTag](CombinedTag.md#createtag) + +___ + +### getTag + +▸ **getTag**<`TTag`\>(`tagType`): `TTag` + +Gets a tag of the specified tag type if a matching tag exists in the current instance. + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `TTag` | extends [`Tag`](Tag.md)<`TTag`\> | + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `tagType` | [`TagTypes`](../enums/TagTypes.md) | Type of tag to retrieve | + +#### Returns + +`TTag` + +Tag Tag with specified type, if it exists. `undefined` otherwise. + +#### Inherited from + +[CombinedTag](CombinedTag.md).[getTag](CombinedTag.md#gettag) + +___ + +### removeTags + +▸ **removeTags**(`tagTypes`): `void` + +Remove all tags that match the specified tagTypes. This is performed recursively. Any nested +`CombinedTag` instances are left in place. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `tagTypes` | [`TagTypes`](../enums/TagTypes.md) | Types of tags to remove | + +#### Returns + +`void` + +#### Overrides + +[CombinedTag](CombinedTag.md).[removeTags](CombinedTag.md#removetags) + +___ + +### replaceTag + +▸ `Protected` **replaceTag**(`oldTag`, `newTag`): `void` + +This is used for special cases where the order of tags is important. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `oldTag` | [`Tag`](Tag.md) | +| `newTag` | [`Tag`](Tag.md) | + +#### Returns + +`void` + +#### Inherited from + +[CombinedTag](CombinedTag.md).[replaceTag](CombinedTag.md#replacetag) + +___ + +### setInfoTag + +▸ **setInfoTag**(): `void` + +Set the tags that represent the tagger software (node-taglib-sharp) itself. + +**`remarks`** This is typically a method to call just before saving a tag. + +#### Returns + +`void` + +#### Inherited from + +[CombinedTag](CombinedTag.md).[setInfoTag](CombinedTag.md#setinfotag) + +___ + +### validateTagCreation + +▸ `Protected` **validateTagCreation**(`tagType`): `void` + +Verifies if a tag can be added to the current instance. The criteria for validation are: +* A tag of the given tag type does not already exist +* The given tag type is supported by the current instance + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `tagType` | [`TagTypes`](../enums/TagTypes.md) | Tag type that the caller wants to create | + +#### Returns + +`void` + +#### Inherited from + +[CombinedTag](CombinedTag.md).[validateTagCreation](CombinedTag.md#validatetagcreation) + +___ + +### firstInGroup + +▸ `Static` `Protected` **firstInGroup**(`group`): `string` + +Gets the first string in an array. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `group` | `string`[] | Array of strings to get the first string from. | + +#### Returns + +`string` + +First string contained in `group` or `undefined` if the array is + `undefined` or empty + +#### Inherited from + +[CombinedTag](CombinedTag.md).[firstInGroup](CombinedTag.md#firstingroup) + +___ + +### isFalsyOrLikeEmpty + +▸ `Static` `Protected` **isFalsyOrLikeEmpty**(`value`): `boolean` + +Checks if a value is falsy or empty. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | `string` \| `string`[] | Object to check | + +#### Returns + +`boolean` + +If `value` is a string, `true` is returned if the value is falsy or all + whitespace, `false` is returned otherwise. If `value` is an array of strings, + the array must be falsy or all elements must be falsy or whitespace to return `true`. + +#### Inherited from + +[CombinedTag](CombinedTag.md).[isFalsyOrLikeEmpty](CombinedTag.md#isfalsyorlikeempty) + +___ + +### joinGroup + +▸ `Static` `Protected` **joinGroup**(`group`): `string` + +Joins an array of string into a single, semicolon and space separated string. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `group` | `string`[] | Array of string to join | + +#### Returns + +`string` + +A semicolon and space separated string containing the values from `group` + or undefined if the array is `undefined` or empty. + +#### Inherited from + +[CombinedTag](CombinedTag.md).[joinGroup](CombinedTag.md#joingroup) + +___ + +### tagTypeFlagsToArray + +▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/TagTypes.md)[] + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `tagTypes` | [`TagTypes`](../enums/TagTypes.md) | + +#### Returns + +[`TagTypes`](../enums/TagTypes.md)[] + +#### Inherited from + +[CombinedTag](CombinedTag.md).[tagTypeFlagsToArray](CombinedTag.md#tagtypeflagstoarray) diff --git a/docs/classes/id3v1tag.md b/docs/classes/Id3v1Tag.md similarity index 81% rename from docs/classes/id3v1tag.md rename to docs/classes/Id3v1Tag.md index dafaf122..a9ac6e79 100644 --- a/docs/classes/id3v1tag.md +++ b/docs/classes/Id3v1Tag.md @@ -2,11 +2,11 @@ # Class: Id3v1Tag -Extends [Tag](tag.md) to provide support for reading and writing tags stored in the ID3v1.1 format. +Extends [Tag](Tag.md) to provide support for reading and writing tags stored in the ID3v1.1 format. ## Hierarchy -- [`Tag`](tag.md) +- [`Tag`](Tag.md) ↳ **`Id3v1Tag`** @@ -14,100 +14,101 @@ Extends [Tag](tag.md) to provide support for reading and writing tags stored in ### Properties -- [fileIdentifier](id3v1tag.md#fileidentifier) -- [size](id3v1tag.md#size) +- [FILE\_IDENTIFIER](Id3v1Tag.md#file_identifier) +- [TOTAL\_SIZE](Id3v1Tag.md#total_size) ### Accessors -- [album](id3v1tag.md#album) -- [albumArtists](id3v1tag.md#albumartists) -- [albumArtistsSort](id3v1tag.md#albumartistssort) -- [albumSort](id3v1tag.md#albumsort) -- [amazonId](id3v1tag.md#amazonid) -- [beatsPerMinute](id3v1tag.md#beatsperminute) -- [comment](id3v1tag.md#comment) -- [composers](id3v1tag.md#composers) -- [composersSort](id3v1tag.md#composerssort) -- [conductor](id3v1tag.md#conductor) -- [copyright](id3v1tag.md#copyright) -- [dateTagged](id3v1tag.md#datetagged) -- [description](id3v1tag.md#description) -- [disc](id3v1tag.md#disc) -- [discCount](id3v1tag.md#disccount) -- [firstAlbumArtist](id3v1tag.md#firstalbumartist) -- [firstAlbumArtistSort](id3v1tag.md#firstalbumartistsort) -- [firstComposer](id3v1tag.md#firstcomposer) -- [firstComposerSort](id3v1tag.md#firstcomposersort) -- [firstGenre](id3v1tag.md#firstgenre) -- [firstPerformer](id3v1tag.md#firstperformer) -- [firstPerformerSort](id3v1tag.md#firstperformersort) -- [genres](id3v1tag.md#genres) -- [grouping](id3v1tag.md#grouping) -- [initialKey](id3v1tag.md#initialkey) -- [isEmpty](id3v1tag.md#isempty) -- [isrc](id3v1tag.md#isrc) -- [joinedAlbumArtists](id3v1tag.md#joinedalbumartists) -- [joinedComposers](id3v1tag.md#joinedcomposers) -- [joinedGenres](id3v1tag.md#joinedgenres) -- [joinedPerformers](id3v1tag.md#joinedperformers) -- [joinedPerformersSort](id3v1tag.md#joinedperformerssort) -- [lyrics](id3v1tag.md#lyrics) -- [musicBrainzArtistId](id3v1tag.md#musicbrainzartistid) -- [musicBrainzDiscId](id3v1tag.md#musicbrainzdiscid) -- [musicBrainzReleaseArtistId](id3v1tag.md#musicbrainzreleaseartistid) -- [musicBrainzReleaseCountry](id3v1tag.md#musicbrainzreleasecountry) -- [musicBrainzReleaseGroupId](id3v1tag.md#musicbrainzreleasegroupid) -- [musicBrainzReleaseId](id3v1tag.md#musicbrainzreleaseid) -- [musicBrainzReleaseStatus](id3v1tag.md#musicbrainzreleasestatus) -- [musicBrainzReleaseType](id3v1tag.md#musicbrainzreleasetype) -- [musicBrainzTrackId](id3v1tag.md#musicbrainztrackid) -- [musicIpId](id3v1tag.md#musicipid) -- [performers](id3v1tag.md#performers) -- [performersRole](id3v1tag.md#performersrole) -- [performersSort](id3v1tag.md#performerssort) -- [pictures](id3v1tag.md#pictures) -- [publisher](id3v1tag.md#publisher) -- [remixedBy](id3v1tag.md#remixedby) -- [replayGainAlbumGain](id3v1tag.md#replaygainalbumgain) -- [replayGainAlbumPeak](id3v1tag.md#replaygainalbumpeak) -- [replayGainTrackGain](id3v1tag.md#replaygaintrackgain) -- [replayGainTrackPeak](id3v1tag.md#replaygaintrackpeak) -- [sizeOnDisk](id3v1tag.md#sizeondisk) -- [subtitle](id3v1tag.md#subtitle) -- [tagTypes](id3v1tag.md#tagtypes) -- [title](id3v1tag.md#title) -- [titleSort](id3v1tag.md#titlesort) -- [track](id3v1tag.md#track) -- [trackCount](id3v1tag.md#trackcount) -- [year](id3v1tag.md#year) +- [album](Id3v1Tag.md#album) +- [albumArtists](Id3v1Tag.md#albumartists) +- [albumArtistsSort](Id3v1Tag.md#albumartistssort) +- [albumSort](Id3v1Tag.md#albumsort) +- [amazonId](Id3v1Tag.md#amazonid) +- [beatsPerMinute](Id3v1Tag.md#beatsperminute) +- [comment](Id3v1Tag.md#comment) +- [composers](Id3v1Tag.md#composers) +- [composersSort](Id3v1Tag.md#composerssort) +- [conductor](Id3v1Tag.md#conductor) +- [copyright](Id3v1Tag.md#copyright) +- [dateTagged](Id3v1Tag.md#datetagged) +- [description](Id3v1Tag.md#description) +- [disc](Id3v1Tag.md#disc) +- [discCount](Id3v1Tag.md#disccount) +- [firstAlbumArtist](Id3v1Tag.md#firstalbumartist) +- [firstAlbumArtistSort](Id3v1Tag.md#firstalbumartistsort) +- [firstComposer](Id3v1Tag.md#firstcomposer) +- [firstComposerSort](Id3v1Tag.md#firstcomposersort) +- [firstGenre](Id3v1Tag.md#firstgenre) +- [firstPerformer](Id3v1Tag.md#firstperformer) +- [firstPerformerSort](Id3v1Tag.md#firstperformersort) +- [genres](Id3v1Tag.md#genres) +- [grouping](Id3v1Tag.md#grouping) +- [initialKey](Id3v1Tag.md#initialkey) +- [isCompilation](Id3v1Tag.md#iscompilation) +- [isEmpty](Id3v1Tag.md#isempty) +- [isrc](Id3v1Tag.md#isrc) +- [joinedAlbumArtists](Id3v1Tag.md#joinedalbumartists) +- [joinedComposers](Id3v1Tag.md#joinedcomposers) +- [joinedGenres](Id3v1Tag.md#joinedgenres) +- [joinedPerformers](Id3v1Tag.md#joinedperformers) +- [joinedPerformersSort](Id3v1Tag.md#joinedperformerssort) +- [lyrics](Id3v1Tag.md#lyrics) +- [musicBrainzArtistId](Id3v1Tag.md#musicbrainzartistid) +- [musicBrainzDiscId](Id3v1Tag.md#musicbrainzdiscid) +- [musicBrainzReleaseArtistId](Id3v1Tag.md#musicbrainzreleaseartistid) +- [musicBrainzReleaseCountry](Id3v1Tag.md#musicbrainzreleasecountry) +- [musicBrainzReleaseGroupId](Id3v1Tag.md#musicbrainzreleasegroupid) +- [musicBrainzReleaseId](Id3v1Tag.md#musicbrainzreleaseid) +- [musicBrainzReleaseStatus](Id3v1Tag.md#musicbrainzreleasestatus) +- [musicBrainzReleaseType](Id3v1Tag.md#musicbrainzreleasetype) +- [musicBrainzTrackId](Id3v1Tag.md#musicbrainztrackid) +- [musicIpId](Id3v1Tag.md#musicipid) +- [performers](Id3v1Tag.md#performers) +- [performersRole](Id3v1Tag.md#performersrole) +- [performersSort](Id3v1Tag.md#performerssort) +- [pictures](Id3v1Tag.md#pictures) +- [publisher](Id3v1Tag.md#publisher) +- [remixedBy](Id3v1Tag.md#remixedby) +- [replayGainAlbumGain](Id3v1Tag.md#replaygainalbumgain) +- [replayGainAlbumPeak](Id3v1Tag.md#replaygainalbumpeak) +- [replayGainTrackGain](Id3v1Tag.md#replaygaintrackgain) +- [replayGainTrackPeak](Id3v1Tag.md#replaygaintrackpeak) +- [sizeOnDisk](Id3v1Tag.md#sizeondisk) +- [subtitle](Id3v1Tag.md#subtitle) +- [tagTypes](Id3v1Tag.md#tagtypes) +- [title](Id3v1Tag.md#title) +- [titleSort](Id3v1Tag.md#titlesort) +- [track](Id3v1Tag.md#track) +- [trackCount](Id3v1Tag.md#trackcount) +- [year](Id3v1Tag.md#year) ### Methods -- [clear](id3v1tag.md#clear) -- [copyTo](id3v1tag.md#copyto) -- [render](id3v1tag.md#render) -- [setInfoTag](id3v1tag.md#setinfotag) -- [firstInGroup](id3v1tag.md#firstingroup) -- [fromData](id3v1tag.md#fromdata) -- [fromEmpty](id3v1tag.md#fromempty) -- [fromFile](id3v1tag.md#fromfile) -- [isFalsyOrLikeEmpty](id3v1tag.md#isfalsyorlikeempty) -- [joinGroup](id3v1tag.md#joingroup) -- [tagTypeFlagsToArray](id3v1tag.md#tagtypeflagstoarray) +- [clear](Id3v1Tag.md#clear) +- [copyTo](Id3v1Tag.md#copyto) +- [render](Id3v1Tag.md#render) +- [setInfoTag](Id3v1Tag.md#setinfotag) +- [firstInGroup](Id3v1Tag.md#firstingroup) +- [fromData](Id3v1Tag.md#fromdata) +- [fromEmpty](Id3v1Tag.md#fromempty) +- [fromFile](Id3v1Tag.md#fromfile) +- [isFalsyOrLikeEmpty](Id3v1Tag.md#isfalsyorlikeempty) +- [joinGroup](Id3v1Tag.md#joingroup) +- [tagTypeFlagsToArray](Id3v1Tag.md#tagtypeflagstoarray) ## Properties -### fileIdentifier +### FILE\_IDENTIFIER -▪ `Static` `Readonly` **fileIdentifier**: [`ByteVector`](bytevector.md) +▪ `Static` `Readonly` **FILE\_IDENTIFIER**: [`ByteVector`](ByteVector.md) Identifier used to recognize an ID3v1 tag. ___ -### size +### TOTAL\_SIZE -▪ `Static` `Readonly` **size**: ``128`` +▪ `Static` `Readonly` **TOTAL\_SIZE**: ``128`` Size of an ID3v1 tag. @@ -117,22 +118,17 @@ Size of an ID3v1 tag. • `get` **album**(): `string` -Gets the album of the media represented by the current instance. For video media, this -represents the collection the video belongs to. - **`inheritdoc`** #### Returns `string` -Album of the media represented by the current instance or `undefined` if no value - is present +#### Overrides -• `set` **album**(`value`): `void` +Tag.album -Gets the album of the media represented by the current instance. For video media, this -represents the collection the video belongs to. +• `set` **album**(`value`): `void` **`inheritdoc`** @@ -149,8 +145,9 @@ represents the collection the video belongs to. `void` -Album of the media represented by the current instance or `undefined` if no value - is present +#### Overrides + +Tag.album ___ @@ -166,7 +163,7 @@ collection containing the media described by the current instance. will split up albums by the same artist. Having a single album artist for an entire album solves this problem. As this value is to be used as a sorting key, it should be used with less variation - than [performers](id3v1tag.md#performers). Where performers can be broken into multiple artists, it is + than [performers](Id3v1Tag.md#performers). Where performers can be broken into multiple artists, it is best to stick to a single name. Eg, "Super8 & Tab" #### Returns @@ -177,6 +174,10 @@ Band or artist credited with the creation of the entire album or collection containing the media described by the current instance or an empty array if no value is present +#### Inherited from + +Tag.albumArtists + • `set` **albumArtists**(`value`): `void` Sets the bands or artists who is credited credited in the creation of the entire album or @@ -187,7 +188,7 @@ collection containing the media described by the current instance. will split up albums by the same artist. Having a single album artist for an entire album solves this problem. As this value is to be used as a sorting key, it should be used with less variation - than [performers](id3v1tag.md#performers). Where performers can be broken into multiple artists, it is + than [performers](Id3v1Tag.md#performers). Where performers can be broken into multiple artists, it is best to stick to a single name. Eg, "Super8 & Tab" #### Parameters @@ -204,6 +205,10 @@ Band or artist credited with the creation of the entire album or collection containing the media described by the current instance or an empty array if no value is present +#### Inherited from + +Tag.albumArtists + ___ ### albumArtistsSort @@ -219,7 +224,7 @@ album or collection containing the media described by the current instance. skip articles or sort by last by last name. For example "Ben Folds" might be sorted as "Folds, Ben". As this value is to be used as a sorting key, it should be used with less variation than - [performers](id3v1tag.md#performers). Where [performers](id3v1tag.md#performers) can be broken into multiple performers, it is + [performers](Id3v1Tag.md#performers). Where [performers](Id3v1Tag.md#performers) can be broken into multiple performers, it is best to stick to a single album artist. Eg, "Van Buuren, Armin" #### Returns @@ -230,6 +235,10 @@ Sortable names for the bands/artists are credited with the creation of the entir album or collection containing the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +Tag.albumArtistsSort + • `set` **albumArtistsSort**(`value`): `void` Sets the sortable names of the bands/artists who are credited with creating the entire @@ -241,7 +250,7 @@ album or collection containing the media described by the current instance. skip articles or sort by last by last name. For example "Ben Folds" might be sorted as "Folds, Ben". As this value is to be used as a sorting key, it should be used with less variation than - [performers](id3v1tag.md#performers). Where [performers](id3v1tag.md#performers) can be broken into multiple performers, it is + [performers](Id3v1Tag.md#performers). Where [performers](Id3v1Tag.md#performers) can be broken into multiple performers, it is best to stick to a single album artist. Eg, "Van Buuren, Armin" #### Parameters @@ -258,6 +267,10 @@ Sortable names for the bands/artists are credited with the creation of the entir album or collection containing the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +Tag.albumArtistsSort + ___ ### albumSort @@ -278,6 +291,10 @@ Gets the sortable name of the album title of the media represented by the curren Sortable name for the album title of the media or `undefined` if the value is not present +#### Inherited from + +Tag.albumSort + • `set` **albumSort**(`value`): `void` Sets the sortable name of the album title of the media represented by the current instance. @@ -300,6 +317,10 @@ Sets the sortable name of the album title of the media represented by the curren Sortable name for the album title of the media or `undefined` if the value is not present +#### Inherited from + +Tag.albumSort + ___ ### amazonId @@ -318,6 +339,10 @@ Gets the Amazon ID of the media represented by the current instance. Amazon ID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.amazonId + • `set` **amazonId**(`value`): `void` Sets the Amazon ID of the media represented by the current instance. @@ -338,6 +363,10 @@ Sets the Amazon ID of the media represented by the current instance. Amazon ID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.amazonId + ___ ### beatsPerMinute @@ -357,6 +386,10 @@ instance. Beats per minute of the audio in the media represented by the current instance, or `0` if not specified +#### Inherited from + +Tag.beatsPerMinute + • `set` **beatsPerMinute**(`value`): `void` Sets the number of beats per minute in the audio of the media represented by the current @@ -378,26 +411,27 @@ instance. Beats per minute of the audio in the media represented by the current instance, or `0` if not specified +#### Inherited from + +Tag.beatsPerMinute + ___ ### comment • `get` **comment**(): `string` -Gets a user comment on the media represented by the current instance. - **`inheritdoc`** #### Returns `string` -User comments on the media represented by the current instance or `undefined` if - the value is not present +#### Overrides -• `set` **comment**(`value`): `void` +Tag.comment -Gets a user comment on the media represented by the current instance. +• `set` **comment**(`value`): `void` **`inheritdoc`** @@ -414,8 +448,9 @@ Gets a user comment on the media represented by the current instance. `void` -User comments on the media represented by the current instance or `undefined` if - the value is not present +#### Overrides + +Tag.comment ___ @@ -435,6 +470,10 @@ Gets the composers of the media represented by the current instance. Composers of the media represented by the current instance of an empty array if no value is present. +#### Inherited from + +Tag.composers + • `set` **composers**(`value`): `void` Sets the composers of the media represented by the current instance. @@ -455,6 +494,10 @@ Sets the composers of the media represented by the current instance. Composers of the media represented by the current instance of an empty array if no value is present. +#### Inherited from + +Tag.composers + ___ ### composersSort @@ -475,6 +518,10 @@ Gets the sortable names of the composers of the media represented by the current Sortable names for the composers of the media represented by the current instance or an empty array if no value is present. +#### Inherited from + +Tag.composersSort + • `set` **composersSort**(`value`): `void` Sets the sortable names of the composers of the media represented by the current instance. @@ -497,6 +544,10 @@ Sets the sortable names of the composers of the media represented by the current Sortable names for the composers of the media represented by the current instance or an empty array if no value is present. +#### Inherited from + +Tag.composersSort + ___ ### conductor @@ -514,6 +565,10 @@ Gets the conductor or director of the media represented by the current instance. Conductor or director of the media represented by the current instance or `undefined` if no value present. +#### Inherited from + +Tag.conductor + • `set` **conductor**(`value`): `void` Sets the conductor or director of the media represented by the current instance. @@ -533,6 +588,10 @@ Sets the conductor or director of the media represented by the current instance. Conductor or director of the media represented by the current instance or `undefined` if no value present. +#### Inherited from + +Tag.conductor + ___ ### copyright @@ -553,6 +612,10 @@ Gets the copyright information for the media represented by the current instance Copyright information for the media represented by the current instance or `undefined` if no value is present. +#### Inherited from + +Tag.copyright + • `set` **copyright**(`value`): `void` Sets the copyright information for the media represented by the current instance. @@ -575,6 +638,10 @@ Sets the copyright information for the media represented by the current instance Copyright information for the media represented by the current instance or `undefined` if no value is present. +#### Inherited from + +Tag.copyright + ___ ### dateTagged @@ -589,6 +656,10 @@ Gets the date and time at which the tag has been written. Date/time at which the tag has been written, or `undefined` if no value is present +#### Inherited from + +Tag.dateTagged + • `set` **dateTagged**(`value`): `void` Sets the date and time at which the tag has been written. @@ -605,6 +676,10 @@ Sets the date and time at which the tag has been written. Date/time at which the tag has been written, or `undefined` if no value is present +#### Inherited from + +Tag.dateTagged + ___ ### description @@ -626,6 +701,10 @@ generally no spoliers. This should give the impression of what to expect in the Description of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.description + • `set` **description**(`value`): `void` Sets a short description of the media. For music, this could be the comment that the artist @@ -649,6 +728,10 @@ generally no spoliers. This should give the impression of what to expect in the Description of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.description + ___ ### disc @@ -660,7 +743,7 @@ boxed set. For a series, this represents the season number. **`remarks`** This value should be the same as the number that appears on the disc. For example, if the disc is the first of three, the value should be `1`. It should be no more than - [discCount](id3v1tag.md#disccount) if [discCount](id3v1tag.md#disccount) is non-zero. + [discCount](Id3v1Tag.md#disccount) if [discCount](Id3v1Tag.md#disccount) is non-zero. #### Returns @@ -669,6 +752,10 @@ boxed set. For a series, this represents the season number. Number of the disc or season of the media represented by the current instance in a boxed set. +#### Inherited from + +Tag.disc + • `set` **disc**(`value`): `void` Sets the number of the disc containing the media represented by the current instance in the @@ -676,7 +763,7 @@ boxed set. For a series, this represents the season number. **`remarks`** This value should be the same as the number that appears on the disc. For example, if the disc is the first of three, the value should be `1`. It should be no more than - [discCount](id3v1tag.md#disccount) if [discCount](id3v1tag.md#disccount) is non-zero. + [discCount](Id3v1Tag.md#disccount) if [discCount](Id3v1Tag.md#disccount) is non-zero. #### Parameters @@ -691,6 +778,10 @@ boxed set. For a series, this represents the season number. Number of the disc or season of the media represented by the current instance in a boxed set. +#### Inherited from + +Tag.disc + ___ ### discCount @@ -700,7 +791,7 @@ ___ Gets the number of discs or seasons in the boxed set containing the media represented by the current instance. -**`remarks`** If non-zero, this should be at least equal to [disc](id3v1tag.md#disc). If [disc](id3v1tag.md#disc) is zero, +**`remarks`** If non-zero, this should be at least equal to [disc](Id3v1Tag.md#disc). If [disc](Id3v1Tag.md#disc) is zero, this value should also be zero. #### Returns @@ -710,12 +801,16 @@ current instance. Number of discs or seasons in the boxed set containing the media represented by the current instance or `0` if not specified. +#### Inherited from + +Tag.discCount + • `set` **discCount**(`value`): `void` Sets the number of discs or seasons in the boxed set containing the media represented by the current instance. -**`remarks`** If non-zero, this should be at least equal to [disc](id3v1tag.md#disc). If [disc](id3v1tag.md#disc) is zero, +**`remarks`** If non-zero, this should be at least equal to [disc](Id3v1Tag.md#disc). If [disc](Id3v1Tag.md#disc) is zero, this value should also be zero. #### Parameters @@ -731,110 +826,139 @@ current instance. Number of discs or seasons in the boxed set containing the media represented by the current instance or `0` if not specified. +#### Inherited from + +Tag.discCount + ___ ### firstAlbumArtist • `get` **firstAlbumArtist**(): `string` -Gets the the first value contained in [albumArtists](id3v1tag.md#albumartists). +Gets the first value contained in [albumArtists](Id3v1Tag.md#albumartists). #### Returns `string` +#### Inherited from + +Tag.firstAlbumArtist + ___ ### firstAlbumArtistSort • `get` **firstAlbumArtistSort**(): `string` -Gets the first value contained in [albumArtistsSort](id3v1tag.md#albumartistssort) +Gets the first value contained in [albumArtistsSort](Id3v1Tag.md#albumartistssort) #### Returns `string` +#### Inherited from + +Tag.firstAlbumArtistSort + ___ ### firstComposer • `get` **firstComposer**(): `string` -Gets the first value contained in [composers](id3v1tag.md#composers) +Gets the first value contained in [composers](Id3v1Tag.md#composers) #### Returns `string` +#### Inherited from + +Tag.firstComposer + ___ ### firstComposerSort • `get` **firstComposerSort**(): `string` -Gets the first value contained in [composersSort](id3v1tag.md#composerssort) +Gets the first value contained in [composersSort](Id3v1Tag.md#composerssort) #### Returns `string` +#### Inherited from + +Tag.firstComposerSort + ___ ### firstGenre • `get` **firstGenre**(): `string` -Gets the first value contained in [genres](id3v1tag.md#genres) +Gets the first value contained in [genres](Id3v1Tag.md#genres) #### Returns `string` +#### Inherited from + +Tag.firstGenre + ___ ### firstPerformer • `get` **firstPerformer**(): `string` -Gets the first value contained in [performers](id3v1tag.md#performers) +Gets the first value contained in [performers](Id3v1Tag.md#performers) #### Returns `string` +#### Inherited from + +Tag.firstPerformer + ___ ### firstPerformerSort • `get` **firstPerformerSort**(): `string` -Gets the first value contained in [performersSort](id3v1tag.md#performerssort) +Gets the first value contained in [performersSort](Id3v1Tag.md#performerssort) #### Returns `string` +#### Inherited from + +Tag.firstPerformerSort + ___ ### genres • `get` **genres**(): `string`[] -Gets the genres of the media represented by the current instance. - **`inheritdoc`** #### Returns `string`[] -Genres of the media represented by the current instance or an empty array if no - value is present. +#### Overrides -• `set` **genres**(`value`): `void` +Tag.genres -Gets the genres of the media represented by the current instance. +• `set` **genres**(`value`): `void` **`inheritdoc`** @@ -851,8 +975,9 @@ Gets the genres of the media represented by the current instance. `void` -Genres of the media represented by the current instance or an empty array if no - value is present. +#### Overrides + +Tag.genres ___ @@ -873,6 +998,10 @@ Gets the grouping on the album which the media in the current instance belongs t Grouping on the album which the media in the current instance belongs to or `undefined` if no value is present. +#### Inherited from + +Tag.grouping + • `set` **grouping**(`value`): `void` Sets the grouping on the album which the media in the current instance belongs to. @@ -894,6 +1023,10 @@ Sets the grouping on the album which the media in the current instance belongs t Grouping on the album which the media in the current instance belongs to or `undefined` if no value is present. +#### Inherited from + +Tag.grouping + ___ ### initialKey @@ -908,6 +1041,10 @@ Gets the initial key of the track. Initial key of the track or `undefined` if no value is set +#### Inherited from + +Tag.initialKey + • `set` **initialKey**(`value`): `void` Sets the initial key of the track. @@ -924,6 +1061,44 @@ Sets the initial key of the track. Initial key of the track or `undefined` if no value is set +#### Inherited from + +Tag.initialKey + +___ + +### isCompilation + +• `get` **isCompilation**(): `boolean` + +Gets whether or not the album described by the current instance is a compilation. + +#### Returns + +`boolean` + +#### Inherited from + +Tag.isCompilation + +• `set` **isCompilation**(`value`): `void` + +Gets whether or not the album described by the current instance is a compilation. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | `boolean` | Whether or not the album described by the current instance is a compilation | + +#### Returns + +`void` + +#### Inherited from + +Tag.isCompilation + ___ ### isEmpty @@ -932,7 +1107,7 @@ ___ Gets whether or not the current instance is empty. -**`remarks`** In the default implementation, this checks the values supported by [Tag](tag.md), but it +**`remarks`** In the default implementation, this checks the values supported by [Tag](Tag.md), but it may be extended by child classes to support other values. #### Returns @@ -941,6 +1116,10 @@ Gets whether or not the current instance is empty. `true` if the current instance does not contain any values. `false` otherwise +#### Inherited from + +Tag.isEmpty + ___ ### isrc @@ -955,6 +1134,10 @@ Gets the ISRC (International Standard Recording Code) of the track. the ISRC of the track or `undefined` if no value is set +#### Inherited from + +Tag.isrc + • `set` **isrc**(`value`): `void` Sets the ISRC (International Standard Recording Code) of the track. @@ -971,66 +1154,90 @@ Sets the ISRC (International Standard Recording Code) of the track. the ISRC of the track or `undefined` if no value is set +#### Inherited from + +Tag.isrc + ___ ### joinedAlbumArtists • `get` **joinedAlbumArtists**(): `string` -Gets a semicolon and space separated string containing the values in [albumArtists](id3v1tag.md#albumartists) +Gets a semicolon and space separated string containing the values in [albumArtists](Id3v1Tag.md#albumartists) #### Returns `string` +#### Inherited from + +Tag.joinedAlbumArtists + ___ ### joinedComposers • `get` **joinedComposers**(): `string` -Gets a semicolon and space separated string containing the values in [composers](id3v1tag.md#composers) +Gets a semicolon and space separated string containing the values in [composers](Id3v1Tag.md#composers) #### Returns `string` +#### Inherited from + +Tag.joinedComposers + ___ ### joinedGenres • `get` **joinedGenres**(): `string` -Gets a semicolon and space separated string containing the values in [genres](id3v1tag.md#genres) +Gets a semicolon and space separated string containing the values in [genres](Id3v1Tag.md#genres) #### Returns `string` +#### Inherited from + +Tag.joinedGenres + ___ ### joinedPerformers • `get` **joinedPerformers**(): `string` -Gets a semicolon and space separated string containing the values in [performers](id3v1tag.md#performers) +Gets a semicolon and space separated string containing the values in [performers](Id3v1Tag.md#performers) #### Returns `string` +#### Inherited from + +Tag.joinedPerformers + ___ ### joinedPerformersSort • `get` **joinedPerformersSort**(): `string` -Gets a semicolon and space separated string containing the values in [performersSort](id3v1tag.md#performerssort) +Gets a semicolon and space separated string containing the values in [performersSort](Id3v1Tag.md#performerssort) #### Returns `string` +#### Inherited from + +Tag.joinedPerformersSort + ___ ### lyrics @@ -1051,6 +1258,10 @@ Gets the lyrics or script of the media represented by the current instance. Lyrics or script of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.lyrics + • `set` **lyrics**(`value`): `void` Sets the lyrics or script of the media represented by the current instance. @@ -1073,6 +1284,10 @@ Sets the lyrics or script of the media represented by the current instance. Lyrics or script of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.lyrics + ___ ### musicBrainzArtistId @@ -1091,6 +1306,10 @@ Gets the MusicBrainz artist ID of the media represented by the current instance. MusicBrainz ArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzArtistId + • `set` **musicBrainzArtistId**(`value`): `void` Sets the MusicBrainz artist ID of the media represented by the current instance. @@ -1111,6 +1330,10 @@ Sets the MusicBrainz artist ID of the media represented by the current instance. MusicBrainz ArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzArtistId + ___ ### musicBrainzDiscId @@ -1129,6 +1352,10 @@ Gets the MusicBrainz disc ID of the media represented by the current instance. MusicBrainz DiscID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzDiscId + • `set` **musicBrainzDiscId**(`value`): `void` Sets the MusicBrainz disc ID of the media represented by the current instance. @@ -1149,6 +1376,10 @@ Sets the MusicBrainz disc ID of the media represented by the current instance. MusicBrainz DiscID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzDiscId + ___ ### musicBrainzReleaseArtistId @@ -1167,6 +1398,10 @@ Gets the MusicBrainz release artist ID of the media represented by the current i MusicBrainz ReleaseArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseArtistId + • `set` **musicBrainzReleaseArtistId**(`value`): `void` Sets the MusicBrainz release artist ID of the media represented by the current instance. @@ -1187,6 +1422,10 @@ Sets the MusicBrainz release artist ID of the media represented by the current i MusicBrainz ReleaseArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseArtistId + ___ ### musicBrainzReleaseCountry @@ -1208,6 +1447,10 @@ Gets the MusicBrainz release country of the media represented by the current ins MusicBrainz ReleaseCountry of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseCountry + • `set` **musicBrainzReleaseCountry**(`value`): `void` Sets the MusicBrainz release country of the media represented by the current instance. @@ -1231,6 +1474,10 @@ Sets the MusicBrainz release country of the media represented by the current ins MusicBrainz ReleaseCountry of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseCountry + ___ ### musicBrainzReleaseGroupId @@ -1249,6 +1496,10 @@ Gets the MusicBrainz release group ID of the media represented by the current in MusicBrainz ReleaseGroupID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseGroupId + • `set` **musicBrainzReleaseGroupId**(`value`): `void` Sets the MusicBrainz release group ID of the media represented by the current instance. @@ -1269,6 +1520,10 @@ Sets the MusicBrainz release group ID of the media represented by the current in MusicBrainz ReleaseGroupID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseGroupId + ___ ### musicBrainzReleaseId @@ -1287,6 +1542,10 @@ Gets the MusicBrainz release ID of the media represented by the current instance MusicBrainz ReleaseID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseId + • `set` **musicBrainzReleaseId**(`value`): `void` Sets the MusicBrainz release ID of the media represented by the current instance. @@ -1307,6 +1566,10 @@ Sets the MusicBrainz release ID of the media represented by the current instance MusicBrainz ReleaseID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseId + ___ ### musicBrainzReleaseStatus @@ -1325,6 +1588,10 @@ Gets the MusicBrainz release status of the media represented by the current inst MusicBrainz ReleaseStatus of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseStatus + • `set` **musicBrainzReleaseStatus**(`value`): `void` Sets the MusicBrainz release status of the media represented by the current instance. @@ -1345,6 +1612,10 @@ Sets the MusicBrainz release status of the media represented by the current inst MusicBrainz ReleaseStatus of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseStatus + ___ ### musicBrainzReleaseType @@ -1365,6 +1636,10 @@ Gets the MusicBrainz release type of the media represented by the current instan MusicBrainz ReleaseType of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseType + • `set` **musicBrainzReleaseType**(`value`): `void` Sets the MusicBrainz release type of the media represented by the current instance. @@ -1387,6 +1662,10 @@ Sets the MusicBrainz release type of the media represented by the current instan MusicBrainz ReleaseType of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseType + ___ ### musicBrainzTrackId @@ -1406,6 +1685,10 @@ current instance. MusicBrainz TrackID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzTrackId + • `set` **musicBrainzTrackId**(`value`): `void` Sets the MusicBrainz track ID of the media represented by the media represented by the @@ -1427,6 +1710,10 @@ current instance. MusicBrainz TrackID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzTrackId + ___ ### musicIpId @@ -1445,6 +1732,10 @@ Gets the MusicIP PUID of the media represented by the current instance. MusicIP PUID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicIpId + • `set` **musicIpId**(`value`): `void` Sets the MusicIP PUID of the media represented by the current instance. @@ -1465,26 +1756,27 @@ Sets the MusicIP PUID of the media represented by the current instance. MusicIP PUID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicIpId + ___ ### performers • `get` **performers**(): `string`[] -Gets the performers or artists who performed in the media described by the current instance. - **`inheritdoc`** #### Returns `string`[] -Performers who performed in the media described by the current instance or an empty - array if no value is present. +#### Overrides -• `set` **performers**(`value`): `void` +Tag.performers -Gets the performers or artists who performed in the media described by the current instance. +• `set` **performers**(`value`): `void` **`inheritdoc`** @@ -1502,8 +1794,9 @@ Gets the performers or artists who performed in the media described by the curre `void` -Performers who performed in the media described by the current instance or an empty - array if no value is present. +#### Overrides + +Tag.performers ___ @@ -1512,12 +1805,12 @@ ___ • `get` **performersRole**(): `string`[] Gets the characters portrayed by an actor for a video or instruments played by a musician -for music. This must match the [performers](id3v1tag.md#performers) array (for each person, correspond one/more +for music. This must match the [performers](Id3v1Tag.md#performers) array (for each person, correspond one/more role). Several roles for the same artist/actor can be separated with semicolons. For example: "Bass; Backing Vocals; Vibraphone". **`remarks`** It is highly important to match each role to the performers. This means that an entry - in the [performersRole](id3v1tag.md#performersrole) array is `undefined` to maintain the relationship between + in the [performersRole](Id3v1Tag.md#performersrole) array is `undefined` to maintain the relationship between `performers[i]` and `performersRole[i]`. #### Returns @@ -1527,15 +1820,19 @@ example: "Bass; Backing Vocals; Vibraphone". Array containing the roles played by the performers in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +Tag.performersRole + • `set` **performersRole**(`value`): `void` Sets the characters portrayed by an actor for a video or instruments played by a musician -for music. This must match the [performers](id3v1tag.md#performers) array (for each person, correspond one/more +for music. This must match the [performers](Id3v1Tag.md#performers) array (for each person, correspond one/more role). Several roles for the same artist/actor can be separated with semicolons. For example: "Bass; Backing Vocals; Vibraphone". **`remarks`** It is highly important to match each role to the performers. This means that an entry - in the [performersRole](id3v1tag.md#performersrole) array is `undefined` to maintain the relationship between + in the [performersRole](Id3v1Tag.md#performersrole) array is `undefined` to maintain the relationship between `performers[i]` and `performersRole[i]`. #### Parameters @@ -1551,6 +1848,10 @@ example: "Bass; Backing Vocals; Vibraphone". Array containing the roles played by the performers in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +Tag.performersRole + ___ ### performersSort @@ -1573,6 +1874,10 @@ the current instance. Sortable names for the performers who performed in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +Tag.performersSort + • `set` **performersSort**(`value`): `void` Gets the sortable names of the performers or artists who performed in the media described by @@ -1597,11 +1902,15 @@ the current instance. Sortable names for the performers who performed in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +Tag.performersSort + ___ ### pictures -• `get` **pictures**(): [`IPicture`](../interfaces/ipicture.md)[] +• `get` **pictures**(): [`IPicture`](../interfaces/IPicture.md)[] Gets a collection of pictures associated with the media represented by the current instance. @@ -1611,11 +1920,15 @@ Gets a collection of pictures associated with the media represented by the curre #### Returns -[`IPicture`](../interfaces/ipicture.md)[] +[`IPicture`](../interfaces/IPicture.md)[] Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. +#### Inherited from + +Tag.pictures + • `set` **pictures**(`value`): `void` Sets a collection of pictures associated with the media represented by the current instance. @@ -1628,7 +1941,7 @@ Sets a collection of pictures associated with the media represented by the curre | Name | Type | Description | | :------ | :------ | :------ | -| `value` | [`IPicture`](../interfaces/ipicture.md)[] | Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. | +| `value` | [`IPicture`](../interfaces/IPicture.md)[] | Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. | #### Returns @@ -1637,6 +1950,10 @@ Sets a collection of pictures associated with the media represented by the curre Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. +#### Inherited from + +Tag.pictures + ___ ### publisher @@ -1651,6 +1968,10 @@ Gets the publisher of the track. Publisher of the track or `undefined` if no value is set +#### Inherited from + +Tag.publisher + • `set` **publisher**(`value`): `void` Sets the publisher of the track. @@ -1667,6 +1988,10 @@ Sets the publisher of the track. Publisher of the track or `undefined` if no value is set +#### Inherited from + +Tag.publisher + ___ ### remixedBy @@ -1681,6 +2006,10 @@ Gets the remixer of the track. Remixer of the track or `undefined` if no value is set +#### Inherited from + +Tag.remixedBy + • `set` **remixedBy**(`value`): `void` Sets the remixer of the track. @@ -1697,6 +2026,10 @@ Sets the remixer of the track. Remixer of the track or `undefined` if no value is set +#### Inherited from + +Tag.remixedBy + ___ ### replayGainAlbumGain @@ -1711,6 +2044,10 @@ Gets the ReplayGain album gain in dB. Album gain as per the ReplayGain specifications, in dB, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainAlbumGain + • `set` **replayGainAlbumGain**(`value`): `void` Sets the ReplayGain album gain in dB. @@ -1727,6 +2064,10 @@ Sets the ReplayGain album gain in dB. Album gain as per the ReplayGain specifications, in dB, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainAlbumGain + ___ ### replayGainAlbumPeak @@ -1741,6 +2082,10 @@ Gets the ReplayGain album peak sample. Album peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainAlbumPeak + • `set` **replayGainAlbumPeak**(`value`): `void` Sets the ReplayGain album peak sample. @@ -1757,6 +2102,10 @@ Sets the ReplayGain album peak sample. Album peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainAlbumPeak + ___ ### replayGainTrackGain @@ -1771,6 +2120,10 @@ Gets the ReplayGain track gain in dB. Track gain as per ReplayGain specifications, in dB, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainTrackGain + • `set` **replayGainTrackGain**(`value`): `void` Sets the ReplayGain track gain in dB. @@ -1787,6 +2140,10 @@ Sets the ReplayGain track gain in dB. Track gain as per ReplayGain specifications, in dB, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainTrackGain + ___ ### replayGainTrackPeak @@ -1801,6 +2158,10 @@ Gets the ReplayGain track peak sample. Track peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainTrackPeak + • `set` **replayGainTrackPeak**(`value`): `void` Sets the ReplayGain track peak sample. @@ -1817,20 +2178,26 @@ Sets the ReplayGain track peak sample. Track peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainTrackPeak + ___ ### sizeOnDisk • `get` **sizeOnDisk**(): `number` -Gets the size of the tag in bytes on disk as it was read from disk. - **`inheritdoc`** #### Returns `number` +#### Overrides + +Tag.sizeOnDisk + ___ ### subtitle @@ -1850,6 +2217,10 @@ Gets a description, one-line. It represents the tagline of the vide/music. Subtitle of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.subtitle + • `set` **subtitle**(`value`): `void` Sets a description, one-line. It represents the tagline of the vide/music. @@ -1871,20 +2242,28 @@ Sets a description, one-line. It represents the tagline of the vide/music. Subtitle of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.subtitle + ___ ### tagTypes -• `get` **tagTypes**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypes**(): [`TagTypes`](../enums/TagTypes.md) -Gets the tag types contained in the current instance. A bit wise combined [TagTypes](../enums/tagtypes.md) +Gets the tag types contained in the current instance. A bit wise combined [TagTypes](../enums/TagTypes.md) containing the tag types contained in the current instance. **`inheritdoc`** #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) + +#### Overrides + +Tag.tagTypes ___ @@ -1892,21 +2271,18 @@ ___ • `get` **title**(): `string` -Gets the title for the media described by the current instance. - **`inheritdoc`** #### Returns `string` -Title of the media described by the current instance or `undefined` if no value is - present. +#### Overrides + +Tag.title • `set` **title**(`value`): `void` -Gets the title for the media described by the current instance. - **`inheritdoc`** **`remarks`** When stored on disk, only the first 30 bytes of the latin-1 encoded value will @@ -1922,8 +2298,9 @@ Gets the title for the media described by the current instance. `void` -Title of the media described by the current instance or `undefined` if no value is - present. +#### Overrides + +Tag.title ___ @@ -1942,6 +2319,10 @@ Gets the sortable name for the title of the media described by the current insta Sortable name of the media described by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.titleSort + • `set` **titleSort**(`value`): `void` Sets the sortable name for the title of the media described by the current instance. @@ -1961,28 +2342,27 @@ Sets the sortable name for the title of the media described by the current insta Sortable name of the media described by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.titleSort + ___ ### track • `get` **track**(): `number` -Gets the position of the media represented by the current instance in its containing album -or season (for a series). - **`inheritdoc`** #### Returns `number` -Position of the media represented by the current instance in its containing album - or `0` if not specified. +#### Overrides -• `set` **track**(`value`): `void` +Tag.track -Gets the position of the media represented by the current instance in its containing album -or season (for a series). +• `set` **track**(`value`): `void` **`inheritdoc`** @@ -1999,8 +2379,9 @@ or season (for a series). `void` -Position of the media represented by the current instance in its containing album - or `0` if not specified. +#### Overrides + +Tag.track ___ @@ -2011,8 +2392,8 @@ ___ Gets the number of tracks in the album or the number of episodes in a series of the media represented by the current instance. -**`remarks`** If non-zero, this value should be equal to or greater than [track](id3v1tag.md#track). If - [track](id3v1tag.md#track) is `0`, this value should also be `0`. +**`remarks`** If non-zero, this value should be equal to or greater than [track](Id3v1Tag.md#track). If + [track](Id3v1Tag.md#track) is `0`, this value should also be `0`. #### Returns @@ -2021,13 +2402,17 @@ represented by the current instance. Number of tracks in the album or number of episodes in a series of the media represented by the current instance or `0` if not specified. +#### Inherited from + +Tag.trackCount + • `set` **trackCount**(`value`): `void` Sets the number of tracks in the album or the number of episodes in a series of the media represented by the current instance. -**`remarks`** If non-zero, this value should be equal to or greater than [track](id3v1tag.md#track). If - [track](id3v1tag.md#track) is `0`, this value should also be `0`. +**`remarks`** If non-zero, this value should be equal to or greater than [track](Id3v1Tag.md#track). If + [track](Id3v1Tag.md#track) is `0`, this value should also be `0`. #### Parameters @@ -2042,26 +2427,27 @@ represented by the current instance. Number of tracks in the album or number of episodes in a series of the media represented by the current instance or `0` if not specified. +#### Inherited from + +Tag.trackCount + ___ ### year • `get` **year**(): `number` -Gets the year that the media represented by the current instance was recorded. - **`inheritdoc`** #### Returns `number` -Year that the media represented by the current instance was created or `0` if no - value is present. +#### Overrides -• `set` **year**(`value`): `void` +Tag.year -Gets the year that the media represented by the current instance was recorded. +• `set` **year**(`value`): `void` **`inheritdoc`** @@ -2078,8 +2464,9 @@ Gets the year that the media represented by the current instance was recorded. `void` -Year that the media represented by the current instance was created or `0` if no - value is present. +#### Overrides + +Tag.year ## Methods @@ -2097,7 +2484,7 @@ Clears all values stored in the current instance. #### Overrides -[Tag](tag.md).[clear](tag.md#clear) +[Tag](Tag.md).[clear](Tag.md#clear) ___ @@ -2105,19 +2492,19 @@ ___ ▸ **copyTo**(`target`, `overwrite`): `void` -Copies the values from the current instance to another [Tag](tag.md), optionally overwriting +Copies the values from the current instance to another [Tag](Tag.md), optionally overwriting existing values. **`remarks`** This method only copies the most basic values when copying between different tag formats. However, if `target` is of the same type as the current instance, more advanced copying may be done. For example if both `this` and `target` are - [Id3v2Tag](id3v2tag.md), all frames will be copied to the target. + [Id3v2Tag](Id3v2Tag.md), all frames will be copied to the target. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `target` | [`Tag`](tag.md) | Target tag to copy values to | +| `target` | [`Tag`](Tag.md) | Target tag to copy values to | | `overwrite` | `boolean` | Whether or not to copy values over existing ones | #### Returns @@ -2126,19 +2513,19 @@ Copies the values from the current instance to another [Tag](tag.md), optionally #### Inherited from -[Tag](tag.md).[copyTo](tag.md#copyto) +[Tag](Tag.md).[copyTo](Tag.md#copyto) ___ ### render -▸ **render**(): [`ByteVector`](bytevector.md) +▸ **render**(): [`ByteVector`](ByteVector.md) Renders the current instance as a raw ID3v1 tag. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ___ @@ -2156,7 +2543,7 @@ Set the tags that represent the tagger software (node-taglib-sharp) itself. #### Inherited from -[Tag](tag.md).[setInfoTag](tag.md#setinfotag) +[Tag](Tag.md).[setInfoTag](Tag.md#setinfotag) ___ @@ -2181,52 +2568,52 @@ First string contained in `group` or `undefined` if the array is #### Inherited from -[Tag](tag.md).[firstInGroup](tag.md#firstingroup) +[Tag](Tag.md).[firstInGroup](Tag.md#firstingroup) ___ ### fromData -▸ `Static` **fromData**(`data`): [`Id3v1Tag`](id3v1tag.md) +▸ `Static` **fromData**(`data`): [`Id3v1Tag`](Id3v1Tag.md) #### Parameters | Name | Type | | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | +| `data` | [`ByteVector`](ByteVector.md) | #### Returns -[`Id3v1Tag`](id3v1tag.md) +[`Id3v1Tag`](Id3v1Tag.md) ___ ### fromEmpty -▸ `Static` **fromEmpty**(): [`Id3v1Tag`](id3v1tag.md) +▸ `Static` **fromEmpty**(): [`Id3v1Tag`](Id3v1Tag.md) -Constructs and initializes a new instance of [Id3v1Tag](id3v1tag.md) with no contents. +Constructs and initializes a new instance of [Id3v1Tag](Id3v1Tag.md) with no contents. #### Returns -[`Id3v1Tag`](id3v1tag.md) +[`Id3v1Tag`](Id3v1Tag.md) ___ ### fromFile -▸ `Static` **fromFile**(`file`, `position`): [`Id3v1Tag`](id3v1tag.md) +▸ `Static` **fromFile**(`file`, `position`): [`Id3v1Tag`](Id3v1Tag.md) #### Parameters | Name | Type | | :------ | :------ | -| `file` | [`File`](file.md) | +| `file` | [`File`](File.md) | | `position` | `number` | #### Returns -[`Id3v1Tag`](id3v1tag.md) +[`Id3v1Tag`](Id3v1Tag.md) ___ @@ -2252,7 +2639,7 @@ If `value` is a string, `true` is returned if the value is falsy or all #### Inherited from -[Tag](tag.md).[isFalsyOrLikeEmpty](tag.md#isfalsyorlikeempty) +[Tag](Tag.md).[isFalsyOrLikeEmpty](Tag.md#isfalsyorlikeempty) ___ @@ -2277,24 +2664,24 @@ A semicolon and space separated string containing the values from `group` #### Inherited from -[Tag](tag.md).[joinGroup](tag.md#joingroup) +[Tag](Tag.md).[joinGroup](Tag.md#joingroup) ___ ### tagTypeFlagsToArray -▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/tagtypes.md)[] +▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/TagTypes.md)[] #### Parameters | Name | Type | | :------ | :------ | -| `tagTypes` | [`TagTypes`](../enums/tagtypes.md) | +| `tagTypes` | [`TagTypes`](../enums/TagTypes.md) | #### Returns -[`TagTypes`](../enums/tagtypes.md)[] +[`TagTypes`](../enums/TagTypes.md)[] #### Inherited from -[Tag](tag.md).[tagTypeFlagsToArray](tag.md#tagtypeflagstoarray) +[Tag](Tag.md).[tagTypeFlagsToArray](Tag.md#tagtypeflagstoarray) diff --git a/docs/classes/id3v2attachmentframe.md b/docs/classes/Id3v2AttachmentFrame.md similarity index 62% rename from docs/classes/id3v2attachmentframe.md rename to docs/classes/Id3v2AttachmentFrame.md index 157000e3..8fa167f1 100644 --- a/docs/classes/id3v2attachmentframe.md +++ b/docs/classes/Id3v2AttachmentFrame.md @@ -4,76 +4,63 @@ ## Hierarchy -- [`Id3v2Frame`](id3v2frame.md) +- [`Id3v2Frame`](Id3v2Frame.md) ↳ **`Id3v2AttachmentFrame`** ## Implements -- [`IPicture`](../interfaces/ipicture.md) +- [`IPicture`](../interfaces/IPicture.md) ## Table of contents -### Properties - -- [\_header](id3v2attachmentframe.md#_header) - ### Accessors -- [data](id3v2attachmentframe.md#data) -- [description](id3v2attachmentframe.md#description) -- [encryptionId](id3v2attachmentframe.md#encryptionid) -- [filename](id3v2attachmentframe.md#filename) -- [flags](id3v2attachmentframe.md#flags) -- [frameClassType](id3v2attachmentframe.md#frameclasstype) -- [frameId](id3v2attachmentframe.md#frameid) -- [groupId](id3v2attachmentframe.md#groupid) -- [mimeType](id3v2attachmentframe.md#mimetype) -- [size](id3v2attachmentframe.md#size) -- [textEncoding](id3v2attachmentframe.md#textencoding) -- [type](id3v2attachmentframe.md#type) +- [data](Id3v2AttachmentFrame.md#data) +- [description](Id3v2AttachmentFrame.md#description) +- [encryptionId](Id3v2AttachmentFrame.md#encryptionid) +- [filename](Id3v2AttachmentFrame.md#filename) +- [flags](Id3v2AttachmentFrame.md#flags) +- [frameClassType](Id3v2AttachmentFrame.md#frameclasstype) +- [frameId](Id3v2AttachmentFrame.md#frameid) +- [groupId](Id3v2AttachmentFrame.md#groupid) +- [header](Id3v2AttachmentFrame.md#header) +- [mimeType](Id3v2AttachmentFrame.md#mimetype) +- [size](Id3v2AttachmentFrame.md#size) +- [textEncoding](Id3v2AttachmentFrame.md#textencoding) +- [type](Id3v2AttachmentFrame.md#type) ### Methods -- [clone](id3v2attachmentframe.md#clone) -- [fieldData](id3v2attachmentframe.md#fielddata) -- [parseFields](id3v2attachmentframe.md#parsefields) -- [render](id3v2attachmentframe.md#render) -- [renderFields](id3v2attachmentframe.md#renderfields) -- [setData](id3v2attachmentframe.md#setdata) -- [toString](id3v2attachmentframe.md#tostring) -- [correctEncoding](id3v2attachmentframe.md#correctencoding) -- [find](id3v2attachmentframe.md#find) -- [fromFile](id3v2attachmentframe.md#fromfile) -- [fromOffsetRawData](id3v2attachmentframe.md#fromoffsetrawdata) -- [fromPicture](id3v2attachmentframe.md#frompicture) -- [fromRawData](id3v2attachmentframe.md#fromrawdata) - -## Properties - -### \_header - -• `Protected` **\_header**: [`Id3v2FrameHeader`](id3v2frameheader.md) - -#### Inherited from - -[Id3v2Frame](id3v2frame.md).[_header](id3v2frame.md#_header) +- [clone](Id3v2AttachmentFrame.md#clone) +- [fieldData](Id3v2AttachmentFrame.md#fielddata) +- [parseFields](Id3v2AttachmentFrame.md#parsefields) +- [render](Id3v2AttachmentFrame.md#render) +- [renderFields](Id3v2AttachmentFrame.md#renderfields) +- [setData](Id3v2AttachmentFrame.md#setdata) +- [toString](Id3v2AttachmentFrame.md#tostring) +- [correctEncoding](Id3v2AttachmentFrame.md#correctencoding) +- [find](Id3v2AttachmentFrame.md#find) +- [fromFile](Id3v2AttachmentFrame.md#fromfile) +- [fromOffsetRawData](Id3v2AttachmentFrame.md#fromoffsetrawdata) +- [fromPicture](Id3v2AttachmentFrame.md#frompicture) +- [fromRawData](Id3v2AttachmentFrame.md#fromrawdata) ## Accessors ### data -• `get` **data**(): [`ByteVector`](bytevector.md) +• `get` **data**(): [`ByteVector`](ByteVector.md) Gets the image data stored in the current instance. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Implementation of -[IPicture](../interfaces/ipicture.md).[data](../interfaces/ipicture.md#data) +[IPicture](../interfaces/IPicture.md).[data](../interfaces/IPicture.md#data) • `set` **data**(`value`): `void` @@ -83,7 +70,7 @@ Sets the image data stored in the current instance. | Name | Type | | :------ | :------ | -| `value` | [`ByteVector`](bytevector.md) | +| `value` | [`ByteVector`](ByteVector.md) | #### Returns @@ -91,7 +78,7 @@ Sets the image data stored in the current instance. #### Implementation of -[IPicture](../interfaces/ipicture.md).[data](../interfaces/ipicture.md#data) +[IPicture](../interfaces/IPicture.md).[data](../interfaces/IPicture.md#data) ___ @@ -107,7 +94,7 @@ Gets the description stored in the current instance. #### Implementation of -[IPicture](../interfaces/ipicture.md).[description](../interfaces/ipicture.md#description) +[IPicture](../interfaces/IPicture.md).[description](../interfaces/IPicture.md#description) • `set` **description**(`value`): `void` @@ -126,7 +113,7 @@ There should only be one frame with a matching description and type per tag. #### Implementation of -[IPicture](../interfaces/ipicture.md).[description](../interfaces/ipicture.md#description) +[IPicture](../interfaces/IPicture.md).[description](../interfaces/IPicture.md#description) ___ @@ -143,6 +130,10 @@ Gets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + • `set` **encryptionId**(`value`): `void` Sets the encryption ID applied to the current instance. @@ -160,6 +151,10 @@ Sets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + ___ ### filename @@ -174,7 +169,7 @@ Gets a filename of the picture stored in the current instance. #### Implementation of -[IPicture](../interfaces/ipicture.md).[filename](../interfaces/ipicture.md#filename) +[IPicture](../interfaces/IPicture.md).[filename](../interfaces/IPicture.md#filename) • `set` **filename**(`value`): `void` @@ -192,62 +187,78 @@ Sets a filename of the picture stored in the current instance. #### Implementation of -[IPicture](../interfaces/ipicture.md).[filename](../interfaces/ipicture.md#filename) +[IPicture](../interfaces/IPicture.md).[filename](../interfaces/IPicture.md#filename) ___ ### flags -• `get` **flags**(): [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +• `get` **flags**(): [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) Gets the frame flags applied to the current instance. #### Returns -[`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +[`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) + +#### Inherited from + +Frame.flags • `set` **flags**(`value`): `void` Sets the frame flags applied to the current instance. -If the value includes either [Id3v2FrameFlags.Encryption](../enums/id3v2frameflags.md#encryption) or -[Id3v2FrameFlags.Compression](../enums/id3v2frameflags.md#compression), [render](id3v2attachmentframe.md#render) will throw. +If the value includes either [Id3v2FrameFlags.Encryption](../enums/Id3v2FrameFlags.md#encryption) or +[Id3v2FrameFlags.Compression](../enums/Id3v2FrameFlags.md#compression), [render](Id3v2AttachmentFrame.md#render) will throw. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) | +| `value` | [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) | #### Returns `void` +#### Inherited from + +Frame.flags + ___ ### frameClassType -• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) **`inheritdoc`** #### Returns -[`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +[`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) + +#### Overrides + +Frame.frameClassType ___ ### frameId -• `get` **frameId**(): [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +• `get` **frameId**(): [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) Gets the frame ID for the current instance. #### Returns -[`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +[`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) FrameIdentifier Object representing of the identifier of the frame +#### Inherited from + +Frame.frameId + ___ ### groupId @@ -263,6 +274,10 @@ Gets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + • `set` **groupId**(`value`): `void` Sets the grouping ID applied to the current instance. @@ -280,6 +295,44 @@ Sets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + +___ + +### header + +• `Protected` `get` **header**(): [`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +Gets the header for the frame. For new frames this should not exist. + +#### Returns + +[`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +#### Inherited from + +Frame.header + +• `Protected` `set` **header**(`value`): `void` + +Sets the header for the frame. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header for the frame | + +#### Returns + +`void` + +#### Inherited from + +Frame.header + ___ ### mimeType @@ -294,7 +347,7 @@ Gets the MimeType of the picture stored in the current instance. #### Implementation of -[IPicture](../interfaces/ipicture.md).[mimeType](../interfaces/ipicture.md#mimetype) +[IPicture](../interfaces/IPicture.md).[mimeType](../interfaces/IPicture.md#mimetype) • `set` **mimeType**(`value`): `void` @@ -312,7 +365,7 @@ Sets the MimeType of the picture stored in the current instance. #### Implementation of -[IPicture](../interfaces/ipicture.md).[mimeType](../interfaces/ipicture.md#mimetype) +[IPicture](../interfaces/IPicture.md).[mimeType](../interfaces/IPicture.md#mimetype) ___ @@ -328,11 +381,15 @@ NOTE: This value is not used outside of reading a frame from disk, so newly crea `number` +#### Inherited from + +Frame.size + ___ ### textEncoding -• `get` **textEncoding**(): [`StringType`](../enums/stringtype.md) +• `get` **textEncoding**(): [`StringType`](../enums/StringType.md) Gets the text encoding to use when storing the current instance. @@ -340,7 +397,7 @@ Gets the text encoding to use when storing the current instance. #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) • `set` **textEncoding**(`value`): `void` @@ -350,7 +407,7 @@ Sets the text encoding to use when storing the current instance. | Name | Type | Description | | :------ | :------ | :------ | -| `value` | [`StringType`](../enums/stringtype.md) | Text encoding to use when storing the current instance. This encoding is overridden when rendering if [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) is `true` or the render version does not support it. | +| `value` | [`StringType`](../enums/StringType.md) | Text encoding to use when storing the current instance. This encoding is overridden when rendering if [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) is `true` or the render version does not support it. | #### Returns @@ -360,29 +417,29 @@ ___ ### type -• `get` **type**(): [`PictureType`](../enums/picturetype.md) +• `get` **type**(): [`PictureType`](../enums/PictureType.md) Gets the object type stored in the current instance. #### Returns -[`PictureType`](../enums/picturetype.md) +[`PictureType`](../enums/PictureType.md) #### Implementation of -[IPicture](../interfaces/ipicture.md).[type](../interfaces/ipicture.md#type) +[IPicture](../interfaces/IPicture.md).[type](../interfaces/IPicture.md#type) • `set` **type**(`value`): `void` Sets the object type stored in the current instance. -For General Object Frame, use [PictureType.NotAPicture](../enums/picturetype.md#notapicture). Other types will make it a +For General Object Frame, use [PictureType.NotAPicture](../enums/PictureType.md#notapicture). Other types will make it a Picture Frame. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`PictureType`](../enums/picturetype.md) | +| `value` | [`PictureType`](../enums/PictureType.md) | #### Returns @@ -390,13 +447,13 @@ Picture Frame. #### Implementation of -[IPicture](../interfaces/ipicture.md).[type](../interfaces/ipicture.md#type) +[IPicture](../interfaces/IPicture.md).[type](../interfaces/IPicture.md#type) ## Methods ### clone -▸ **clone**(): [`Id3v2Frame`](id3v2frame.md) +▸ **clone**(): [`Id3v2Frame`](Id3v2Frame.md) Creates a deep copy of the current instance. This method is implemented by rendering the current instance as an ID3v2.4 frame and using @@ -405,17 +462,17 @@ classes. #### Returns -[`Id3v2Frame`](id3v2frame.md) +[`Id3v2Frame`](Id3v2Frame.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[clone](id3v2frame.md#clone) +[Id3v2Frame](Id3v2Frame.md).[clone](Id3v2Frame.md#clone) ___ ### fieldData -▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](bytevector.md) +▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](ByteVector.md) Extracts the field data from the raw portion of an ID3v2 frame. This method is necessary for extracting extra data prepended to the frame such the as @@ -425,18 +482,18 @@ grouping ID. | Name | Type | Description | | :------ | :------ | :------ | -| `frameData` | [`ByteVector`](bytevector.md) | Raw frame data | +| `frameData` | [`ByteVector`](ByteVector.md) | Raw frame data | | `offset` | `number` | Index at which the data is contained | | `version` | `number` | Version of the ID3v2 tag the data was originally encoded with | | `dataIncludesHeader` | `boolean` | `true` if `frameData` includes the header, `false` otherwise | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[fieldData](id3v2frame.md#fielddata) +[Id3v2Frame](Id3v2Frame.md).[fieldData](Id3v2Frame.md#fielddata) ___ @@ -450,7 +507,7 @@ Populates the values in this frame by parsing its field data in a specified vers | Name | Type | | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | +| `data` | [`ByteVector`](ByteVector.md) | | `version` | `number` | #### Returns @@ -459,13 +516,13 @@ Populates the values in this frame by parsing its field data in a specified vers #### Overrides -[Id3v2Frame](id3v2frame.md).[parseFields](id3v2frame.md#parsefields) +[Id3v2Frame](Id3v2Frame.md).[parseFields](Id3v2Frame.md#parsefields) ___ ### render -▸ **render**(`version`): [`ByteVector`](bytevector.md) +▸ **render**(`version`): [`ByteVector`](ByteVector.md) Renders the current instance, encoded in a specified ID3v2 version. @@ -477,17 +534,17 @@ Renders the current instance, encoded in a specified ID3v2 version. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[render](id3v2frame.md#render) +[Id3v2Frame](Id3v2Frame.md).[render](Id3v2Frame.md#render) ___ ### renderFields -▸ `Protected` **renderFields**(`version`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderFields**(`version`): [`ByteVector`](ByteVector.md) Renders the values in the current instance into field data for a specified version. @@ -499,11 +556,11 @@ Renders the values in the current instance into field data for a specified versi #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[renderFields](id3v2frame.md#renderfields) +[Id3v2Frame](Id3v2Frame.md).[renderFields](Id3v2Frame.md#renderfields) ___ @@ -518,7 +575,7 @@ header. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw ID3v2 frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw ID3v2 frame | | `offset` | `number` | Offset in `data` at which the frame begins. | | `readHeader` | `boolean` | Whether or not to read the reader into the current instance. | | `version` | `number` | Version of the ID3v2 tag the data was encoded with | @@ -529,7 +586,7 @@ header. #### Inherited from -[Id3v2Frame](id3v2frame.md).[setData](id3v2frame.md#setdata) +[Id3v2Frame](Id3v2Frame.md).[setData](Id3v2Frame.md#setdata) ___ @@ -545,7 +602,7 @@ ___ ### correctEncoding -▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/stringtype.md) +▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/StringType.md) Converts an encoding to be a supported encoding for a specified tag version. @@ -553,41 +610,41 @@ Converts an encoding to be a supported encoding for a specified tag version. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`StringType`](../enums/stringtype.md) | Value containing the original encoding | +| `type` | [`StringType`](../enums/StringType.md) | Value containing the original encoding | | `version` | `number` | Value containing the ID3v2 version to be encoded. | #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) StringType Value containing the correct encoding to use, based on - [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) and what is supported by + [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) and what is supported by `version` #### Inherited from -[Id3v2Frame](id3v2frame.md).[correctEncoding](id3v2frame.md#correctencoding) +[Id3v2Frame](Id3v2Frame.md).[correctEncoding](Id3v2Frame.md#correctencoding) ___ ### find -▸ `Static` **find**(`frames`, `description?`, `type?`): [`Id3v2AttachmentFrame`](id3v2attachmentframe.md) +▸ `Static` **find**(`frames`, `description?`, `type?`): [`Id3v2AttachmentFrame`](Id3v2AttachmentFrame.md) Get a specified attachment frame from the specified tag, optionally creating it if it does not exist. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `frames` | [`Id3v2AttachmentFrame`](id3v2attachmentframe.md)[] | List of attachment frames to search | -| `description?` | `string` | Description to match | -| `type` | [`PictureType`](../enums/picturetype.md) | Picture type to match | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `frames` | [`Id3v2AttachmentFrame`](Id3v2AttachmentFrame.md)[] | `undefined` | List of attachment frames to search | +| `description?` | `string` | `undefined` | Description to match | +| `type` | [`PictureType`](../enums/PictureType.md) | `PictureType.Other` | Picture type to match | #### Returns -[`Id3v2AttachmentFrame`](id3v2attachmentframe.md) +[`Id3v2AttachmentFrame`](Id3v2AttachmentFrame.md) Matching frame or `undefined` if a match wasn't found and `create` is `false` @@ -596,7 +653,7 @@ ___ ### fromFile -▸ `Static` **fromFile**(`file`, `header`, `frameStart`, `size`, `version`): [`Id3v2AttachmentFrame`](id3v2attachmentframe.md) +▸ `Static` **fromFile**(`file`, `header`, `frameStart`, `size`, `version`): [`Id3v2AttachmentFrame`](Id3v2AttachmentFrame.md) Constructs and initializes a new attachment frame by populating it with the contents of a section of a file. This constructor is only meant to be used internally. All loading is done @@ -609,20 +666,20 @@ lazily. | Name | Type | Description | | :------ | :------ | :------ | | `file` | `IFileAbstraction` | File to load frame data from | -| `header` | [`Id3v2FrameHeader`](id3v2frameheader.md) | ID3v2 frame header that defines the frame | +| `header` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | ID3v2 frame header that defines the frame | | `frameStart` | `number` | Index into the file where the frame starts | | `size` | `number` | Length of the frame data | | `version` | `number` | ID3v2 version the frame was originally encoded with | #### Returns -[`Id3v2AttachmentFrame`](id3v2attachmentframe.md) +[`Id3v2AttachmentFrame`](Id3v2AttachmentFrame.md) ___ ### fromOffsetRawData -▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2AttachmentFrame`](id3v2attachmentframe.md) +▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2AttachmentFrame`](Id3v2AttachmentFrame.md) Constructs and initializes a new attachment frame by reading its raw data in a specified ID3v2 version. @@ -631,44 +688,44 @@ ID3v2 version. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | ByteVector containing the raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | ByteVector containing the raw representation of the new frame | | `offset` | `number` | Index into `data` where the frame actually begins | -| `header` | [`Id3v2FrameHeader`](id3v2frameheader.md) | Header of the frame found at `offset` in the data | +| `header` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header of the frame found at `offset` in the data | | `version` | `number` | ID3v2 version the frame was originally encoded with | #### Returns -[`Id3v2AttachmentFrame`](id3v2attachmentframe.md) +[`Id3v2AttachmentFrame`](Id3v2AttachmentFrame.md) ___ ### fromPicture -▸ `Static` **fromPicture**(`picture`): [`Id3v2AttachmentFrame`](id3v2attachmentframe.md) +▸ `Static` **fromPicture**(`picture`): [`Id3v2AttachmentFrame`](Id3v2AttachmentFrame.md) Constructs and initializes a new attachment frame by populating it with the contents of -another [IPicture](../interfaces/ipicture.md) object. +another [IPicture](../interfaces/IPicture.md) object. **`remarks`** When a frame is created, it is not automatically added to the tag. Consider - using [get](bytevector.md#get) for more integrated frame creation. - Additionally, see [Tag.pictures](tag.md#pictures) provides a generic way of getting and setting + using [get](ByteVector.md#get) for more integrated frame creation. + Additionally, see [Tag.pictures](Tag.md#pictures) provides a generic way of getting and setting attachments which is preferable to format specific code. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `picture` | [`IPicture`](../interfaces/ipicture.md) | Value to use in the new instance. | +| `picture` | [`IPicture`](../interfaces/IPicture.md) | Value to use in the new instance. | #### Returns -[`Id3v2AttachmentFrame`](id3v2attachmentframe.md) +[`Id3v2AttachmentFrame`](Id3v2AttachmentFrame.md) ___ ### fromRawData -▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2AttachmentFrame`](id3v2attachmentframe.md) +▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2AttachmentFrame`](Id3v2AttachmentFrame.md) Constructs and initializes a new attachment frame by reading its raw data in a specified Id3v2 version. @@ -677,9 +734,9 @@ Id3v2 version. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | ByteVector starting with the raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | ByteVector starting with the raw representation of the new frame | | `version` | `number` | ID3v2 version the raw frame is encoded with. | #### Returns -[`Id3v2AttachmentFrame`](id3v2attachmentframe.md) +[`Id3v2AttachmentFrame`](Id3v2AttachmentFrame.md) diff --git a/docs/classes/id3v2commentsframe.md b/docs/classes/Id3v2CommentsFrame.md similarity index 65% rename from docs/classes/id3v2commentsframe.md rename to docs/classes/Id3v2CommentsFrame.md index 665df4d5..10bc3ae0 100644 --- a/docs/classes/id3v2commentsframe.md +++ b/docs/classes/Id3v2CommentsFrame.md @@ -3,63 +3,50 @@ # Class: Id3v2CommentsFrame Class that extends {@link Frame}, implementing support for ID3v2 Comments (COMM) frames. -A [CommentsFrame](../enums/id3v2frameclasstype.md#commentsframe) should be used for storing user readable comments on the media file. +A [CommentsFrame](../enums/Id3v2FrameClassType.md#commentsframe) should be used for storing user readable comments on the media file. When reading comments from a file, {@link CommentsFrame.findPreferred} should be used as it gracefully falls back to comments that you, as a developer, may not be expecting. When writing -comments, however, it is best to use [get](bytevector.md#get) as it forces it to be written in the exact +comments, however, it is best to use [get](ByteVector.md#get) as it forces it to be written in the exact version you are specifying. ## Hierarchy -- [`Id3v2Frame`](id3v2frame.md) +- [`Id3v2Frame`](Id3v2Frame.md) ↳ **`Id3v2CommentsFrame`** ## Table of contents -### Properties - -- [\_header](id3v2commentsframe.md#_header) - ### Accessors -- [description](id3v2commentsframe.md#description) -- [encryptionId](id3v2commentsframe.md#encryptionid) -- [flags](id3v2commentsframe.md#flags) -- [frameClassType](id3v2commentsframe.md#frameclasstype) -- [frameId](id3v2commentsframe.md#frameid) -- [groupId](id3v2commentsframe.md#groupid) -- [language](id3v2commentsframe.md#language) -- [size](id3v2commentsframe.md#size) -- [text](id3v2commentsframe.md#text) -- [textEncoding](id3v2commentsframe.md#textencoding) +- [description](Id3v2CommentsFrame.md#description) +- [encryptionId](Id3v2CommentsFrame.md#encryptionid) +- [flags](Id3v2CommentsFrame.md#flags) +- [frameClassType](Id3v2CommentsFrame.md#frameclasstype) +- [frameId](Id3v2CommentsFrame.md#frameid) +- [groupId](Id3v2CommentsFrame.md#groupid) +- [header](Id3v2CommentsFrame.md#header) +- [language](Id3v2CommentsFrame.md#language) +- [size](Id3v2CommentsFrame.md#size) +- [text](Id3v2CommentsFrame.md#text) +- [textEncoding](Id3v2CommentsFrame.md#textencoding) ### Methods -- [clone](id3v2commentsframe.md#clone) -- [fieldData](id3v2commentsframe.md#fielddata) -- [parseFields](id3v2commentsframe.md#parsefields) -- [render](id3v2commentsframe.md#render) -- [renderFields](id3v2commentsframe.md#renderfields) -- [setData](id3v2commentsframe.md#setdata) -- [toString](id3v2commentsframe.md#tostring) -- [correctEncoding](id3v2commentsframe.md#correctencoding) -- [find](id3v2commentsframe.md#find) -- [findAll](id3v2commentsframe.md#findall) -- [findPreferred](id3v2commentsframe.md#findpreferred) -- [fromDescription](id3v2commentsframe.md#fromdescription) -- [fromOffsetRawData](id3v2commentsframe.md#fromoffsetrawdata) -- [fromRawData](id3v2commentsframe.md#fromrawdata) - -## Properties - -### \_header - -• `Protected` **\_header**: [`Id3v2FrameHeader`](id3v2frameheader.md) - -#### Inherited from - -[Id3v2Frame](id3v2frame.md).[_header](id3v2frame.md#_header) +- [clone](Id3v2CommentsFrame.md#clone) +- [fieldData](Id3v2CommentsFrame.md#fielddata) +- [parseFields](Id3v2CommentsFrame.md#parsefields) +- [render](Id3v2CommentsFrame.md#render) +- [renderFields](Id3v2CommentsFrame.md#renderfields) +- [setData](Id3v2CommentsFrame.md#setdata) +- [toString](Id3v2CommentsFrame.md#tostring) +- [correctEncoding](Id3v2CommentsFrame.md#correctencoding) +- [find](Id3v2CommentsFrame.md#find) +- [findAll](Id3v2CommentsFrame.md#findall) +- [findPreferred](Id3v2CommentsFrame.md#findpreferred) +- [fromDescription](Id3v2CommentsFrame.md#fromdescription) +- [fromOffsetRawData](Id3v2CommentsFrame.md#fromoffsetrawdata) +- [fromRawData](Id3v2CommentsFrame.md#fromrawdata) ## Accessors @@ -104,6 +91,10 @@ Gets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + • `set` **encryptionId**(`value`): `void` Sets the encryption ID applied to the current instance. @@ -121,60 +112,80 @@ Sets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + ___ ### flags -• `get` **flags**(): [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +• `get` **flags**(): [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) Gets the frame flags applied to the current instance. #### Returns -[`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +[`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) + +#### Inherited from + +Frame.flags • `set` **flags**(`value`): `void` Sets the frame flags applied to the current instance. -If the value includes either [Id3v2FrameFlags.Encryption](../enums/id3v2frameflags.md#encryption) or -[Id3v2FrameFlags.Compression](../enums/id3v2frameflags.md#compression), [render](id3v2commentsframe.md#render) will throw. +If the value includes either [Id3v2FrameFlags.Encryption](../enums/Id3v2FrameFlags.md#encryption) or +[Id3v2FrameFlags.Compression](../enums/Id3v2FrameFlags.md#compression), [render](Id3v2CommentsFrame.md#render) will throw. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) | +| `value` | [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) | #### Returns `void` +#### Inherited from + +Frame.flags + ___ ### frameClassType -• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) **`inheritdoc`** #### Returns -[`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +[`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) + +#### Overrides + +Frame.frameClassType ___ ### frameId -• `get` **frameId**(): [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +• `get` **frameId**(): [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) Gets the frame ID for the current instance. #### Returns -[`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +[`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) FrameIdentifier Object representing of the identifier of the frame +#### Inherited from + +Frame.frameId + ___ ### groupId @@ -190,6 +201,10 @@ Gets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + • `set` **groupId**(`value`): `void` Sets the grouping ID applied to the current instance. @@ -207,6 +222,44 @@ Sets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + +___ + +### header + +• `Protected` `get` **header**(): [`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +Gets the header for the frame. For new frames this should not exist. + +#### Returns + +[`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +#### Inherited from + +Frame.header + +• `Protected` `set` **header**(`value`): `void` + +Sets the header for the frame. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header for the frame | + +#### Returns + +`void` + +#### Inherited from + +Frame.header + ___ ### language @@ -247,6 +300,10 @@ NOTE: This value is not used outside of reading a frame from disk, so newly crea `number` +#### Inherited from + +Frame.size + ___ ### text @@ -277,13 +334,13 @@ ___ ### textEncoding -• `get` **textEncoding**(): [`StringType`](../enums/stringtype.md) +• `get` **textEncoding**(): [`StringType`](../enums/StringType.md) Gets the text encoding to use when storing the current instance. #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) • `set` **textEncoding**(`value`): `void` @@ -293,7 +350,7 @@ Sets the text encoding to use when storing the current instance. | Name | Type | Description | | :------ | :------ | :------ | -| `value` | [`StringType`](../enums/stringtype.md) | Text encoding to use when storing the current instance | +| `value` | [`StringType`](../enums/StringType.md) | Text encoding to use when storing the current instance | #### Returns @@ -303,7 +360,7 @@ Sets the text encoding to use when storing the current instance. ### clone -▸ **clone**(): [`Id3v2Frame`](id3v2frame.md) +▸ **clone**(): [`Id3v2Frame`](Id3v2Frame.md) Creates a deep copy of the current instance. This method is implemented by rendering the current instance as an ID3v2.4 frame and using @@ -312,17 +369,17 @@ classes. #### Returns -[`Id3v2Frame`](id3v2frame.md) +[`Id3v2Frame`](Id3v2Frame.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[clone](id3v2frame.md#clone) +[Id3v2Frame](Id3v2Frame.md).[clone](Id3v2Frame.md#clone) ___ ### fieldData -▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](bytevector.md) +▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](ByteVector.md) Extracts the field data from the raw portion of an ID3v2 frame. This method is necessary for extracting extra data prepended to the frame such the as @@ -332,24 +389,24 @@ grouping ID. | Name | Type | Description | | :------ | :------ | :------ | -| `frameData` | [`ByteVector`](bytevector.md) | Raw frame data | +| `frameData` | [`ByteVector`](ByteVector.md) | Raw frame data | | `offset` | `number` | Index at which the data is contained | | `version` | `number` | Version of the ID3v2 tag the data was originally encoded with | | `dataIncludesHeader` | `boolean` | `true` if `frameData` includes the header, `false` otherwise | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[fieldData](id3v2frame.md#fielddata) +[Id3v2Frame](Id3v2Frame.md).[fieldData](Id3v2Frame.md#fielddata) ___ ### parseFields -▸ `Protected` **parseFields**(`data`, `_version`): `void` +▸ `Protected` **parseFields**(`data`): `void` Populates the values in this frame by parsing its field data in a specified version. @@ -357,8 +414,7 @@ Populates the values in this frame by parsing its field data in a specified vers | Name | Type | | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | -| `_version` | `number` | +| `data` | [`ByteVector`](ByteVector.md) | #### Returns @@ -366,13 +422,13 @@ Populates the values in this frame by parsing its field data in a specified vers #### Overrides -[Id3v2Frame](id3v2frame.md).[parseFields](id3v2frame.md#parsefields) +[Id3v2Frame](Id3v2Frame.md).[parseFields](Id3v2Frame.md#parsefields) ___ ### render -▸ **render**(`version`): [`ByteVector`](bytevector.md) +▸ **render**(`version`): [`ByteVector`](ByteVector.md) Renders the current instance, encoded in a specified ID3v2 version. @@ -384,17 +440,17 @@ Renders the current instance, encoded in a specified ID3v2 version. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[render](id3v2frame.md#render) +[Id3v2Frame](Id3v2Frame.md).[render](Id3v2Frame.md#render) ___ ### renderFields -▸ `Protected` **renderFields**(`version`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderFields**(`version`): [`ByteVector`](ByteVector.md) Renders the values in the current instance into field data for a specified version. @@ -406,11 +462,11 @@ Renders the values in the current instance into field data for a specified versi #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[renderFields](id3v2frame.md#renderfields) +[Id3v2Frame](Id3v2Frame.md).[renderFields](Id3v2Frame.md#renderfields) ___ @@ -425,7 +481,7 @@ header. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw ID3v2 frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw ID3v2 frame | | `offset` | `number` | Offset in `data` at which the frame begins. | | `readHeader` | `boolean` | Whether or not to read the reader into the current instance. | | `version` | `number` | Version of the ID3v2 tag the data was encoded with | @@ -436,7 +492,7 @@ header. #### Inherited from -[Id3v2Frame](id3v2frame.md).[setData](id3v2frame.md#setdata) +[Id3v2Frame](Id3v2Frame.md).[setData](Id3v2Frame.md#setdata) ___ @@ -456,7 +512,7 @@ ___ ### correctEncoding -▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/stringtype.md) +▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/StringType.md) Converts an encoding to be a supported encoding for a specified tag version. @@ -464,26 +520,26 @@ Converts an encoding to be a supported encoding for a specified tag version. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`StringType`](../enums/stringtype.md) | Value containing the original encoding | +| `type` | [`StringType`](../enums/StringType.md) | Value containing the original encoding | | `version` | `number` | Value containing the ID3v2 version to be encoded. | #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) StringType Value containing the correct encoding to use, based on - [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) and what is supported by + [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) and what is supported by `version` #### Inherited from -[Id3v2Frame](id3v2frame.md).[correctEncoding](id3v2frame.md#correctencoding) +[Id3v2Frame](Id3v2Frame.md).[correctEncoding](Id3v2Frame.md#correctencoding) ___ ### find -▸ `Static` **find**(`frames`, `description`, `language?`): [`Id3v2CommentsFrame`](id3v2commentsframe.md) +▸ `Static` **find**(`frames`, `description`, `language?`): [`Id3v2CommentsFrame`](Id3v2CommentsFrame.md) Gets a comment frame that matched the provided parameters from the list of frames @@ -491,13 +547,13 @@ Gets a comment frame that matched the provided parameters from the list of frame | Name | Type | Description | | :------ | :------ | :------ | -| `frames` | [`Id3v2CommentsFrame`](id3v2commentsframe.md)[] | Frames to search for best matching frame | +| `frames` | [`Id3v2CommentsFrame`](Id3v2CommentsFrame.md)[] | Frames to search for best matching frame | | `description` | `string` | Description of the comments frame to match | | `language?` | `string` | Optional, ISO-639-2 language code to match | #### Returns -[`Id3v2CommentsFrame`](id3v2commentsframe.md) +[`Id3v2CommentsFrame`](Id3v2CommentsFrame.md) CommentsFrame Object containing the matching frame or `undefined` if a match was not found @@ -506,7 +562,7 @@ ___ ### findAll -▸ `Static` **findAll**(`frames`, `description`, `language?`): [`Id3v2CommentsFrame`](id3v2commentsframe.md)[] +▸ `Static` **findAll**(`frames`, `description`, `language?`): [`Id3v2CommentsFrame`](Id3v2CommentsFrame.md)[] Gets all comment frames that match the provided parameters from the list of frames @@ -514,13 +570,13 @@ Gets all comment frames that match the provided parameters from the list of fram | Name | Type | Description | | :------ | :------ | :------ | -| `frames` | [`Id3v2CommentsFrame`](id3v2commentsframe.md)[] | Frames to search | +| `frames` | [`Id3v2CommentsFrame`](Id3v2CommentsFrame.md)[] | Frames to search | | `description` | `string` | Description of the comments frame to match | | `language?` | `string` | Optional, ISO-639-2 language code to match | #### Returns -[`Id3v2CommentsFrame`](id3v2commentsframe.md)[] +[`Id3v2CommentsFrame`](Id3v2CommentsFrame.md)[] CommentsFrame[] Array of comments frames that match the provided parameters or an empty array if none were found @@ -529,7 +585,7 @@ ___ ### findPreferred -▸ `Static` **findPreferred**(`frames`, `description`, `language?`): [`Id3v2CommentsFrame`](id3v2commentsframe.md) +▸ `Static` **findPreferred**(`frames`, `description`, `language?`): [`Id3v2CommentsFrame`](Id3v2CommentsFrame.md) Gets a specified comments frame from the specified tag, trying to match the description and language but accepting an incomplete match. @@ -543,39 +599,39 @@ The method tries matching with the following order of precedence: | Name | Type | Description | | :------ | :------ | :------ | -| `frames` | [`Id3v2CommentsFrame`](id3v2commentsframe.md)[] | Frames to search for best matching frame | +| `frames` | [`Id3v2CommentsFrame`](Id3v2CommentsFrame.md)[] | Frames to search for best matching frame | | `description` | `string` | Description to match | | `language?` | `string` | ISO-639-2 language code to match | #### Returns -[`Id3v2CommentsFrame`](id3v2commentsframe.md) +[`Id3v2CommentsFrame`](Id3v2CommentsFrame.md) ___ ### fromDescription -▸ `Static` **fromDescription**(`description`, `language?`, `encoding?`): [`Id3v2CommentsFrame`](id3v2commentsframe.md) +▸ `Static` **fromDescription**(`description`, `language?`, `encoding?`): [`Id3v2CommentsFrame`](Id3v2CommentsFrame.md) Constructs and initializes a new CommentsFrame from a description #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `description` | `string` | Description of the new frame | -| `language?` | `string` | Optional, ISO-639-2 language code for the new frame | -| `encoding` | [`StringType`](../enums/stringtype.md) | Optional, text encoding to use when rendering the new frame | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `description` | `string` | `undefined` | Description of the new frame | +| `language?` | `string` | `undefined` | Optional, ISO-639-2 language code for the new frame | +| `encoding` | [`StringType`](../enums/StringType.md) | `Id3v2Settings.defaultEncoding` | Optional, text encoding to use when rendering the new frame | #### Returns -[`Id3v2CommentsFrame`](id3v2commentsframe.md) +[`Id3v2CommentsFrame`](Id3v2CommentsFrame.md) ___ ### fromOffsetRawData -▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2CommentsFrame`](id3v2commentsframe.md) +▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2CommentsFrame`](Id3v2CommentsFrame.md) Constructs and initializes a new CommentsFrame by reading its raw data in a specified ID3v2 version. This method allows for offset reading from the data byte vector. @@ -584,20 +640,20 @@ version. This method allows for offset reading from the data byte vector. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `offset` | `number` | What offset in `data` the frame actually begins. Must be positive, safe integer | -| `header` | [`Id3v2FrameHeader`](id3v2frameheader.md) | Header of the frame found at `data` in the data | +| `header` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header of the frame found at `data` in the data | | `version` | `number` | ID3v2 version the frame was originally encoded with | #### Returns -[`Id3v2CommentsFrame`](id3v2commentsframe.md) +[`Id3v2CommentsFrame`](Id3v2CommentsFrame.md) ___ ### fromRawData -▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2CommentsFrame`](id3v2commentsframe.md) +▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2CommentsFrame`](Id3v2CommentsFrame.md) Constructs and initializes a new CommentsFrame by reading its raw data in a specified ID3v2 version. @@ -606,9 +662,9 @@ ID3v2 version. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | -| `version` | `number` | ID3v2 version the frame was originally encoded with | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | +| `version` | `number` | ID3v2 version the raw frame is encoded with, must be a positive 8-bit integer | #### Returns -[`Id3v2CommentsFrame`](id3v2commentsframe.md) +[`Id3v2CommentsFrame`](Id3v2CommentsFrame.md) diff --git a/docs/classes/id3v2eventtimecode.md b/docs/classes/Id3v2EventTimeCode.md similarity index 51% rename from docs/classes/id3v2eventtimecode.md rename to docs/classes/Id3v2EventTimeCode.md index df09bf32..fea3b100 100644 --- a/docs/classes/id3v2eventtimecode.md +++ b/docs/classes/Id3v2EventTimeCode.md @@ -6,18 +6,18 @@ ### Constructors -- [constructor](id3v2eventtimecode.md#constructor) +- [constructor](Id3v2EventTimeCode.md#constructor) ### Accessors -- [eventType](id3v2eventtimecode.md#eventtype) -- [time](id3v2eventtimecode.md#time) +- [eventType](Id3v2EventTimeCode.md#eventtype) +- [time](Id3v2EventTimeCode.md#time) ### Methods -- [clone](id3v2eventtimecode.md#clone) -- [render](id3v2eventtimecode.md#render) -- [fromEmpty](id3v2eventtimecode.md#fromempty) +- [clone](Id3v2EventTimeCode.md#clone) +- [render](Id3v2EventTimeCode.md#render) +- [fromEmpty](Id3v2EventTimeCode.md#fromempty) ## Constructors @@ -29,18 +29,18 @@ | Name | Type | | :------ | :------ | -| `eventType` | [`Id3v2EventType`](../enums/id3v2eventtype.md) | +| `eventType` | [`Id3v2EventType`](../enums/Id3v2EventType.md) | | `time` | `number` | ## Accessors ### eventType -• `get` **eventType**(): [`Id3v2EventType`](../enums/id3v2eventtype.md) +• `get` **eventType**(): [`Id3v2EventType`](../enums/Id3v2EventType.md) #### Returns -[`Id3v2EventType`](../enums/id3v2eventtype.md) +[`Id3v2EventType`](../enums/Id3v2EventType.md) • `set` **eventType**(`value`): `void` @@ -48,7 +48,7 @@ | Name | Type | | :------ | :------ | -| `value` | [`Id3v2EventType`](../enums/id3v2eventtype.md) | +| `value` | [`Id3v2EventType`](../enums/Id3v2EventType.md) | #### Returns @@ -80,30 +80,30 @@ ___ ### clone -▸ **clone**(): [`Id3v2EventTimeCode`](id3v2eventtimecode.md) +▸ **clone**(): [`Id3v2EventTimeCode`](Id3v2EventTimeCode.md) Creates a copy of this instance #### Returns -[`Id3v2EventTimeCode`](id3v2eventtimecode.md) +[`Id3v2EventTimeCode`](Id3v2EventTimeCode.md) ___ ### render -▸ **render**(): [`ByteVector`](bytevector.md) +▸ **render**(): [`ByteVector`](ByteVector.md) #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ___ ### fromEmpty -▸ `Static` **fromEmpty**(): [`Id3v2EventTimeCode`](id3v2eventtimecode.md) +▸ `Static` **fromEmpty**(): [`Id3v2EventTimeCode`](Id3v2EventTimeCode.md) #### Returns -[`Id3v2EventTimeCode`](id3v2eventtimecode.md) +[`Id3v2EventTimeCode`](Id3v2EventTimeCode.md) diff --git a/docs/classes/id3v2eventtimecodeframe.md b/docs/classes/Id3v2EventTimeCodeFrame.md similarity index 60% rename from docs/classes/id3v2eventtimecodeframe.md rename to docs/classes/Id3v2EventTimeCodeFrame.md index ce64c236..1cffaa7d 100644 --- a/docs/classes/id3v2eventtimecodeframe.md +++ b/docs/classes/Id3v2EventTimeCodeFrame.md @@ -4,50 +4,37 @@ ## Hierarchy -- [`Id3v2Frame`](id3v2frame.md) +- [`Id3v2Frame`](Id3v2Frame.md) ↳ **`Id3v2EventTimeCodeFrame`** ## Table of contents -### Properties - -- [\_header](id3v2eventtimecodeframe.md#_header) - ### Accessors -- [encryptionId](id3v2eventtimecodeframe.md#encryptionid) -- [events](id3v2eventtimecodeframe.md#events) -- [flags](id3v2eventtimecodeframe.md#flags) -- [frameClassType](id3v2eventtimecodeframe.md#frameclasstype) -- [frameId](id3v2eventtimecodeframe.md#frameid) -- [groupId](id3v2eventtimecodeframe.md#groupid) -- [size](id3v2eventtimecodeframe.md#size) -- [timestampFormat](id3v2eventtimecodeframe.md#timestampformat) +- [encryptionId](Id3v2EventTimeCodeFrame.md#encryptionid) +- [events](Id3v2EventTimeCodeFrame.md#events) +- [flags](Id3v2EventTimeCodeFrame.md#flags) +- [frameClassType](Id3v2EventTimeCodeFrame.md#frameclasstype) +- [frameId](Id3v2EventTimeCodeFrame.md#frameid) +- [groupId](Id3v2EventTimeCodeFrame.md#groupid) +- [header](Id3v2EventTimeCodeFrame.md#header) +- [size](Id3v2EventTimeCodeFrame.md#size) +- [timestampFormat](Id3v2EventTimeCodeFrame.md#timestampformat) ### Methods -- [clone](id3v2eventtimecodeframe.md#clone) -- [fieldData](id3v2eventtimecodeframe.md#fielddata) -- [parseFields](id3v2eventtimecodeframe.md#parsefields) -- [render](id3v2eventtimecodeframe.md#render) -- [renderFields](id3v2eventtimecodeframe.md#renderfields) -- [setData](id3v2eventtimecodeframe.md#setdata) -- [correctEncoding](id3v2eventtimecodeframe.md#correctencoding) -- [fromEmpty](id3v2eventtimecodeframe.md#fromempty) -- [fromOffsetRawData](id3v2eventtimecodeframe.md#fromoffsetrawdata) -- [fromRawData](id3v2eventtimecodeframe.md#fromrawdata) -- [fromTimestampFormat](id3v2eventtimecodeframe.md#fromtimestampformat) - -## Properties - -### \_header - -• `Protected` **\_header**: [`Id3v2FrameHeader`](id3v2frameheader.md) - -#### Inherited from - -[Id3v2Frame](id3v2frame.md).[_header](id3v2frame.md#_header) +- [clone](Id3v2EventTimeCodeFrame.md#clone) +- [fieldData](Id3v2EventTimeCodeFrame.md#fielddata) +- [parseFields](Id3v2EventTimeCodeFrame.md#parsefields) +- [render](Id3v2EventTimeCodeFrame.md#render) +- [renderFields](Id3v2EventTimeCodeFrame.md#renderfields) +- [setData](Id3v2EventTimeCodeFrame.md#setdata) +- [correctEncoding](Id3v2EventTimeCodeFrame.md#correctencoding) +- [fromEmpty](Id3v2EventTimeCodeFrame.md#fromempty) +- [fromOffsetRawData](Id3v2EventTimeCodeFrame.md#fromoffsetrawdata) +- [fromRawData](Id3v2EventTimeCodeFrame.md#fromrawdata) +- [fromTimestampFormat](Id3v2EventTimeCodeFrame.md#fromtimestampformat) ## Accessors @@ -64,6 +51,10 @@ Gets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + • `set` **encryptionId**(`value`): `void` Sets the encryption ID applied to the current instance. @@ -81,18 +72,22 @@ Sets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + ___ ### events -• `get` **events**(): [`Id3v2EventTimeCode`](id3v2eventtimecode.md)[] +• `get` **events**(): [`Id3v2EventTimeCode`](Id3v2EventTimeCode.md)[] Gets the event this frame contains. Each {@link EventTimeCode} represents a single event at a certain point in time. #### Returns -[`Id3v2EventTimeCode`](id3v2eventtimecode.md)[] +[`Id3v2EventTimeCode`](Id3v2EventTimeCode.md)[] • `set` **events**(`value`): `void` @@ -102,7 +97,7 @@ Sets the event this frame contains | Name | Type | | :------ | :------ | -| `value` | [`Id3v2EventTimeCode`](id3v2eventtimecode.md)[] | +| `value` | [`Id3v2EventTimeCode`](Id3v2EventTimeCode.md)[] | #### Returns @@ -112,56 +107,72 @@ ___ ### flags -• `get` **flags**(): [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +• `get` **flags**(): [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) Gets the frame flags applied to the current instance. #### Returns -[`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +[`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) + +#### Inherited from + +Frame.flags • `set` **flags**(`value`): `void` Sets the frame flags applied to the current instance. -If the value includes either [Id3v2FrameFlags.Encryption](../enums/id3v2frameflags.md#encryption) or -[Id3v2FrameFlags.Compression](../enums/id3v2frameflags.md#compression), [render](id3v2eventtimecodeframe.md#render) will throw. +If the value includes either [Id3v2FrameFlags.Encryption](../enums/Id3v2FrameFlags.md#encryption) or +[Id3v2FrameFlags.Compression](../enums/Id3v2FrameFlags.md#compression), [render](Id3v2EventTimeCodeFrame.md#render) will throw. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) | +| `value` | [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) | #### Returns `void` +#### Inherited from + +Frame.flags + ___ ### frameClassType -• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) **`inheritdoc`** #### Returns -[`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +[`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) + +#### Overrides + +Frame.frameClassType ___ ### frameId -• `get` **frameId**(): [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +• `get` **frameId**(): [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) Gets the frame ID for the current instance. #### Returns -[`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +[`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) FrameIdentifier Object representing of the identifier of the frame +#### Inherited from + +Frame.frameId + ___ ### groupId @@ -177,6 +188,10 @@ Gets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + • `set` **groupId**(`value`): `void` Sets the grouping ID applied to the current instance. @@ -194,6 +209,44 @@ Sets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + +___ + +### header + +• `Protected` `get` **header**(): [`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +Gets the header for the frame. For new frames this should not exist. + +#### Returns + +[`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +#### Inherited from + +Frame.header + +• `Protected` `set` **header**(`value`): `void` + +Sets the header for the frame. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header for the frame | + +#### Returns + +`void` + +#### Inherited from + +Frame.header + ___ ### size @@ -208,17 +261,21 @@ NOTE: This value is not used outside of reading a frame from disk, so newly crea `number` +#### Inherited from + +Frame.size + ___ ### timestampFormat -• `get` **timestampFormat**(): [`Id3v2TimestampFormat`](../enums/id3v2timestampformat.md) +• `get` **timestampFormat**(): [`Id3v2TimestampFormat`](../enums/Id3v2TimestampFormat.md) Gets the format of timestamps in this frame instance #### Returns -[`Id3v2TimestampFormat`](../enums/id3v2timestampformat.md) +[`Id3v2TimestampFormat`](../enums/Id3v2TimestampFormat.md) • `set` **timestampFormat**(`value`): `void` @@ -228,7 +285,7 @@ Sets the format of timestamps in this frame instance | Name | Type | | :------ | :------ | -| `value` | [`Id3v2TimestampFormat`](../enums/id3v2timestampformat.md) | +| `value` | [`Id3v2TimestampFormat`](../enums/Id3v2TimestampFormat.md) | #### Returns @@ -238,7 +295,7 @@ Sets the format of timestamps in this frame instance ### clone -▸ **clone**(): [`Id3v2Frame`](id3v2frame.md) +▸ **clone**(): [`Id3v2Frame`](Id3v2Frame.md) Creates a deep copy of the current instance. This method is implemented by rendering the current instance as an ID3v2.4 frame and using @@ -247,17 +304,17 @@ classes. #### Returns -[`Id3v2Frame`](id3v2frame.md) +[`Id3v2Frame`](Id3v2Frame.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[clone](id3v2frame.md#clone) +[Id3v2Frame](Id3v2Frame.md).[clone](Id3v2Frame.md#clone) ___ ### fieldData -▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](bytevector.md) +▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](ByteVector.md) Extracts the field data from the raw portion of an ID3v2 frame. This method is necessary for extracting extra data prepended to the frame such the as @@ -267,33 +324,32 @@ grouping ID. | Name | Type | Description | | :------ | :------ | :------ | -| `frameData` | [`ByteVector`](bytevector.md) | Raw frame data | +| `frameData` | [`ByteVector`](ByteVector.md) | Raw frame data | | `offset` | `number` | Index at which the data is contained | | `version` | `number` | Version of the ID3v2 tag the data was originally encoded with | | `dataIncludesHeader` | `boolean` | `true` if `frameData` includes the header, `false` otherwise | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[fieldData](id3v2frame.md#fielddata) +[Id3v2Frame](Id3v2Frame.md).[fieldData](Id3v2Frame.md#fielddata) ___ ### parseFields -▸ `Protected` **parseFields**(`data`, `_version`): `void` +▸ `Protected` **parseFields**(`data`): `void` Populates the values in this frame by parsing its field data in a specified version. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Extracted field data | -| `_version` | `number` | ID3v2 version the field data is encoded in | +| Name | Type | +| :------ | :------ | +| `data` | [`ByteVector`](ByteVector.md) | #### Returns @@ -301,13 +357,13 @@ Populates the values in this frame by parsing its field data in a specified vers #### Overrides -[Id3v2Frame](id3v2frame.md).[parseFields](id3v2frame.md#parsefields) +[Id3v2Frame](Id3v2Frame.md).[parseFields](Id3v2Frame.md#parsefields) ___ ### render -▸ **render**(`version`): [`ByteVector`](bytevector.md) +▸ **render**(`version`): [`ByteVector`](ByteVector.md) Renders the current instance, encoded in a specified ID3v2 version. @@ -319,33 +375,27 @@ Renders the current instance, encoded in a specified ID3v2 version. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[render](id3v2frame.md#render) +[Id3v2Frame](Id3v2Frame.md).[render](Id3v2Frame.md#render) ___ ### renderFields -▸ `Protected` **renderFields**(`_version`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderFields**(): [`ByteVector`](ByteVector.md) Renders the values in the current instance into field data for a specified version. -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `_version` | `number` | ID3v2 version the field data is to be encoded in. | - #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[renderFields](id3v2frame.md#renderfields) +[Id3v2Frame](Id3v2Frame.md).[renderFields](Id3v2Frame.md#renderfields) ___ @@ -360,7 +410,7 @@ header. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw ID3v2 frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw ID3v2 frame | | `offset` | `number` | Offset in `data` at which the frame begins. | | `readHeader` | `boolean` | Whether or not to read the reader into the current instance. | | `version` | `number` | Version of the ID3v2 tag the data was encoded with | @@ -371,13 +421,13 @@ header. #### Inherited from -[Id3v2Frame](id3v2frame.md).[setData](id3v2frame.md#setdata) +[Id3v2Frame](Id3v2Frame.md).[setData](Id3v2Frame.md#setdata) ___ ### correctEncoding -▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/stringtype.md) +▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/StringType.md) Converts an encoding to be a supported encoding for a specified tag version. @@ -385,38 +435,38 @@ Converts an encoding to be a supported encoding for a specified tag version. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`StringType`](../enums/stringtype.md) | Value containing the original encoding | +| `type` | [`StringType`](../enums/StringType.md) | Value containing the original encoding | | `version` | `number` | Value containing the ID3v2 version to be encoded. | #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) StringType Value containing the correct encoding to use, based on - [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) and what is supported by + [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) and what is supported by `version` #### Inherited from -[Id3v2Frame](id3v2frame.md).[correctEncoding](id3v2frame.md#correctencoding) +[Id3v2Frame](Id3v2Frame.md).[correctEncoding](Id3v2Frame.md#correctencoding) ___ ### fromEmpty -▸ `Static` **fromEmpty**(): [`Id3v2EventTimeCodeFrame`](id3v2eventtimecodeframe.md) +▸ `Static` **fromEmpty**(): [`Id3v2EventTimeCodeFrame`](Id3v2EventTimeCodeFrame.md) Constructs and initializes a new instance without contents #### Returns -[`Id3v2EventTimeCodeFrame`](id3v2eventtimecodeframe.md) +[`Id3v2EventTimeCodeFrame`](Id3v2EventTimeCodeFrame.md) ___ ### fromOffsetRawData -▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2EventTimeCodeFrame`](id3v2eventtimecodeframe.md) +▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2EventTimeCodeFrame`](Id3v2EventTimeCodeFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. This method allows for offset reading from the data byte vector. @@ -425,20 +475,20 @@ version. This method allows for offset reading from the data byte vector. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `offset` | `number` | What offset in `data` the frame actually begins. Must be positive, safe integer | -| `header` | [`Id3v2FrameHeader`](id3v2frameheader.md) | Header of the frame found at `data` in the data | +| `header` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header of the frame found at `data` in the data | | `version` | `number` | ID3v2 version the frame was originally encoded with | #### Returns -[`Id3v2EventTimeCodeFrame`](id3v2eventtimecodeframe.md) +[`Id3v2EventTimeCodeFrame`](Id3v2EventTimeCodeFrame.md) ___ ### fromRawData -▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2EventTimeCodeFrame`](id3v2eventtimecodeframe.md) +▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2EventTimeCodeFrame`](Id3v2EventTimeCodeFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. @@ -447,18 +497,18 @@ ID3v2 version. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `version` | `number` | ID3v2 version the raw frame is encoded with, must be a positive 8-bit integer | #### Returns -[`Id3v2EventTimeCodeFrame`](id3v2eventtimecodeframe.md) +[`Id3v2EventTimeCodeFrame`](Id3v2EventTimeCodeFrame.md) ___ ### fromTimestampFormat -▸ `Static` **fromTimestampFormat**(`timestampFormat`): [`Id3v2EventTimeCodeFrame`](id3v2eventtimecodeframe.md) +▸ `Static` **fromTimestampFormat**(`timestampFormat`): [`Id3v2EventTimeCodeFrame`](Id3v2EventTimeCodeFrame.md) Constructs and initializes a timestamp format set @@ -466,8 +516,8 @@ Constructs and initializes a timestamp format set | Name | Type | Description | | :------ | :------ | :------ | -| `timestampFormat` | [`Id3v2TimestampFormat`](../enums/id3v2timestampformat.md) | Timestamp format for the event codes stored in this frame | +| `timestampFormat` | [`Id3v2TimestampFormat`](../enums/Id3v2TimestampFormat.md) | Timestamp format for the event codes stored in this frame | #### Returns -[`Id3v2EventTimeCodeFrame`](id3v2eventtimecodeframe.md) +[`Id3v2EventTimeCodeFrame`](Id3v2EventTimeCodeFrame.md) diff --git a/docs/classes/id3v2extendedheader.md b/docs/classes/Id3v2ExtendedHeader.md similarity index 65% rename from docs/classes/id3v2extendedheader.md rename to docs/classes/Id3v2ExtendedHeader.md index 608ce141..55ef3f8e 100644 --- a/docs/classes/id3v2extendedheader.md +++ b/docs/classes/Id3v2ExtendedHeader.md @@ -6,13 +6,13 @@ ### Accessors -- [size](id3v2extendedheader.md#size) +- [size](Id3v2ExtendedHeader.md#size) ### Methods -- [parse](id3v2extendedheader.md#parse) -- [fromData](id3v2extendedheader.md#fromdata) -- [fromEmpty](id3v2extendedheader.md#fromempty) +- [parse](Id3v2ExtendedHeader.md#parse) +- [fromData](Id3v2ExtendedHeader.md#fromdata) +- [fromEmpty](Id3v2ExtendedHeader.md#fromempty) ## Accessors @@ -36,7 +36,7 @@ Gets the size of the data on disk in bytes. | Name | Type | | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | +| `data` | [`ByteVector`](ByteVector.md) | | `version` | `number` | #### Returns @@ -47,7 +47,7 @@ ___ ### fromData -▸ `Static` **fromData**(`data`, `version`): [`Id3v2ExtendedHeader`](id3v2extendedheader.md) +▸ `Static` **fromData**(`data`, `version`): [`Id3v2ExtendedHeader`](Id3v2ExtendedHeader.md) Constructs and initializes a new instance by reading the raw contents. @@ -55,21 +55,21 @@ Constructs and initializes a new instance by reading the raw contents. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw extended header structure | +| `data` | [`ByteVector`](ByteVector.md) | Raw extended header structure | | `version` | `number` | ID3v2 version. Must be an unsigned 8-bit integer. | #### Returns -[`Id3v2ExtendedHeader`](id3v2extendedheader.md) +[`Id3v2ExtendedHeader`](Id3v2ExtendedHeader.md) ___ ### fromEmpty -▸ `Static` **fromEmpty**(): [`Id3v2ExtendedHeader`](id3v2extendedheader.md) +▸ `Static` **fromEmpty**(): [`Id3v2ExtendedHeader`](Id3v2ExtendedHeader.md) Constructs and initializes a new instance with no contents. #### Returns -[`Id3v2ExtendedHeader`](id3v2extendedheader.md) +[`Id3v2ExtendedHeader`](Id3v2ExtendedHeader.md) diff --git a/docs/classes/id3v2frame.md b/docs/classes/Id3v2Frame.md similarity index 63% rename from docs/classes/id3v2frame.md rename to docs/classes/Id3v2Frame.md index bcae862c..0f110d7c 100644 --- a/docs/classes/id3v2frame.md +++ b/docs/classes/Id3v2Frame.md @@ -6,64 +6,61 @@ - **`Id3v2Frame`** - ↳ [`Id3v2AttachmentFrame`](id3v2attachmentframe.md) + ↳ [`Id3v2AttachmentFrame`](Id3v2AttachmentFrame.md) - ↳ [`Id3v2CommentsFrame`](id3v2commentsframe.md) + ↳ [`Id3v2CommentsFrame`](Id3v2CommentsFrame.md) - ↳ [`Id3v2EventTimeCodeFrame`](id3v2eventtimecodeframe.md) + ↳ [`Id3v2EventTimeCodeFrame`](Id3v2EventTimeCodeFrame.md) - ↳ [`Id3v2MusicCdIdentifierFrame`](id3v2musiccdidentifierframe.md) + ↳ [`Id3v2MusicCdIdentifierFrame`](Id3v2MusicCdIdentifierFrame.md) - ↳ [`Id3v2PlayCountFrame`](id3v2playcountframe.md) + ↳ [`Id3v2PlayCountFrame`](Id3v2PlayCountFrame.md) - ↳ [`Id3v2PopularimeterFrame`](id3v2popularimeterframe.md) + ↳ [`Id3v2PopularimeterFrame`](Id3v2PopularimeterFrame.md) - ↳ [`Id3v2PrivateFrame`](id3v2privateframe.md) + ↳ [`Id3v2PrivateFrame`](Id3v2PrivateFrame.md) - ↳ [`Id3v2RelativeVolumeFrame`](id3v2relativevolumeframe.md) + ↳ [`Id3v2RelativeVolumeFrame`](Id3v2RelativeVolumeFrame.md) - ↳ [`Id3v2Synchronized`](id3v2synchronized.md) + ↳ [`Id3v2Synchronized`](Id3v2Synchronized.md) - ↳ [`Id3v2TermsOfUseFrame`](id3v2termsofuseframe.md) + ↳ [`Id3v2TermsOfUseFrame`](Id3v2TermsOfUseFrame.md) - ↳ [`Id3v2TextInformationFrame`](id3v2textinformationframe.md) + ↳ [`Id3v2TextInformationFrame`](Id3v2TextInformationFrame.md) - ↳ [`Id3v2UniqueFileIdentifierFrame`](id3v2uniquefileidentifierframe.md) + ↳ [`Id3v2UniqueFileIdentifierFrame`](Id3v2UniqueFileIdentifierFrame.md) - ↳ [`Id3v2UnknownFrame`](id3v2unknownframe.md) + ↳ [`Id3v2UnknownFrame`](Id3v2UnknownFrame.md) - ↳ [`Id3v2UnsynchronizedFrame`](id3v2unsynchronizedframe.md) + ↳ [`Id3v2UnsynchronizedFrame`](Id3v2UnsynchronizedFrame.md) - ↳ [`Id3v2UrlLinkFrame`](id3v2urllinkframe.md) + ↳ [`Id3v2UrlLinkFrame`](Id3v2UrlLinkFrame.md) ## Table of contents ### Constructors -- [constructor](id3v2frame.md#constructor) - -### Properties - -- [\_header](id3v2frame.md#_header) +- [constructor](Id3v2Frame.md#constructor) ### Accessors -- [encryptionId](id3v2frame.md#encryptionid) -- [flags](id3v2frame.md#flags) -- [frameClassType](id3v2frame.md#frameclasstype) -- [frameId](id3v2frame.md#frameid) -- [groupId](id3v2frame.md#groupid) -- [size](id3v2frame.md#size) +- [encryptionId](Id3v2Frame.md#encryptionid) +- [flags](Id3v2Frame.md#flags) +- [frameClassType](Id3v2Frame.md#frameclasstype) +- [frameId](Id3v2Frame.md#frameid) +- [groupId](Id3v2Frame.md#groupid) +- [header](Id3v2Frame.md#header) +- [size](Id3v2Frame.md#size) ### Methods -- [clone](id3v2frame.md#clone) -- [fieldData](id3v2frame.md#fielddata) -- [parseFields](id3v2frame.md#parsefields) -- [render](id3v2frame.md#render) -- [renderFields](id3v2frame.md#renderfields) -- [setData](id3v2frame.md#setdata) -- [correctEncoding](id3v2frame.md#correctencoding) +- [clone](Id3v2Frame.md#clone) +- [fieldData](Id3v2Frame.md#fielddata) +- [parseFields](Id3v2Frame.md#parsefields) +- [render](Id3v2Frame.md#render) +- [renderFields](Id3v2Frame.md#renderfields) +- [setData](Id3v2Frame.md#setdata) +- [correctEncoding](Id3v2Frame.md#correctencoding) ## Constructors @@ -75,13 +72,7 @@ | Name | Type | | :------ | :------ | -| `header` | [`Id3v2FrameHeader`](id3v2frameheader.md) | - -## Properties - -### \_header - -• `Protected` **\_header**: [`Id3v2FrameHeader`](id3v2frameheader.md) +| `header` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | ## Accessors @@ -119,25 +110,25 @@ ___ ### flags -• `get` **flags**(): [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +• `get` **flags**(): [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) Gets the frame flags applied to the current instance. #### Returns -[`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +[`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) • `set` **flags**(`value`): `void` Sets the frame flags applied to the current instance. -If the value includes either [Id3v2FrameFlags.Encryption](../enums/id3v2frameflags.md#encryption) or -[Id3v2FrameFlags.Compression](../enums/id3v2frameflags.md#compression), [render](id3v2frame.md#render) will throw. +If the value includes either [Id3v2FrameFlags.Encryption](../enums/Id3v2FrameFlags.md#encryption) or +[Id3v2FrameFlags.Compression](../enums/Id3v2FrameFlags.md#compression), [render](Id3v2Frame.md#render) will throw. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) | +| `value` | [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) | #### Returns @@ -147,23 +138,23 @@ ___ ### frameClassType -• `Abstract` `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +• `Abstract` `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) #### Returns -[`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +[`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) ___ ### frameId -• `get` **frameId**(): [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +• `get` **frameId**(): [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) Gets the frame ID for the current instance. #### Returns -[`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +[`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) FrameIdentifier Object representing of the identifier of the frame @@ -201,6 +192,32 @@ number Value containing the grouping identifier for the current instance, or ___ +### header + +• `Protected` `get` **header**(): [`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +Gets the header for the frame. For new frames this should not exist. + +#### Returns + +[`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +• `Protected` `set` **header**(`value`): `void` + +Sets the header for the frame. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header for the frame | + +#### Returns + +`void` + +___ + ### size • `get` **size**(): `number` @@ -217,7 +234,7 @@ NOTE: This value is not used outside of reading a frame from disk, so newly crea ### clone -▸ `Abstract` **clone**(): [`Id3v2Frame`](id3v2frame.md) +▸ `Abstract` **clone**(): [`Id3v2Frame`](Id3v2Frame.md) Creates a deep copy of the current instance. This method is implemented by rendering the current instance as an ID3v2.4 frame and using @@ -226,13 +243,13 @@ classes. #### Returns -[`Id3v2Frame`](id3v2frame.md) +[`Id3v2Frame`](Id3v2Frame.md) ___ ### fieldData -▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](bytevector.md) +▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](ByteVector.md) Extracts the field data from the raw portion of an ID3v2 frame. This method is necessary for extracting extra data prepended to the frame such the as @@ -242,14 +259,14 @@ grouping ID. | Name | Type | Description | | :------ | :------ | :------ | -| `frameData` | [`ByteVector`](bytevector.md) | Raw frame data | +| `frameData` | [`ByteVector`](ByteVector.md) | Raw frame data | | `offset` | `number` | Index at which the data is contained | | `version` | `number` | Version of the ID3v2 tag the data was originally encoded with | | `dataIncludesHeader` | `boolean` | `true` if `frameData` includes the header, `false` otherwise | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ___ @@ -263,7 +280,7 @@ Populates the values in this frame by parsing its field data in a specified vers | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Extracted field data | +| `data` | [`ByteVector`](ByteVector.md) | Extracted field data | | `version` | `number` | ID3v2 version the field data is encoded in | #### Returns @@ -274,7 +291,7 @@ ___ ### render -▸ **render**(`version`): [`ByteVector`](bytevector.md) +▸ **render**(`version`): [`ByteVector`](ByteVector.md) Renders the current instance, encoded in a specified ID3v2 version. @@ -286,13 +303,13 @@ Renders the current instance, encoded in a specified ID3v2 version. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ___ ### renderFields -▸ `Protected` `Abstract` **renderFields**(`version`): [`ByteVector`](bytevector.md) +▸ `Protected` `Abstract` **renderFields**(`version`): [`ByteVector`](ByteVector.md) Renders the values in the current instance into field data for a specified version. @@ -304,7 +321,7 @@ Renders the values in the current instance into field data for a specified versi #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ___ @@ -319,7 +336,7 @@ header. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw ID3v2 frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw ID3v2 frame | | `offset` | `number` | Offset in `data` at which the frame begins. | | `readHeader` | `boolean` | Whether or not to read the reader into the current instance. | | `version` | `number` | Version of the ID3v2 tag the data was encoded with | @@ -332,7 +349,7 @@ ___ ### correctEncoding -▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/stringtype.md) +▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/StringType.md) Converts an encoding to be a supported encoding for a specified tag version. @@ -340,13 +357,13 @@ Converts an encoding to be a supported encoding for a specified tag version. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`StringType`](../enums/stringtype.md) | Value containing the original encoding | +| `type` | [`StringType`](../enums/StringType.md) | Value containing the original encoding | | `version` | `number` | Value containing the ID3v2 version to be encoded. | #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) StringType Value containing the correct encoding to use, based on - [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) and what is supported by + [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) and what is supported by `version` diff --git a/docs/classes/id3v2frameheader.md b/docs/classes/Id3v2FrameHeader.md similarity index 66% rename from docs/classes/id3v2frameheader.md rename to docs/classes/Id3v2FrameHeader.md index 41fda88b..16368f22 100644 --- a/docs/classes/id3v2frameheader.md +++ b/docs/classes/Id3v2FrameHeader.md @@ -6,20 +6,20 @@ ### Constructors -- [constructor](id3v2frameheader.md#constructor) +- [constructor](Id3v2FrameHeader.md#constructor) ### Accessors -- [flags](id3v2frameheader.md#flags) -- [frameId](id3v2frameheader.md#frameid) -- [frameSize](id3v2frameheader.md#framesize) +- [flags](Id3v2FrameHeader.md#flags) +- [frameId](Id3v2FrameHeader.md#frameid) +- [frameSize](Id3v2FrameHeader.md#framesize) ### Methods -- [render](id3v2frameheader.md#render) -- [fromData](id3v2frameheader.md#fromdata) -- [fromFrameIdentifier](id3v2frameheader.md#fromframeidentifier) -- [getSize](id3v2frameheader.md#getsize) +- [render](Id3v2FrameHeader.md#render) +- [fromData](Id3v2FrameHeader.md#fromdata) +- [fromFrameIdentifier](Id3v2FrameHeader.md#fromframeidentifier) +- [getSize](Id3v2FrameHeader.md#getsize) ## Constructors @@ -33,21 +33,21 @@ Constructs and initializes a new instance by processing the data for the frame h | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `id` | [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) | `undefined` | Identifier of the frame | -| `flags` | [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) | `undefined` | Flags to assign to the frame (if omitted, defaults to [Id3v2FrameFlags.None](../enums/id3v2frameflags.md#none)) | +| `id` | [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) | `undefined` | Identifier of the frame | +| `flags` | [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) | `Id3v2FrameFlags.None` | Flags to assign to the frame (if omitted, defaults to [Id3v2FrameFlags.None](../enums/Id3v2FrameFlags.md#none)) | | `frameSize` | `number` | `0` | Size of the frame in bytes, excluding the size of the header (if omitted, defaults to 0) | ## Accessors ### flags -• `get` **flags**(): [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +• `get` **flags**(): [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) Gets the flags applied to the current instance. #### Returns -[`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +[`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) • `set` **flags**(`value`): `void` @@ -57,7 +57,7 @@ Sets the flags applied to the current instance. | Name | Type | | :------ | :------ | -| `value` | [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) | +| `value` | [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) | #### Returns @@ -67,13 +67,13 @@ ___ ### frameId -• `get` **frameId**(): [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +• `get` **frameId**(): [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) Gets the identifier of the frame described by the current instance. #### Returns -[`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +[`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) • `set` **frameId**(`value`): `void` @@ -83,7 +83,7 @@ Sets the identifier of the frame described by the current instance. | Name | Type | | :------ | :------ | -| `value` | [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) | +| `value` | [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) | #### Returns @@ -120,7 +120,7 @@ Must be a positive, safe integer. ### render -▸ **render**(`version`): [`ByteVector`](bytevector.md) +▸ **render**(`version`): [`ByteVector`](ByteVector.md) Renders the current instance, encoded in a specified ID3v2 version. @@ -132,49 +132,49 @@ Renders the current instance, encoded in a specified ID3v2 version. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ___ ### fromData -▸ `Static` **fromData**(`data`, `version`): [`Id3v2FrameHeader`](id3v2frameheader.md) +▸ `Static` **fromData**(`data`, `version`): [`Id3v2FrameHeader`](Id3v2FrameHeader.md) -Constructs and initializes a new instance of [Id3v2FrameHeader](id3v2frameheader.md) by reading it from raw +Constructs and initializes a new instance of [Id3v2FrameHeader](Id3v2FrameHeader.md) by reading it from raw header data of a specified version. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw data to build the new instance from. If the data size is smaller than the size of a full header, the data is just treated as a frame identifier and the remaining values are zeroed. | +| `data` | [`ByteVector`](ByteVector.md) | Raw data to build the new instance from. If the data size is smaller than the size of a full header, the data is just treated as a frame identifier and the remaining values are zeroed. | | `version` | `number` | ID3v2 version with which the data in `data` was encoded. | #### Returns -[`Id3v2FrameHeader`](id3v2frameheader.md) +[`Id3v2FrameHeader`](Id3v2FrameHeader.md) ___ ### fromFrameIdentifier -▸ `Static` **fromFrameIdentifier**(`id`): [`Id3v2FrameHeader`](id3v2frameheader.md) +▸ `Static` **fromFrameIdentifier**(`id`): [`Id3v2FrameHeader`](Id3v2FrameHeader.md) #### Parameters | Name | Type | | :------ | :------ | -| `id` | [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) | +| `id` | [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) | #### Returns -[`Id3v2FrameHeader`](id3v2frameheader.md) +[`Id3v2FrameHeader`](Id3v2FrameHeader.md) ___ ### getSize -▸ `Static` **getSize**(`version`): ``6`` \| ``10`` +▸ `Static` **getSize**(`version`): `number` Gets the size of a header for a specified ID3v2 version. @@ -186,4 +186,4 @@ Gets the size of a header for a specified ID3v2 version. #### Returns -``6`` \| ``10`` +`number` diff --git a/docs/classes/id3v2frameidentifier.md b/docs/classes/Id3v2FrameIdentifier.md similarity index 84% rename from docs/classes/id3v2frameidentifier.md rename to docs/classes/Id3v2FrameIdentifier.md index d321bc16..5a97c651 100644 --- a/docs/classes/id3v2frameidentifier.md +++ b/docs/classes/Id3v2FrameIdentifier.md @@ -21,17 +21,17 @@ ### Constructors -- [constructor](id3v2frameidentifier.md#constructor) +- [constructor](Id3v2FrameIdentifier.md#constructor) ### Accessors -- [isTextFrame](id3v2frameidentifier.md#istextframe) -- [isUrlFrame](id3v2frameidentifier.md#isurlframe) +- [isTextFrame](Id3v2FrameIdentifier.md#istextframe) +- [isUrlFrame](Id3v2FrameIdentifier.md#isurlframe) ### Methods -- [render](id3v2frameidentifier.md#render) -- [toString](id3v2frameidentifier.md#tostring) +- [render](Id3v2FrameIdentifier.md#render) +- [toString](Id3v2FrameIdentifier.md#tostring) ## Constructors @@ -71,7 +71,7 @@ ___ ### render -▸ **render**(`version`): [`ByteVector`](bytevector.md) +▸ **render**(`version`): [`ByteVector`](ByteVector.md) #### Parameters @@ -81,7 +81,7 @@ ___ #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ___ diff --git a/docs/classes/id3v2musiccdidentifierframe.md b/docs/classes/Id3v2MusicCdIdentifierFrame.md similarity index 61% rename from docs/classes/id3v2musiccdidentifierframe.md rename to docs/classes/Id3v2MusicCdIdentifierFrame.md index 93f3d927..8b1dc3c1 100644 --- a/docs/classes/id3v2musiccdidentifierframe.md +++ b/docs/classes/Id3v2MusicCdIdentifierFrame.md @@ -8,59 +8,46 @@ CD. It is primarily used for track information lookup through web sources like C ## Hierarchy -- [`Id3v2Frame`](id3v2frame.md) +- [`Id3v2Frame`](Id3v2Frame.md) ↳ **`Id3v2MusicCdIdentifierFrame`** ## Table of contents -### Properties - -- [\_header](id3v2musiccdidentifierframe.md#_header) - ### Accessors -- [data](id3v2musiccdidentifierframe.md#data) -- [encryptionId](id3v2musiccdidentifierframe.md#encryptionid) -- [flags](id3v2musiccdidentifierframe.md#flags) -- [frameClassType](id3v2musiccdidentifierframe.md#frameclasstype) -- [frameId](id3v2musiccdidentifierframe.md#frameid) -- [groupId](id3v2musiccdidentifierframe.md#groupid) -- [size](id3v2musiccdidentifierframe.md#size) +- [data](Id3v2MusicCdIdentifierFrame.md#data) +- [encryptionId](Id3v2MusicCdIdentifierFrame.md#encryptionid) +- [flags](Id3v2MusicCdIdentifierFrame.md#flags) +- [frameClassType](Id3v2MusicCdIdentifierFrame.md#frameclasstype) +- [frameId](Id3v2MusicCdIdentifierFrame.md#frameid) +- [groupId](Id3v2MusicCdIdentifierFrame.md#groupid) +- [header](Id3v2MusicCdIdentifierFrame.md#header) +- [size](Id3v2MusicCdIdentifierFrame.md#size) ### Methods -- [clone](id3v2musiccdidentifierframe.md#clone) -- [fieldData](id3v2musiccdidentifierframe.md#fielddata) -- [parseFields](id3v2musiccdidentifierframe.md#parsefields) -- [render](id3v2musiccdidentifierframe.md#render) -- [renderFields](id3v2musiccdidentifierframe.md#renderfields) -- [setData](id3v2musiccdidentifierframe.md#setdata) -- [correctEncoding](id3v2musiccdidentifierframe.md#correctencoding) -- [fromOffsetRawData](id3v2musiccdidentifierframe.md#fromoffsetrawdata) -- [fromRawData](id3v2musiccdidentifierframe.md#fromrawdata) - -## Properties - -### \_header - -• `Protected` **\_header**: [`Id3v2FrameHeader`](id3v2frameheader.md) - -#### Inherited from - -[Id3v2Frame](id3v2frame.md).[_header](id3v2frame.md#_header) +- [clone](Id3v2MusicCdIdentifierFrame.md#clone) +- [fieldData](Id3v2MusicCdIdentifierFrame.md#fielddata) +- [parseFields](Id3v2MusicCdIdentifierFrame.md#parsefields) +- [render](Id3v2MusicCdIdentifierFrame.md#render) +- [renderFields](Id3v2MusicCdIdentifierFrame.md#renderfields) +- [setData](Id3v2MusicCdIdentifierFrame.md#setdata) +- [correctEncoding](Id3v2MusicCdIdentifierFrame.md#correctencoding) +- [fromOffsetRawData](Id3v2MusicCdIdentifierFrame.md#fromoffsetrawdata) +- [fromRawData](Id3v2MusicCdIdentifierFrame.md#fromrawdata) ## Accessors ### data -• `get` **data**(): [`ByteVector`](bytevector.md) +• `get` **data**(): [`ByteVector`](ByteVector.md) Gets the identifier data stored in the current instance #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) • `set` **data**(`value`): `void` @@ -70,7 +57,7 @@ Sets the identifier data stored in the current instance | Name | Type | Description | | :------ | :------ | :------ | -| `value` | [`ByteVector`](bytevector.md) | ByteVector containing the identifier stored in the current instance | +| `value` | [`ByteVector`](ByteVector.md) | ByteVector containing the identifier stored in the current instance | #### Returns @@ -91,6 +78,10 @@ Gets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + • `set` **encryptionId**(`value`): `void` Sets the encryption ID applied to the current instance. @@ -108,60 +99,80 @@ Sets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + ___ ### flags -• `get` **flags**(): [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +• `get` **flags**(): [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) Gets the frame flags applied to the current instance. #### Returns -[`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +[`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) + +#### Inherited from + +Frame.flags • `set` **flags**(`value`): `void` Sets the frame flags applied to the current instance. -If the value includes either [Id3v2FrameFlags.Encryption](../enums/id3v2frameflags.md#encryption) or -[Id3v2FrameFlags.Compression](../enums/id3v2frameflags.md#compression), [render](id3v2musiccdidentifierframe.md#render) will throw. +If the value includes either [Id3v2FrameFlags.Encryption](../enums/Id3v2FrameFlags.md#encryption) or +[Id3v2FrameFlags.Compression](../enums/Id3v2FrameFlags.md#compression), [render](Id3v2MusicCdIdentifierFrame.md#render) will throw. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) | +| `value` | [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) | #### Returns `void` +#### Inherited from + +Frame.flags + ___ ### frameClassType -• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) **`inheritdoc`** #### Returns -[`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +[`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) + +#### Overrides + +Frame.frameClassType ___ ### frameId -• `get` **frameId**(): [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +• `get` **frameId**(): [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) Gets the frame ID for the current instance. #### Returns -[`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +[`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) FrameIdentifier Object representing of the identifier of the frame +#### Inherited from + +Frame.frameId + ___ ### groupId @@ -177,6 +188,10 @@ Gets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + • `set` **groupId**(`value`): `void` Sets the grouping ID applied to the current instance. @@ -194,6 +209,44 @@ Sets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + +___ + +### header + +• `Protected` `get` **header**(): [`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +Gets the header for the frame. For new frames this should not exist. + +#### Returns + +[`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +#### Inherited from + +Frame.header + +• `Protected` `set` **header**(`value`): `void` + +Sets the header for the frame. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header for the frame | + +#### Returns + +`void` + +#### Inherited from + +Frame.header + ___ ### size @@ -208,11 +261,15 @@ NOTE: This value is not used outside of reading a frame from disk, so newly crea `number` +#### Inherited from + +Frame.size + ## Methods ### clone -▸ **clone**(): [`Id3v2Frame`](id3v2frame.md) +▸ **clone**(): [`Id3v2Frame`](Id3v2Frame.md) Creates a deep copy of the current instance. This method is implemented by rendering the current instance as an ID3v2.4 frame and using @@ -221,17 +278,17 @@ classes. #### Returns -[`Id3v2Frame`](id3v2frame.md) +[`Id3v2Frame`](Id3v2Frame.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[clone](id3v2frame.md#clone) +[Id3v2Frame](Id3v2Frame.md).[clone](Id3v2Frame.md#clone) ___ ### fieldData -▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](bytevector.md) +▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](ByteVector.md) Extracts the field data from the raw portion of an ID3v2 frame. This method is necessary for extracting extra data prepended to the frame such the as @@ -241,33 +298,32 @@ grouping ID. | Name | Type | Description | | :------ | :------ | :------ | -| `frameData` | [`ByteVector`](bytevector.md) | Raw frame data | +| `frameData` | [`ByteVector`](ByteVector.md) | Raw frame data | | `offset` | `number` | Index at which the data is contained | | `version` | `number` | Version of the ID3v2 tag the data was originally encoded with | | `dataIncludesHeader` | `boolean` | `true` if `frameData` includes the header, `false` otherwise | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[fieldData](id3v2frame.md#fielddata) +[Id3v2Frame](Id3v2Frame.md).[fieldData](Id3v2Frame.md#fielddata) ___ ### parseFields -▸ `Protected` **parseFields**(`data`, `version`): `void` +▸ `Protected` **parseFields**(`data`): `void` -Populates the values in the current instance. +Populates the values in this frame by parsing its field data in a specified version. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | ByteVector containing the extracted field data. | -| `version` | `number` | Ignored. | +| `data` | [`ByteVector`](ByteVector.md) | Extracted field data | #### Returns @@ -275,13 +331,13 @@ Populates the values in the current instance. #### Overrides -[Id3v2Frame](id3v2frame.md).[parseFields](id3v2frame.md#parsefields) +[Id3v2Frame](Id3v2Frame.md).[parseFields](Id3v2Frame.md#parsefields) ___ ### render -▸ **render**(`version`): [`ByteVector`](bytevector.md) +▸ **render**(`version`): [`ByteVector`](ByteVector.md) Renders the current instance, encoded in a specified ID3v2 version. @@ -293,33 +349,27 @@ Renders the current instance, encoded in a specified ID3v2 version. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[render](id3v2frame.md#render) +[Id3v2Frame](Id3v2Frame.md).[render](Id3v2Frame.md#render) ___ ### renderFields -▸ `Protected` **renderFields**(`version`): [`ByteVector`](bytevector.md) - -Renders the value in current instance into field data. +▸ `Protected` **renderFields**(): [`ByteVector`](ByteVector.md) -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `version` | `number` | Ignored. | +Renders the values in the current instance into field data for a specified version. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[renderFields](id3v2frame.md#renderfields) +[Id3v2Frame](Id3v2Frame.md).[renderFields](Id3v2Frame.md#renderfields) ___ @@ -334,7 +384,7 @@ header. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw ID3v2 frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw ID3v2 frame | | `offset` | `number` | Offset in `data` at which the frame begins. | | `readHeader` | `boolean` | Whether or not to read the reader into the current instance. | | `version` | `number` | Version of the ID3v2 tag the data was encoded with | @@ -345,13 +395,13 @@ header. #### Inherited from -[Id3v2Frame](id3v2frame.md).[setData](id3v2frame.md#setdata) +[Id3v2Frame](Id3v2Frame.md).[setData](Id3v2Frame.md#setdata) ___ ### correctEncoding -▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/stringtype.md) +▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/StringType.md) Converts an encoding to be a supported encoding for a specified tag version. @@ -359,26 +409,26 @@ Converts an encoding to be a supported encoding for a specified tag version. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`StringType`](../enums/stringtype.md) | Value containing the original encoding | +| `type` | [`StringType`](../enums/StringType.md) | Value containing the original encoding | | `version` | `number` | Value containing the ID3v2 version to be encoded. | #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) StringType Value containing the correct encoding to use, based on - [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) and what is supported by + [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) and what is supported by `version` #### Inherited from -[Id3v2Frame](id3v2frame.md).[correctEncoding](id3v2frame.md#correctencoding) +[Id3v2Frame](Id3v2Frame.md).[correctEncoding](Id3v2Frame.md#correctencoding) ___ ### fromOffsetRawData -▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2MusicCdIdentifierFrame`](id3v2musiccdidentifierframe.md) +▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2MusicCdIdentifierFrame`](Id3v2MusicCdIdentifierFrame.md) Constructs and initializes a new instance of MusicCdIdentifier frame by reading its raw data in a specified ID3v2 version starting at a specified offset. @@ -387,20 +437,20 @@ in a specified ID3v2 version starting at a specified offset. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame. | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame. | | `offset` | `number` | Offset into `data` where the frame actually begins. Must be a positive, safe integer | -| `header` | [`Id3v2FrameHeader`](id3v2frameheader.md) | Header of the frame found at `offset` in the data | +| `header` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header of the frame found at `offset` in the data | | `version` | `number` | ID3v2 version the frame was originally encoded with | #### Returns -[`Id3v2MusicCdIdentifierFrame`](id3v2musiccdidentifierframe.md) +[`Id3v2MusicCdIdentifierFrame`](Id3v2MusicCdIdentifierFrame.md) ___ ### fromRawData -▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2MusicCdIdentifierFrame`](id3v2musiccdidentifierframe.md) +▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2MusicCdIdentifierFrame`](Id3v2MusicCdIdentifierFrame.md) Constructs and initializes a new instance of MusicCdIdentifierFrame by reading its raw data in a specified ID3v2 version. @@ -409,9 +459,9 @@ in a specified ID3v2 version. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | ByteVector object starting with the raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | ByteVector object starting with the raw representation of the new frame | | `version` | `number` | The ID3v2 version the raw frame is encoded in. Must be positive 8-bit integer | #### Returns -[`Id3v2MusicCdIdentifierFrame`](id3v2musiccdidentifierframe.md) +[`Id3v2MusicCdIdentifierFrame`](Id3v2MusicCdIdentifierFrame.md) diff --git a/docs/classes/id3v2playcountframe.md b/docs/classes/Id3v2PlayCountFrame.md similarity index 63% rename from docs/classes/id3v2playcountframe.md rename to docs/classes/Id3v2PlayCountFrame.md index 3537a9a3..992e33c2 100644 --- a/docs/classes/id3v2playcountframe.md +++ b/docs/classes/Id3v2PlayCountFrame.md @@ -6,48 +6,35 @@ This class extends {@link Frame} implementing support for ID3v2 play count (PCNT ## Hierarchy -- [`Id3v2Frame`](id3v2frame.md) +- [`Id3v2Frame`](Id3v2Frame.md) ↳ **`Id3v2PlayCountFrame`** ## Table of contents -### Properties - -- [\_header](id3v2playcountframe.md#_header) - ### Accessors -- [encryptionId](id3v2playcountframe.md#encryptionid) -- [flags](id3v2playcountframe.md#flags) -- [frameClassType](id3v2playcountframe.md#frameclasstype) -- [frameId](id3v2playcountframe.md#frameid) -- [groupId](id3v2playcountframe.md#groupid) -- [playCount](id3v2playcountframe.md#playcount) -- [size](id3v2playcountframe.md#size) +- [encryptionId](Id3v2PlayCountFrame.md#encryptionid) +- [flags](Id3v2PlayCountFrame.md#flags) +- [frameClassType](Id3v2PlayCountFrame.md#frameclasstype) +- [frameId](Id3v2PlayCountFrame.md#frameid) +- [groupId](Id3v2PlayCountFrame.md#groupid) +- [header](Id3v2PlayCountFrame.md#header) +- [playCount](Id3v2PlayCountFrame.md#playcount) +- [size](Id3v2PlayCountFrame.md#size) ### Methods -- [clone](id3v2playcountframe.md#clone) -- [fieldData](id3v2playcountframe.md#fielddata) -- [parseFields](id3v2playcountframe.md#parsefields) -- [render](id3v2playcountframe.md#render) -- [renderFields](id3v2playcountframe.md#renderfields) -- [setData](id3v2playcountframe.md#setdata) -- [correctEncoding](id3v2playcountframe.md#correctencoding) -- [fromEmpty](id3v2playcountframe.md#fromempty) -- [fromOffsetRawData](id3v2playcountframe.md#fromoffsetrawdata) -- [fromRawData](id3v2playcountframe.md#fromrawdata) - -## Properties - -### \_header - -• `Protected` **\_header**: [`Id3v2FrameHeader`](id3v2frameheader.md) - -#### Inherited from - -[Id3v2Frame](id3v2frame.md).[_header](id3v2frame.md#_header) +- [clone](Id3v2PlayCountFrame.md#clone) +- [fieldData](Id3v2PlayCountFrame.md#fielddata) +- [parseFields](Id3v2PlayCountFrame.md#parsefields) +- [render](Id3v2PlayCountFrame.md#render) +- [renderFields](Id3v2PlayCountFrame.md#renderfields) +- [setData](Id3v2PlayCountFrame.md#setdata) +- [correctEncoding](Id3v2PlayCountFrame.md#correctencoding) +- [fromEmpty](Id3v2PlayCountFrame.md#fromempty) +- [fromOffsetRawData](Id3v2PlayCountFrame.md#fromoffsetrawdata) +- [fromRawData](Id3v2PlayCountFrame.md#fromrawdata) ## Accessors @@ -64,6 +51,10 @@ Gets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + • `set` **encryptionId**(`value`): `void` Sets the encryption ID applied to the current instance. @@ -81,60 +72,80 @@ Sets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + ___ ### flags -• `get` **flags**(): [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +• `get` **flags**(): [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) Gets the frame flags applied to the current instance. #### Returns -[`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +[`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) + +#### Inherited from + +Frame.flags • `set` **flags**(`value`): `void` Sets the frame flags applied to the current instance. -If the value includes either [Id3v2FrameFlags.Encryption](../enums/id3v2frameflags.md#encryption) or -[Id3v2FrameFlags.Compression](../enums/id3v2frameflags.md#compression), [render](id3v2playcountframe.md#render) will throw. +If the value includes either [Id3v2FrameFlags.Encryption](../enums/Id3v2FrameFlags.md#encryption) or +[Id3v2FrameFlags.Compression](../enums/Id3v2FrameFlags.md#compression), [render](Id3v2PlayCountFrame.md#render) will throw. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) | +| `value` | [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) | #### Returns `void` +#### Inherited from + +Frame.flags + ___ ### frameClassType -• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) **`inheritdoc`** #### Returns -[`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +[`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) + +#### Overrides + +Frame.frameClassType ___ ### frameId -• `get` **frameId**(): [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +• `get` **frameId**(): [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) Gets the frame ID for the current instance. #### Returns -[`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +[`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) FrameIdentifier Object representing of the identifier of the frame +#### Inherited from + +Frame.frameId + ___ ### groupId @@ -150,6 +161,10 @@ Gets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + • `set` **groupId**(`value`): `void` Sets the grouping ID applied to the current instance. @@ -167,6 +182,44 @@ Sets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + +___ + +### header + +• `Protected` `get` **header**(): [`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +Gets the header for the frame. For new frames this should not exist. + +#### Returns + +[`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +#### Inherited from + +Frame.header + +• `Protected` `set` **header**(`value`): `void` + +Sets the header for the frame. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header for the frame | + +#### Returns + +`void` + +#### Inherited from + +Frame.header + ___ ### playCount @@ -207,11 +260,15 @@ NOTE: This value is not used outside of reading a frame from disk, so newly crea `number` +#### Inherited from + +Frame.size + ## Methods ### clone -▸ **clone**(): [`Id3v2Frame`](id3v2frame.md) +▸ **clone**(): [`Id3v2Frame`](Id3v2Frame.md) Creates a deep copy of the current instance. This method is implemented by rendering the current instance as an ID3v2.4 frame and using @@ -220,17 +277,17 @@ classes. #### Returns -[`Id3v2Frame`](id3v2frame.md) +[`Id3v2Frame`](Id3v2Frame.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[clone](id3v2frame.md#clone) +[Id3v2Frame](Id3v2Frame.md).[clone](Id3v2Frame.md#clone) ___ ### fieldData -▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](bytevector.md) +▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](ByteVector.md) Extracts the field data from the raw portion of an ID3v2 frame. This method is necessary for extracting extra data prepended to the frame such the as @@ -240,24 +297,24 @@ grouping ID. | Name | Type | Description | | :------ | :------ | :------ | -| `frameData` | [`ByteVector`](bytevector.md) | Raw frame data | +| `frameData` | [`ByteVector`](ByteVector.md) | Raw frame data | | `offset` | `number` | Index at which the data is contained | | `version` | `number` | Version of the ID3v2 tag the data was originally encoded with | | `dataIncludesHeader` | `boolean` | `true` if `frameData` includes the header, `false` otherwise | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[fieldData](id3v2frame.md#fielddata) +[Id3v2Frame](Id3v2Frame.md).[fieldData](Id3v2Frame.md#fielddata) ___ ### parseFields -▸ `Protected` **parseFields**(`data`, `_version`): `void` +▸ `Protected` **parseFields**(`data`): `void` Populates the values in this frame by parsing its field data in a specified version. @@ -265,8 +322,7 @@ Populates the values in this frame by parsing its field data in a specified vers | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Extracted field data | -| `_version` | `number` | ID3v2 version the field data is encoded in | +| `data` | [`ByteVector`](ByteVector.md) | Extracted field data | #### Returns @@ -274,13 +330,13 @@ Populates the values in this frame by parsing its field data in a specified vers #### Overrides -[Id3v2Frame](id3v2frame.md).[parseFields](id3v2frame.md#parsefields) +[Id3v2Frame](Id3v2Frame.md).[parseFields](Id3v2Frame.md#parsefields) ___ ### render -▸ **render**(`version`): [`ByteVector`](bytevector.md) +▸ **render**(`version`): [`ByteVector`](ByteVector.md) Renders the current instance, encoded in a specified ID3v2 version. @@ -292,33 +348,27 @@ Renders the current instance, encoded in a specified ID3v2 version. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[render](id3v2frame.md#render) +[Id3v2Frame](Id3v2Frame.md).[render](Id3v2Frame.md#render) ___ ### renderFields -▸ `Protected` **renderFields**(`_version`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderFields**(): [`ByteVector`](ByteVector.md) Renders the values in the current instance into field data for a specified version. -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `_version` | `number` | ID3v2 version the field data is to be encoded in. | - #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[renderFields](id3v2frame.md#renderfields) +[Id3v2Frame](Id3v2Frame.md).[renderFields](Id3v2Frame.md#renderfields) ___ @@ -333,7 +383,7 @@ header. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw ID3v2 frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw ID3v2 frame | | `offset` | `number` | Offset in `data` at which the frame begins. | | `readHeader` | `boolean` | Whether or not to read the reader into the current instance. | | `version` | `number` | Version of the ID3v2 tag the data was encoded with | @@ -344,13 +394,13 @@ header. #### Inherited from -[Id3v2Frame](id3v2frame.md).[setData](id3v2frame.md#setdata) +[Id3v2Frame](Id3v2Frame.md).[setData](Id3v2Frame.md#setdata) ___ ### correctEncoding -▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/stringtype.md) +▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/StringType.md) Converts an encoding to be a supported encoding for a specified tag version. @@ -358,38 +408,38 @@ Converts an encoding to be a supported encoding for a specified tag version. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`StringType`](../enums/stringtype.md) | Value containing the original encoding | +| `type` | [`StringType`](../enums/StringType.md) | Value containing the original encoding | | `version` | `number` | Value containing the ID3v2 version to be encoded. | #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) StringType Value containing the correct encoding to use, based on - [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) and what is supported by + [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) and what is supported by `version` #### Inherited from -[Id3v2Frame](id3v2frame.md).[correctEncoding](id3v2frame.md#correctencoding) +[Id3v2Frame](Id3v2Frame.md).[correctEncoding](Id3v2Frame.md#correctencoding) ___ ### fromEmpty -▸ `Static` **fromEmpty**(): [`Id3v2PlayCountFrame`](id3v2playcountframe.md) +▸ `Static` **fromEmpty**(): [`Id3v2PlayCountFrame`](Id3v2PlayCountFrame.md) Constructs and initializes a new instance with a count of zero #### Returns -[`Id3v2PlayCountFrame`](id3v2playcountframe.md) +[`Id3v2PlayCountFrame`](Id3v2PlayCountFrame.md) ___ ### fromOffsetRawData -▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2PlayCountFrame`](id3v2playcountframe.md) +▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2PlayCountFrame`](Id3v2PlayCountFrame.md) Constructs and initializes a new instance of frame by reading its raw data in a specified ID3v2 version starting at a specified offset. @@ -398,20 +448,20 @@ ID3v2 version starting at a specified offset. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame. | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame. | | `offset` | `number` | Offset into `data` where the frame actually begins. Must be a positive, safe integer | -| `header` | [`Id3v2FrameHeader`](id3v2frameheader.md) | Header of the frame found at `offset` in the data | +| `header` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header of the frame found at `offset` in the data | | `version` | `number` | ID3v2 version the frame was originally encoded with | #### Returns -[`Id3v2PlayCountFrame`](id3v2playcountframe.md) +[`Id3v2PlayCountFrame`](Id3v2PlayCountFrame.md) ___ ### fromRawData -▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2PlayCountFrame`](id3v2playcountframe.md) +▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2PlayCountFrame`](Id3v2PlayCountFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version @@ -420,9 +470,9 @@ version | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | ByteVector starting with the raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | ByteVector starting with the raw representation of the new frame | | `version` | `number` | ID3v2 version the raw frame is encoded in, must be a positive 8-bit integer | #### Returns -[`Id3v2PlayCountFrame`](id3v2playcountframe.md) +[`Id3v2PlayCountFrame`](Id3v2PlayCountFrame.md) diff --git a/docs/classes/id3v2popularimeterframe.md b/docs/classes/Id3v2PopularimeterFrame.md similarity index 65% rename from docs/classes/id3v2popularimeterframe.md rename to docs/classes/Id3v2PopularimeterFrame.md index 6e7bdb3b..656548c1 100644 --- a/docs/classes/id3v2popularimeterframe.md +++ b/docs/classes/Id3v2PopularimeterFrame.md @@ -6,51 +6,38 @@ This class extends {@link Frame} implementing support for ID3v2 popularimeter (P ## Hierarchy -- [`Id3v2Frame`](id3v2frame.md) +- [`Id3v2Frame`](Id3v2Frame.md) ↳ **`Id3v2PopularimeterFrame`** ## Table of contents -### Properties - -- [\_header](id3v2popularimeterframe.md#_header) - ### Accessors -- [encryptionId](id3v2popularimeterframe.md#encryptionid) -- [flags](id3v2popularimeterframe.md#flags) -- [frameClassType](id3v2popularimeterframe.md#frameclasstype) -- [frameId](id3v2popularimeterframe.md#frameid) -- [groupId](id3v2popularimeterframe.md#groupid) -- [playCount](id3v2popularimeterframe.md#playcount) -- [rating](id3v2popularimeterframe.md#rating) -- [size](id3v2popularimeterframe.md#size) -- [user](id3v2popularimeterframe.md#user) +- [encryptionId](Id3v2PopularimeterFrame.md#encryptionid) +- [flags](Id3v2PopularimeterFrame.md#flags) +- [frameClassType](Id3v2PopularimeterFrame.md#frameclasstype) +- [frameId](Id3v2PopularimeterFrame.md#frameid) +- [groupId](Id3v2PopularimeterFrame.md#groupid) +- [header](Id3v2PopularimeterFrame.md#header) +- [playCount](Id3v2PopularimeterFrame.md#playcount) +- [rating](Id3v2PopularimeterFrame.md#rating) +- [size](Id3v2PopularimeterFrame.md#size) +- [user](Id3v2PopularimeterFrame.md#user) ### Methods -- [clone](id3v2popularimeterframe.md#clone) -- [fieldData](id3v2popularimeterframe.md#fielddata) -- [parseFields](id3v2popularimeterframe.md#parsefields) -- [render](id3v2popularimeterframe.md#render) -- [renderFields](id3v2popularimeterframe.md#renderfields) -- [setData](id3v2popularimeterframe.md#setdata) -- [correctEncoding](id3v2popularimeterframe.md#correctencoding) -- [find](id3v2popularimeterframe.md#find) -- [fromOffsetRawData](id3v2popularimeterframe.md#fromoffsetrawdata) -- [fromRawData](id3v2popularimeterframe.md#fromrawdata) -- [fromUser](id3v2popularimeterframe.md#fromuser) - -## Properties - -### \_header - -• `Protected` **\_header**: [`Id3v2FrameHeader`](id3v2frameheader.md) - -#### Inherited from - -[Id3v2Frame](id3v2frame.md).[_header](id3v2frame.md#_header) +- [clone](Id3v2PopularimeterFrame.md#clone) +- [fieldData](Id3v2PopularimeterFrame.md#fielddata) +- [parseFields](Id3v2PopularimeterFrame.md#parsefields) +- [render](Id3v2PopularimeterFrame.md#render) +- [renderFields](Id3v2PopularimeterFrame.md#renderfields) +- [setData](Id3v2PopularimeterFrame.md#setdata) +- [correctEncoding](Id3v2PopularimeterFrame.md#correctencoding) +- [find](Id3v2PopularimeterFrame.md#find) +- [fromOffsetRawData](Id3v2PopularimeterFrame.md#fromoffsetrawdata) +- [fromRawData](Id3v2PopularimeterFrame.md#fromrawdata) +- [fromUser](Id3v2PopularimeterFrame.md#fromuser) ## Accessors @@ -67,6 +54,10 @@ Gets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + • `set` **encryptionId**(`value`): `void` Sets the encryption ID applied to the current instance. @@ -84,60 +75,80 @@ Sets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + ___ ### flags -• `get` **flags**(): [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +• `get` **flags**(): [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) Gets the frame flags applied to the current instance. #### Returns -[`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +[`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) + +#### Inherited from + +Frame.flags • `set` **flags**(`value`): `void` Sets the frame flags applied to the current instance. -If the value includes either [Id3v2FrameFlags.Encryption](../enums/id3v2frameflags.md#encryption) or -[Id3v2FrameFlags.Compression](../enums/id3v2frameflags.md#compression), [render](id3v2popularimeterframe.md#render) will throw. +If the value includes either [Id3v2FrameFlags.Encryption](../enums/Id3v2FrameFlags.md#encryption) or +[Id3v2FrameFlags.Compression](../enums/Id3v2FrameFlags.md#compression), [render](Id3v2PopularimeterFrame.md#render) will throw. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) | +| `value` | [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) | #### Returns `void` +#### Inherited from + +Frame.flags + ___ ### frameClassType -• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) **`inheritdoc`** #### Returns -[`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +[`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) + +#### Overrides + +Frame.frameClassType ___ ### frameId -• `get` **frameId**(): [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +• `get` **frameId**(): [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) Gets the frame ID for the current instance. #### Returns -[`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +[`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) FrameIdentifier Object representing of the identifier of the frame +#### Inherited from + +Frame.frameId + ___ ### groupId @@ -153,6 +164,10 @@ Gets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + • `set` **groupId**(`value`): `void` Sets the grouping ID applied to the current instance. @@ -170,6 +185,44 @@ Sets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + +___ + +### header + +• `Protected` `get` **header**(): [`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +Gets the header for the frame. For new frames this should not exist. + +#### Returns + +[`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +#### Inherited from + +Frame.header + +• `Protected` `set` **header**(`value`): `void` + +Sets the header for the frame. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header for the frame | + +#### Returns + +`void` + +#### Inherited from + +Frame.header + ___ ### playCount @@ -236,6 +289,10 @@ NOTE: This value is not used outside of reading a frame from disk, so newly crea `number` +#### Inherited from + +Frame.size + ___ ### user @@ -266,7 +323,7 @@ Sets the email address of the user to whom the current instance belongs ### clone -▸ **clone**(): [`Id3v2Frame`](id3v2frame.md) +▸ **clone**(): [`Id3v2Frame`](Id3v2Frame.md) Creates a deep copy of the current instance. This method is implemented by rendering the current instance as an ID3v2.4 frame and using @@ -275,17 +332,17 @@ classes. #### Returns -[`Id3v2Frame`](id3v2frame.md) +[`Id3v2Frame`](Id3v2Frame.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[clone](id3v2frame.md#clone) +[Id3v2Frame](Id3v2Frame.md).[clone](Id3v2Frame.md#clone) ___ ### fieldData -▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](bytevector.md) +▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](ByteVector.md) Extracts the field data from the raw portion of an ID3v2 frame. This method is necessary for extracting extra data prepended to the frame such the as @@ -295,24 +352,24 @@ grouping ID. | Name | Type | Description | | :------ | :------ | :------ | -| `frameData` | [`ByteVector`](bytevector.md) | Raw frame data | +| `frameData` | [`ByteVector`](ByteVector.md) | Raw frame data | | `offset` | `number` | Index at which the data is contained | | `version` | `number` | Version of the ID3v2 tag the data was originally encoded with | | `dataIncludesHeader` | `boolean` | `true` if `frameData` includes the header, `false` otherwise | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[fieldData](id3v2frame.md#fielddata) +[Id3v2Frame](Id3v2Frame.md).[fieldData](Id3v2Frame.md#fielddata) ___ ### parseFields -▸ `Protected` **parseFields**(`data`, `_version`): `void` +▸ `Protected` **parseFields**(`data`): `void` Populates the values in this frame by parsing its field data in a specified version. @@ -320,8 +377,7 @@ Populates the values in this frame by parsing its field data in a specified vers | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Extracted field data | -| `_version` | `number` | ID3v2 version the field data is encoded in | +| `data` | [`ByteVector`](ByteVector.md) | Extracted field data | #### Returns @@ -329,13 +385,13 @@ Populates the values in this frame by parsing its field data in a specified vers #### Overrides -[Id3v2Frame](id3v2frame.md).[parseFields](id3v2frame.md#parsefields) +[Id3v2Frame](Id3v2Frame.md).[parseFields](Id3v2Frame.md#parsefields) ___ ### render -▸ **render**(`version`): [`ByteVector`](bytevector.md) +▸ **render**(`version`): [`ByteVector`](ByteVector.md) Renders the current instance, encoded in a specified ID3v2 version. @@ -347,33 +403,27 @@ Renders the current instance, encoded in a specified ID3v2 version. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[render](id3v2frame.md#render) +[Id3v2Frame](Id3v2Frame.md).[render](Id3v2Frame.md#render) ___ ### renderFields -▸ `Protected` **renderFields**(`_version`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderFields**(): [`ByteVector`](ByteVector.md) Renders the values in the current instance into field data for a specified version. -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `_version` | `number` | ID3v2 version the field data is to be encoded in. | - #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[renderFields](id3v2frame.md#renderfields) +[Id3v2Frame](Id3v2Frame.md).[renderFields](Id3v2Frame.md#renderfields) ___ @@ -388,7 +438,7 @@ header. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw ID3v2 frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw ID3v2 frame | | `offset` | `number` | Offset in `data` at which the frame begins. | | `readHeader` | `boolean` | Whether or not to read the reader into the current instance. | | `version` | `number` | Version of the ID3v2 tag the data was encoded with | @@ -399,13 +449,13 @@ header. #### Inherited from -[Id3v2Frame](id3v2frame.md).[setData](id3v2frame.md#setdata) +[Id3v2Frame](Id3v2Frame.md).[setData](Id3v2Frame.md#setdata) ___ ### correctEncoding -▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/stringtype.md) +▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/StringType.md) Converts an encoding to be a supported encoding for a specified tag version. @@ -413,26 +463,26 @@ Converts an encoding to be a supported encoding for a specified tag version. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`StringType`](../enums/stringtype.md) | Value containing the original encoding | +| `type` | [`StringType`](../enums/StringType.md) | Value containing the original encoding | | `version` | `number` | Value containing the ID3v2 version to be encoded. | #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) StringType Value containing the correct encoding to use, based on - [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) and what is supported by + [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) and what is supported by `version` #### Inherited from -[Id3v2Frame](id3v2frame.md).[correctEncoding](id3v2frame.md#correctencoding) +[Id3v2Frame](Id3v2Frame.md).[correctEncoding](Id3v2Frame.md#correctencoding) ___ ### find -▸ `Static` **find**(`frames`, `user`): [`Id3v2PopularimeterFrame`](id3v2popularimeterframe.md) +▸ `Static` **find**(`frames`, `user`): [`Id3v2PopularimeterFrame`](Id3v2PopularimeterFrame.md) Gets a popularimeter frame from a specified tag that matches the given parameters @@ -440,12 +490,12 @@ Gets a popularimeter frame from a specified tag that matches the given parameter | Name | Type | Description | | :------ | :------ | :------ | -| `frames` | [`Id3v2PopularimeterFrame`](id3v2popularimeterframe.md)[] | List of frames to search | +| `frames` | [`Id3v2PopularimeterFrame`](Id3v2PopularimeterFrame.md)[] | List of frames to search | | `user` | `string` | User email to use to match the frame in the `tag` | #### Returns -[`Id3v2PopularimeterFrame`](id3v2popularimeterframe.md) +[`Id3v2PopularimeterFrame`](Id3v2PopularimeterFrame.md) PopularimeterFrame Frame containing the matching user or `undefined` if a match was not found @@ -454,7 +504,7 @@ ___ ### fromOffsetRawData -▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2PopularimeterFrame`](id3v2popularimeterframe.md) +▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2PopularimeterFrame`](Id3v2PopularimeterFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. This method allows for offset reading from the data byte vector. @@ -463,20 +513,20 @@ version. This method allows for offset reading from the data byte vector. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `offset` | `number` | What offset in `data` the frame actually begins. Must be positive, safe integer | -| `header` | [`Id3v2FrameHeader`](id3v2frameheader.md) | Header of the frame found at `data` in the data | +| `header` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header of the frame found at `data` in the data | | `version` | `number` | ID3v2 version the frame was originally encoded with | #### Returns -[`Id3v2PopularimeterFrame`](id3v2popularimeterframe.md) +[`Id3v2PopularimeterFrame`](Id3v2PopularimeterFrame.md) ___ ### fromRawData -▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2PopularimeterFrame`](id3v2popularimeterframe.md) +▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2PopularimeterFrame`](Id3v2PopularimeterFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. @@ -485,18 +535,18 @@ ID3v2 version. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `version` | `number` | ID3v2 version the raw frame is encoded with, must be a positive 8-bit integer | #### Returns -[`Id3v2PopularimeterFrame`](id3v2popularimeterframe.md) +[`Id3v2PopularimeterFrame`](Id3v2PopularimeterFrame.md) ___ ### fromUser -▸ `Static` **fromUser**(`user`): [`Id3v2PopularimeterFrame`](id3v2popularimeterframe.md) +▸ `Static` **fromUser**(`user`): [`Id3v2PopularimeterFrame`](Id3v2PopularimeterFrame.md) Constructs and initializes a new instance for a specified user with a rating and play count of zero. @@ -509,4 +559,4 @@ of zero. #### Returns -[`Id3v2PopularimeterFrame`](id3v2popularimeterframe.md) +[`Id3v2PopularimeterFrame`](Id3v2PopularimeterFrame.md) diff --git a/docs/classes/id3v2privateframe.md b/docs/classes/Id3v2PrivateFrame.md similarity index 64% rename from docs/classes/id3v2privateframe.md rename to docs/classes/Id3v2PrivateFrame.md index 67e8c964..5367221f 100644 --- a/docs/classes/id3v2privateframe.md +++ b/docs/classes/Id3v2PrivateFrame.md @@ -8,50 +8,37 @@ should not be stored in another frame type. ## Hierarchy -- [`Id3v2Frame`](id3v2frame.md) +- [`Id3v2Frame`](Id3v2Frame.md) ↳ **`Id3v2PrivateFrame`** ## Table of contents -### Properties - -- [\_header](id3v2privateframe.md#_header) - ### Accessors -- [encryptionId](id3v2privateframe.md#encryptionid) -- [flags](id3v2privateframe.md#flags) -- [frameClassType](id3v2privateframe.md#frameclasstype) -- [frameId](id3v2privateframe.md#frameid) -- [groupId](id3v2privateframe.md#groupid) -- [owner](id3v2privateframe.md#owner) -- [privateData](id3v2privateframe.md#privatedata) -- [size](id3v2privateframe.md#size) +- [encryptionId](Id3v2PrivateFrame.md#encryptionid) +- [flags](Id3v2PrivateFrame.md#flags) +- [frameClassType](Id3v2PrivateFrame.md#frameclasstype) +- [frameId](Id3v2PrivateFrame.md#frameid) +- [groupId](Id3v2PrivateFrame.md#groupid) +- [header](Id3v2PrivateFrame.md#header) +- [owner](Id3v2PrivateFrame.md#owner) +- [privateData](Id3v2PrivateFrame.md#privatedata) +- [size](Id3v2PrivateFrame.md#size) ### Methods -- [clone](id3v2privateframe.md#clone) -- [fieldData](id3v2privateframe.md#fielddata) -- [parseFields](id3v2privateframe.md#parsefields) -- [render](id3v2privateframe.md#render) -- [renderFields](id3v2privateframe.md#renderfields) -- [setData](id3v2privateframe.md#setdata) -- [correctEncoding](id3v2privateframe.md#correctencoding) -- [find](id3v2privateframe.md#find) -- [fromOffsetRawData](id3v2privateframe.md#fromoffsetrawdata) -- [fromOwner](id3v2privateframe.md#fromowner) -- [fromRawData](id3v2privateframe.md#fromrawdata) - -## Properties - -### \_header - -• `Protected` **\_header**: [`Id3v2FrameHeader`](id3v2frameheader.md) - -#### Inherited from - -[Id3v2Frame](id3v2frame.md).[_header](id3v2frame.md#_header) +- [clone](Id3v2PrivateFrame.md#clone) +- [fieldData](Id3v2PrivateFrame.md#fielddata) +- [parseFields](Id3v2PrivateFrame.md#parsefields) +- [render](Id3v2PrivateFrame.md#render) +- [renderFields](Id3v2PrivateFrame.md#renderfields) +- [setData](Id3v2PrivateFrame.md#setdata) +- [correctEncoding](Id3v2PrivateFrame.md#correctencoding) +- [find](Id3v2PrivateFrame.md#find) +- [fromOffsetRawData](Id3v2PrivateFrame.md#fromoffsetrawdata) +- [fromOwner](Id3v2PrivateFrame.md#fromowner) +- [fromRawData](Id3v2PrivateFrame.md#fromrawdata) ## Accessors @@ -68,6 +55,10 @@ Gets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + • `set` **encryptionId**(`value`): `void` Sets the encryption ID applied to the current instance. @@ -85,60 +76,80 @@ Sets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + ___ ### flags -• `get` **flags**(): [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +• `get` **flags**(): [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) Gets the frame flags applied to the current instance. #### Returns -[`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +[`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) + +#### Inherited from + +Frame.flags • `set` **flags**(`value`): `void` Sets the frame flags applied to the current instance. -If the value includes either [Id3v2FrameFlags.Encryption](../enums/id3v2frameflags.md#encryption) or -[Id3v2FrameFlags.Compression](../enums/id3v2frameflags.md#compression), [render](id3v2privateframe.md#render) will throw. +If the value includes either [Id3v2FrameFlags.Encryption](../enums/Id3v2FrameFlags.md#encryption) or +[Id3v2FrameFlags.Compression](../enums/Id3v2FrameFlags.md#compression), [render](Id3v2PrivateFrame.md#render) will throw. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) | +| `value` | [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) | #### Returns `void` +#### Inherited from + +Frame.flags + ___ ### frameClassType -• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) **`inheritdoc`** #### Returns -[`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +[`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) + +#### Overrides + +Frame.frameClassType ___ ### frameId -• `get` **frameId**(): [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +• `get` **frameId**(): [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) Gets the frame ID for the current instance. #### Returns -[`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +[`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) FrameIdentifier Object representing of the identifier of the frame +#### Inherited from + +Frame.frameId + ___ ### groupId @@ -154,6 +165,10 @@ Gets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + • `set` **groupId**(`value`): `void` Sets the grouping ID applied to the current instance. @@ -171,6 +186,44 @@ Sets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + +___ + +### header + +• `Protected` `get` **header**(): [`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +Gets the header for the frame. For new frames this should not exist. + +#### Returns + +[`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +#### Inherited from + +Frame.header + +• `Protected` `set` **header**(`value`): `void` + +Sets the header for the frame. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header for the frame | + +#### Returns + +`void` + +#### Inherited from + +Frame.header + ___ ### owner @@ -188,13 +241,13 @@ ___ ### privateData -• `get` **privateData**(): [`ByteVector`](bytevector.md) +• `get` **privateData**(): [`ByteVector`](ByteVector.md) Gets the private data stored in the current instance. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) • `set` **privateData**(`value`): `void` @@ -204,7 +257,7 @@ Sets the private data stored in the current instance. | Name | Type | Description | | :------ | :------ | :------ | -| `value` | [`ByteVector`](bytevector.md) | Private data to store in the current instance | +| `value` | [`ByteVector`](ByteVector.md) | Private data to store in the current instance | #### Returns @@ -224,11 +277,15 @@ NOTE: This value is not used outside of reading a frame from disk, so newly crea `number` +#### Inherited from + +Frame.size + ## Methods ### clone -▸ **clone**(): [`Id3v2Frame`](id3v2frame.md) +▸ **clone**(): [`Id3v2Frame`](Id3v2Frame.md) Creates a deep copy of the current instance. This method is implemented by rendering the current instance as an ID3v2.4 frame and using @@ -237,17 +294,17 @@ classes. #### Returns -[`Id3v2Frame`](id3v2frame.md) +[`Id3v2Frame`](Id3v2Frame.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[clone](id3v2frame.md#clone) +[Id3v2Frame](Id3v2Frame.md).[clone](Id3v2Frame.md#clone) ___ ### fieldData -▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](bytevector.md) +▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](ByteVector.md) Extracts the field data from the raw portion of an ID3v2 frame. This method is necessary for extracting extra data prepended to the frame such the as @@ -257,24 +314,24 @@ grouping ID. | Name | Type | Description | | :------ | :------ | :------ | -| `frameData` | [`ByteVector`](bytevector.md) | Raw frame data | +| `frameData` | [`ByteVector`](ByteVector.md) | Raw frame data | | `offset` | `number` | Index at which the data is contained | | `version` | `number` | Version of the ID3v2 tag the data was originally encoded with | | `dataIncludesHeader` | `boolean` | `true` if `frameData` includes the header, `false` otherwise | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[fieldData](id3v2frame.md#fielddata) +[Id3v2Frame](Id3v2Frame.md).[fieldData](Id3v2Frame.md#fielddata) ___ ### parseFields -▸ `Protected` **parseFields**(`data`, `_version`): `void` +▸ `Protected` **parseFields**(`data`): `void` Populates the values in this frame by parsing its field data in a specified version. @@ -282,8 +339,7 @@ Populates the values in this frame by parsing its field data in a specified vers | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Extracted field data | -| `_version` | `number` | ID3v2 version the field data is encoded in | +| `data` | [`ByteVector`](ByteVector.md) | Extracted field data | #### Returns @@ -291,13 +347,13 @@ Populates the values in this frame by parsing its field data in a specified vers #### Overrides -[Id3v2Frame](id3v2frame.md).[parseFields](id3v2frame.md#parsefields) +[Id3v2Frame](Id3v2Frame.md).[parseFields](Id3v2Frame.md#parsefields) ___ ### render -▸ **render**(`version`): [`ByteVector`](bytevector.md) +▸ **render**(`version`): [`ByteVector`](ByteVector.md) Renders the current instance, encoded in a specified ID3v2 version. @@ -309,17 +365,17 @@ Renders the current instance, encoded in a specified ID3v2 version. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[render](id3v2frame.md#render) +[Id3v2Frame](Id3v2Frame.md).[render](Id3v2Frame.md#render) ___ ### renderFields -▸ `Protected` **renderFields**(`version`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderFields**(`version`): [`ByteVector`](ByteVector.md) Renders the values in the current instance into field data for a specified version. @@ -331,11 +387,11 @@ Renders the values in the current instance into field data for a specified versi #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[renderFields](id3v2frame.md#renderfields) +[Id3v2Frame](Id3v2Frame.md).[renderFields](Id3v2Frame.md#renderfields) ___ @@ -350,7 +406,7 @@ header. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw ID3v2 frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw ID3v2 frame | | `offset` | `number` | Offset in `data` at which the frame begins. | | `readHeader` | `boolean` | Whether or not to read the reader into the current instance. | | `version` | `number` | Version of the ID3v2 tag the data was encoded with | @@ -361,13 +417,13 @@ header. #### Inherited from -[Id3v2Frame](id3v2frame.md).[setData](id3v2frame.md#setdata) +[Id3v2Frame](Id3v2Frame.md).[setData](Id3v2Frame.md#setdata) ___ ### correctEncoding -▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/stringtype.md) +▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/StringType.md) Converts an encoding to be a supported encoding for a specified tag version. @@ -375,26 +431,26 @@ Converts an encoding to be a supported encoding for a specified tag version. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`StringType`](../enums/stringtype.md) | Value containing the original encoding | +| `type` | [`StringType`](../enums/StringType.md) | Value containing the original encoding | | `version` | `number` | Value containing the ID3v2 version to be encoded. | #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) StringType Value containing the correct encoding to use, based on - [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) and what is supported by + [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) and what is supported by `version` #### Inherited from -[Id3v2Frame](id3v2frame.md).[correctEncoding](id3v2frame.md#correctencoding) +[Id3v2Frame](Id3v2Frame.md).[correctEncoding](Id3v2Frame.md#correctencoding) ___ ### find -▸ `Static` **find**(`frames`, `owner`): [`Id3v2PrivateFrame`](id3v2privateframe.md) +▸ `Static` **find**(`frames`, `owner`): [`Id3v2PrivateFrame`](Id3v2PrivateFrame.md) Get a specified private frame from the list of private frames that matches the provided parameters. @@ -403,12 +459,12 @@ parameters. | Name | Type | Description | | :------ | :------ | :------ | -| `frames` | [`Id3v2PrivateFrame`](id3v2privateframe.md)[] | List of frames to search | +| `frames` | [`Id3v2PrivateFrame`](Id3v2PrivateFrame.md)[] | List of frames to search | | `owner` | `string` | Owner to match when searching | #### Returns -[`Id3v2PrivateFrame`](id3v2privateframe.md) +[`Id3v2PrivateFrame`](Id3v2PrivateFrame.md) PrivateFrame Matching frame or `undefined` if a match was not found @@ -416,7 +472,7 @@ ___ ### fromOffsetRawData -▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2PrivateFrame`](id3v2privateframe.md) +▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2PrivateFrame`](Id3v2PrivateFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. This method allows for offset reading from the data byte vector. @@ -425,20 +481,20 @@ version. This method allows for offset reading from the data byte vector. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `offset` | `number` | What offset in `data` the frame actually begins. Must be positive, safe integer | -| `header` | [`Id3v2FrameHeader`](id3v2frameheader.md) | Header of the frame found at `data` in the data | +| `header` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header of the frame found at `data` in the data | | `version` | `number` | ID3v2 version the frame was originally encoded with | #### Returns -[`Id3v2PrivateFrame`](id3v2privateframe.md) +[`Id3v2PrivateFrame`](Id3v2PrivateFrame.md) ___ ### fromOwner -▸ `Static` **fromOwner**(`owner`): [`Id3v2PrivateFrame`](id3v2privateframe.md) +▸ `Static` **fromOwner**(`owner`): [`Id3v2PrivateFrame`](Id3v2PrivateFrame.md) Constructs and initializes a new instance with the provided owner @@ -450,13 +506,13 @@ Constructs and initializes a new instance with the provided owner #### Returns -[`Id3v2PrivateFrame`](id3v2privateframe.md) +[`Id3v2PrivateFrame`](Id3v2PrivateFrame.md) ___ ### fromRawData -▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2PrivateFrame`](id3v2privateframe.md) +▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2PrivateFrame`](Id3v2PrivateFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. @@ -465,9 +521,9 @@ ID3v2 version. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `version` | `number` | ID3v2 version the raw frame is encoded with, must be a positive 8-bit integer | #### Returns -[`Id3v2PrivateFrame`](id3v2privateframe.md) +[`Id3v2PrivateFrame`](Id3v2PrivateFrame.md) diff --git a/docs/classes/id3v2relativevolumeframe.md b/docs/classes/Id3v2RelativeVolumeFrame.md similarity index 62% rename from docs/classes/id3v2relativevolumeframe.md rename to docs/classes/Id3v2RelativeVolumeFrame.md index 9fe3f00f..99963eef 100644 --- a/docs/classes/id3v2relativevolumeframe.md +++ b/docs/classes/Id3v2RelativeVolumeFrame.md @@ -4,69 +4,56 @@ ## Hierarchy -- [`Id3v2Frame`](id3v2frame.md) +- [`Id3v2Frame`](Id3v2Frame.md) ↳ **`Id3v2RelativeVolumeFrame`** ## Table of contents -### Properties - -- [\_header](id3v2relativevolumeframe.md#_header) - ### Accessors -- [channels](id3v2relativevolumeframe.md#channels) -- [encryptionId](id3v2relativevolumeframe.md#encryptionid) -- [flags](id3v2relativevolumeframe.md#flags) -- [frameClassType](id3v2relativevolumeframe.md#frameclasstype) -- [frameId](id3v2relativevolumeframe.md#frameid) -- [groupId](id3v2relativevolumeframe.md#groupid) -- [identification](id3v2relativevolumeframe.md#identification) -- [size](id3v2relativevolumeframe.md#size) +- [channels](Id3v2RelativeVolumeFrame.md#channels) +- [encryptionId](Id3v2RelativeVolumeFrame.md#encryptionid) +- [flags](Id3v2RelativeVolumeFrame.md#flags) +- [frameClassType](Id3v2RelativeVolumeFrame.md#frameclasstype) +- [frameId](Id3v2RelativeVolumeFrame.md#frameid) +- [groupId](Id3v2RelativeVolumeFrame.md#groupid) +- [header](Id3v2RelativeVolumeFrame.md#header) +- [identification](Id3v2RelativeVolumeFrame.md#identification) +- [size](Id3v2RelativeVolumeFrame.md#size) ### Methods -- [clone](id3v2relativevolumeframe.md#clone) -- [fieldData](id3v2relativevolumeframe.md#fielddata) -- [getPeakBits](id3v2relativevolumeframe.md#getpeakbits) -- [getPeakVolume](id3v2relativevolumeframe.md#getpeakvolume) -- [getVolumeAdjustment](id3v2relativevolumeframe.md#getvolumeadjustment) -- [parseFields](id3v2relativevolumeframe.md#parsefields) -- [render](id3v2relativevolumeframe.md#render) -- [renderFields](id3v2relativevolumeframe.md#renderfields) -- [setData](id3v2relativevolumeframe.md#setdata) -- [setPeakBits](id3v2relativevolumeframe.md#setpeakbits) -- [setPeakVolume](id3v2relativevolumeframe.md#setpeakvolume) -- [setVolumeAdjustment](id3v2relativevolumeframe.md#setvolumeadjustment) -- [toString](id3v2relativevolumeframe.md#tostring) -- [correctEncoding](id3v2relativevolumeframe.md#correctencoding) -- [find](id3v2relativevolumeframe.md#find) -- [fromIdentification](id3v2relativevolumeframe.md#fromidentification) -- [fromOffsetRawData](id3v2relativevolumeframe.md#fromoffsetrawdata) -- [fromRawData](id3v2relativevolumeframe.md#fromrawdata) - -## Properties - -### \_header - -• `Protected` **\_header**: [`Id3v2FrameHeader`](id3v2frameheader.md) - -#### Inherited from - -[Id3v2Frame](id3v2frame.md).[_header](id3v2frame.md#_header) +- [clone](Id3v2RelativeVolumeFrame.md#clone) +- [fieldData](Id3v2RelativeVolumeFrame.md#fielddata) +- [getPeakBits](Id3v2RelativeVolumeFrame.md#getpeakbits) +- [getPeakVolume](Id3v2RelativeVolumeFrame.md#getpeakvolume) +- [getVolumeAdjustment](Id3v2RelativeVolumeFrame.md#getvolumeadjustment) +- [parseFields](Id3v2RelativeVolumeFrame.md#parsefields) +- [render](Id3v2RelativeVolumeFrame.md#render) +- [renderFields](Id3v2RelativeVolumeFrame.md#renderfields) +- [setData](Id3v2RelativeVolumeFrame.md#setdata) +- [setPeakBits](Id3v2RelativeVolumeFrame.md#setpeakbits) +- [setPeakVolume](Id3v2RelativeVolumeFrame.md#setpeakvolume) +- [setVolumeAdjustment](Id3v2RelativeVolumeFrame.md#setvolumeadjustment) +- [toString](Id3v2RelativeVolumeFrame.md#tostring) +- [correctEncoding](Id3v2RelativeVolumeFrame.md#correctencoding) +- [find](Id3v2RelativeVolumeFrame.md#find) +- [fromIdentification](Id3v2RelativeVolumeFrame.md#fromidentification) +- [fromOffsetRawData](Id3v2RelativeVolumeFrame.md#fromoffsetrawdata) +- [fromRawData](Id3v2RelativeVolumeFrame.md#fromrawdata) ## Accessors ### channels -• `get` **channels**(): [`Id3v2RelativeVolumeFrameChannelData`](id3v2relativevolumeframechanneldata.md)[] +• `get` **channels**(): [`Id3v2RelativeVolumeFrameChannelData`](Id3v2RelativeVolumeFrameChannelData.md)[] Gets the channels in the current instance that have a value #### Returns -[`Id3v2RelativeVolumeFrameChannelData`](id3v2relativevolumeframechanneldata.md)[] +[`Id3v2RelativeVolumeFrameChannelData`](Id3v2RelativeVolumeFrameChannelData.md)[] ___ @@ -83,6 +70,10 @@ Gets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + • `set` **encryptionId**(`value`): `void` Sets the encryption ID applied to the current instance. @@ -100,60 +91,80 @@ Sets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + ___ ### flags -• `get` **flags**(): [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +• `get` **flags**(): [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) Gets the frame flags applied to the current instance. #### Returns -[`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +[`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) + +#### Inherited from + +Frame.flags • `set` **flags**(`value`): `void` Sets the frame flags applied to the current instance. -If the value includes either [Id3v2FrameFlags.Encryption](../enums/id3v2frameflags.md#encryption) or -[Id3v2FrameFlags.Compression](../enums/id3v2frameflags.md#compression), [render](id3v2relativevolumeframe.md#render) will throw. +If the value includes either [Id3v2FrameFlags.Encryption](../enums/Id3v2FrameFlags.md#encryption) or +[Id3v2FrameFlags.Compression](../enums/Id3v2FrameFlags.md#compression), [render](Id3v2RelativeVolumeFrame.md#render) will throw. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) | +| `value` | [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) | #### Returns `void` +#### Inherited from + +Frame.flags + ___ ### frameClassType -• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) **`inheritdoc`** #### Returns -[`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +[`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) + +#### Overrides + +Frame.frameClassType ___ ### frameId -• `get` **frameId**(): [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +• `get` **frameId**(): [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) Gets the frame ID for the current instance. #### Returns -[`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +[`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) FrameIdentifier Object representing of the identifier of the frame +#### Inherited from + +Frame.frameId + ___ ### groupId @@ -169,6 +180,10 @@ Gets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + • `set` **groupId**(`value`): `void` Sets the grouping ID applied to the current instance. @@ -186,6 +201,44 @@ Sets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + +___ + +### header + +• `Protected` `get` **header**(): [`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +Gets the header for the frame. For new frames this should not exist. + +#### Returns + +[`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +#### Inherited from + +Frame.header + +• `Protected` `set` **header**(`value`): `void` + +Sets the header for the frame. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header for the frame | + +#### Returns + +`void` + +#### Inherited from + +Frame.header + ___ ### identification @@ -212,11 +265,15 @@ NOTE: This value is not used outside of reading a frame from disk, so newly crea `number` +#### Inherited from + +Frame.size + ## Methods ### clone -▸ **clone**(): [`Id3v2Frame`](id3v2frame.md) +▸ **clone**(): [`Id3v2Frame`](Id3v2Frame.md) Creates a deep copy of the current instance. This method is implemented by rendering the current instance as an ID3v2.4 frame and using @@ -225,17 +282,17 @@ classes. #### Returns -[`Id3v2Frame`](id3v2frame.md) +[`Id3v2Frame`](Id3v2Frame.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[clone](id3v2frame.md#clone) +[Id3v2Frame](Id3v2Frame.md).[clone](Id3v2Frame.md#clone) ___ ### fieldData -▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](bytevector.md) +▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](ByteVector.md) Extracts the field data from the raw portion of an ID3v2 frame. This method is necessary for extracting extra data prepended to the frame such the as @@ -245,18 +302,18 @@ grouping ID. | Name | Type | Description | | :------ | :------ | :------ | -| `frameData` | [`ByteVector`](bytevector.md) | Raw frame data | +| `frameData` | [`ByteVector`](ByteVector.md) | Raw frame data | | `offset` | `number` | Index at which the data is contained | | `version` | `number` | Version of the ID3v2 tag the data was originally encoded with | | `dataIncludesHeader` | `boolean` | `true` if `frameData` includes the header, `false` otherwise | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[fieldData](id3v2frame.md#fielddata) +[Id3v2Frame](Id3v2Frame.md).[fieldData](Id3v2Frame.md#fielddata) ___ @@ -270,7 +327,7 @@ Gets the number of bits used to encode the peak volume | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`Id3v2RelativeVolumeFrameChannelType`](../enums/id3v2relativevolumeframechanneltype.md) | Which channel to get the value for | +| `type` | [`Id3v2RelativeVolumeFrameChannelType`](../enums/Id3v2RelativeVolumeFrameChannelType.md) | Which channel to get the value for | #### Returns @@ -288,7 +345,7 @@ Gets the peak volume for a specified channel | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`Id3v2RelativeVolumeFrameChannelType`](../enums/id3v2relativevolumeframechanneltype.md) | Which channel to get the value for | +| `type` | [`Id3v2RelativeVolumeFrameChannelType`](../enums/Id3v2RelativeVolumeFrameChannelType.md) | Which channel to get the value for | #### Returns @@ -306,7 +363,7 @@ Gets the volume adjustment for the specified channel. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`Id3v2RelativeVolumeFrameChannelType`](../enums/id3v2relativevolumeframechanneltype.md) | Which channel to get the value for | +| `type` | [`Id3v2RelativeVolumeFrameChannelType`](../enums/Id3v2RelativeVolumeFrameChannelType.md) | Which channel to get the value for | #### Returns @@ -318,7 +375,7 @@ ___ ### parseFields -▸ `Protected` **parseFields**(`data`, `_version`): `void` +▸ `Protected` **parseFields**(`data`): `void` Populates the values in this frame by parsing its field data in a specified version. @@ -326,8 +383,7 @@ Populates the values in this frame by parsing its field data in a specified vers | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Extracted field data | -| `_version` | `number` | ID3v2 version the field data is encoded in | +| `data` | [`ByteVector`](ByteVector.md) | Extracted field data | #### Returns @@ -335,13 +391,13 @@ Populates the values in this frame by parsing its field data in a specified vers #### Overrides -[Id3v2Frame](id3v2frame.md).[parseFields](id3v2frame.md#parsefields) +[Id3v2Frame](Id3v2Frame.md).[parseFields](Id3v2Frame.md#parsefields) ___ ### render -▸ **render**(`version`): [`ByteVector`](bytevector.md) +▸ **render**(`version`): [`ByteVector`](ByteVector.md) Renders the current instance, encoded in a specified ID3v2 version. @@ -353,33 +409,27 @@ Renders the current instance, encoded in a specified ID3v2 version. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[render](id3v2frame.md#render) +[Id3v2Frame](Id3v2Frame.md).[render](Id3v2Frame.md#render) ___ ### renderFields -▸ `Protected` **renderFields**(`_version`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderFields**(): [`ByteVector`](ByteVector.md) Renders the values in the current instance into field data for a specified version. -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `_version` | `number` | ID3v2 version the field data is to be encoded in. | - #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[renderFields](id3v2frame.md#renderfields) +[Id3v2Frame](Id3v2Frame.md).[renderFields](Id3v2Frame.md#renderfields) ___ @@ -394,7 +444,7 @@ header. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw ID3v2 frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw ID3v2 frame | | `offset` | `number` | Offset in `data` at which the frame begins. | | `readHeader` | `boolean` | Whether or not to read the reader into the current instance. | | `version` | `number` | Version of the ID3v2 tag the data was encoded with | @@ -405,7 +455,7 @@ header. #### Inherited from -[Id3v2Frame](id3v2frame.md).[setData](id3v2frame.md#setdata) +[Id3v2Frame](Id3v2Frame.md).[setData](Id3v2Frame.md#setdata) ___ @@ -419,7 +469,7 @@ Sets the number of bits used to encode peak volume for a specified channel. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`Id3v2RelativeVolumeFrameChannelType`](../enums/id3v2relativevolumeframechanneltype.md) | Which channel to set the value for | +| `type` | [`Id3v2RelativeVolumeFrameChannelType`](../enums/Id3v2RelativeVolumeFrameChannelType.md) | Which channel to set the value for | | `value` | `number` | Peak volume | #### Returns @@ -438,7 +488,7 @@ Sets the peak volume for a specified channel. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`Id3v2RelativeVolumeFrameChannelType`](../enums/id3v2relativevolumeframechanneltype.md) | Which channel to set the value for | +| `type` | [`Id3v2RelativeVolumeFrameChannelType`](../enums/Id3v2RelativeVolumeFrameChannelType.md) | Which channel to set the value for | | `value` | `bigint` | Peak volume | #### Returns @@ -457,7 +507,7 @@ Sets the volume adjustment in decibels for the specified channel. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`Id3v2RelativeVolumeFrameChannelType`](../enums/id3v2relativevolumeframechanneltype.md) | Which channel to set the value for | +| `type` | [`Id3v2RelativeVolumeFrameChannelType`](../enums/Id3v2RelativeVolumeFrameChannelType.md) | Which channel to set the value for | | `value` | `number` | Volume adjustment in decibels. Must be betweenInclusive -64 and +64 | #### Returns @@ -480,7 +530,7 @@ ___ ### correctEncoding -▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/stringtype.md) +▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/StringType.md) Converts an encoding to be a supported encoding for a specified tag version. @@ -488,26 +538,26 @@ Converts an encoding to be a supported encoding for a specified tag version. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`StringType`](../enums/stringtype.md) | Value containing the original encoding | +| `type` | [`StringType`](../enums/StringType.md) | Value containing the original encoding | | `version` | `number` | Value containing the ID3v2 version to be encoded. | #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) StringType Value containing the correct encoding to use, based on - [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) and what is supported by + [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) and what is supported by `version` #### Inherited from -[Id3v2Frame](id3v2frame.md).[correctEncoding](id3v2frame.md#correctencoding) +[Id3v2Frame](Id3v2Frame.md).[correctEncoding](Id3v2Frame.md#correctencoding) ___ ### find -▸ `Static` **find**(`frames`, `identification`): [`Id3v2RelativeVolumeFrame`](id3v2relativevolumeframe.md) +▸ `Static` **find**(`frames`, `identification`): [`Id3v2RelativeVolumeFrame`](Id3v2RelativeVolumeFrame.md) Gets a specified volume adjustment frame from the list of relative volume frames @@ -515,12 +565,12 @@ Gets a specified volume adjustment frame from the list of relative volume frames | Name | Type | Description | | :------ | :------ | :------ | -| `frames` | [`Id3v2RelativeVolumeFrame`](id3v2relativevolumeframe.md)[] | List of frames to search | +| `frames` | [`Id3v2RelativeVolumeFrame`](Id3v2RelativeVolumeFrame.md)[] | List of frames to search | | `identification` | `string` | Identification to match | #### Returns -[`Id3v2RelativeVolumeFrame`](id3v2relativevolumeframe.md) +[`Id3v2RelativeVolumeFrame`](Id3v2RelativeVolumeFrame.md) RelativeVolumeFrame Frame containing the matching user or `undefined` if a match was not found @@ -529,7 +579,7 @@ ___ ### fromIdentification -▸ `Static` **fromIdentification**(`identification`): [`Id3v2RelativeVolumeFrame`](id3v2relativevolumeframe.md) +▸ `Static` **fromIdentification**(`identification`): [`Id3v2RelativeVolumeFrame`](Id3v2RelativeVolumeFrame.md) Constructs and initializes a new instance with a specified identifier @@ -541,13 +591,13 @@ Constructs and initializes a new instance with a specified identifier #### Returns -[`Id3v2RelativeVolumeFrame`](id3v2relativevolumeframe.md) +[`Id3v2RelativeVolumeFrame`](Id3v2RelativeVolumeFrame.md) ___ ### fromOffsetRawData -▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2RelativeVolumeFrame`](id3v2relativevolumeframe.md) +▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2RelativeVolumeFrame`](Id3v2RelativeVolumeFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version starting a specified offset. @@ -556,20 +606,20 @@ version starting a specified offset. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `offset` | `number` | Offset into `data` where the frame actually begins. Must be a positive, 32-bit integer | -| `header` | [`Id3v2FrameHeader`](id3v2frameheader.md) | Header of the frame found at `offset` in `data` | +| `header` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header of the frame found at `offset` in `data` | | `version` | `number` | ID3v2 version the frame was originally encoded with | #### Returns -[`Id3v2RelativeVolumeFrame`](id3v2relativevolumeframe.md) +[`Id3v2RelativeVolumeFrame`](Id3v2RelativeVolumeFrame.md) ___ ### fromRawData -▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2RelativeVolumeFrame`](id3v2relativevolumeframe.md) +▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2RelativeVolumeFrame`](Id3v2RelativeVolumeFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. @@ -578,9 +628,9 @@ version. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `version` | `number` | ID3v2 version the frame is encoded with. Must be a positive 8-bit integer. | #### Returns -[`Id3v2RelativeVolumeFrame`](id3v2relativevolumeframe.md) +[`Id3v2RelativeVolumeFrame`](Id3v2RelativeVolumeFrame.md) diff --git a/docs/classes/id3v2relativevolumeframechanneldata.md b/docs/classes/Id3v2RelativeVolumeFrameChannelData.md similarity index 67% rename from docs/classes/id3v2relativevolumeframechanneldata.md rename to docs/classes/Id3v2RelativeVolumeFrameChannelData.md index c7bc4418..a0a8412d 100644 --- a/docs/classes/id3v2relativevolumeframechanneldata.md +++ b/docs/classes/Id3v2RelativeVolumeFrameChannelData.md @@ -6,20 +6,20 @@ ### Constructors -- [constructor](id3v2relativevolumeframechanneldata.md#constructor) +- [constructor](Id3v2RelativeVolumeFrameChannelData.md#constructor) ### Accessors -- [channelType](id3v2relativevolumeframechanneldata.md#channeltype) -- [isSet](id3v2relativevolumeframechanneldata.md#isset) -- [peakBits](id3v2relativevolumeframechanneldata.md#peakbits) -- [peakVolume](id3v2relativevolumeframechanneldata.md#peakvolume) -- [volumeAdjustment](id3v2relativevolumeframechanneldata.md#volumeadjustment) +- [channelType](Id3v2RelativeVolumeFrameChannelData.md#channeltype) +- [isSet](Id3v2RelativeVolumeFrameChannelData.md#isset) +- [peakBits](Id3v2RelativeVolumeFrameChannelData.md#peakbits) +- [peakVolume](Id3v2RelativeVolumeFrameChannelData.md#peakvolume) +- [volumeAdjustment](Id3v2RelativeVolumeFrameChannelData.md#volumeadjustment) ### Methods -- [render](id3v2relativevolumeframechanneldata.md#render) -- [fromData](id3v2relativevolumeframechanneldata.md#fromdata) +- [render](Id3v2RelativeVolumeFrameChannelData.md#render) +- [fromData](Id3v2RelativeVolumeFrameChannelData.md#fromdata) ## Constructors @@ -31,17 +31,17 @@ | Name | Type | | :------ | :------ | -| `channel` | [`Id3v2RelativeVolumeFrameChannelType`](../enums/id3v2relativevolumeframechanneltype.md) | +| `channel` | [`Id3v2RelativeVolumeFrameChannelType`](../enums/Id3v2RelativeVolumeFrameChannelType.md) | ## Accessors ### channelType -• `get` **channelType**(): [`Id3v2RelativeVolumeFrameChannelType`](../enums/id3v2relativevolumeframechanneltype.md) +• `get` **channelType**(): [`Id3v2RelativeVolumeFrameChannelType`](../enums/Id3v2RelativeVolumeFrameChannelType.md) #### Returns -[`Id3v2RelativeVolumeFrameChannelType`](../enums/id3v2relativevolumeframechanneltype.md) +[`Id3v2RelativeVolumeFrameChannelType`](../enums/Id3v2RelativeVolumeFrameChannelType.md) ___ @@ -87,7 +87,7 @@ ___ Value of the peak sample in the file. It's unclear exactly how this works, but the ID3v2.4 documentation explains this value as betweenInclusive 0 and 255 - but can be expressed using any -number of bits ([peakBits](id3v2relativevolumeframechanneldata.md#peakbits)). +number of bits ([peakBits](Id3v2RelativeVolumeFrameChannelData.md#peakbits)). #### Returns @@ -97,13 +97,13 @@ number of bits ([peakBits](id3v2relativevolumeframechanneldata.md#peakbits)). Value of the peak sample in the file. It's unclear exactly how this works, but the ID3v2.4 documentation explains this value as betweenInclusive 0 and 255 - but can be expressed using any -number of bits ([peakBits](id3v2relativevolumeframechanneldata.md#peakbits)). +number of bits ([peakBits](Id3v2RelativeVolumeFrameChannelData.md#peakbits)). #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `value` | `bigint` | Peak volume value. Must fit in the number of bits set in [peakBits](id3v2relativevolumeframechanneldata.md#peakbits) | +| `value` | `bigint` | Peak volume value. Must fit in the number of bits set in [peakBits](Id3v2RelativeVolumeFrameChannelData.md#peakbits) | #### Returns @@ -140,24 +140,24 @@ betweenInclusive -64 and 64. Don't worry about the math, we'll do it for you. ### render -▸ **render**(): [`ByteVector`](bytevector.md) +▸ **render**(): [`ByteVector`](ByteVector.md) #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ___ ### fromData -▸ `Static` **fromData**(`bytes`): [`Id3v2RelativeVolumeFrameChannelData`](id3v2relativevolumeframechanneldata.md) +▸ `Static` **fromData**(`bytes`): [`Id3v2RelativeVolumeFrameChannelData`](Id3v2RelativeVolumeFrameChannelData.md) #### Parameters | Name | Type | | :------ | :------ | -| `bytes` | [`ByteVector`](bytevector.md) | +| `bytes` | [`ByteVector`](ByteVector.md) | #### Returns -[`Id3v2RelativeVolumeFrameChannelData`](id3v2relativevolumeframechanneldata.md) +[`Id3v2RelativeVolumeFrameChannelData`](Id3v2RelativeVolumeFrameChannelData.md) diff --git a/docs/classes/id3v2settings.md b/docs/classes/Id3v2Settings.md similarity index 86% rename from docs/classes/id3v2settings.md rename to docs/classes/Id3v2Settings.md index 891a9c24..cd3815d1 100644 --- a/docs/classes/id3v2settings.md +++ b/docs/classes/Id3v2Settings.md @@ -6,28 +6,28 @@ ### Accessors -- [defaultEncoding](id3v2settings.md#defaultencoding) -- [defaultVersion](id3v2settings.md#defaultversion) -- [footerSize](id3v2settings.md#footersize) -- [forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) -- [forceDefaultVersion](id3v2settings.md#forcedefaultversion) -- [headerSize](id3v2settings.md#headersize) -- [strictFrameForVersion](id3v2settings.md#strictframeforversion) -- [useNonStandardV2V3GenreSeparators](id3v2settings.md#usenonstandardv2v3genreseparators) -- [useNonStandardV2V3NumericGenres](id3v2settings.md#usenonstandardv2v3numericgenres) -- [useNumericGenres](id3v2settings.md#usenumericgenres) +- [defaultEncoding](Id3v2Settings.md#defaultencoding) +- [defaultVersion](Id3v2Settings.md#defaultversion) +- [footerSize](Id3v2Settings.md#footersize) +- [forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) +- [forceDefaultVersion](Id3v2Settings.md#forcedefaultversion) +- [headerSize](Id3v2Settings.md#headersize) +- [strictFrameForVersion](Id3v2Settings.md#strictframeforversion) +- [useNonStandardV2V3GenreSeparators](Id3v2Settings.md#usenonstandardv2v3genreseparators) +- [useNonStandardV2V3NumericGenres](Id3v2Settings.md#usenonstandardv2v3numericgenres) +- [useNumericGenres](Id3v2Settings.md#usenumericgenres) ## Accessors ### defaultEncoding -• `Static` `get` **defaultEncoding**(): [`StringType`](../enums/stringtype.md) +• `Static` `get` **defaultEncoding**(): [`StringType`](../enums/StringType.md) Gets the encoding to use when creating new frames. #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) • `Static` `set` **defaultEncoding**(`value`): `void` @@ -37,7 +37,7 @@ Sets the encoding to use when creating new frames. | Name | Type | Description | | :------ | :------ | :------ | -| `value` | [`StringType`](../enums/stringtype.md) | Encoding to use when creating new frames | +| `value` | [`StringType`](../enums/StringType.md) | Encoding to use when creating new frames | #### Returns @@ -50,7 +50,7 @@ ___ • `Static` `get` **defaultVersion**(): `number` Gets the default version to use when creating new tags. -If [forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) is `true` then all tags will be rendered with this version. +If [forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) is `true` then all tags will be rendered with this version. #### Returns @@ -59,7 +59,7 @@ If [forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) is `true` then • `Static` `set` **defaultVersion**(`value`): `void` Sets the default version to use when creating new tags. -If [forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) is `true` then all tags will be rendered with this version. +If [forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) is `true` then all tags will be rendered with this version. #### Parameters @@ -105,7 +105,7 @@ original encoding. | Name | Type | Description | | :------ | :------ | :------ | -| `value` | `boolean` | If `true` frames will be rendered using [defaultEncoding](id3v2settings.md#defaultencoding) rather than their original encoding. | +| `value` | `boolean` | If `true` frames will be rendered using [defaultEncoding](Id3v2Settings.md#defaultencoding) rather than their original encoding. | #### Returns @@ -133,7 +133,7 @@ version. | Name | Type | Description | | :------ | :------ | :------ | -| `value` | `boolean` | If `true`, tags will be saved in the version defined in [defaultVersion](id3v2settings.md#defaultversion) rather than their original format, with the exception of tags with footers which will always be saved in version 4 | +| `value` | `boolean` | If `true`, tags will be saved in the version defined in [defaultVersion](Id3v2Settings.md#defaultversion) rather than their original format, with the exception of tags with footers which will always be saved in version 4 | #### Returns @@ -200,7 +200,7 @@ standard, escaped numeric genres). inherent flaws fixed in ID3v2.4. However, various media players, as well as the original implementation of TagLib#, support using `;` and `/` to separate genres. In order to maintain compatibility, this functionality is preserved, but can be disabled by setting - [useNonStandardV2V3GenreSeparators](id3v2settings.md#usenonstandardv2v3genreseparators) to `false`. + [useNonStandardV2V3GenreSeparators](Id3v2Settings.md#usenonstandardv2v3genreseparators) to `false`. #### Returns @@ -217,7 +217,7 @@ standard, escaped numeric genres). inherent flaws fixed in ID3v2.4. However, various media players, as well as the original implementation of TagLib#, support using `;` and `/` to separate genres. In order to maintain compatibility, this functionality is preserved, but can be disabled by setting - [useNonStandardV2V3GenreSeparators](id3v2settings.md#usenonstandardv2v3genreseparators) to `false`. + [useNonStandardV2V3GenreSeparators](Id3v2Settings.md#usenonstandardv2v3genreseparators) to `false`. #### Parameters @@ -243,7 +243,7 @@ If `false`, the TCO/TCON frame value will be returned without parsing purely num escaped inside parenthesis (eg, `(12)`). However, the original implementation of TagLib# allowed ID3v2.2 and ID3v2.3 tags to parse unescaped numeric genres. In order to maintain compatibility, this functionality is preserved, but can be disabled by setting - [useNonStandardV2V3NumericGenres](id3v2settings.md#usenonstandardv2v3numericgenres) to `false`. + [useNonStandardV2V3NumericGenres](Id3v2Settings.md#usenonstandardv2v3numericgenres) to `false`. #### Returns @@ -259,7 +259,7 @@ If `false`, the TCO/TCON frame value will be returned without parsing purely num escaped inside parenthesis (eg, `(12)`). However, the original implementation of TagLib# allowed ID3v2.2 and ID3v2.3 tags to parse unescaped numeric genres. In order to maintain compatibility, this functionality is preserved, but can be disabled by setting - [useNonStandardV2V3NumericGenres](id3v2settings.md#usenonstandardv2v3numericgenres) to `false`. + [useNonStandardV2V3NumericGenres](Id3v2Settings.md#usenonstandardv2v3numericgenres) to `false`. #### Parameters diff --git a/docs/classes/id3v2synchronized.md b/docs/classes/Id3v2Synchronized.md similarity index 63% rename from docs/classes/id3v2synchronized.md rename to docs/classes/Id3v2Synchronized.md index 57f7f24b..673e29c8 100644 --- a/docs/classes/id3v2synchronized.md +++ b/docs/classes/Id3v2Synchronized.md @@ -7,55 +7,42 @@ frames. ## Hierarchy -- [`Id3v2Frame`](id3v2frame.md) +- [`Id3v2Frame`](Id3v2Frame.md) ↳ **`Id3v2Synchronized`** ## Table of contents -### Properties - -- [\_header](id3v2synchronized.md#_header) - ### Accessors -- [description](id3v2synchronized.md#description) -- [encryptionId](id3v2synchronized.md#encryptionid) -- [flags](id3v2synchronized.md#flags) -- [format](id3v2synchronized.md#format) -- [frameClassType](id3v2synchronized.md#frameclasstype) -- [frameId](id3v2synchronized.md#frameid) -- [groupId](id3v2synchronized.md#groupid) -- [language](id3v2synchronized.md#language) -- [size](id3v2synchronized.md#size) -- [text](id3v2synchronized.md#text) -- [textEncoding](id3v2synchronized.md#textencoding) -- [textType](id3v2synchronized.md#texttype) +- [description](Id3v2Synchronized.md#description) +- [encryptionId](Id3v2Synchronized.md#encryptionid) +- [flags](Id3v2Synchronized.md#flags) +- [format](Id3v2Synchronized.md#format) +- [frameClassType](Id3v2Synchronized.md#frameclasstype) +- [frameId](Id3v2Synchronized.md#frameid) +- [groupId](Id3v2Synchronized.md#groupid) +- [header](Id3v2Synchronized.md#header) +- [language](Id3v2Synchronized.md#language) +- [size](Id3v2Synchronized.md#size) +- [text](Id3v2Synchronized.md#text) +- [textEncoding](Id3v2Synchronized.md#textencoding) +- [textType](Id3v2Synchronized.md#texttype) ### Methods -- [clone](id3v2synchronized.md#clone) -- [fieldData](id3v2synchronized.md#fielddata) -- [parseFields](id3v2synchronized.md#parsefields) -- [render](id3v2synchronized.md#render) -- [renderFields](id3v2synchronized.md#renderfields) -- [setData](id3v2synchronized.md#setdata) -- [correctEncoding](id3v2synchronized.md#correctencoding) -- [find](id3v2synchronized.md#find) -- [findPreferred](id3v2synchronized.md#findpreferred) -- [fromInfo](id3v2synchronized.md#frominfo) -- [fromOffsetRawData](id3v2synchronized.md#fromoffsetrawdata) -- [fromRawData](id3v2synchronized.md#fromrawdata) - -## Properties - -### \_header - -• `Protected` **\_header**: [`Id3v2FrameHeader`](id3v2frameheader.md) - -#### Inherited from - -[Id3v2Frame](id3v2frame.md).[_header](id3v2frame.md#_header) +- [clone](Id3v2Synchronized.md#clone) +- [fieldData](Id3v2Synchronized.md#fielddata) +- [parseFields](Id3v2Synchronized.md#parsefields) +- [render](Id3v2Synchronized.md#render) +- [renderFields](Id3v2Synchronized.md#renderfields) +- [setData](Id3v2Synchronized.md#setdata) +- [correctEncoding](Id3v2Synchronized.md#correctencoding) +- [find](Id3v2Synchronized.md#find) +- [findPreferred](Id3v2Synchronized.md#findpreferred) +- [fromInfo](Id3v2Synchronized.md#frominfo) +- [fromOffsetRawData](Id3v2Synchronized.md#fromoffsetrawdata) +- [fromRawData](Id3v2Synchronized.md#fromrawdata) ## Accessors @@ -100,6 +87,10 @@ Gets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + • `set` **encryptionId**(`value`): `void` Sets the encryption ID applied to the current instance. @@ -117,45 +108,57 @@ Sets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + ___ ### flags -• `get` **flags**(): [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +• `get` **flags**(): [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) Gets the frame flags applied to the current instance. #### Returns -[`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +[`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) + +#### Inherited from + +Frame.flags • `set` **flags**(`value`): `void` Sets the frame flags applied to the current instance. -If the value includes either [Id3v2FrameFlags.Encryption](../enums/id3v2frameflags.md#encryption) or -[Id3v2FrameFlags.Compression](../enums/id3v2frameflags.md#compression), [render](id3v2synchronized.md#render) will throw. +If the value includes either [Id3v2FrameFlags.Encryption](../enums/Id3v2FrameFlags.md#encryption) or +[Id3v2FrameFlags.Compression](../enums/Id3v2FrameFlags.md#compression), [render](Id3v2Synchronized.md#render) will throw. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) | +| `value` | [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) | #### Returns `void` +#### Inherited from + +Frame.flags + ___ ### format -• `get` **format**(): [`Id3v2TimestampFormat`](../enums/id3v2timestampformat.md) +• `get` **format**(): [`Id3v2TimestampFormat`](../enums/Id3v2TimestampFormat.md) Gets the timestamp format used by the current instance. #### Returns -[`Id3v2TimestampFormat`](../enums/id3v2timestampformat.md) +[`Id3v2TimestampFormat`](../enums/Id3v2TimestampFormat.md) • `set` **format**(`value`): `void` @@ -165,7 +168,7 @@ Sets the timestamp format used by the current instance. | Name | Type | Description | | :------ | :------ | :------ | -| `value` | [`Id3v2TimestampFormat`](../enums/id3v2timestampformat.md) | Timestamp format to use | +| `value` | [`Id3v2TimestampFormat`](../enums/Id3v2TimestampFormat.md) | Timestamp format to use | #### Returns @@ -175,28 +178,36 @@ ___ ### frameClassType -• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) **`inheritdoc`** #### Returns -[`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +[`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) + +#### Overrides + +Frame.frameClassType ___ ### frameId -• `get` **frameId**(): [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +• `get` **frameId**(): [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) Gets the frame ID for the current instance. #### Returns -[`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +[`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) FrameIdentifier Object representing of the identifier of the frame +#### Inherited from + +Frame.frameId + ___ ### groupId @@ -212,6 +223,10 @@ Gets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + • `set` **groupId**(`value`): `void` Sets the grouping ID applied to the current instance. @@ -229,6 +244,44 @@ Sets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + +___ + +### header + +• `Protected` `get` **header**(): [`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +Gets the header for the frame. For new frames this should not exist. + +#### Returns + +[`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +#### Inherited from + +Frame.header + +• `Protected` `set` **header**(`value`): `void` + +Sets the header for the frame. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header for the frame | + +#### Returns + +`void` + +#### Inherited from + +Frame.header + ___ ### language @@ -271,17 +324,21 @@ NOTE: This value is not used outside of reading a frame from disk, so newly crea `number` +#### Inherited from + +Frame.size + ___ ### text -• `get` **text**(): [`Id3v2SynchronizedLyricsFrame`](id3v2synchronizedlyricsframe.md)[] +• `get` **text**(): [`Id3v2SynchronizedLyricsFrame`](Id3v2SynchronizedLyricsFrame.md)[] Gets the text contained in the current instance #### Returns -[`Id3v2SynchronizedLyricsFrame`](id3v2synchronizedlyricsframe.md)[] +[`Id3v2SynchronizedLyricsFrame`](Id3v2SynchronizedLyricsFrame.md)[] • `set` **text**(`value`): `void` @@ -291,7 +348,7 @@ Sets the text contained in the current instance | Name | Type | Description | | :------ | :------ | :------ | -| `value` | [`Id3v2SynchronizedLyricsFrame`](id3v2synchronizedlyricsframe.md)[] | Text contained in the current instance | +| `value` | [`Id3v2SynchronizedLyricsFrame`](Id3v2SynchronizedLyricsFrame.md)[] | Text contained in the current instance | #### Returns @@ -301,25 +358,25 @@ ___ ### textEncoding -• `get` **textEncoding**(): [`StringType`](../enums/stringtype.md) +• `get` **textEncoding**(): [`StringType`](../enums/StringType.md) Gets the text encoding to use when storing the current instance #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) • `set` **textEncoding**(`value`): `void` Sets the text encoding to use when storing the current instance. -This encoding is overridden when rendering if [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) is +This encoding is overridden when rendering if [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) is `true` or the render version does not support it. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `value` | [`StringType`](../enums/stringtype.md) | Text encoding to use when storing the current instance | +| `value` | [`StringType`](../enums/StringType.md) | Text encoding to use when storing the current instance | #### Returns @@ -329,13 +386,13 @@ ___ ### textType -• `get` **textType**(): [`Id3v2SynchronizedTextType`](../enums/id3v2synchronizedtexttype.md) +• `get` **textType**(): [`Id3v2SynchronizedTextType`](../enums/Id3v2SynchronizedTextType.md) Gets the type of text contained in the current instance #### Returns -[`Id3v2SynchronizedTextType`](../enums/id3v2synchronizedtexttype.md) +[`Id3v2SynchronizedTextType`](../enums/Id3v2SynchronizedTextType.md) • `set` **textType**(`value`): `void` @@ -345,7 +402,7 @@ Sets the type of text contained in the current instance. | Name | Type | Description | | :------ | :------ | :------ | -| `value` | [`Id3v2SynchronizedTextType`](../enums/id3v2synchronizedtexttype.md) | Type of the synchronized text | +| `value` | [`Id3v2SynchronizedTextType`](../enums/Id3v2SynchronizedTextType.md) | Type of the synchronized text | #### Returns @@ -355,7 +412,7 @@ Sets the type of text contained in the current instance. ### clone -▸ **clone**(): [`Id3v2Frame`](id3v2frame.md) +▸ **clone**(): [`Id3v2Frame`](Id3v2Frame.md) Creates a deep copy of the current instance. This method is implemented by rendering the current instance as an ID3v2.4 frame and using @@ -364,17 +421,17 @@ classes. #### Returns -[`Id3v2Frame`](id3v2frame.md) +[`Id3v2Frame`](Id3v2Frame.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[clone](id3v2frame.md#clone) +[Id3v2Frame](Id3v2Frame.md).[clone](Id3v2Frame.md#clone) ___ ### fieldData -▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](bytevector.md) +▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](ByteVector.md) Extracts the field data from the raw portion of an ID3v2 frame. This method is necessary for extracting extra data prepended to the frame such the as @@ -384,24 +441,24 @@ grouping ID. | Name | Type | Description | | :------ | :------ | :------ | -| `frameData` | [`ByteVector`](bytevector.md) | Raw frame data | +| `frameData` | [`ByteVector`](ByteVector.md) | Raw frame data | | `offset` | `number` | Index at which the data is contained | | `version` | `number` | Version of the ID3v2 tag the data was originally encoded with | | `dataIncludesHeader` | `boolean` | `true` if `frameData` includes the header, `false` otherwise | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[fieldData](id3v2frame.md#fielddata) +[Id3v2Frame](Id3v2Frame.md).[fieldData](Id3v2Frame.md#fielddata) ___ ### parseFields -▸ `Protected` **parseFields**(`data`, `_version`): `void` +▸ `Protected` **parseFields**(`data`): `void` Populates the values in this frame by parsing its field data in a specified version. @@ -409,8 +466,7 @@ Populates the values in this frame by parsing its field data in a specified vers | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Extracted field data | -| `_version` | `number` | ID3v2 version the field data is encoded in | +| `data` | [`ByteVector`](ByteVector.md) | Extracted field data | #### Returns @@ -418,13 +474,13 @@ Populates the values in this frame by parsing its field data in a specified vers #### Overrides -[Id3v2Frame](id3v2frame.md).[parseFields](id3v2frame.md#parsefields) +[Id3v2Frame](Id3v2Frame.md).[parseFields](Id3v2Frame.md#parsefields) ___ ### render -▸ **render**(`version`): [`ByteVector`](bytevector.md) +▸ **render**(`version`): [`ByteVector`](ByteVector.md) Renders the current instance, encoded in a specified ID3v2 version. @@ -436,17 +492,17 @@ Renders the current instance, encoded in a specified ID3v2 version. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[render](id3v2frame.md#render) +[Id3v2Frame](Id3v2Frame.md).[render](Id3v2Frame.md#render) ___ ### renderFields -▸ `Protected` **renderFields**(`version`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderFields**(`version`): [`ByteVector`](ByteVector.md) Renders the values in the current instance into field data for a specified version. @@ -458,11 +514,11 @@ Renders the values in the current instance into field data for a specified versi #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[renderFields](id3v2frame.md#renderfields) +[Id3v2Frame](Id3v2Frame.md).[renderFields](Id3v2Frame.md#renderfields) ___ @@ -477,7 +533,7 @@ header. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw ID3v2 frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw ID3v2 frame | | `offset` | `number` | Offset in `data` at which the frame begins. | | `readHeader` | `boolean` | Whether or not to read the reader into the current instance. | | `version` | `number` | Version of the ID3v2 tag the data was encoded with | @@ -488,13 +544,13 @@ header. #### Inherited from -[Id3v2Frame](id3v2frame.md).[setData](id3v2frame.md#setdata) +[Id3v2Frame](Id3v2Frame.md).[setData](Id3v2Frame.md#setdata) ___ ### correctEncoding -▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/stringtype.md) +▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/StringType.md) Converts an encoding to be a supported encoding for a specified tag version. @@ -502,26 +558,26 @@ Converts an encoding to be a supported encoding for a specified tag version. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`StringType`](../enums/stringtype.md) | Value containing the original encoding | +| `type` | [`StringType`](../enums/StringType.md) | Value containing the original encoding | | `version` | `number` | Value containing the ID3v2 version to be encoded. | #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) StringType Value containing the correct encoding to use, based on - [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) and what is supported by + [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) and what is supported by `version` #### Inherited from -[Id3v2Frame](id3v2frame.md).[correctEncoding](id3v2frame.md#correctencoding) +[Id3v2Frame](Id3v2Frame.md).[correctEncoding](Id3v2Frame.md#correctencoding) ___ ### find -▸ `Static` **find**(`frames`, `description`, `textType`, `language?`): [`Id3v2Synchronized`](id3v2synchronized.md) +▸ `Static` **find**(`frames`, `description`, `textType`, `language?`): [`Id3v2Synchronized`](Id3v2Synchronized.md) Gets a specified lyrics frame from a list of synchronized lyrics frames @@ -529,14 +585,14 @@ Gets a specified lyrics frame from a list of synchronized lyrics frames | Name | Type | Description | | :------ | :------ | :------ | -| `frames` | [`Id3v2Synchronized`](id3v2synchronized.md)[] | List of frames to search | +| `frames` | [`Id3v2Synchronized`](Id3v2Synchronized.md)[] | List of frames to search | | `description` | `string` | Description to match | -| `textType` | [`Id3v2SynchronizedTextType`](../enums/id3v2synchronizedtexttype.md) | Text type to match | +| `textType` | [`Id3v2SynchronizedTextType`](../enums/Id3v2SynchronizedTextType.md) | Text type to match | | `language?` | `string` | Optionally, ISO-639-2 language code to match | #### Returns -[`Id3v2Synchronized`](id3v2synchronized.md) +[`Id3v2Synchronized`](Id3v2Synchronized.md) SynchronizedLyricsFrame Frame containing the matching user, `undefined` if a match was not found @@ -545,7 +601,7 @@ ___ ### findPreferred -▸ `Static` **findPreferred**(`frames`, `description`, `language`, `textType`): [`Id3v2Synchronized`](id3v2synchronized.md) +▸ `Static` **findPreferred**(`frames`, `description`, `language`, `textType`): [`Id3v2Synchronized`](Id3v2Synchronized.md) Gets a synchronized lyrics frame from the specified list, trying to match the description and language but accepting an incomplete match. @@ -561,14 +617,14 @@ This method tries matching with the following order of precedence: | Name | Type | Description | | :------ | :------ | :------ | -| `frames` | [`Id3v2Synchronized`](id3v2synchronized.md)[] | List of frames to search for the best match | +| `frames` | [`Id3v2Synchronized`](Id3v2Synchronized.md)[] | List of frames to search for the best match | | `description` | `string` | Description to match | | `language` | `string` | ISO-639-2 language code to match | -| `textType` | [`Id3v2SynchronizedTextType`](../enums/id3v2synchronizedtexttype.md) | Text type to match | +| `textType` | [`Id3v2SynchronizedTextType`](../enums/Id3v2SynchronizedTextType.md) | Text type to match | #### Returns -[`Id3v2Synchronized`](id3v2synchronized.md) +[`Id3v2Synchronized`](Id3v2Synchronized.md) SynchronizedLyricsFrame The matching frame or `undefined` if a match was not found @@ -576,29 +632,29 @@ ___ ### fromInfo -▸ `Static` **fromInfo**(`description`, `language`, `textType`, `encoding?`): [`Id3v2Synchronized`](id3v2synchronized.md) +▸ `Static` **fromInfo**(`description`, `language`, `textType`, `encoding?`): [`Id3v2Synchronized`](Id3v2Synchronized.md) Constructs and initializes a new instance with a specified description, ISO-639-2 language code, text type, and text encoding. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `description` | `string` | Description of the synchronized lyrics frame | -| `language` | `string` | ISO-639-2 language code of the new instance | -| `textType` | [`Id3v2SynchronizedTextType`](../enums/id3v2synchronizedtexttype.md) | Type of the text to store in the new instance | -| `encoding` | [`StringType`](../enums/stringtype.md) | Encoding to use when rendering text in this new instance | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `description` | `string` | `undefined` | Description of the synchronized lyrics frame | +| `language` | `string` | `undefined` | ISO-639-2 language code of the new instance | +| `textType` | [`Id3v2SynchronizedTextType`](../enums/Id3v2SynchronizedTextType.md) | `undefined` | Type of the text to store in the new instance | +| `encoding` | [`StringType`](../enums/StringType.md) | `Id3v2Settings.defaultEncoding` | Encoding to use when rendering text in this new instance | #### Returns -[`Id3v2Synchronized`](id3v2synchronized.md) +[`Id3v2Synchronized`](Id3v2Synchronized.md) ___ ### fromOffsetRawData -▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2Synchronized`](id3v2synchronized.md) +▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2Synchronized`](Id3v2Synchronized.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 format. @@ -607,20 +663,20 @@ format. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new instance | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new instance | | `offset` | `number` | Offset into `data` where the frame begins. Must be unsigned, safe integer | -| `header` | [`Id3v2FrameHeader`](id3v2frameheader.md) | Header of the frame found at `offset` in `data` | +| `header` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header of the frame found at `offset` in `data` | | `version` | `number` | ID3v2 version the frame was originally encoded with | #### Returns -[`Id3v2Synchronized`](id3v2synchronized.md) +[`Id3v2Synchronized`](Id3v2Synchronized.md) ___ ### fromRawData -▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2Synchronized`](id3v2synchronized.md) +▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2Synchronized`](Id3v2Synchronized.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 format. @@ -629,9 +685,9 @@ format. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new instance | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new instance | | `version` | `number` | ID3v2 version the raw frame is encoded with. Must be unsigned 8-bit integer. | #### Returns -[`Id3v2Synchronized`](id3v2synchronized.md) +[`Id3v2Synchronized`](Id3v2Synchronized.md) diff --git a/docs/classes/id3v2synchronizedlyricsframe.md b/docs/classes/Id3v2SynchronizedLyricsFrame.md similarity index 73% rename from docs/classes/id3v2synchronizedlyricsframe.md rename to docs/classes/Id3v2SynchronizedLyricsFrame.md index 1635936b..cf59ae8f 100644 --- a/docs/classes/id3v2synchronizedlyricsframe.md +++ b/docs/classes/Id3v2SynchronizedLyricsFrame.md @@ -2,26 +2,26 @@ # Class: Id3v2SynchronizedLyricsFrame -This structure contains a single entry in a [SynchronizedLyricsFrame](../enums/id3v2frameclasstype.md#synchronizedlyricsframe) object. +This structure contains a single entry in a [SynchronizedLyricsFrame](../enums/Id3v2FrameClassType.md#synchronizedlyricsframe) object. ## Table of contents ### Constructors -- [constructor](id3v2synchronizedlyricsframe.md#constructor) +- [constructor](Id3v2SynchronizedLyricsFrame.md#constructor) ### Properties -- [text](id3v2synchronizedlyricsframe.md#text) +- [text](Id3v2SynchronizedLyricsFrame.md#text) ### Accessors -- [time](id3v2synchronizedlyricsframe.md#time) +- [time](Id3v2SynchronizedLyricsFrame.md#time) ### Methods -- [clone](id3v2synchronizedlyricsframe.md#clone) -- [render](id3v2synchronizedlyricsframe.md#render) +- [clone](Id3v2SynchronizedLyricsFrame.md#clone) +- [render](Id3v2SynchronizedLyricsFrame.md#render) ## Constructors @@ -78,26 +78,26 @@ in {@link SynchronizedLyricsFrame.format} of the frame that owns this element. ### clone -▸ **clone**(): [`Id3v2SynchronizedLyricsFrame`](id3v2synchronizedlyricsframe.md) +▸ **clone**(): [`Id3v2SynchronizedLyricsFrame`](Id3v2SynchronizedLyricsFrame.md) Creates a copy of this instance. #### Returns -[`Id3v2SynchronizedLyricsFrame`](id3v2synchronizedlyricsframe.md) +[`Id3v2SynchronizedLyricsFrame`](Id3v2SynchronizedLyricsFrame.md) ___ ### render -▸ **render**(`encoding`): [`ByteVector`](bytevector.md) +▸ **render**(`encoding`): [`ByteVector`](ByteVector.md) #### Parameters | Name | Type | | :------ | :------ | -| `encoding` | [`StringType`](../enums/stringtype.md) | +| `encoding` | [`StringType`](../enums/StringType.md) | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) diff --git a/docs/classes/id3v2tag.md b/docs/classes/Id3v2Tag.md similarity index 50% rename from docs/classes/id3v2tag.md rename to docs/classes/Id3v2Tag.md index 68acd61f..2246638b 100644 --- a/docs/classes/id3v2tag.md +++ b/docs/classes/Id3v2Tag.md @@ -4,7 +4,7 @@ ## Hierarchy -- [`Tag`](tag.md) +- [`Tag`](Tag.md) ↳ **`Id3v2Tag`** @@ -12,99 +12,99 @@ ### Accessors -- [album](id3v2tag.md#album) -- [albumArtists](id3v2tag.md#albumartists) -- [albumArtistsSort](id3v2tag.md#albumartistssort) -- [albumSort](id3v2tag.md#albumsort) -- [amazonId](id3v2tag.md#amazonid) -- [beatsPerMinute](id3v2tag.md#beatsperminute) -- [comment](id3v2tag.md#comment) -- [composers](id3v2tag.md#composers) -- [composersSort](id3v2tag.md#composerssort) -- [conductor](id3v2tag.md#conductor) -- [copyright](id3v2tag.md#copyright) -- [dateTagged](id3v2tag.md#datetagged) -- [description](id3v2tag.md#description) -- [disc](id3v2tag.md#disc) -- [discCount](id3v2tag.md#disccount) -- [firstAlbumArtist](id3v2tag.md#firstalbumartist) -- [firstAlbumArtistSort](id3v2tag.md#firstalbumartistsort) -- [firstComposer](id3v2tag.md#firstcomposer) -- [firstComposerSort](id3v2tag.md#firstcomposersort) -- [firstGenre](id3v2tag.md#firstgenre) -- [firstPerformer](id3v2tag.md#firstperformer) -- [firstPerformerSort](id3v2tag.md#firstperformersort) -- [flags](id3v2tag.md#flags) -- [frames](id3v2tag.md#frames) -- [genres](id3v2tag.md#genres) -- [grouping](id3v2tag.md#grouping) -- [initialKey](id3v2tag.md#initialkey) -- [isCompilation](id3v2tag.md#iscompilation) -- [isEmpty](id3v2tag.md#isempty) -- [isrc](id3v2tag.md#isrc) -- [joinedAlbumArtists](id3v2tag.md#joinedalbumartists) -- [joinedComposers](id3v2tag.md#joinedcomposers) -- [joinedGenres](id3v2tag.md#joinedgenres) -- [joinedPerformers](id3v2tag.md#joinedperformers) -- [joinedPerformersSort](id3v2tag.md#joinedperformerssort) -- [lyrics](id3v2tag.md#lyrics) -- [musicBrainzArtistId](id3v2tag.md#musicbrainzartistid) -- [musicBrainzDiscId](id3v2tag.md#musicbrainzdiscid) -- [musicBrainzReleaseArtistId](id3v2tag.md#musicbrainzreleaseartistid) -- [musicBrainzReleaseCountry](id3v2tag.md#musicbrainzreleasecountry) -- [musicBrainzReleaseGroupId](id3v2tag.md#musicbrainzreleasegroupid) -- [musicBrainzReleaseId](id3v2tag.md#musicbrainzreleaseid) -- [musicBrainzReleaseStatus](id3v2tag.md#musicbrainzreleasestatus) -- [musicBrainzReleaseType](id3v2tag.md#musicbrainzreleasetype) -- [musicBrainzTrackId](id3v2tag.md#musicbrainztrackid) -- [musicIpId](id3v2tag.md#musicipid) -- [performers](id3v2tag.md#performers) -- [performersRole](id3v2tag.md#performersrole) -- [performersSort](id3v2tag.md#performerssort) -- [pictures](id3v2tag.md#pictures) -- [publisher](id3v2tag.md#publisher) -- [remixedBy](id3v2tag.md#remixedby) -- [replayGainAlbumGain](id3v2tag.md#replaygainalbumgain) -- [replayGainAlbumPeak](id3v2tag.md#replaygainalbumpeak) -- [replayGainTrackGain](id3v2tag.md#replaygaintrackgain) -- [replayGainTrackPeak](id3v2tag.md#replaygaintrackpeak) -- [sizeOnDisk](id3v2tag.md#sizeondisk) -- [subtitle](id3v2tag.md#subtitle) -- [tagTypes](id3v2tag.md#tagtypes) -- [title](id3v2tag.md#title) -- [titleSort](id3v2tag.md#titlesort) -- [track](id3v2tag.md#track) -- [trackCount](id3v2tag.md#trackcount) -- [version](id3v2tag.md#version) -- [year](id3v2tag.md#year) -- [language](id3v2tag.md#language) +- [album](Id3v2Tag.md#album) +- [albumArtists](Id3v2Tag.md#albumartists) +- [albumArtistsSort](Id3v2Tag.md#albumartistssort) +- [albumSort](Id3v2Tag.md#albumsort) +- [amazonId](Id3v2Tag.md#amazonid) +- [beatsPerMinute](Id3v2Tag.md#beatsperminute) +- [comment](Id3v2Tag.md#comment) +- [composers](Id3v2Tag.md#composers) +- [composersSort](Id3v2Tag.md#composerssort) +- [conductor](Id3v2Tag.md#conductor) +- [copyright](Id3v2Tag.md#copyright) +- [dateTagged](Id3v2Tag.md#datetagged) +- [description](Id3v2Tag.md#description) +- [disc](Id3v2Tag.md#disc) +- [discCount](Id3v2Tag.md#disccount) +- [firstAlbumArtist](Id3v2Tag.md#firstalbumartist) +- [firstAlbumArtistSort](Id3v2Tag.md#firstalbumartistsort) +- [firstComposer](Id3v2Tag.md#firstcomposer) +- [firstComposerSort](Id3v2Tag.md#firstcomposersort) +- [firstGenre](Id3v2Tag.md#firstgenre) +- [firstPerformer](Id3v2Tag.md#firstperformer) +- [firstPerformerSort](Id3v2Tag.md#firstperformersort) +- [flags](Id3v2Tag.md#flags) +- [frames](Id3v2Tag.md#frames) +- [genres](Id3v2Tag.md#genres) +- [grouping](Id3v2Tag.md#grouping) +- [initialKey](Id3v2Tag.md#initialkey) +- [isCompilation](Id3v2Tag.md#iscompilation) +- [isEmpty](Id3v2Tag.md#isempty) +- [isrc](Id3v2Tag.md#isrc) +- [joinedAlbumArtists](Id3v2Tag.md#joinedalbumartists) +- [joinedComposers](Id3v2Tag.md#joinedcomposers) +- [joinedGenres](Id3v2Tag.md#joinedgenres) +- [joinedPerformers](Id3v2Tag.md#joinedperformers) +- [joinedPerformersSort](Id3v2Tag.md#joinedperformerssort) +- [lyrics](Id3v2Tag.md#lyrics) +- [musicBrainzArtistId](Id3v2Tag.md#musicbrainzartistid) +- [musicBrainzDiscId](Id3v2Tag.md#musicbrainzdiscid) +- [musicBrainzReleaseArtistId](Id3v2Tag.md#musicbrainzreleaseartistid) +- [musicBrainzReleaseCountry](Id3v2Tag.md#musicbrainzreleasecountry) +- [musicBrainzReleaseGroupId](Id3v2Tag.md#musicbrainzreleasegroupid) +- [musicBrainzReleaseId](Id3v2Tag.md#musicbrainzreleaseid) +- [musicBrainzReleaseStatus](Id3v2Tag.md#musicbrainzreleasestatus) +- [musicBrainzReleaseType](Id3v2Tag.md#musicbrainzreleasetype) +- [musicBrainzTrackId](Id3v2Tag.md#musicbrainztrackid) +- [musicIpId](Id3v2Tag.md#musicipid) +- [performers](Id3v2Tag.md#performers) +- [performersRole](Id3v2Tag.md#performersrole) +- [performersSort](Id3v2Tag.md#performerssort) +- [pictures](Id3v2Tag.md#pictures) +- [publisher](Id3v2Tag.md#publisher) +- [remixedBy](Id3v2Tag.md#remixedby) +- [replayGainAlbumGain](Id3v2Tag.md#replaygainalbumgain) +- [replayGainAlbumPeak](Id3v2Tag.md#replaygainalbumpeak) +- [replayGainTrackGain](Id3v2Tag.md#replaygaintrackgain) +- [replayGainTrackPeak](Id3v2Tag.md#replaygaintrackpeak) +- [sizeOnDisk](Id3v2Tag.md#sizeondisk) +- [subtitle](Id3v2Tag.md#subtitle) +- [tagTypes](Id3v2Tag.md#tagtypes) +- [title](Id3v2Tag.md#title) +- [titleSort](Id3v2Tag.md#titlesort) +- [track](Id3v2Tag.md#track) +- [trackCount](Id3v2Tag.md#trackcount) +- [version](Id3v2Tag.md#version) +- [year](Id3v2Tag.md#year) +- [language](Id3v2Tag.md#language) ### Methods -- [addFrame](id3v2tag.md#addframe) -- [clear](id3v2tag.md#clear) -- [copyTo](id3v2tag.md#copyto) -- [getFramesByClassType](id3v2tag.md#getframesbyclasstype) -- [getFramesByIdentifier](id3v2tag.md#getframesbyidentifier) -- [getTextAsString](id3v2tag.md#gettextasstring) -- [parse](id3v2tag.md#parse) -- [readFromEnd](id3v2tag.md#readfromend) -- [readFromStart](id3v2tag.md#readfromstart) -- [removeFrame](id3v2tag.md#removeframe) -- [removeFrames](id3v2tag.md#removeframes) -- [render](id3v2tag.md#render) -- [replaceFrame](id3v2tag.md#replaceframe) -- [setInfoTag](id3v2tag.md#setinfotag) -- [setNumberFrame](id3v2tag.md#setnumberframe) -- [setTextFrame](id3v2tag.md#settextframe) -- [firstInGroup](id3v2tag.md#firstingroup) -- [fromData](id3v2tag.md#fromdata) -- [fromEmpty](id3v2tag.md#fromempty) -- [fromFileEnd](id3v2tag.md#fromfileend) -- [fromFileStart](id3v2tag.md#fromfilestart) -- [isFalsyOrLikeEmpty](id3v2tag.md#isfalsyorlikeempty) -- [joinGroup](id3v2tag.md#joingroup) -- [tagTypeFlagsToArray](id3v2tag.md#tagtypeflagstoarray) +- [addFrame](Id3v2Tag.md#addframe) +- [clear](Id3v2Tag.md#clear) +- [copyTo](Id3v2Tag.md#copyto) +- [getFramesByClassType](Id3v2Tag.md#getframesbyclasstype) +- [getFramesByIdentifier](Id3v2Tag.md#getframesbyidentifier) +- [getTextAsString](Id3v2Tag.md#gettextasstring) +- [parse](Id3v2Tag.md#parse) +- [readFromEnd](Id3v2Tag.md#readfromend) +- [readFromStart](Id3v2Tag.md#readfromstart) +- [removeFrame](Id3v2Tag.md#removeframe) +- [removeFrames](Id3v2Tag.md#removeframes) +- [render](Id3v2Tag.md#render) +- [replaceFrame](Id3v2Tag.md#replaceframe) +- [setInfoTag](Id3v2Tag.md#setinfotag) +- [setNumberFrame](Id3v2Tag.md#setnumberframe) +- [setTextFrame](Id3v2Tag.md#settextframe) +- [firstInGroup](Id3v2Tag.md#firstingroup) +- [fromData](Id3v2Tag.md#fromdata) +- [fromEmpty](Id3v2Tag.md#fromempty) +- [fromFileEnd](Id3v2Tag.md#fromfileend) +- [fromFileStart](Id3v2Tag.md#fromfilestart) +- [isFalsyOrLikeEmpty](Id3v2Tag.md#isfalsyorlikeempty) +- [joinGroup](Id3v2Tag.md#joingroup) +- [tagTypeFlagsToArray](Id3v2Tag.md#tagtypeflagstoarray) ## Accessors @@ -112,22 +112,17 @@ • `get` **album**(): `string` -Gets the album of the media represented by the current instance. For video media, this -represents the collection the video belongs to. - **`inheritdoc`** TALB frame #### Returns `string` -Album of the media represented by the current instance or `undefined` if no value - is present +#### Overrides -• `set` **album**(`value`): `void` +Tag.album -Gets the album of the media represented by the current instance. For video media, this -represents the collection the video belongs to. +• `set` **album**(`value`): `void` **`inheritdoc`** TALB frame @@ -141,8 +136,9 @@ represents the collection the video belongs to. `void` -Album of the media represented by the current instance or `undefined` if no value - is present +#### Overrides + +Tag.album ___ @@ -150,23 +146,17 @@ ___ • `get` **albumArtists**(): `string`[] -Gets the band or artist who is credited credited in the creation of the entire album or -collection containing the media described by the current instance. - **`inheritdoc`** TSO2 frame #### Returns `string`[] -Band or artist credited with the creation of the entire album or collection - containing the media described by the current instance or an empty array if no value is - present +#### Overrides -• `set` **albumArtists**(`value`): `void` +Tag.albumArtists -Gets the band or artist who is credited credited in the creation of the entire album or -collection containing the media described by the current instance. +• `set` **albumArtists**(`value`): `void` **`inheritdoc`** TSO2 frame @@ -180,9 +170,9 @@ collection containing the media described by the current instance. `void` -Band or artist credited with the creation of the entire album or collection - containing the media described by the current instance or an empty array if no value is - present +#### Overrides + +Tag.albumArtists ___ @@ -190,23 +180,17 @@ ___ • `get` **albumArtistsSort**(): `string`[] -Gets the sortable names of the bands/artists who are credited with creating the entire -album or collection containing the media described by the current instance. - **`inheritdoc`** TPE2 frame #### Returns `string`[] -Sortable names for the bands/artists are credited with the creation of the entire - album or collection containing the media described by the current instance, or an empty - array if no value is present. +#### Overrides -• `set` **albumArtistsSort**(`value`): `void` +Tag.albumArtistsSort -Gets the sortable names of the bands/artists who are credited with creating the entire -album or collection containing the media described by the current instance. +• `set` **albumArtistsSort**(`value`): `void` **`inheritdoc`** TPE2 frame @@ -220,9 +204,9 @@ album or collection containing the media described by the current instance. `void` -Sortable names for the bands/artists are credited with the creation of the entire - album or collection containing the media described by the current instance, or an empty - array if no value is present. +#### Overrides + +Tag.albumArtistsSort ___ @@ -230,20 +214,17 @@ ___ • `get` **albumSort**(): `string` -Gets the sortable name of the album title of the media represented by the current instance. - **`inheritdoc`** TSOA frame #### Returns `string` -Sortable name for the album title of the media or `undefined` if the value is not - present +#### Overrides -• `set` **albumSort**(`value`): `void` +Tag.albumSort -Gets the sortable name of the album title of the media represented by the current instance. +• `set` **albumSort**(`value`): `void` **`inheritdoc`** TSOA frame @@ -257,8 +238,9 @@ Gets the sortable name of the album title of the media represented by the curren `void` -Sortable name for the album title of the media or `undefined` if the value is not - present +#### Overrides + +Tag.albumSort ___ @@ -266,20 +248,17 @@ ___ • `get` **amazonId**(): `string` -Gets the Amazon ID of the media represented by the current instance. - **`inheritdoc`** TXXX:ASIN #### Returns `string` -Amazon ID of the media represented by the current instance or `undefined` if no - value is present +#### Overrides -• `set` **amazonId**(`value`): `void` +Tag.amazonId -Gets the Amazon ID of the media represented by the current instance. +• `set` **amazonId**(`value`): `void` **`inheritdoc`** TXXX:ASIN @@ -293,8 +272,9 @@ Gets the Amazon ID of the media represented by the current instance. `void` -Amazon ID of the media represented by the current instance or `undefined` if no - value is present +#### Overrides + +Tag.amazonId ___ @@ -302,22 +282,17 @@ ___ • `get` **beatsPerMinute**(): `number` -Gets the number of beats per minute in the audio of the media represented by the current -instance. - **`inheritdoc`** TBPM frame #### Returns `number` -Beats per minute of the audio in the media represented by the current instance, or - `0` if not specified +#### Overrides -• `set` **beatsPerMinute**(`value`): `void` +Tag.beatsPerMinute -Gets the number of beats per minute in the audio of the media represented by the current -instance. +• `set` **beatsPerMinute**(`value`): `void` **`inheritdoc`** TBPM frame @@ -331,8 +306,9 @@ instance. `void` -Beats per minute of the audio in the media represented by the current instance, or - `0` if not specified +#### Overrides + +Tag.beatsPerMinute ___ @@ -340,20 +316,17 @@ ___ • `get` **comment**(): `string` -Gets a user comment on the media represented by the current instance. - **`inheritdoc`** COMM frame #### Returns `string` -User comments on the media represented by the current instance or `undefined` if - the value is not present +#### Overrides -• `set` **comment**(`value`): `void` +Tag.comment -Gets a user comment on the media represented by the current instance. +• `set` **comment**(`value`): `void` **`inheritdoc`** COMM frame @@ -367,8 +340,9 @@ Gets a user comment on the media represented by the current instance. `void` -User comments on the media represented by the current instance or `undefined` if - the value is not present +#### Overrides + +Tag.comment ___ @@ -376,20 +350,17 @@ ___ • `get` **composers**(): `string`[] -Gets the composers of the media represented by the current instance. - **`inheritdoc`** TCOM frame #### Returns `string`[] -Composers of the media represented by the current instance of an empty array if no - value is present. +#### Overrides -• `set` **composers**(`value`): `void` +Tag.composers -Gets the composers of the media represented by the current instance. +• `set` **composers**(`value`): `void` **`inheritdoc`** TCOM frame @@ -403,8 +374,9 @@ Gets the composers of the media represented by the current instance. `void` -Composers of the media represented by the current instance of an empty array if no - value is present. +#### Overrides + +Tag.composers ___ @@ -412,20 +384,17 @@ ___ • `get` **composersSort**(): `string`[] -Gets the sortable names of the composers of the media represented by the current instance. - **`inheritdoc`** TSOC frame #### Returns `string`[] -Sortable names for the composers of the media represented by the current instance - or an empty array if no value is present. +#### Overrides -• `set` **composersSort**(`value`): `void` +Tag.composersSort -Gets the sortable names of the composers of the media represented by the current instance. +• `set` **composersSort**(`value`): `void` **`inheritdoc`** TSOC frame @@ -439,8 +408,9 @@ Gets the sortable names of the composers of the media represented by the current `void` -Sortable names for the composers of the media represented by the current instance - or an empty array if no value is present. +#### Overrides + +Tag.composersSort ___ @@ -448,20 +418,17 @@ ___ • `get` **conductor**(): `string` -Gets the conductor or director of the media represented by the current instance. - **`inheritdoc`** TPE3 frame #### Returns `string` -Conductor or director of the media represented by the current instance or - `undefined` if no value present. +#### Overrides -• `set` **conductor**(`value`): `void` +Tag.conductor -Gets the conductor or director of the media represented by the current instance. +• `set` **conductor**(`value`): `void` **`inheritdoc`** TPE3 frame @@ -475,8 +442,9 @@ Gets the conductor or director of the media represented by the current instance. `void` -Conductor or director of the media represented by the current instance or - `undefined` if no value present. +#### Overrides + +Tag.conductor ___ @@ -484,20 +452,17 @@ ___ • `get` **copyright**(): `string` -Gets the copyright information for the media represented by the current instance. - **`inheritdoc`** TCOP frame #### Returns `string` -Copyright information for the media represented by the current instance or - `undefined` if no value is present. +#### Overrides -• `set` **copyright**(`value`): `void` +Tag.copyright -Gets the copyright information for the media represented by the current instance. +• `set` **copyright**(`value`): `void` **`inheritdoc`** TCOP frame @@ -511,8 +476,9 @@ Gets the copyright information for the media represented by the current instance `void` -Copyright information for the media represented by the current instance or - `undefined` if no value is present. +#### Overrides + +Tag.copyright ___ @@ -520,20 +486,18 @@ ___ • `get` **dateTagged**(): `Date` -Gets the date and time at which the tag has been written. - **`inheritdoc`** TDTG frame #### Returns `Date` -Date/time at which the tag has been written, or `undefined` if no value is present +#### Overrides + +Tag.dateTagged • `set` **dateTagged**(`value`): `void` -Gets the date and time at which the tag has been written. - **`inheritdoc`** TDTG frame #### Parameters @@ -546,7 +510,9 @@ Gets the date and time at which the tag has been written. `void` -Date/time at which the tag has been written, or `undefined` if no value is present +#### Overrides + +Tag.dateTagged ___ @@ -554,24 +520,17 @@ ___ • `get` **description**(): `string` -Gets a short description of the media. For music, this could be the comment that the artist -made of his/her work. For a video, this should be a short summary of the story/plot, but -generally no spoliers. This should give the impression of what to expect in the media. - **`inheritdoc`** user text frame "description" #### Returns `string` -Description of the media represented by the current instance or `undefined` if no - value is present +#### Overrides -• `set` **description**(`value`): `void` +Tag.description -Gets a short description of the media. For music, this could be the comment that the artist -made of his/her work. For a video, this should be a short summary of the story/plot, but -generally no spoliers. This should give the impression of what to expect in the media. +• `set` **description**(`value`): `void` **`inheritdoc`** user text frame "description" @@ -585,8 +544,9 @@ generally no spoliers. This should give the impression of what to expect in the `void` -Description of the media represented by the current instance or `undefined` if no - value is present +#### Overrides + +Tag.description ___ @@ -594,22 +554,17 @@ ___ • `get` **disc**(): `number` -Gets the number of the disc containing the media represented by the current instance in the -boxed set. For a series, this represents the season number. - **`inheritdoc`** TPOS frame #### Returns `number` -Number of the disc or season of the media represented by the current instance in a - boxed set. +#### Overrides -• `set` **disc**(`value`): `void` +Tag.disc -Gets the number of the disc containing the media represented by the current instance in the -boxed set. For a series, this represents the season number. +• `set` **disc**(`value`): `void` **`inheritdoc`** TPOS frame @@ -623,8 +578,9 @@ boxed set. For a series, this represents the season number. `void` -Number of the disc or season of the media represented by the current instance in a - boxed set. +#### Overrides + +Tag.disc ___ @@ -632,23 +588,18 @@ ___ • `get` **discCount**(): `number` -Gets the number of discs or seasons in the boxed set containing the media represented by the -current instance. - **`inheritdoc`** TPOS frame #### Returns `number` -Number of discs or seasons in the boxed set containing the media represented by the - current instance or `0` if not specified. +#### Overrides + +Tag.discCount • `set` **discCount**(`value`): `void` -Gets the number of discs or seasons in the boxed set containing the media represented by the -current instance. - **`inheritdoc`** TPOS frame #### Parameters @@ -661,8 +612,9 @@ current instance. `void` -Number of discs or seasons in the boxed set containing the media represented by the - current instance or `0` if not specified. +#### Overrides + +Tag.discCount ___ @@ -670,95 +622,123 @@ ___ • `get` **firstAlbumArtist**(): `string` -Gets the the first value contained in [albumArtists](id3v2tag.md#albumartists). +Gets the first value contained in [albumArtists](Id3v2Tag.md#albumartists). #### Returns `string` +#### Inherited from + +Tag.firstAlbumArtist + ___ ### firstAlbumArtistSort • `get` **firstAlbumArtistSort**(): `string` -Gets the first value contained in [albumArtistsSort](id3v2tag.md#albumartistssort) +Gets the first value contained in [albumArtistsSort](Id3v2Tag.md#albumartistssort) #### Returns `string` +#### Inherited from + +Tag.firstAlbumArtistSort + ___ ### firstComposer • `get` **firstComposer**(): `string` -Gets the first value contained in [composers](id3v2tag.md#composers) +Gets the first value contained in [composers](Id3v2Tag.md#composers) #### Returns `string` +#### Inherited from + +Tag.firstComposer + ___ ### firstComposerSort • `get` **firstComposerSort**(): `string` -Gets the first value contained in [composersSort](id3v2tag.md#composerssort) +Gets the first value contained in [composersSort](Id3v2Tag.md#composerssort) #### Returns `string` +#### Inherited from + +Tag.firstComposerSort + ___ ### firstGenre • `get` **firstGenre**(): `string` -Gets the first value contained in [genres](id3v2tag.md#genres) +Gets the first value contained in [genres](Id3v2Tag.md#genres) #### Returns `string` +#### Inherited from + +Tag.firstGenre + ___ ### firstPerformer • `get` **firstPerformer**(): `string` -Gets the first value contained in [performers](id3v2tag.md#performers) +Gets the first value contained in [performers](Id3v2Tag.md#performers) #### Returns `string` +#### Inherited from + +Tag.firstPerformer + ___ ### firstPerformerSort • `get` **firstPerformerSort**(): `string` -Gets the first value contained in [performersSort](id3v2tag.md#performerssort) +Gets the first value contained in [performersSort](Id3v2Tag.md#performerssort) #### Returns `string` +#### Inherited from + +Tag.firstPerformerSort + ___ ### flags -• `get` **flags**(): [`Id3v2TagHeaderFlags`](../enums/id3v2tagheaderflags.md) +• `get` **flags**(): [`Id3v2TagHeaderFlags`](../enums/Id3v2TagHeaderFlags.md) Gets the header flags applied to the current instance. #### Returns -[`Id3v2TagHeaderFlags`](../enums/id3v2tagheaderflags.md) +[`Id3v2TagHeaderFlags`](../enums/Id3v2TagHeaderFlags.md) • `set` **flags**(`value`): `void` @@ -768,7 +748,7 @@ Sets the header flags applied to the current instance | Name | Type | Description | | :------ | :------ | :------ | -| `value` | [`Id3v2TagHeaderFlags`](../enums/id3v2tagheaderflags.md) | Bitwise combined [Id3v2TagHeaderFlags](../enums/id3v2tagheaderflags.md) value containing flags applied to the current instance. | +| `value` | [`Id3v2TagHeaderFlags`](../enums/Id3v2TagHeaderFlags.md) | Bitwise combined [Id3v2TagHeaderFlags](../enums/Id3v2TagHeaderFlags.md) value containing flags applied to the current instance. | #### Returns @@ -778,13 +758,13 @@ ___ ### frames -• `get` **frames**(): [`Id3v2Frame`](id3v2frame.md)[] +• `get` **frames**(): [`Id3v2Frame`](Id3v2Frame.md)[] Gets all frames contained in the current instance. #### Returns -[`Id3v2Frame`](id3v2frame.md)[] +[`Id3v2Frame`](Id3v2Frame.md)[] ___ @@ -792,20 +772,17 @@ ___ • `get` **genres**(): `string`[] -Gets the genres of the media represented by the current instance. - **`inheritdoc`** TCON frame #### Returns `string`[] -Genres of the media represented by the current instance or an empty array if no - value is present. +#### Overrides -• `set` **genres**(`value`): `void` +Tag.genres -Gets the genres of the media represented by the current instance. +• `set` **genres**(`value`): `void` **`inheritdoc`** TCON frame @@ -819,8 +796,9 @@ Gets the genres of the media represented by the current instance. `void` -Genres of the media represented by the current instance or an empty array if no - value is present. +#### Overrides + +Tag.genres ___ @@ -828,20 +806,17 @@ ___ • `get` **grouping**(): `string` -Gets the grouping on the album which the media in the current instance belongs to. - **`inheritdoc`** TIT1 frame #### Returns `string` -Grouping on the album which the media in the current instance belongs to or - `undefined` if no value is present. +#### Overrides -• `set` **grouping**(`value`): `void` +Tag.grouping -Gets the grouping on the album which the media in the current instance belongs to. +• `set` **grouping**(`value`): `void` **`inheritdoc`** TIT1 frame @@ -855,8 +830,9 @@ Gets the grouping on the album which the media in the current instance belongs t `void` -Grouping on the album which the media in the current instance belongs to or - `undefined` if no value is present. +#### Overrides + +Tag.grouping ___ @@ -864,19 +840,17 @@ ___ • `get` **initialKey**(): `string` -Gets the initial key of the track. - **`inheritdoc`** TKEY frame #### Returns `string` -Initial key of the track or `undefined` if no value is set +#### Overrides -• `set` **initialKey**(`value`): `void` +Tag.initialKey -Gets the initial key of the track. +• `set` **initialKey**(`value`): `void` **`inheritdoc`** TKEY frame @@ -890,7 +864,9 @@ Gets the initial key of the track. `void` -Initial key of the track or `undefined` if no value is set +#### Overrides + +Tag.initialKey ___ @@ -898,19 +874,27 @@ ___ • `get` **isCompilation**(): `boolean` -Gets whether or not the album described by the current instance is a compilation. -This property is implemented using the TCMP Text Information Frame to provide support for a -feature of the Apple iPod and iTunes products. +**`inheritdoc`** + +**`remarks`** This property is implemented using the TCMP Text Information Frame to provide +support for a feature of the Apple iPod and iTunes products (ie, this is a non-standard +field). #### Returns `boolean` +#### Overrides + +Tag.isCompilation + • `set` **isCompilation**(`value`): `void` -Gets whether or not the album described by the current instance is a compilation. -This property is implemented using the TCMP Text Information Frame to provide support for a -feature of the Apple iPod and iTunes products. +**`inheritdoc`** + +**`remarks`** This property is implemented using the TCMP Text Information Frame to provide +support for a feature of the Apple iPod and iTunes products (ie, this is a non-standard +field). #### Parameters @@ -922,21 +906,25 @@ feature of the Apple iPod and iTunes products. `void` +#### Overrides + +Tag.isCompilation + ___ ### isEmpty • `get` **isEmpty**(): `boolean` -Gets whether or not the current instance is empty. - **`inheritdoc`** #### Returns `boolean` -`true` if the current instance does not contain any values. `false` otherwise +#### Overrides + +Tag.isEmpty ___ @@ -944,19 +932,17 @@ ___ • `get` **isrc**(): `string` -Gets the ISRC (International Standard Recording Code) of the track. - **`inheritdoc`** TSRC frame #### Returns `string` -the ISRC of the track or `undefined` if no value is set +#### Overrides -• `set` **isrc**(`value`): `void` +Tag.isrc -Gets the ISRC (International Standard Recording Code) of the track. +• `set` **isrc**(`value`): `void` **`inheritdoc`** TSRC frame @@ -970,7 +956,9 @@ Gets the ISRC (International Standard Recording Code) of the track. `void` -the ISRC of the track or `undefined` if no value is set +#### Overrides + +Tag.isrc ___ @@ -978,80 +966,97 @@ ___ • `get` **joinedAlbumArtists**(): `string` -Gets a semicolon and space separated string containing the values in [albumArtists](id3v2tag.md#albumartists) +Gets a semicolon and space separated string containing the values in [albumArtists](Id3v2Tag.md#albumartists) #### Returns `string` +#### Inherited from + +Tag.joinedAlbumArtists + ___ ### joinedComposers • `get` **joinedComposers**(): `string` -Gets a semicolon and space separated string containing the values in [composers](id3v2tag.md#composers) +Gets a semicolon and space separated string containing the values in [composers](Id3v2Tag.md#composers) #### Returns `string` +#### Inherited from + +Tag.joinedComposers + ___ ### joinedGenres • `get` **joinedGenres**(): `string` -Gets a semicolon and space separated string containing the values in [genres](id3v2tag.md#genres) +Gets a semicolon and space separated string containing the values in [genres](Id3v2Tag.md#genres) #### Returns `string` +#### Inherited from + +Tag.joinedGenres + ___ ### joinedPerformers • `get` **joinedPerformers**(): `string` -Gets a semicolon and space separated string containing the values in [performers](id3v2tag.md#performers) +Gets a semicolon and space separated string containing the values in [performers](Id3v2Tag.md#performers) #### Returns `string` +#### Inherited from + +Tag.joinedPerformers + ___ ### joinedPerformersSort • `get` **joinedPerformersSort**(): `string` -Gets a semicolon and space separated string containing the values in [performersSort](id3v2tag.md#performerssort) +Gets a semicolon and space separated string containing the values in [performersSort](Id3v2Tag.md#performerssort) #### Returns `string` +#### Inherited from + +Tag.joinedPerformersSort + ___ ### lyrics • `get` **lyrics**(): `string` -Gets the lyrics or script of the media represented by the current instance. - **`inheritdoc`** USLT frame #### Returns `string` -Lyrics or script of the media represented by the current instance or `undefined` if - no value is present +#### Overrides -• `set` **lyrics**(`value`): `void` +Tag.lyrics -Gets the lyrics or script of the media represented by the current instance. +• `set` **lyrics**(`value`): `void` **`inheritdoc`** USLT frame @@ -1065,8 +1070,9 @@ Gets the lyrics or script of the media represented by the current instance. `void` -Lyrics or script of the media represented by the current instance or `undefined` if - no value is present +#### Overrides + +Tag.lyrics ___ @@ -1074,20 +1080,17 @@ ___ • `get` **musicBrainzArtistId**(): `string` -Gets the MusicBrainz artist ID of the media represented by the current instance. - **`inheritdoc`** TXXX:MusicBrainz Artist Id frame #### Returns `string` -MusicBrainz ArtistID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides -• `set` **musicBrainzArtistId**(`value`): `void` +Tag.musicBrainzArtistId -Gets the MusicBrainz artist ID of the media represented by the current instance. +• `set` **musicBrainzArtistId**(`value`): `void` **`inheritdoc`** TXXX:MusicBrainz Artist Id frame @@ -1101,8 +1104,9 @@ Gets the MusicBrainz artist ID of the media represented by the current instance. `void` -MusicBrainz ArtistID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzArtistId ___ @@ -1110,20 +1114,17 @@ ___ • `get` **musicBrainzDiscId**(): `string` -Gets the MusicBrainz disc ID of the media represented by the current instance. - **`inheritdoc`** TXXX:MusicBrainz Disc Id frame #### Returns `string` -MusicBrainz DiscID of the media represented by the current instance or `undefined` - if no value is present +#### Overrides -• `set` **musicBrainzDiscId**(`value`): `void` +Tag.musicBrainzDiscId -Gets the MusicBrainz disc ID of the media represented by the current instance. +• `set` **musicBrainzDiscId**(`value`): `void` **`inheritdoc`** TXXX:MusicBrainz Disc Id frame @@ -1137,8 +1138,9 @@ Gets the MusicBrainz disc ID of the media represented by the current instance. `void` -MusicBrainz DiscID of the media represented by the current instance or `undefined` - if no value is present +#### Overrides + +Tag.musicBrainzDiscId ___ @@ -1146,20 +1148,17 @@ ___ • `get` **musicBrainzReleaseArtistId**(): `string` -Gets the MusicBrainz release artist ID of the media represented by the current instance. - **`inheritdoc`** TXXX:MusicBrainz Album Artist Id frame #### Returns `string` -MusicBrainz ReleaseArtistID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides -• `set` **musicBrainzReleaseArtistId**(`value`): `void` +Tag.musicBrainzReleaseArtistId -Gets the MusicBrainz release artist ID of the media represented by the current instance. +• `set` **musicBrainzReleaseArtistId**(`value`): `void` **`inheritdoc`** TXXX:MusicBrainz Album Artist Id frame @@ -1173,8 +1172,9 @@ Gets the MusicBrainz release artist ID of the media represented by the current i `void` -MusicBrainz ReleaseArtistID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzReleaseArtistId ___ @@ -1182,20 +1182,17 @@ ___ • `get` **musicBrainzReleaseCountry**(): `string` -Gets the MusicBrainz release country of the media represented by the current instance. - **`inheritdoc`** TXXX:MusicBrainz Album Release Country frame #### Returns `string` -MusicBrainz ReleaseCountry of the media represented by the current instance or - `undefined` if no value is present +#### Overrides -• `set` **musicBrainzReleaseCountry**(`value`): `void` +Tag.musicBrainzReleaseCountry -Gets the MusicBrainz release country of the media represented by the current instance. +• `set` **musicBrainzReleaseCountry**(`value`): `void` **`inheritdoc`** TXXX:MusicBrainz Album Release Country frame @@ -1209,8 +1206,9 @@ Gets the MusicBrainz release country of the media represented by the current ins `void` -MusicBrainz ReleaseCountry of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzReleaseCountry ___ @@ -1218,20 +1216,17 @@ ___ • `get` **musicBrainzReleaseGroupId**(): `string` -Gets the MusicBrainz release group ID of the media represented by the current instance. - **`inheritdoc`** TXXX:MusicBrainz Release Group Id frame #### Returns `string` -MusicBrainz ReleaseGroupID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides -• `set` **musicBrainzReleaseGroupId**(`value`): `void` +Tag.musicBrainzReleaseGroupId -Gets the MusicBrainz release group ID of the media represented by the current instance. +• `set` **musicBrainzReleaseGroupId**(`value`): `void` **`inheritdoc`** TXXX:MusicBrainz Release Group Id frame @@ -1245,8 +1240,9 @@ Gets the MusicBrainz release group ID of the media represented by the current in `void` -MusicBrainz ReleaseGroupID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzReleaseGroupId ___ @@ -1254,20 +1250,17 @@ ___ • `get` **musicBrainzReleaseId**(): `string` -Gets the MusicBrainz release ID of the media represented by the current instance. - **`inheritdoc`** TXXX:MusicBrainz Album Id frame #### Returns `string` -MusicBrainz ReleaseID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides -• `set` **musicBrainzReleaseId**(`value`): `void` +Tag.musicBrainzReleaseId -Gets the MusicBrainz release ID of the media represented by the current instance. +• `set` **musicBrainzReleaseId**(`value`): `void` **`inheritdoc`** TXXX:MusicBrainz Album Id frame @@ -1281,8 +1274,9 @@ Gets the MusicBrainz release ID of the media represented by the current instance `void` -MusicBrainz ReleaseID of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzReleaseId ___ @@ -1290,20 +1284,17 @@ ___ • `get` **musicBrainzReleaseStatus**(): `string` -Gets the MusicBrainz release status of the media represented by the current instance. - **`inheritdoc`** TXXX:MusicBrainz Album Status frame #### Returns `string` -MusicBrainz ReleaseStatus of the media represented by the current instance or - `undefined` if no value is present +#### Overrides -• `set` **musicBrainzReleaseStatus**(`value`): `void` +Tag.musicBrainzReleaseStatus -Gets the MusicBrainz release status of the media represented by the current instance. +• `set` **musicBrainzReleaseStatus**(`value`): `void` **`inheritdoc`** TXXX:MusicBrainz Album Status frame @@ -1317,8 +1308,9 @@ Gets the MusicBrainz release status of the media represented by the current inst `void` -MusicBrainz ReleaseStatus of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzReleaseStatus ___ @@ -1326,20 +1318,17 @@ ___ • `get` **musicBrainzReleaseType**(): `string` -Gets the MusicBrainz release type of the media represented by the current instance. - **`inheritdoc`** TXXX:MusicBrainz Album Type frame #### Returns `string` -MusicBrainz ReleaseType of the media represented by the current instance or - `undefined` if no value is present +#### Overrides -• `set` **musicBrainzReleaseType**(`value`): `void` +Tag.musicBrainzReleaseType -Gets the MusicBrainz release type of the media represented by the current instance. +• `set` **musicBrainzReleaseType**(`value`): `void` **`inheritdoc`** TXXX:MusicBrainz Album Type frame @@ -1353,8 +1342,9 @@ Gets the MusicBrainz release type of the media represented by the current instan `void` -MusicBrainz ReleaseType of the media represented by the current instance or - `undefined` if no value is present +#### Overrides + +Tag.musicBrainzReleaseType ___ @@ -1362,22 +1352,17 @@ ___ • `get` **musicBrainzTrackId**(): `string` -Gets the MusicBrainz track ID of the media represented by the media represented by the -current instance. - **`inheritdoc`** UFID:http://musicbrainz.org frame #### Returns `string` -MusicBrainz TrackID of the media represented by the current instance or `undefined` - if no value is present +#### Overrides -• `set` **musicBrainzTrackId**(`value`): `void` +Tag.musicBrainzTrackId -Gets the MusicBrainz track ID of the media represented by the media represented by the -current instance. +• `set` **musicBrainzTrackId**(`value`): `void` **`inheritdoc`** UFID:http://musicbrainz.org frame @@ -1391,8 +1376,9 @@ current instance. `void` -MusicBrainz TrackID of the media represented by the current instance or `undefined` - if no value is present +#### Overrides + +Tag.musicBrainzTrackId ___ @@ -1400,20 +1386,17 @@ ___ • `get` **musicIpId**(): `string` -Gets the MusicIP PUID of the media represented by the current instance. - **`inheritdoc`** TXXX:MusicIP PUID frame #### Returns `string` -MusicIP PUID of the media represented by the current instance or `undefined` if no - value is present +#### Overrides -• `set` **musicIpId**(`value`): `void` +Tag.musicIpId -Gets the MusicIP PUID of the media represented by the current instance. +• `set` **musicIpId**(`value`): `void` **`inheritdoc`** TXXX:MusicIP PUID frame @@ -1427,8 +1410,9 @@ Gets the MusicIP PUID of the media represented by the current instance. `void` -MusicIP PUID of the media represented by the current instance or `undefined` if no - value is present +#### Overrides + +Tag.musicIpId ___ @@ -1436,20 +1420,17 @@ ___ • `get` **performers**(): `string`[] -Gets the performers or artists who performed in the media described by the current instance. - **`inheritdoc`** TPE1 frame #### Returns `string`[] -Performers who performed in the media described by the current instance or an empty - array if no value is present. +#### Overrides -• `set` **performers**(`value`): `void` +Tag.performers -Gets the performers or artists who performed in the media described by the current instance. +• `set` **performers**(`value`): `void` **`inheritdoc`** TPE1 frame @@ -1463,8 +1444,9 @@ Gets the performers or artists who performed in the media described by the curre `void` -Performers who performed in the media described by the current instance or an empty - array if no value is present. +#### Overrides + +Tag.performers ___ @@ -1472,26 +1454,17 @@ ___ • `get` **performersRole**(): `string`[] -Gets the characters portrayed by an actor for a video or instruments played by a musician -for music. This must match the [performers](id3v2tag.md#performers) array (for each person, correspond one/more -role). Several roles for the same artist/actor can be separated with semicolons. For -example: "Bass; Backing Vocals; Vibraphone". - **`inheritdoc`** TMCL frame #### Returns `string`[] -Array containing the roles played by the performers in the media described by the - current instance, or an empty array if no value is present. +#### Overrides -• `set` **performersRole**(`value`): `void` +Tag.performersRole -Gets the characters portrayed by an actor for a video or instruments played by a musician -for music. This must match the [performers](id3v2tag.md#performers) array (for each person, correspond one/more -role). Several roles for the same artist/actor can be separated with semicolons. For -example: "Bass; Backing Vocals; Vibraphone". +• `set` **performersRole**(`value`): `void` **`inheritdoc`** TMCL frame @@ -1505,8 +1478,9 @@ example: "Bass; Backing Vocals; Vibraphone". `void` -Array containing the roles played by the performers in the media described by the - current instance, or an empty array if no value is present. +#### Overrides + +Tag.performersRole ___ @@ -1514,22 +1488,17 @@ ___ • `get` **performersSort**(): `string`[] -Gets the sortable names of the performers or artists who performed in the media described by -the current instance. - **`inheritdoc`** TSOP frame #### Returns `string`[] -Sortable names for the performers who performed in the media described by the - current instance, or an empty array if no value is present. +#### Overrides -• `set` **performersSort**(`value`): `void` +Tag.performersSort -Gets the sortable names of the performers or artists who performed in the media described by -the current instance. +• `set` **performersSort**(`value`): `void` **`inheritdoc`** TSOP frame @@ -1543,44 +1512,43 @@ the current instance. `void` -Sortable names for the performers who performed in the media described by the - current instance, or an empty array if no value is present. +#### Overrides + +Tag.performersSort ___ ### pictures -• `get` **pictures**(): [`IPicture`](../interfaces/ipicture.md)[] - -Gets a collection of pictures associated with the media represented by the current instance. +• `get` **pictures**(): [`IPicture`](../interfaces/IPicture.md)[] **`inheritdoc`** APIC frame #### Returns -[`IPicture`](../interfaces/ipicture.md)[] +[`IPicture`](../interfaces/IPicture.md)[] + +#### Overrides -Array containing a collection of pictures associated with the media represented by - the current instance or an empty array if no pictures are present. +Tag.pictures • `set` **pictures**(`value`): `void` -Gets a collection of pictures associated with the media represented by the current instance. - **`inheritdoc`** APIC frame #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`IPicture`](../interfaces/ipicture.md)[] | +| `value` | [`IPicture`](../interfaces/IPicture.md)[] | #### Returns `void` -Array containing a collection of pictures associated with the media represented by - the current instance or an empty array if no pictures are present. +#### Overrides + +Tag.pictures ___ @@ -1588,19 +1556,17 @@ ___ • `get` **publisher**(): `string` -Gets the publisher of the track. - **`inheritdoc`** TPUB frame #### Returns `string` -Publisher of the track or `undefined` if no value is set +#### Overrides -• `set` **publisher**(`value`): `void` +Tag.publisher -Gets the publisher of the track. +• `set` **publisher**(`value`): `void` **`inheritdoc`** TPUB frame @@ -1614,7 +1580,9 @@ Gets the publisher of the track. `void` -Publisher of the track or `undefined` if no value is set +#### Overrides + +Tag.publisher ___ @@ -1622,19 +1590,17 @@ ___ • `get` **remixedBy**(): `string` -Gets the remixer of the track. - **`inheritdoc`** TPE4 frame #### Returns `string` -Remixer of the track or `undefined` if no value is set +#### Overrides -• `set` **remixedBy**(`value`): `void` +Tag.remixedBy -Gets the remixer of the track. +• `set` **remixedBy**(`value`): `void` **`inheritdoc`** TPE4 frame @@ -1648,7 +1614,9 @@ Gets the remixer of the track. `void` -Remixer of the track or `undefined` if no value is set +#### Overrides + +Tag.remixedBy ___ @@ -1656,19 +1624,17 @@ ___ • `get` **replayGainAlbumGain**(): `number` -Gets the ReplayGain album gain in dB. - **`inheritdoc`** TXXX:REPLAYGAIN_ALBUM_GAIN frame #### Returns `number` -Album gain as per the ReplayGain specifications, in dB, or `NaN` if no value is set +#### Overrides -• `set` **replayGainAlbumGain**(`value`): `void` +Tag.replayGainAlbumGain -Gets the ReplayGain album gain in dB. +• `set` **replayGainAlbumGain**(`value`): `void` **`inheritdoc`** TXXX:REPLAYGAIN_ALBUM_GAIN frame @@ -1682,7 +1648,9 @@ Gets the ReplayGain album gain in dB. `void` -Album gain as per the ReplayGain specifications, in dB, or `NaN` if no value is set +#### Overrides + +Tag.replayGainAlbumGain ___ @@ -1690,20 +1658,18 @@ ___ • `get` **replayGainAlbumPeak**(): `number` -Gets the ReplayGain album peak sample. - **`inheritdoc`** TXXX:REPLAYGAIN_ALBUM_PEAK frame #### Returns `number` -Album peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Overrides + +Tag.replayGainAlbumPeak • `set` **replayGainAlbumPeak**(`value`): `void` -Gets the ReplayGain album peak sample. - **`inheritdoc`** TXXX:REPLAYGAIN_ALBUM_PEAK frame #### Parameters @@ -1716,7 +1682,9 @@ Gets the ReplayGain album peak sample. `void` -Album peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Overrides + +Tag.replayGainAlbumPeak ___ @@ -1724,19 +1692,17 @@ ___ • `get` **replayGainTrackGain**(): `number` -Gets the ReplayGain track gain in dB. - **`inheritdoc`** TXXX:REPLAY_GAIN_TRACK_GAIN frame #### Returns `number` -Track gain as per ReplayGain specifications, in dB, or `NaN` if no value is set +#### Overrides -• `set` **replayGainTrackGain**(`value`): `void` +Tag.replayGainTrackGain -Gets the ReplayGain track gain in dB. +• `set` **replayGainTrackGain**(`value`): `void` **`inheritdoc`** TXXX:REPLAY_GAIN_TRACK_GAIN frame @@ -1750,7 +1716,9 @@ Gets the ReplayGain track gain in dB. `void` -Track gain as per ReplayGain specifications, in dB, or `NaN` if no value is set +#### Overrides + +Tag.replayGainTrackGain ___ @@ -1758,19 +1726,17 @@ ___ • `get` **replayGainTrackPeak**(): `number` -Gets the ReplayGain track peak sample. - **`inheritdoc`** TXXX:REPLAYGAIN_TRACK_PEAK frame #### Returns `number` -Track peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Overrides -• `set` **replayGainTrackPeak**(`value`): `void` +Tag.replayGainTrackPeak -Gets the ReplayGain track peak sample. +• `set` **replayGainTrackPeak**(`value`): `void` **`inheritdoc`** TXXX:REPLAYGAIN_TRACK_PEAK frame @@ -1784,7 +1750,9 @@ Gets the ReplayGain track peak sample. `void` -Track peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Overrides + +Tag.replayGainTrackPeak ___ @@ -1792,34 +1760,33 @@ ___ • `get` **sizeOnDisk**(): `number` -Gets the size of the tag in bytes on disk as it was read from disk. - **`inheritdoc`** #### Returns `number` +#### Overrides + +Tag.sizeOnDisk + ___ ### subtitle • `get` **subtitle**(): `string` -Gets a description, one-line. It represents the tagline of the vide/music. - **`inheritdoc`** TIT3 frame #### Returns `string` -Subtitle of the media represented by the current instance or `undefined` if no - value is present +#### Overrides -• `set` **subtitle**(`value`): `void` +Tag.subtitle -Gets a description, one-line. It represents the tagline of the vide/music. +• `set` **subtitle**(`value`): `void` **`inheritdoc`** TIT3 frame @@ -1833,23 +1800,28 @@ Gets a description, one-line. It represents the tagline of the vide/music. `void` -Subtitle of the media represented by the current instance or `undefined` if no - value is present +#### Overrides + +Tag.subtitle ___ ### tagTypes -• `get` **tagTypes**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypes**(): [`TagTypes`](../enums/TagTypes.md) -Gets the tag types contained in the current instance. A bit wise combined [TagTypes](../enums/tagtypes.md) +Gets the tag types contained in the current instance. A bit wise combined [TagTypes](../enums/TagTypes.md) containing the tag types contained in the current instance. **`inheritdoc`** #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) + +#### Overrides + +Tag.tagTypes ___ @@ -1857,20 +1829,17 @@ ___ • `get` **title**(): `string` -Gets the title for the media described by the current instance. - **`inheritdoc`** TIT2 frame #### Returns `string` -Title of the media described by the current instance or `undefined` if no value is - present. +#### Overrides -• `set` **title**(`value`): `void` +Tag.title -Gets the title for the media described by the current instance. +• `set` **title**(`value`): `void` **`inheritdoc`** TIT2 frame @@ -1884,8 +1853,9 @@ Gets the title for the media described by the current instance. `void` -Title of the media described by the current instance or `undefined` if no value is - present. +#### Overrides + +Tag.title ___ @@ -1893,20 +1863,17 @@ ___ • `get` **titleSort**(): `string` -Gets the sortable name for the title of the media described by the current instance. - **`inheritdoc`** TSOT frame #### Returns `string` -Sortable name of the media described by the current instance or `undefined` if no - value is present +#### Overrides -• `set` **titleSort**(`value`): `void` +Tag.titleSort -Gets the sortable name for the title of the media described by the current instance. +• `set` **titleSort**(`value`): `void` **`inheritdoc`** TSOT frame @@ -1920,8 +1887,9 @@ Gets the sortable name for the title of the media described by the current insta `void` -Sortable name of the media described by the current instance or `undefined` if no - value is present +#### Overrides + +Tag.titleSort ___ @@ -1929,22 +1897,17 @@ ___ • `get` **track**(): `number` -Gets the position of the media represented by the current instance in its containing album -or season (for a series). - **`inheritdoc`** TRCK frame #### Returns `number` -Position of the media represented by the current instance in its containing album - or `0` if not specified. +#### Overrides -• `set` **track**(`value`): `void` +Tag.track -Gets the position of the media represented by the current instance in its containing album -or season (for a series). +• `set` **track**(`value`): `void` **`inheritdoc`** TRCK frame @@ -1958,8 +1921,9 @@ or season (for a series). `void` -Position of the media represented by the current instance in its containing album - or `0` if not specified. +#### Overrides + +Tag.track ___ @@ -1967,23 +1931,18 @@ ___ • `get` **trackCount**(): `number` -Gets the number of tracks in the album or the number of episodes in a series of the media -represented by the current instance. - **`inheritdoc`** TRCK frame #### Returns `number` -Number of tracks in the album or number of episodes in a series of the media - represented by the current instance or `0` if not specified. +#### Overrides + +Tag.trackCount • `set` **trackCount**(`value`): `void` -Gets the number of tracks in the album or the number of episodes in a series of the media -represented by the current instance. - **`inheritdoc`** TRCK frame #### Parameters @@ -1996,8 +1955,9 @@ represented by the current instance. `void` -Number of tracks in the album or number of episodes in a series of the media - represented by the current instance or `0` if not specified. +#### Overrides + +Tag.trackCount ___ @@ -2031,8 +1991,6 @@ ___ • `get` **year**(): `number` -Gets the year that the media represented by the current instance was recorded. - **`inheritdoc`** If a TDRC frame exists, the year will be read from that. If a TDRC frame doesn't exist and a TYER or TYE frame exists, the year will be read from that. Failing both cases, 0 will be @@ -2042,12 +2000,11 @@ returned. `number` -Year that the media represented by the current instance was created or `0` if no - value is present. +#### Overrides -• `set` **year**(`value`): `void` +Tag.year -Gets the year that the media represented by the current instance was recorded. +• `set` **year**(`value`): `void` **`inheritdoc`** NOTE: values >9999 will remove the frame @@ -2062,8 +2019,9 @@ NOTE: values >9999 will remove the frame `void` -Year that the media represented by the current instance was created or `0` if no - value is present. +#### Overrides + +Tag.year ___ @@ -2105,7 +2063,7 @@ Adds a frame to the current instance. | Name | Type | Description | | :------ | :------ | :------ | -| `frame` | [`Id3v2Frame`](id3v2frame.md) | Frame to add to the current instance | +| `frame` | [`Id3v2Frame`](Id3v2Frame.md) | Frame to add to the current instance | #### Returns @@ -2127,7 +2085,7 @@ Clears all values stored in the current instance. #### Overrides -[Tag](tag.md).[clear](tag.md#clear) +[Tag](Tag.md).[clear](Tag.md#clear) ___ @@ -2135,19 +2093,19 @@ ___ ▸ **copyTo**(`target`, `overwrite`): `void` -Copies the values from the current instance to another [Tag](tag.md), optionally overwriting +Copies the values from the current instance to another [Tag](Tag.md), optionally overwriting existing values. **`remarks`** This method only copies the most basic values when copying between different tag formats. However, if `target` is of the same type as the current instance, more advanced copying may be done. For example if both `this` and `target` are - [Id3v2Tag](id3v2tag.md), all frames will be copied to the target. + [Id3v2Tag](Id3v2Tag.md), all frames will be copied to the target. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `target` | [`Tag`](tag.md) | Target tag to copy values to | +| `target` | [`Tag`](Tag.md) | Target tag to copy values to | | `overwrite` | `boolean` | Whether or not to copy values over existing ones | #### Returns @@ -2156,7 +2114,7 @@ Copies the values from the current instance to another [Tag](tag.md), optionally #### Overrides -[Tag](tag.md).[copyTo](tag.md#copyto) +[Tag](Tag.md).[copyTo](Tag.md#copyto) ___ @@ -2173,13 +2131,13 @@ the same functionality. | Name | Type | | :------ | :------ | -| `TFrame` | extends [`Id3v2Frame`](id3v2frame.md)<`TFrame`\> | +| `TFrame` | extends [`Id3v2Frame`](Id3v2Frame.md)<`TFrame`\> | #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) | Class type of the frame to find | +| `type` | [`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) | Class type of the frame to find | #### Returns @@ -2197,20 +2155,20 @@ Gets a list of frames with the specified identifier contained in the current ins NOTE: This implementation deviates a bit from the original .NET implementation due to the inability to do `x is y` comparison by types in typescript without type guards. `type` is the type guard for differentiating frame types. If all frames are needed -use [frames](id3v2tag.md#frames). +use [frames](Id3v2Tag.md#frames). #### Type parameters | Name | Type | | :------ | :------ | -| `TFrame` | extends [`Id3v2Frame`](id3v2frame.md)<`TFrame`\> | +| `TFrame` | extends [`Id3v2Frame`](Id3v2Frame.md)<`TFrame`\> | #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) | Type of frame to return | -| `ident` | [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) | Identifier of the frame | +| `type` | [`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) | Type of frame to return | +| `ident` | [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) | Identifier of the frame | #### Returns @@ -2231,7 +2189,7 @@ specified). | Name | Type | Description | | :------ | :------ | :------ | -| `ident` | [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) | Frame identifier of the text information frame to get the value from | +| `ident` | [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) | Frame identifier of the text information frame to get the value from | #### Returns @@ -2249,10 +2207,10 @@ ___ | Name | Type | | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | -| `file` | [`File`](file.md) | +| `data` | [`ByteVector`](ByteVector.md) | +| `file` | [`File`](File.md) | | `position` | `number` | -| `style` | [`ReadStyle`](../enums/readstyle.md) | +| `style` | [`ReadStyle`](../enums/ReadStyle.md) | #### Returns @@ -2268,9 +2226,9 @@ ___ | Name | Type | | :------ | :------ | -| `file` | [`File`](file.md) | +| `file` | [`File`](File.md) | | `position` | `number` | -| `style` | [`ReadStyle`](../enums/readstyle.md) | +| `style` | [`ReadStyle`](../enums/ReadStyle.md) | #### Returns @@ -2286,9 +2244,9 @@ ___ | Name | Type | | :------ | :------ | -| `file` | [`File`](file.md) | +| `file` | [`File`](File.md) | | `position` | `number` | -| `style` | [`ReadStyle`](../enums/readstyle.md) | +| `style` | [`ReadStyle`](../enums/ReadStyle.md) | #### Returns @@ -2306,7 +2264,7 @@ Removes a specified frame from the current instance. | Name | Type | Description | | :------ | :------ | :------ | -| `frame` | [`Id3v2Frame`](id3v2frame.md) | Object to remove from the current instance | +| `frame` | [`Id3v2Frame`](Id3v2Frame.md) | Object to remove from the current instance | #### Returns @@ -2324,7 +2282,7 @@ Removes all frames with a specified identifier from the current instance. | Name | Type | Description | | :------ | :------ | :------ | -| `ident` | [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) | Identifier of the frames to remove | +| `ident` | [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) | Identifier of the frames to remove | #### Returns @@ -2334,17 +2292,17 @@ ___ ### render -▸ **render**(): [`ByteVector`](bytevector.md) +▸ **render**(): [`ByteVector`](ByteVector.md) Renders the current instance as a raw ID3v2 tag. By default, tags will be rendered in the version they were loaded in and new tags using the -version specified by [defaultVersion](id3v2settings.md#defaultversion). If [forceDefaultVersion](id3v2settings.md#forcedefaultversion) is `true`, all +version specified by [defaultVersion](Id3v2Settings.md#defaultversion). If [forceDefaultVersion](Id3v2Settings.md#forcedefaultversion) is `true`, all tags will be rendered using that version, except for tags with footers which must be in version 4. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ByteVector The rendered tag. @@ -2361,8 +2319,8 @@ adds a new one if the existing one is not contained. | Name | Type | Description | | :------ | :------ | :------ | -| `oldFrame` | [`Id3v2Frame`](id3v2frame.md) | Object to be replaced | -| `newFrame` | [`Id3v2Frame`](id3v2frame.md) | Object to replace `oldFrame` with | +| `oldFrame` | [`Id3v2Frame`](Id3v2Frame.md) | Object to be replaced | +| `newFrame` | [`Id3v2Frame`](Id3v2Frame.md) | Object to replace `oldFrame` with | #### Returns @@ -2384,7 +2342,7 @@ Set the tags that represent the tagger software (node-taglib-sharp) itself. #### Inherited from -[Tag](tag.md).[setInfoTag](tag.md#setinfotag) +[Tag](Tag.md).[setInfoTag](Tag.md#setinfotag) ___ @@ -2401,7 +2359,7 @@ itself. Otherwise the values will be stored as `{numerator}/{denominator}`. | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `ident` | [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) | `undefined` | Identity of the frame to set | +| `ident` | [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) | `undefined` | Identity of the frame to set | | `numerator` | `number` | `undefined` | Value containing the top half of the fraction, or the number if `denominator` is zero | | `denominator` | `number` | `undefined` | Value containing the bottom half of the fraction | | `minPlaces` | `number` | `1` | Minimum number of digits to use to display the `numerator`, if the numerator has less than this number of digits, it will be filled with leading zeroes. | @@ -2422,7 +2380,7 @@ Sets the text for a specified text information frame. | Name | Type | Description | | :------ | :------ | :------ | -| `ident` | [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) | Identifier of the frame to set the data for | +| `ident` | [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) | Identifier of the frame to set the data for | | `...text` | `string`[] | Text to set for the specified frame or `undefined`/`null`/`""` to remove all frames with that identifier. | #### Returns @@ -2452,26 +2410,26 @@ First string contained in `group` or `undefined` if the array is #### Inherited from -[Tag](tag.md).[firstInGroup](tag.md#firstingroup) +[Tag](Tag.md).[firstInGroup](Tag.md#firstingroup) ___ ### fromData -▸ `Static` **fromData**(`data`): [`Id3v2Tag`](id3v2tag.md) +▸ `Static` **fromData**(`data`): [`Id3v2Tag`](Id3v2Tag.md) Constructs and initializes a new Tag by reading the contents from a specified -[ByteVector](bytevector.md) object. +[ByteVector](ByteVector.md) object. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Tag data to read into a tag object | +| `data` | [`ByteVector`](ByteVector.md) | Tag data to read into a tag object | #### Returns -[`Id3v2Tag`](id3v2tag.md) +[`Id3v2Tag`](Id3v2Tag.md) Id3v2Tag Tag with the data from the byte vector read into it @@ -2479,17 +2437,17 @@ ___ ### fromEmpty -▸ `Static` **fromEmpty**(): [`Id3v2Tag`](id3v2tag.md) +▸ `Static` **fromEmpty**(): [`Id3v2Tag`](Id3v2Tag.md) #### Returns -[`Id3v2Tag`](id3v2tag.md) +[`Id3v2Tag`](Id3v2Tag.md) ___ ### fromFileEnd -▸ `Static` **fromFileEnd**(`file`, `position`, `style`): [`Id3v2Tag`](id3v2tag.md) +▸ `Static` **fromFileEnd**(`file`, `position`, `style`): [`Id3v2Tag`](Id3v2Tag.md) Constructs and initializes a new Tag by reading the end of the tag first. @@ -2500,19 +2458,19 @@ Constructs and initializes a new Tag by reading the end of the tag first. | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File from which the contents of the new instance is to be read | +| `file` | [`File`](File.md) | File from which the contents of the new instance is to be read | | `position` | `number` | Offset into the file where the tag ends | -| `style` | [`ReadStyle`](../enums/readstyle.md) | How the data is to be read into the current instance | +| `style` | [`ReadStyle`](../enums/ReadStyle.md) | How the data is to be read into the current instance | #### Returns -[`Id3v2Tag`](id3v2tag.md) +[`Id3v2Tag`](Id3v2Tag.md) ___ ### fromFileStart -▸ `Static` **fromFileStart**(`file`, `position`, `style`): [`Id3v2Tag`](id3v2tag.md) +▸ `Static` **fromFileStart**(`file`, `position`, `style`): [`Id3v2Tag`](Id3v2Tag.md) Constructs and initializes a new Tag by reading the beginning of the tag. @@ -2522,13 +2480,13 @@ Constructs and initializes a new Tag by reading the beginning of the tag. | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File from which the contents of the new instance is to be read | +| `file` | [`File`](File.md) | File from which the contents of the new instance is to be read | | `position` | `number` | Offset into the file where the tag begins | -| `style` | [`ReadStyle`](../enums/readstyle.md) | How the data is to be read into the current instance | +| `style` | [`ReadStyle`](../enums/ReadStyle.md) | How the data is to be read into the current instance | #### Returns -[`Id3v2Tag`](id3v2tag.md) +[`Id3v2Tag`](Id3v2Tag.md) Id3v2Tag Tag with the data from the file read into it @@ -2556,7 +2514,7 @@ If `value` is a string, `true` is returned if the value is falsy or all #### Inherited from -[Tag](tag.md).[isFalsyOrLikeEmpty](tag.md#isfalsyorlikeempty) +[Tag](Tag.md).[isFalsyOrLikeEmpty](Tag.md#isfalsyorlikeempty) ___ @@ -2581,24 +2539,24 @@ A semicolon and space separated string containing the values from `group` #### Inherited from -[Tag](tag.md).[joinGroup](tag.md#joingroup) +[Tag](Tag.md).[joinGroup](Tag.md#joingroup) ___ ### tagTypeFlagsToArray -▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/tagtypes.md)[] +▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/TagTypes.md)[] #### Parameters | Name | Type | | :------ | :------ | -| `tagTypes` | [`TagTypes`](../enums/tagtypes.md) | +| `tagTypes` | [`TagTypes`](../enums/TagTypes.md) | #### Returns -[`TagTypes`](../enums/tagtypes.md)[] +[`TagTypes`](../enums/TagTypes.md)[] #### Inherited from -[Tag](tag.md).[tagTypeFlagsToArray](tag.md#tagtypeflagstoarray) +[Tag](Tag.md).[tagTypeFlagsToArray](Tag.md#tagtypeflagstoarray) diff --git a/docs/classes/id3v2tagfooter.md b/docs/classes/Id3v2TagFooter.md similarity index 70% rename from docs/classes/id3v2tagfooter.md rename to docs/classes/Id3v2TagFooter.md index 3063d030..60848539 100644 --- a/docs/classes/id3v2tagfooter.md +++ b/docs/classes/Id3v2TagFooter.md @@ -6,22 +6,25 @@ ### Constructors -- [constructor](id3v2tagfooter.md#constructor) +- [constructor](Id3v2TagFooter.md#constructor) + +### Properties + +- [FILE\_IDENTIFIER](Id3v2TagFooter.md#file_identifier) ### Accessors -- [completeTagSize](id3v2tagfooter.md#completetagsize) -- [flags](id3v2tagfooter.md#flags) -- [majorVersion](id3v2tagfooter.md#majorversion) -- [revisionNumber](id3v2tagfooter.md#revisionnumber) -- [tagSize](id3v2tagfooter.md#tagsize) -- [fileIdentifier](id3v2tagfooter.md#fileidentifier) +- [completeTagSize](Id3v2TagFooter.md#completetagsize) +- [flags](Id3v2TagFooter.md#flags) +- [majorVersion](Id3v2TagFooter.md#majorversion) +- [revisionNumber](Id3v2TagFooter.md#revisionnumber) +- [tagSize](Id3v2TagFooter.md#tagsize) ### Methods -- [render](id3v2tagfooter.md#render) -- [fromData](id3v2tagfooter.md#fromdata) -- [fromHeader](id3v2tagfooter.md#fromheader) +- [render](Id3v2TagFooter.md#render) +- [fromData](Id3v2TagFooter.md#fromdata) +- [fromHeader](Id3v2TagFooter.md#fromheader) ## Constructors @@ -29,6 +32,14 @@ • **new Id3v2TagFooter**() +## Properties + +### FILE\_IDENTIFIER + +▪ `Static` `Readonly` **FILE\_IDENTIFIER**: [`ByteVector`](ByteVector.md) + +Identifier used to recognize an ID3v2 footer. + ## Accessors ### completeTagSize @@ -46,13 +57,13 @@ ___ ### flags -• `get` **flags**(): [`Id3v2TagHeaderFlags`](../enums/id3v2tagheaderflags.md) +• `get` **flags**(): [`Id3v2TagHeaderFlags`](../enums/Id3v2TagHeaderFlags.md) Gets the flags applied to the current instance. #### Returns -[`Id3v2TagHeaderFlags`](../enums/id3v2tagheaderflags.md) +[`Id3v2TagHeaderFlags`](../enums/Id3v2TagHeaderFlags.md) • `set` **flags**(`value`): `void` @@ -62,7 +73,7 @@ Sets the flags applied to the current instance. | Name | Type | Description | | :------ | :------ | :------ | -| `value` | [`Id3v2TagHeaderFlags`](../enums/id3v2tagheaderflags.md) | Bitwise combined [Id3v2TagHeaderFlags](../enums/id3v2tagheaderflags.md) value containing the flags to apply to the current instance. | +| `value` | [`Id3v2TagHeaderFlags`](../enums/Id3v2TagHeaderFlags.md) | Bitwise combined [Id3v2TagHeaderFlags](../enums/Id3v2TagHeaderFlags.md) value containing the flags to apply to the current instance. | #### Returns @@ -153,33 +164,21 @@ footer. NOTE THIS MUST BE AN 28-BIT UNSIGNED INTEGER. `void` -___ - -### fileIdentifier - -• `Static` `get` **fileIdentifier**(): [`ByteVector`](bytevector.md) - -Identifier used to recognize an ID3v2 footer. - -#### Returns - -[`ByteVector`](bytevector.md) - ## Methods ### render -▸ **render**(): [`ByteVector`](bytevector.md) +▸ **render**(): [`ByteVector`](ByteVector.md) #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ___ ### fromData -▸ `Static` **fromData**(`data`): [`Id3v2TagFooter`](id3v2tagfooter.md) +▸ `Static` **fromData**(`data`): [`Id3v2TagFooter`](Id3v2TagFooter.md) Constructs and initializes a new instance by reading it from raw footer data. @@ -187,17 +186,17 @@ Constructs and initializes a new instance by reading it from raw footer data. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw data to build the instance from | +| `data` | [`ByteVector`](ByteVector.md) | Raw data to build the instance from | #### Returns -[`Id3v2TagFooter`](id3v2tagfooter.md) +[`Id3v2TagFooter`](Id3v2TagFooter.md) ___ ### fromHeader -▸ `Static` **fromHeader**(`header`): [`Id3v2TagFooter`](id3v2tagfooter.md) +▸ `Static` **fromHeader**(`header`): [`Id3v2TagFooter`](Id3v2TagFooter.md) Constructs and initializes a new footer based on the contents of the header used for the same tag. @@ -206,8 +205,8 @@ same tag. | Name | Type | Description | | :------ | :------ | :------ | -| `header` | [`Id3v2TagHeader`](id3v2tagheader.md) | Header from which to base the new footer | +| `header` | [`Id3v2TagHeader`](Id3v2TagHeader.md) | Header from which to base the new footer | #### Returns -[`Id3v2TagFooter`](id3v2tagfooter.md) +[`Id3v2TagFooter`](Id3v2TagFooter.md) diff --git a/docs/classes/id3v2tagheader.md b/docs/classes/Id3v2TagHeader.md similarity index 73% rename from docs/classes/id3v2tagheader.md rename to docs/classes/Id3v2TagHeader.md index d085663f..31c134dc 100644 --- a/docs/classes/id3v2tagheader.md +++ b/docs/classes/Id3v2TagHeader.md @@ -6,21 +6,24 @@ ### Constructors -- [constructor](id3v2tagheader.md#constructor) +- [constructor](Id3v2TagHeader.md#constructor) + +### Properties + +- [FILE\_IDENTIFIER](Id3v2TagHeader.md#file_identifier) ### Accessors -- [completeTagSize](id3v2tagheader.md#completetagsize) -- [flags](id3v2tagheader.md#flags) -- [majorVersion](id3v2tagheader.md#majorversion) -- [revisionNumber](id3v2tagheader.md#revisionnumber) -- [tagSize](id3v2tagheader.md#tagsize) -- [fileIdentifier](id3v2tagheader.md#fileidentifier) +- [completeTagSize](Id3v2TagHeader.md#completetagsize) +- [flags](Id3v2TagHeader.md#flags) +- [majorVersion](Id3v2TagHeader.md#majorversion) +- [revisionNumber](Id3v2TagHeader.md#revisionnumber) +- [tagSize](Id3v2TagHeader.md#tagsize) ### Methods -- [render](id3v2tagheader.md#render) -- [fromData](id3v2tagheader.md#fromdata) +- [render](Id3v2TagHeader.md#render) +- [fromData](Id3v2TagHeader.md#fromdata) ## Constructors @@ -28,6 +31,14 @@ • **new Id3v2TagHeader**() +## Properties + +### FILE\_IDENTIFIER + +▪ `Static` `Readonly` **FILE\_IDENTIFIER**: [`ByteVector`](ByteVector.md) + +The identifier used to recognize an ID3v2 header. + ## Accessors ### completeTagSize @@ -45,13 +56,13 @@ ___ ### flags -• `get` **flags**(): [`Id3v2TagHeaderFlags`](../enums/id3v2tagheaderflags.md) +• `get` **flags**(): [`Id3v2TagHeaderFlags`](../enums/Id3v2TagHeaderFlags.md) Gets the flags applied to the current instance. #### Returns -[`Id3v2TagHeaderFlags`](../enums/id3v2tagheaderflags.md) +[`Id3v2TagHeaderFlags`](../enums/Id3v2TagHeaderFlags.md) • `set` **flags**(`value`): `void` @@ -61,7 +72,7 @@ Sets the flags applied to the current instance. | Name | Type | Description | | :------ | :------ | :------ | -| `value` | [`Id3v2TagHeaderFlags`](../enums/id3v2tagheaderflags.md) | Bitwise combined [Id3v2TagHeaderFlags](../enums/id3v2tagheaderflags.md) value containing the flags to apply to the current instance. | +| `value` | [`Id3v2TagHeaderFlags`](../enums/Id3v2TagHeaderFlags.md) | Bitwise combined [Id3v2TagHeaderFlags](../enums/Id3v2TagHeaderFlags.md) value containing the flags to apply to the current instance. | #### Returns @@ -152,35 +163,23 @@ footer. NOTE THIS MUST BE A 28-BIT UNSIGNED INTEGER. `void` -___ - -### fileIdentifier - -• `Static` `get` **fileIdentifier**(): [`ByteVector`](bytevector.md) - -The identifier used to recognize an ID3v2 header. - -#### Returns - -[`ByteVector`](bytevector.md) - ## Methods ### render -▸ **render**(): [`ByteVector`](bytevector.md) +▸ **render**(): [`ByteVector`](ByteVector.md) Renders the current instance as a raw ID3v2 header #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ___ ### fromData -▸ `Static` **fromData**(`data`): [`Id3v2TagHeader`](id3v2tagheader.md) +▸ `Static` **fromData**(`data`): [`Id3v2TagHeader`](Id3v2TagHeader.md) Constructs and initializes a new instance by reading it from the raw header data. @@ -188,8 +187,8 @@ Constructs and initializes a new instance by reading it from the raw header data | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Object containing the raw data to build the new instance from. | +| `data` | [`ByteVector`](ByteVector.md) | Object containing the raw data to build the new instance from. | #### Returns -[`Id3v2TagHeader`](id3v2tagheader.md) +[`Id3v2TagHeader`](Id3v2TagHeader.md) diff --git a/docs/classes/id3v2termsofuseframe.md b/docs/classes/Id3v2TermsOfUseFrame.md similarity index 63% rename from docs/classes/id3v2termsofuseframe.md rename to docs/classes/Id3v2TermsOfUseFrame.md index 7691d305..5be97a08 100644 --- a/docs/classes/id3v2termsofuseframe.md +++ b/docs/classes/Id3v2TermsOfUseFrame.md @@ -4,53 +4,40 @@ ## Hierarchy -- [`Id3v2Frame`](id3v2frame.md) +- [`Id3v2Frame`](Id3v2Frame.md) ↳ **`Id3v2TermsOfUseFrame`** ## Table of contents -### Properties - -- [\_header](id3v2termsofuseframe.md#_header) - ### Accessors -- [encryptionId](id3v2termsofuseframe.md#encryptionid) -- [flags](id3v2termsofuseframe.md#flags) -- [frameClassType](id3v2termsofuseframe.md#frameclasstype) -- [frameId](id3v2termsofuseframe.md#frameid) -- [groupId](id3v2termsofuseframe.md#groupid) -- [language](id3v2termsofuseframe.md#language) -- [size](id3v2termsofuseframe.md#size) -- [text](id3v2termsofuseframe.md#text) -- [textEncoding](id3v2termsofuseframe.md#textencoding) +- [encryptionId](Id3v2TermsOfUseFrame.md#encryptionid) +- [flags](Id3v2TermsOfUseFrame.md#flags) +- [frameClassType](Id3v2TermsOfUseFrame.md#frameclasstype) +- [frameId](Id3v2TermsOfUseFrame.md#frameid) +- [groupId](Id3v2TermsOfUseFrame.md#groupid) +- [header](Id3v2TermsOfUseFrame.md#header) +- [language](Id3v2TermsOfUseFrame.md#language) +- [size](Id3v2TermsOfUseFrame.md#size) +- [text](Id3v2TermsOfUseFrame.md#text) +- [textEncoding](Id3v2TermsOfUseFrame.md#textencoding) ### Methods -- [clone](id3v2termsofuseframe.md#clone) -- [fieldData](id3v2termsofuseframe.md#fielddata) -- [parseFields](id3v2termsofuseframe.md#parsefields) -- [render](id3v2termsofuseframe.md#render) -- [renderFields](id3v2termsofuseframe.md#renderfields) -- [setData](id3v2termsofuseframe.md#setdata) -- [toString](id3v2termsofuseframe.md#tostring) -- [correctEncoding](id3v2termsofuseframe.md#correctencoding) -- [find](id3v2termsofuseframe.md#find) -- [findPreferred](id3v2termsofuseframe.md#findpreferred) -- [fromFields](id3v2termsofuseframe.md#fromfields) -- [fromOffsetRawData](id3v2termsofuseframe.md#fromoffsetrawdata) -- [fromRawData](id3v2termsofuseframe.md#fromrawdata) - -## Properties - -### \_header - -• `Protected` **\_header**: [`Id3v2FrameHeader`](id3v2frameheader.md) - -#### Inherited from - -[Id3v2Frame](id3v2frame.md).[_header](id3v2frame.md#_header) +- [clone](Id3v2TermsOfUseFrame.md#clone) +- [fieldData](Id3v2TermsOfUseFrame.md#fielddata) +- [parseFields](Id3v2TermsOfUseFrame.md#parsefields) +- [render](Id3v2TermsOfUseFrame.md#render) +- [renderFields](Id3v2TermsOfUseFrame.md#renderfields) +- [setData](Id3v2TermsOfUseFrame.md#setdata) +- [toString](Id3v2TermsOfUseFrame.md#tostring) +- [correctEncoding](Id3v2TermsOfUseFrame.md#correctencoding) +- [find](Id3v2TermsOfUseFrame.md#find) +- [findPreferred](Id3v2TermsOfUseFrame.md#findpreferred) +- [fromFields](Id3v2TermsOfUseFrame.md#fromfields) +- [fromOffsetRawData](Id3v2TermsOfUseFrame.md#fromoffsetrawdata) +- [fromRawData](Id3v2TermsOfUseFrame.md#fromrawdata) ## Accessors @@ -67,6 +54,10 @@ Gets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + • `set` **encryptionId**(`value`): `void` Sets the encryption ID applied to the current instance. @@ -84,60 +75,80 @@ Sets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + ___ ### flags -• `get` **flags**(): [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +• `get` **flags**(): [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) Gets the frame flags applied to the current instance. #### Returns -[`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +[`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) + +#### Inherited from + +Frame.flags • `set` **flags**(`value`): `void` Sets the frame flags applied to the current instance. -If the value includes either [Id3v2FrameFlags.Encryption](../enums/id3v2frameflags.md#encryption) or -[Id3v2FrameFlags.Compression](../enums/id3v2frameflags.md#compression), [render](id3v2termsofuseframe.md#render) will throw. +If the value includes either [Id3v2FrameFlags.Encryption](../enums/Id3v2FrameFlags.md#encryption) or +[Id3v2FrameFlags.Compression](../enums/Id3v2FrameFlags.md#compression), [render](Id3v2TermsOfUseFrame.md#render) will throw. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) | +| `value` | [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) | #### Returns `void` +#### Inherited from + +Frame.flags + ___ ### frameClassType -• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) **`inheritdoc`** #### Returns -[`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +[`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) + +#### Overrides + +Frame.frameClassType ___ ### frameId -• `get` **frameId**(): [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +• `get` **frameId**(): [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) Gets the frame ID for the current instance. #### Returns -[`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +[`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) FrameIdentifier Object representing of the identifier of the frame +#### Inherited from + +Frame.frameId + ___ ### groupId @@ -153,6 +164,10 @@ Gets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + • `set` **groupId**(`value`): `void` Sets the grouping ID applied to the current instance. @@ -170,6 +185,44 @@ Sets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + +___ + +### header + +• `Protected` `get` **header**(): [`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +Gets the header for the frame. For new frames this should not exist. + +#### Returns + +[`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +#### Inherited from + +Frame.header + +• `Protected` `set` **header**(`value`): `void` + +Sets the header for the frame. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header for the frame | + +#### Returns + +`void` + +#### Inherited from + +Frame.header + ___ ### language @@ -211,6 +264,10 @@ NOTE: This value is not used outside of reading a frame from disk, so newly crea `number` +#### Inherited from + +Frame.size + ___ ### text @@ -241,25 +298,25 @@ ___ ### textEncoding -• `get` **textEncoding**(): [`StringType`](../enums/stringtype.md) +• `get` **textEncoding**(): [`StringType`](../enums/StringType.md) Gets the text encoding to use when storing the current instance. #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) • `set` **textEncoding**(`value`): `void` Sets the text encoding to use when storing the current instance. -This encoding is overridden when rendering if [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) is +This encoding is overridden when rendering if [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) is `true` or the render version does not support it. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `value` | [`StringType`](../enums/stringtype.md) | Text encoding to use when storing the current instance | +| `value` | [`StringType`](../enums/StringType.md) | Text encoding to use when storing the current instance | #### Returns @@ -269,7 +326,7 @@ This encoding is overridden when rendering if [Id3v2Settings.forceDefaultEncodin ### clone -▸ **clone**(): [`Id3v2Frame`](id3v2frame.md) +▸ **clone**(): [`Id3v2Frame`](Id3v2Frame.md) Creates a deep copy of the current instance. This method is implemented by rendering the current instance as an ID3v2.4 frame and using @@ -278,17 +335,17 @@ classes. #### Returns -[`Id3v2Frame`](id3v2frame.md) +[`Id3v2Frame`](Id3v2Frame.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[clone](id3v2frame.md#clone) +[Id3v2Frame](Id3v2Frame.md).[clone](Id3v2Frame.md#clone) ___ ### fieldData -▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](bytevector.md) +▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](ByteVector.md) Extracts the field data from the raw portion of an ID3v2 frame. This method is necessary for extracting extra data prepended to the frame such the as @@ -298,24 +355,24 @@ grouping ID. | Name | Type | Description | | :------ | :------ | :------ | -| `frameData` | [`ByteVector`](bytevector.md) | Raw frame data | +| `frameData` | [`ByteVector`](ByteVector.md) | Raw frame data | | `offset` | `number` | Index at which the data is contained | | `version` | `number` | Version of the ID3v2 tag the data was originally encoded with | | `dataIncludesHeader` | `boolean` | `true` if `frameData` includes the header, `false` otherwise | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[fieldData](id3v2frame.md#fielddata) +[Id3v2Frame](Id3v2Frame.md).[fieldData](Id3v2Frame.md#fielddata) ___ ### parseFields -▸ `Protected` **parseFields**(`data`, `_version`): `void` +▸ `Protected` **parseFields**(`data`): `void` Populates the values in this frame by parsing its field data in a specified version. @@ -323,8 +380,7 @@ Populates the values in this frame by parsing its field data in a specified vers | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Extracted field data | -| `_version` | `number` | ID3v2 version the field data is encoded in | +| `data` | [`ByteVector`](ByteVector.md) | Extracted field data | #### Returns @@ -332,13 +388,13 @@ Populates the values in this frame by parsing its field data in a specified vers #### Overrides -[Id3v2Frame](id3v2frame.md).[parseFields](id3v2frame.md#parsefields) +[Id3v2Frame](Id3v2Frame.md).[parseFields](Id3v2Frame.md#parsefields) ___ ### render -▸ **render**(`version`): [`ByteVector`](bytevector.md) +▸ **render**(`version`): [`ByteVector`](ByteVector.md) Renders the current instance, encoded in a specified ID3v2 version. @@ -350,17 +406,17 @@ Renders the current instance, encoded in a specified ID3v2 version. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[render](id3v2frame.md#render) +[Id3v2Frame](Id3v2Frame.md).[render](Id3v2Frame.md#render) ___ ### renderFields -▸ `Protected` **renderFields**(`version`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderFields**(`version`): [`ByteVector`](ByteVector.md) Renders the values in the current instance into field data for a specified version. @@ -372,11 +428,11 @@ Renders the values in the current instance into field data for a specified versi #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[renderFields](id3v2frame.md#renderfields) +[Id3v2Frame](Id3v2Frame.md).[renderFields](Id3v2Frame.md#renderfields) ___ @@ -391,7 +447,7 @@ header. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw ID3v2 frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw ID3v2 frame | | `offset` | `number` | Offset in `data` at which the frame begins. | | `readHeader` | `boolean` | Whether or not to read the reader into the current instance. | | `version` | `number` | Version of the ID3v2 tag the data was encoded with | @@ -402,7 +458,7 @@ header. #### Inherited from -[Id3v2Frame](id3v2frame.md).[setData](id3v2frame.md#setdata) +[Id3v2Frame](Id3v2Frame.md).[setData](Id3v2Frame.md#setdata) ___ @@ -420,7 +476,7 @@ ___ ### correctEncoding -▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/stringtype.md) +▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/StringType.md) Converts an encoding to be a supported encoding for a specified tag version. @@ -428,26 +484,26 @@ Converts an encoding to be a supported encoding for a specified tag version. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`StringType`](../enums/stringtype.md) | Value containing the original encoding | +| `type` | [`StringType`](../enums/StringType.md) | Value containing the original encoding | | `version` | `number` | Value containing the ID3v2 version to be encoded. | #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) StringType Value containing the correct encoding to use, based on - [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) and what is supported by + [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) and what is supported by `version` #### Inherited from -[Id3v2Frame](id3v2frame.md).[correctEncoding](id3v2frame.md#correctencoding) +[Id3v2Frame](Id3v2Frame.md).[correctEncoding](Id3v2Frame.md#correctencoding) ___ ### find -▸ `Static` **find**(`frames`, `language?`): [`Id3v2TermsOfUseFrame`](id3v2termsofuseframe.md) +▸ `Static` **find**(`frames`, `language?`): [`Id3v2TermsOfUseFrame`](Id3v2TermsOfUseFrame.md) Gets a specified terms of use frame from the list of frames @@ -455,12 +511,12 @@ Gets a specified terms of use frame from the list of frames | Name | Type | Description | | :------ | :------ | :------ | -| `frames` | [`Id3v2TermsOfUseFrame`](id3v2termsofuseframe.md)[] | List of frames to search | +| `frames` | [`Id3v2TermsOfUseFrame`](Id3v2TermsOfUseFrame.md)[] | List of frames to search | | `language?` | `string` | Optionally, the ISO-639-2 language code to match | #### Returns -[`Id3v2TermsOfUseFrame`](id3v2termsofuseframe.md) +[`Id3v2TermsOfUseFrame`](Id3v2TermsOfUseFrame.md) TermsOfUseFrame A matching frame if found or `undefined` if a matching frame was not found @@ -469,7 +525,7 @@ ___ ### findPreferred -▸ `Static` **findPreferred**(`frames`, `language`): [`Id3v2TermsOfUseFrame`](id3v2termsofuseframe.md) +▸ `Static` **findPreferred**(`frames`, `language`): [`Id3v2TermsOfUseFrame`](Id3v2TermsOfUseFrame.md) Gets a specified terms of use frame from the list of frames, trying to match the language but accepting one with a different language if a match was not found. @@ -478,12 +534,12 @@ accepting one with a different language if a match was not found. | Name | Type | Description | | :------ | :------ | :------ | -| `frames` | [`Id3v2TermsOfUseFrame`](id3v2termsofuseframe.md)[] | List of frames to search | +| `frames` | [`Id3v2TermsOfUseFrame`](Id3v2TermsOfUseFrame.md)[] | List of frames to search | | `language` | `string` | ISO-639-2 language code to match | #### Returns -[`Id3v2TermsOfUseFrame`](id3v2termsofuseframe.md) +[`Id3v2TermsOfUseFrame`](Id3v2TermsOfUseFrame.md) TermsOfUseFrame Frame containing the matching frame or `undefined` if a match was not found @@ -492,26 +548,26 @@ ___ ### fromFields -▸ `Static` **fromFields**(`language`, `textEncoding?`): [`Id3v2TermsOfUseFrame`](id3v2termsofuseframe.md) +▸ `Static` **fromFields**(`language`, `textEncoding?`): [`Id3v2TermsOfUseFrame`](Id3v2TermsOfUseFrame.md) Constructs and initializes a new instance with a specified language. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `language` | `string` | ISO-639-2 language code for the new frame | -| `textEncoding` | [`StringType`](../enums/stringtype.md) | Optional, text encoding to use when rendering the new frame. If not provided defaults to [Id3v2Settings.defaultEncoding](id3v2settings.md#defaultencoding) | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `language` | `string` | `undefined` | ISO-639-2 language code for the new frame | +| `textEncoding` | [`StringType`](../enums/StringType.md) | `Id3v2Settings.defaultEncoding` | Optional, text encoding to use when rendering the new frame. If not provided defaults to [Id3v2Settings.defaultEncoding](Id3v2Settings.md#defaultencoding) | #### Returns -[`Id3v2TermsOfUseFrame`](id3v2termsofuseframe.md) +[`Id3v2TermsOfUseFrame`](Id3v2TermsOfUseFrame.md) ___ ### fromOffsetRawData -▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2TermsOfUseFrame`](id3v2termsofuseframe.md) +▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2TermsOfUseFrame`](Id3v2TermsOfUseFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. This method allows for offset reading from the data byte vector. @@ -520,20 +576,20 @@ version. This method allows for offset reading from the data byte vector. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `offset` | `number` | What offset in `data` the frame actually begins. Must be positive, safe integer | -| `header` | [`Id3v2FrameHeader`](id3v2frameheader.md) | Header of the frame found at `data` in the data | +| `header` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header of the frame found at `data` in the data | | `version` | `number` | ID3v2 version the frame was originally encoded with | #### Returns -[`Id3v2TermsOfUseFrame`](id3v2termsofuseframe.md) +[`Id3v2TermsOfUseFrame`](Id3v2TermsOfUseFrame.md) ___ ### fromRawData -▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2TermsOfUseFrame`](id3v2termsofuseframe.md) +▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2TermsOfUseFrame`](Id3v2TermsOfUseFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. @@ -542,9 +598,9 @@ ID3v2 version. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `version` | `number` | ID3v2 version the raw frame is encoded with, must be a positive 8-bit integer | #### Returns -[`Id3v2TermsOfUseFrame`](id3v2termsofuseframe.md) +[`Id3v2TermsOfUseFrame`](Id3v2TermsOfUseFrame.md) diff --git a/docs/classes/id3v2textinformationframe.md b/docs/classes/Id3v2TextInformationFrame.md similarity index 75% rename from docs/classes/id3v2textinformationframe.md rename to docs/classes/Id3v2TextInformationFrame.md index 0c929e53..325d3088 100644 --- a/docs/classes/id3v2textinformationframe.md +++ b/docs/classes/Id3v2TextInformationFrame.md @@ -124,52 +124,52 @@ Nilsson 2000). ## Hierarchy -- [`Id3v2Frame`](id3v2frame.md) +- [`Id3v2Frame`](Id3v2Frame.md) ↳ **`Id3v2TextInformationFrame`** - ↳↳ [`Id3v2UserTextInformationFrame`](id3v2usertextinformationframe.md) + ↳↳ [`Id3v2UserTextInformationFrame`](Id3v2UserTextInformationFrame.md) ## Table of contents ### Constructors -- [constructor](id3v2textinformationframe.md#constructor) +- [constructor](Id3v2TextInformationFrame.md#constructor) ### Properties -- [\_encoding](id3v2textinformationframe.md#_encoding) -- [\_header](id3v2textinformationframe.md#_header) -- [\_rawData](id3v2textinformationframe.md#_rawdata) -- [\_rawVersion](id3v2textinformationframe.md#_rawversion) -- [\_textFields](id3v2textinformationframe.md#_textfields) +- [\_encoding](Id3v2TextInformationFrame.md#_encoding) +- [\_rawData](Id3v2TextInformationFrame.md#_rawdata) +- [\_rawVersion](Id3v2TextInformationFrame.md#_rawversion) +- [\_textFields](Id3v2TextInformationFrame.md#_textfields) ### Accessors -- [encryptionId](id3v2textinformationframe.md#encryptionid) -- [flags](id3v2textinformationframe.md#flags) -- [frameClassType](id3v2textinformationframe.md#frameclasstype) -- [frameId](id3v2textinformationframe.md#frameid) -- [groupId](id3v2textinformationframe.md#groupid) -- [size](id3v2textinformationframe.md#size) -- [text](id3v2textinformationframe.md#text) -- [textEncoding](id3v2textinformationframe.md#textencoding) +- [encryptionId](Id3v2TextInformationFrame.md#encryptionid) +- [flags](Id3v2TextInformationFrame.md#flags) +- [frameClassType](Id3v2TextInformationFrame.md#frameclasstype) +- [frameId](Id3v2TextInformationFrame.md#frameid) +- [groupId](Id3v2TextInformationFrame.md#groupid) +- [header](Id3v2TextInformationFrame.md#header) +- [size](Id3v2TextInformationFrame.md#size) +- [text](Id3v2TextInformationFrame.md#text) +- [textEncoding](Id3v2TextInformationFrame.md#textencoding) ### Methods -- [clone](id3v2textinformationframe.md#clone) -- [fieldData](id3v2textinformationframe.md#fielddata) -- [parseFields](id3v2textinformationframe.md#parsefields) -- [parseRawData](id3v2textinformationframe.md#parserawdata) -- [render](id3v2textinformationframe.md#render) -- [renderFields](id3v2textinformationframe.md#renderfields) -- [setData](id3v2textinformationframe.md#setdata) -- [toString](id3v2textinformationframe.md#tostring) -- [correctEncoding](id3v2textinformationframe.md#correctencoding) -- [findTextInformationFrame](id3v2textinformationframe.md#findtextinformationframe) -- [fromIdentifier](id3v2textinformationframe.md#fromidentifier) -- [fromOffsetRawData](id3v2textinformationframe.md#fromoffsetrawdata) -- [fromRawData](id3v2textinformationframe.md#fromrawdata) +- [clone](Id3v2TextInformationFrame.md#clone) +- [fieldData](Id3v2TextInformationFrame.md#fielddata) +- [parseFields](Id3v2TextInformationFrame.md#parsefields) +- [parseRawData](Id3v2TextInformationFrame.md#parserawdata) +- [render](Id3v2TextInformationFrame.md#render) +- [renderFields](Id3v2TextInformationFrame.md#renderfields) +- [setData](Id3v2TextInformationFrame.md#setdata) +- [toString](Id3v2TextInformationFrame.md#tostring) +- [correctEncoding](Id3v2TextInformationFrame.md#correctencoding) +- [findTextInformationFrame](Id3v2TextInformationFrame.md#findtextinformationframe) +- [fromIdentifier](Id3v2TextInformationFrame.md#fromidentifier) +- [fromOffsetRawData](Id3v2TextInformationFrame.md#fromoffsetrawdata) +- [fromRawData](Id3v2TextInformationFrame.md#fromrawdata) ## Constructors @@ -181,33 +181,23 @@ Nilsson 2000). | Name | Type | | :------ | :------ | -| `header` | [`Id3v2FrameHeader`](id3v2frameheader.md) | +| `header` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | #### Overrides -[Id3v2Frame](id3v2frame.md).[constructor](id3v2frame.md#constructor) +[Id3v2Frame](Id3v2Frame.md).[constructor](Id3v2Frame.md#constructor) ## Properties ### \_encoding -• `Protected` **\_encoding**: [`StringType`](../enums/stringtype.md) - -___ - -### \_header - -• `Protected` **\_header**: [`Id3v2FrameHeader`](id3v2frameheader.md) - -#### Inherited from - -[Id3v2Frame](id3v2frame.md).[_header](id3v2frame.md#_header) +• `Protected` **\_encoding**: [`StringType`](../enums/StringType.md) = `Id3v2Settings.defaultEncoding` ___ ### \_rawData -• `Protected` **\_rawData**: [`ByteVector`](bytevector.md) +• `Protected` **\_rawData**: [`ByteVector`](ByteVector.md) ___ @@ -236,6 +226,10 @@ Gets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + • `set` **encryptionId**(`value`): `void` Sets the encryption ID applied to the current instance. @@ -253,60 +247,80 @@ Sets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + ___ ### flags -• `get` **flags**(): [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +• `get` **flags**(): [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) Gets the frame flags applied to the current instance. #### Returns -[`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +[`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) + +#### Inherited from + +Frame.flags • `set` **flags**(`value`): `void` Sets the frame flags applied to the current instance. -If the value includes either [Id3v2FrameFlags.Encryption](../enums/id3v2frameflags.md#encryption) or -[Id3v2FrameFlags.Compression](../enums/id3v2frameflags.md#compression), [render](id3v2textinformationframe.md#render) will throw. +If the value includes either [Id3v2FrameFlags.Encryption](../enums/Id3v2FrameFlags.md#encryption) or +[Id3v2FrameFlags.Compression](../enums/Id3v2FrameFlags.md#compression), [render](Id3v2TextInformationFrame.md#render) will throw. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) | +| `value` | [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) | #### Returns `void` +#### Inherited from + +Frame.flags + ___ ### frameClassType -• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) **`inheritdoc`** #### Returns -[`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +[`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) + +#### Overrides + +Frame.frameClassType ___ ### frameId -• `get` **frameId**(): [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +• `get` **frameId**(): [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) Gets the frame ID for the current instance. #### Returns -[`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +[`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) FrameIdentifier Object representing of the identifier of the frame +#### Inherited from + +Frame.frameId + ___ ### groupId @@ -322,6 +336,10 @@ Gets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + • `set` **groupId**(`value`): `void` Sets the grouping ID applied to the current instance. @@ -339,6 +357,44 @@ Sets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + +___ + +### header + +• `Protected` `get` **header**(): [`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +Gets the header for the frame. For new frames this should not exist. + +#### Returns + +[`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +#### Inherited from + +Frame.header + +• `Protected` `set` **header**(`value`): `void` + +Sets the header for the frame. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header for the frame | + +#### Returns + +`void` + +#### Inherited from + +Frame.header + ___ ### size @@ -353,6 +409,10 @@ NOTE: This value is not used outside of reading a frame from disk, so newly crea `number` +#### Inherited from + +Frame.size + ___ ### text @@ -385,24 +445,24 @@ ___ ### textEncoding -• `get` **textEncoding**(): [`StringType`](../enums/stringtype.md) +• `get` **textEncoding**(): [`StringType`](../enums/StringType.md) Gets the text encoding to use when rendering the current instance. #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) • `set` **textEncoding**(`value`): `void` Sets the text encoding to use when rendering the current instance. -This value will be overridden if [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) is `true`. +This value will be overridden if [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) is `true`. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`StringType`](../enums/stringtype.md) | +| `value` | [`StringType`](../enums/StringType.md) | #### Returns @@ -412,7 +472,7 @@ This value will be overridden if [Id3v2Settings.forceDefaultEncoding](id3v2setti ### clone -▸ **clone**(): [`Id3v2Frame`](id3v2frame.md) +▸ **clone**(): [`Id3v2Frame`](Id3v2Frame.md) Creates a deep copy of the current instance. This method is implemented by rendering the current instance as an ID3v2.4 frame and using @@ -421,17 +481,17 @@ classes. #### Returns -[`Id3v2Frame`](id3v2frame.md) +[`Id3v2Frame`](Id3v2Frame.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[clone](id3v2frame.md#clone) +[Id3v2Frame](Id3v2Frame.md).[clone](Id3v2Frame.md#clone) ___ ### fieldData -▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](bytevector.md) +▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](ByteVector.md) Extracts the field data from the raw portion of an ID3v2 frame. This method is necessary for extracting extra data prepended to the frame such the as @@ -441,18 +501,18 @@ grouping ID. | Name | Type | Description | | :------ | :------ | :------ | -| `frameData` | [`ByteVector`](bytevector.md) | Raw frame data | +| `frameData` | [`ByteVector`](ByteVector.md) | Raw frame data | | `offset` | `number` | Index at which the data is contained | | `version` | `number` | Version of the ID3v2 tag the data was originally encoded with | | `dataIncludesHeader` | `boolean` | `true` if `frameData` includes the header, `false` otherwise | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[fieldData](id3v2frame.md#fielddata) +[Id3v2Frame](Id3v2Frame.md).[fieldData](Id3v2Frame.md#fielddata) ___ @@ -466,7 +526,7 @@ Populates the values in this frame by parsing its field data in a specified vers | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Extracted field data | +| `data` | [`ByteVector`](ByteVector.md) | Extracted field data | | `version` | `number` | ID3v2 version the field data is encoded in | #### Returns @@ -475,7 +535,7 @@ Populates the values in this frame by parsing its field data in a specified vers #### Overrides -[Id3v2Frame](id3v2frame.md).[parseFields](id3v2frame.md#parsefields) +[Id3v2Frame](Id3v2Frame.md).[parseFields](Id3v2Frame.md#parsefields) ___ @@ -484,7 +544,7 @@ ___ ▸ `Protected` **parseRawData**(): `void` Performs the actual parsing of the raw data. -Because of the high parsing cost and relatively low usage of the class [parseFields](id3v2textinformationframe.md#parsefields) +Because of the high parsing cost and relatively low usage of the class [parseFields](Id3v2TextInformationFrame.md#parsefields) only stores the field data so it can be parsed on demand. Whenever a property or method is called which requires the data, this method is called, and only on the first call does it actually parse the data. @@ -497,7 +557,7 @@ ___ ### render -▸ **render**(`version`): [`ByteVector`](bytevector.md) +▸ **render**(`version`): [`ByteVector`](ByteVector.md) Renders the current instance, encoded in a specified ID3v2 version. @@ -509,19 +569,19 @@ Renders the current instance, encoded in a specified ID3v2 version. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ByteVector Rendered version of the current instance. #### Overrides -[Id3v2Frame](id3v2frame.md).[render](id3v2frame.md#render) +[Id3v2Frame](Id3v2Frame.md).[render](Id3v2Frame.md#render) ___ ### renderFields -▸ `Protected` **renderFields**(`version`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderFields**(`version`): [`ByteVector`](ByteVector.md) Renders the values in the current instance into field data for a specified version. @@ -533,11 +593,11 @@ Renders the values in the current instance into field data for a specified versi #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[renderFields](id3v2frame.md#renderfields) +[Id3v2Frame](Id3v2Frame.md).[renderFields](Id3v2Frame.md#renderfields) ___ @@ -552,7 +612,7 @@ header. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw ID3v2 frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw ID3v2 frame | | `offset` | `number` | Offset in `data` at which the frame begins. | | `readHeader` | `boolean` | Whether or not to read the reader into the current instance. | | `version` | `number` | Version of the ID3v2 tag the data was encoded with | @@ -563,7 +623,7 @@ header. #### Inherited from -[Id3v2Frame](id3v2frame.md).[setData](id3v2frame.md#setdata) +[Id3v2Frame](Id3v2Frame.md).[setData](Id3v2Frame.md#setdata) ___ @@ -581,7 +641,7 @@ ___ ### correctEncoding -▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/stringtype.md) +▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/StringType.md) Converts an encoding to be a supported encoding for a specified tag version. @@ -589,40 +649,40 @@ Converts an encoding to be a supported encoding for a specified tag version. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`StringType`](../enums/stringtype.md) | Value containing the original encoding | +| `type` | [`StringType`](../enums/StringType.md) | Value containing the original encoding | | `version` | `number` | Value containing the ID3v2 version to be encoded. | #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) StringType Value containing the correct encoding to use, based on - [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) and what is supported by + [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) and what is supported by `version` #### Inherited from -[Id3v2Frame](id3v2frame.md).[correctEncoding](id3v2frame.md#correctencoding) +[Id3v2Frame](Id3v2Frame.md).[correctEncoding](Id3v2Frame.md#correctencoding) ___ ### findTextInformationFrame -▸ `Static` **findTextInformationFrame**(`frames`, `ident`): [`Id3v2TextInformationFrame`](id3v2textinformationframe.md) +▸ `Static` **findTextInformationFrame**(`frames`, `ident`): [`Id3v2TextInformationFrame`](Id3v2TextInformationFrame.md) -Gets a [TextInformationFrame](../enums/id3v2frameclasstype.md#textinformationframe) object of a specified type from a specified type from a +Gets a [TextInformationFrame](../enums/Id3v2FrameClassType.md#textinformationframe) object of a specified type from a specified type from a list of text information frames. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `frames` | [`Id3v2TextInformationFrame`](id3v2textinformationframe.md)[] | List of frames to search | -| `ident` | [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) | Frame identifier to search for | +| `frames` | [`Id3v2TextInformationFrame`](Id3v2TextInformationFrame.md)[] | List of frames to search | +| `ident` | [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) | Frame identifier to search for | #### Returns -[`Id3v2TextInformationFrame`](id3v2textinformationframe.md) +[`Id3v2TextInformationFrame`](Id3v2TextInformationFrame.md) TextInformationFrame Matching frame if it exists in `tag`, `undefined` if a matching frame was not found @@ -631,26 +691,26 @@ ___ ### fromIdentifier -▸ `Static` **fromIdentifier**(`identifier`, `encoding?`): [`Id3v2TextInformationFrame`](id3v2textinformationframe.md) +▸ `Static` **fromIdentifier**(`identifier`, `encoding?`): [`Id3v2TextInformationFrame`](Id3v2TextInformationFrame.md) Constructs and initializes a new instance with a specified identifier #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `identifier` | [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) | Byte vector containing the identifier for the frame | -| `encoding` | [`StringType`](../enums/stringtype.md) | Optionally, the encoding to use for the new instance. If omitted, defaults to [Id3v2Settings.defaultEncoding](id3v2settings.md#defaultencoding) | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `identifier` | [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) | `undefined` | Byte vector containing the identifier for the frame | +| `encoding` | [`StringType`](../enums/StringType.md) | `Id3v2Settings.defaultEncoding` | Optionally, the encoding to use for the new instance. If omitted, defaults to [Id3v2Settings.defaultEncoding](Id3v2Settings.md#defaultencoding) | #### Returns -[`Id3v2TextInformationFrame`](id3v2textinformationframe.md) +[`Id3v2TextInformationFrame`](Id3v2TextInformationFrame.md) ___ ### fromOffsetRawData -▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2TextInformationFrame`](id3v2textinformationframe.md) +▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2TextInformationFrame`](Id3v2TextInformationFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. This method allows for offset reading from the data byte vector. @@ -659,20 +719,20 @@ version. This method allows for offset reading from the data byte vector. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `offset` | `number` | What offset in `data` the frame actually begins. Must be positive, safe integer | -| `header` | [`Id3v2FrameHeader`](id3v2frameheader.md) | Header of the frame found at `data` in the data | +| `header` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header of the frame found at `data` in the data | | `version` | `number` | ID3v2 version the frame was originally encoded with | #### Returns -[`Id3v2TextInformationFrame`](id3v2textinformationframe.md) +[`Id3v2TextInformationFrame`](Id3v2TextInformationFrame.md) ___ ### fromRawData -▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2TextInformationFrame`](id3v2textinformationframe.md) +▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2TextInformationFrame`](Id3v2TextInformationFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. @@ -681,9 +741,9 @@ ID3v2 version. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `version` | `number` | ID3v2 version the raw frame is encoded with, must be a positive 8-bit integer | #### Returns -[`Id3v2TextInformationFrame`](id3v2textinformationframe.md) +[`Id3v2TextInformationFrame`](Id3v2TextInformationFrame.md) diff --git a/docs/classes/id3v2uniquefileidentifierframe.md b/docs/classes/Id3v2UniqueFileIdentifierFrame.md similarity index 62% rename from docs/classes/id3v2uniquefileidentifierframe.md rename to docs/classes/Id3v2UniqueFileIdentifierFrame.md index f7dd84f6..dc913f07 100644 --- a/docs/classes/id3v2uniquefileidentifierframe.md +++ b/docs/classes/Id3v2UniqueFileIdentifierFrame.md @@ -6,50 +6,37 @@ Implements support for ID3v2 Unique File Identifier (UFID) frames. ## Hierarchy -- [`Id3v2Frame`](id3v2frame.md) +- [`Id3v2Frame`](Id3v2Frame.md) ↳ **`Id3v2UniqueFileIdentifierFrame`** ## Table of contents -### Properties - -- [\_header](id3v2uniquefileidentifierframe.md#_header) - ### Accessors -- [encryptionId](id3v2uniquefileidentifierframe.md#encryptionid) -- [flags](id3v2uniquefileidentifierframe.md#flags) -- [frameClassType](id3v2uniquefileidentifierframe.md#frameclasstype) -- [frameId](id3v2uniquefileidentifierframe.md#frameid) -- [groupId](id3v2uniquefileidentifierframe.md#groupid) -- [identifier](id3v2uniquefileidentifierframe.md#identifier) -- [owner](id3v2uniquefileidentifierframe.md#owner) -- [size](id3v2uniquefileidentifierframe.md#size) +- [encryptionId](Id3v2UniqueFileIdentifierFrame.md#encryptionid) +- [flags](Id3v2UniqueFileIdentifierFrame.md#flags) +- [frameClassType](Id3v2UniqueFileIdentifierFrame.md#frameclasstype) +- [frameId](Id3v2UniqueFileIdentifierFrame.md#frameid) +- [groupId](Id3v2UniqueFileIdentifierFrame.md#groupid) +- [header](Id3v2UniqueFileIdentifierFrame.md#header) +- [identifier](Id3v2UniqueFileIdentifierFrame.md#identifier) +- [owner](Id3v2UniqueFileIdentifierFrame.md#owner) +- [size](Id3v2UniqueFileIdentifierFrame.md#size) ### Methods -- [clone](id3v2uniquefileidentifierframe.md#clone) -- [fieldData](id3v2uniquefileidentifierframe.md#fielddata) -- [parseFields](id3v2uniquefileidentifierframe.md#parsefields) -- [render](id3v2uniquefileidentifierframe.md#render) -- [renderFields](id3v2uniquefileidentifierframe.md#renderfields) -- [setData](id3v2uniquefileidentifierframe.md#setdata) -- [correctEncoding](id3v2uniquefileidentifierframe.md#correctencoding) -- [find](id3v2uniquefileidentifierframe.md#find) -- [fromData](id3v2uniquefileidentifierframe.md#fromdata) -- [fromOffsetRawData](id3v2uniquefileidentifierframe.md#fromoffsetrawdata) -- [fromRawData](id3v2uniquefileidentifierframe.md#fromrawdata) - -## Properties - -### \_header - -• `Protected` **\_header**: [`Id3v2FrameHeader`](id3v2frameheader.md) - -#### Inherited from - -[Id3v2Frame](id3v2frame.md).[_header](id3v2frame.md#_header) +- [clone](Id3v2UniqueFileIdentifierFrame.md#clone) +- [fieldData](Id3v2UniqueFileIdentifierFrame.md#fielddata) +- [parseFields](Id3v2UniqueFileIdentifierFrame.md#parsefields) +- [render](Id3v2UniqueFileIdentifierFrame.md#render) +- [renderFields](Id3v2UniqueFileIdentifierFrame.md#renderfields) +- [setData](Id3v2UniqueFileIdentifierFrame.md#setdata) +- [correctEncoding](Id3v2UniqueFileIdentifierFrame.md#correctencoding) +- [find](Id3v2UniqueFileIdentifierFrame.md#find) +- [fromData](Id3v2UniqueFileIdentifierFrame.md#fromdata) +- [fromOffsetRawData](Id3v2UniqueFileIdentifierFrame.md#fromoffsetrawdata) +- [fromRawData](Id3v2UniqueFileIdentifierFrame.md#fromrawdata) ## Accessors @@ -66,6 +53,10 @@ Gets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + • `set` **encryptionId**(`value`): `void` Sets the encryption ID applied to the current instance. @@ -83,60 +74,80 @@ Sets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + ___ ### flags -• `get` **flags**(): [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +• `get` **flags**(): [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) Gets the frame flags applied to the current instance. #### Returns -[`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +[`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) + +#### Inherited from + +Frame.flags • `set` **flags**(`value`): `void` Sets the frame flags applied to the current instance. -If the value includes either [Id3v2FrameFlags.Encryption](../enums/id3v2frameflags.md#encryption) or -[Id3v2FrameFlags.Compression](../enums/id3v2frameflags.md#compression), [render](id3v2uniquefileidentifierframe.md#render) will throw. +If the value includes either [Id3v2FrameFlags.Encryption](../enums/Id3v2FrameFlags.md#encryption) or +[Id3v2FrameFlags.Compression](../enums/Id3v2FrameFlags.md#compression), [render](Id3v2UniqueFileIdentifierFrame.md#render) will throw. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) | +| `value` | [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) | #### Returns `void` +#### Inherited from + +Frame.flags + ___ ### frameClassType -• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) **`inheritdoc`** #### Returns -[`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +[`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) + +#### Overrides + +Frame.frameClassType ___ ### frameId -• `get` **frameId**(): [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +• `get` **frameId**(): [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) Gets the frame ID for the current instance. #### Returns -[`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +[`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) FrameIdentifier Object representing of the identifier of the frame +#### Inherited from + +Frame.frameId + ___ ### groupId @@ -152,6 +163,10 @@ Gets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + • `set` **groupId**(`value`): `void` Sets the grouping ID applied to the current instance. @@ -169,17 +184,55 @@ Sets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + +___ + +### header + +• `Protected` `get` **header**(): [`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +Gets the header for the frame. For new frames this should not exist. + +#### Returns + +[`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +#### Inherited from + +Frame.header + +• `Protected` `set` **header**(`value`): `void` + +Sets the header for the frame. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header for the frame | + +#### Returns + +`void` + +#### Inherited from + +Frame.header + ___ ### identifier -• `get` **identifier**(): [`ByteVector`](bytevector.md) +• `get` **identifier**(): [`ByteVector`](ByteVector.md) Gets the identifier data stored in the current instance. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) • `set` **identifier**(`value`): `void` @@ -189,7 +242,7 @@ Sets the identifier data stored in the current instance. | Name | Type | | :------ | :------ | -| `value` | [`ByteVector`](bytevector.md) | +| `value` | [`ByteVector`](ByteVector.md) | #### Returns @@ -221,11 +274,15 @@ NOTE: This value is not used outside of reading a frame from disk, so newly crea `number` +#### Inherited from + +Frame.size + ## Methods ### clone -▸ **clone**(): [`Id3v2Frame`](id3v2frame.md) +▸ **clone**(): [`Id3v2Frame`](Id3v2Frame.md) Creates a deep copy of the current instance. This method is implemented by rendering the current instance as an ID3v2.4 frame and using @@ -234,17 +291,17 @@ classes. #### Returns -[`Id3v2Frame`](id3v2frame.md) +[`Id3v2Frame`](Id3v2Frame.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[clone](id3v2frame.md#clone) +[Id3v2Frame](Id3v2Frame.md).[clone](Id3v2Frame.md#clone) ___ ### fieldData -▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](bytevector.md) +▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](ByteVector.md) Extracts the field data from the raw portion of an ID3v2 frame. This method is necessary for extracting extra data prepended to the frame such the as @@ -254,24 +311,24 @@ grouping ID. | Name | Type | Description | | :------ | :------ | :------ | -| `frameData` | [`ByteVector`](bytevector.md) | Raw frame data | +| `frameData` | [`ByteVector`](ByteVector.md) | Raw frame data | | `offset` | `number` | Index at which the data is contained | | `version` | `number` | Version of the ID3v2 tag the data was originally encoded with | | `dataIncludesHeader` | `boolean` | `true` if `frameData` includes the header, `false` otherwise | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[fieldData](id3v2frame.md#fielddata) +[Id3v2Frame](Id3v2Frame.md).[fieldData](Id3v2Frame.md#fielddata) ___ ### parseFields -▸ `Protected` **parseFields**(`data`, `_version`): `void` +▸ `Protected` **parseFields**(`data`): `void` Populates the values in this frame by parsing its field data in a specified version. @@ -279,8 +336,7 @@ Populates the values in this frame by parsing its field data in a specified vers | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Extracted field data | -| `_version` | `number` | ID3v2 version the field data is encoded in | +| `data` | [`ByteVector`](ByteVector.md) | Extracted field data | #### Returns @@ -288,13 +344,13 @@ Populates the values in this frame by parsing its field data in a specified vers #### Overrides -[Id3v2Frame](id3v2frame.md).[parseFields](id3v2frame.md#parsefields) +[Id3v2Frame](Id3v2Frame.md).[parseFields](Id3v2Frame.md#parsefields) ___ ### render -▸ **render**(`version`): [`ByteVector`](bytevector.md) +▸ **render**(`version`): [`ByteVector`](ByteVector.md) Renders the current instance, encoded in a specified ID3v2 version. @@ -306,33 +362,27 @@ Renders the current instance, encoded in a specified ID3v2 version. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[render](id3v2frame.md#render) +[Id3v2Frame](Id3v2Frame.md).[render](Id3v2Frame.md#render) ___ ### renderFields -▸ `Protected` **renderFields**(`_version`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderFields**(): [`ByteVector`](ByteVector.md) Renders the values in the current instance into field data for a specified version. -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `_version` | `number` | ID3v2 version the field data is to be encoded in. | - #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[renderFields](id3v2frame.md#renderfields) +[Id3v2Frame](Id3v2Frame.md).[renderFields](Id3v2Frame.md#renderfields) ___ @@ -347,7 +397,7 @@ header. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw ID3v2 frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw ID3v2 frame | | `offset` | `number` | Offset in `data` at which the frame begins. | | `readHeader` | `boolean` | Whether or not to read the reader into the current instance. | | `version` | `number` | Version of the ID3v2 tag the data was encoded with | @@ -358,13 +408,13 @@ header. #### Inherited from -[Id3v2Frame](id3v2frame.md).[setData](id3v2frame.md#setdata) +[Id3v2Frame](Id3v2Frame.md).[setData](Id3v2Frame.md#setdata) ___ ### correctEncoding -▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/stringtype.md) +▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/StringType.md) Converts an encoding to be a supported encoding for a specified tag version. @@ -372,26 +422,26 @@ Converts an encoding to be a supported encoding for a specified tag version. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`StringType`](../enums/stringtype.md) | Value containing the original encoding | +| `type` | [`StringType`](../enums/StringType.md) | Value containing the original encoding | | `version` | `number` | Value containing the ID3v2 version to be encoded. | #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) StringType Value containing the correct encoding to use, based on - [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) and what is supported by + [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) and what is supported by `version` #### Inherited from -[Id3v2Frame](id3v2frame.md).[correctEncoding](id3v2frame.md#correctencoding) +[Id3v2Frame](Id3v2Frame.md).[correctEncoding](Id3v2Frame.md#correctencoding) ___ ### find -▸ `Static` **find**(`frames`, `owner`): [`Id3v2UniqueFileIdentifierFrame`](id3v2uniquefileidentifierframe.md) +▸ `Static` **find**(`frames`, `owner`): [`Id3v2UniqueFileIdentifierFrame`](Id3v2UniqueFileIdentifierFrame.md) Gets a unique file identifier frame from a list of frames @@ -399,12 +449,12 @@ Gets a unique file identifier frame from a list of frames | Name | Type | Description | | :------ | :------ | :------ | -| `frames` | [`Id3v2UniqueFileIdentifierFrame`](id3v2uniquefileidentifierframe.md)[] | List of frames to search | +| `frames` | [`Id3v2UniqueFileIdentifierFrame`](Id3v2UniqueFileIdentifierFrame.md)[] | List of frames to search | | `owner` | `string` | Owner to match | #### Returns -[`Id3v2UniqueFileIdentifierFrame`](id3v2uniquefileidentifierframe.md) +[`Id3v2UniqueFileIdentifierFrame`](Id3v2UniqueFileIdentifierFrame.md) PopularimeterFrame Frame containing the matching user, `undefined` if a match was not found @@ -413,7 +463,7 @@ ___ ### fromData -▸ `Static` **fromData**(`owner`, `identifier`): [`Id3v2UniqueFileIdentifierFrame`](id3v2uniquefileidentifierframe.md) +▸ `Static` **fromData**(`owner`, `identifier`): [`Id3v2UniqueFileIdentifierFrame`](Id3v2UniqueFileIdentifierFrame.md) Constructs and initializes a new instance using the provided information @@ -422,17 +472,17 @@ Constructs and initializes a new instance using the provided information | Name | Type | Description | | :------ | :------ | :------ | | `owner` | `string` | Owner of the new frame. Should be an email or url to the database where this unique identifier is applicable | -| `identifier` | [`ByteVector`](bytevector.md) | Unique identifier to store in the frame. Must be no more than 64 bytes | +| `identifier` | [`ByteVector`](ByteVector.md) | Unique identifier to store in the frame. Must be no more than 64 bytes | #### Returns -[`Id3v2UniqueFileIdentifierFrame`](id3v2uniquefileidentifierframe.md) +[`Id3v2UniqueFileIdentifierFrame`](Id3v2UniqueFileIdentifierFrame.md) ___ ### fromOffsetRawData -▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2UniqueFileIdentifierFrame`](id3v2uniquefileidentifierframe.md) +▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2UniqueFileIdentifierFrame`](Id3v2UniqueFileIdentifierFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. This method allows for offset reading from the data byte vector. @@ -441,20 +491,20 @@ version. This method allows for offset reading from the data byte vector. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `offset` | `number` | What offset in `data` the frame actually begins. Must be positive, safe integer | -| `header` | [`Id3v2FrameHeader`](id3v2frameheader.md) | Header of the frame found at `data` in the data | +| `header` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header of the frame found at `data` in the data | | `version` | `number` | ID3v2 version the frame was originally encoded with | #### Returns -[`Id3v2UniqueFileIdentifierFrame`](id3v2uniquefileidentifierframe.md) +[`Id3v2UniqueFileIdentifierFrame`](Id3v2UniqueFileIdentifierFrame.md) ___ ### fromRawData -▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2UniqueFileIdentifierFrame`](id3v2uniquefileidentifierframe.md) +▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2UniqueFileIdentifierFrame`](Id3v2UniqueFileIdentifierFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. @@ -463,9 +513,9 @@ ID3v2 version. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `version` | `number` | ID3v2 version the raw frame is encoded with, must be a positive 8-bit integer | #### Returns -[`Id3v2UniqueFileIdentifierFrame`](id3v2uniquefileidentifierframe.md) +[`Id3v2UniqueFileIdentifierFrame`](Id3v2UniqueFileIdentifierFrame.md) diff --git a/docs/classes/id3v2unknownframe.md b/docs/classes/Id3v2UnknownFrame.md similarity index 63% rename from docs/classes/id3v2unknownframe.md rename to docs/classes/Id3v2UnknownFrame.md index 5c21ccfb..90f549b9 100644 --- a/docs/classes/id3v2unknownframe.md +++ b/docs/classes/Id3v2UnknownFrame.md @@ -6,7 +6,7 @@ Fallback type when no other frame class works for a given frame. ## Hierarchy -- [`Id3v2Frame`](id3v2frame.md) +- [`Id3v2Frame`](Id3v2Frame.md) ↳ **`Id3v2UnknownFrame`** @@ -14,46 +14,36 @@ Fallback type when no other frame class works for a given frame. ### Properties -- [\_header](id3v2unknownframe.md#_header) -- [data](id3v2unknownframe.md#data) +- [data](Id3v2UnknownFrame.md#data) ### Accessors -- [encryptionId](id3v2unknownframe.md#encryptionid) -- [flags](id3v2unknownframe.md#flags) -- [frameClassType](id3v2unknownframe.md#frameclasstype) -- [frameId](id3v2unknownframe.md#frameid) -- [groupId](id3v2unknownframe.md#groupid) -- [size](id3v2unknownframe.md#size) +- [encryptionId](Id3v2UnknownFrame.md#encryptionid) +- [flags](Id3v2UnknownFrame.md#flags) +- [frameClassType](Id3v2UnknownFrame.md#frameclasstype) +- [frameId](Id3v2UnknownFrame.md#frameid) +- [groupId](Id3v2UnknownFrame.md#groupid) +- [header](Id3v2UnknownFrame.md#header) +- [size](Id3v2UnknownFrame.md#size) ### Methods -- [clone](id3v2unknownframe.md#clone) -- [fieldData](id3v2unknownframe.md#fielddata) -- [parseFields](id3v2unknownframe.md#parsefields) -- [render](id3v2unknownframe.md#render) -- [renderFields](id3v2unknownframe.md#renderfields) -- [setData](id3v2unknownframe.md#setdata) -- [correctEncoding](id3v2unknownframe.md#correctencoding) -- [fromData](id3v2unknownframe.md#fromdata) -- [fromOffsetRawData](id3v2unknownframe.md#fromoffsetrawdata) -- [fromRawData](id3v2unknownframe.md#fromrawdata) +- [clone](Id3v2UnknownFrame.md#clone) +- [fieldData](Id3v2UnknownFrame.md#fielddata) +- [parseFields](Id3v2UnknownFrame.md#parsefields) +- [render](Id3v2UnknownFrame.md#render) +- [renderFields](Id3v2UnknownFrame.md#renderfields) +- [setData](Id3v2UnknownFrame.md#setdata) +- [correctEncoding](Id3v2UnknownFrame.md#correctencoding) +- [fromData](Id3v2UnknownFrame.md#fromdata) +- [fromOffsetRawData](Id3v2UnknownFrame.md#fromoffsetrawdata) +- [fromRawData](Id3v2UnknownFrame.md#fromrawdata) ## Properties -### \_header - -• `Protected` **\_header**: [`Id3v2FrameHeader`](id3v2frameheader.md) - -#### Inherited from - -[Id3v2Frame](id3v2frame.md).[_header](id3v2frame.md#_header) - -___ - ### data -• **data**: [`ByteVector`](bytevector.md) +• **data**: [`ByteVector`](ByteVector.md) Gets and sets the field data in the current instance @@ -72,6 +62,10 @@ Gets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + • `set` **encryptionId**(`value`): `void` Sets the encryption ID applied to the current instance. @@ -89,60 +83,80 @@ Sets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + ___ ### flags -• `get` **flags**(): [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +• `get` **flags**(): [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) Gets the frame flags applied to the current instance. #### Returns -[`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +[`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) + +#### Inherited from + +Frame.flags • `set` **flags**(`value`): `void` Sets the frame flags applied to the current instance. -If the value includes either [Id3v2FrameFlags.Encryption](../enums/id3v2frameflags.md#encryption) or -[Id3v2FrameFlags.Compression](../enums/id3v2frameflags.md#compression), [render](id3v2unknownframe.md#render) will throw. +If the value includes either [Id3v2FrameFlags.Encryption](../enums/Id3v2FrameFlags.md#encryption) or +[Id3v2FrameFlags.Compression](../enums/Id3v2FrameFlags.md#compression), [render](Id3v2UnknownFrame.md#render) will throw. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) | +| `value` | [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) | #### Returns `void` +#### Inherited from + +Frame.flags + ___ ### frameClassType -• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) **`inheritdoc`** #### Returns -[`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +[`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) + +#### Overrides + +Frame.frameClassType ___ ### frameId -• `get` **frameId**(): [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +• `get` **frameId**(): [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) Gets the frame ID for the current instance. #### Returns -[`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +[`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) FrameIdentifier Object representing of the identifier of the frame +#### Inherited from + +Frame.frameId + ___ ### groupId @@ -158,6 +172,10 @@ Gets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + • `set` **groupId**(`value`): `void` Sets the grouping ID applied to the current instance. @@ -175,6 +193,44 @@ Sets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + +___ + +### header + +• `Protected` `get` **header**(): [`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +Gets the header for the frame. For new frames this should not exist. + +#### Returns + +[`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +#### Inherited from + +Frame.header + +• `Protected` `set` **header**(`value`): `void` + +Sets the header for the frame. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header for the frame | + +#### Returns + +`void` + +#### Inherited from + +Frame.header + ___ ### size @@ -189,11 +245,15 @@ NOTE: This value is not used outside of reading a frame from disk, so newly crea `number` +#### Inherited from + +Frame.size + ## Methods ### clone -▸ **clone**(): [`Id3v2Frame`](id3v2frame.md) +▸ **clone**(): [`Id3v2Frame`](Id3v2Frame.md) Creates a deep copy of the current instance. This method is implemented by rendering the current instance as an ID3v2.4 frame and using @@ -202,17 +262,17 @@ classes. #### Returns -[`Id3v2Frame`](id3v2frame.md) +[`Id3v2Frame`](Id3v2Frame.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[clone](id3v2frame.md#clone) +[Id3v2Frame](Id3v2Frame.md).[clone](Id3v2Frame.md#clone) ___ ### fieldData -▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](bytevector.md) +▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](ByteVector.md) Extracts the field data from the raw portion of an ID3v2 frame. This method is necessary for extracting extra data prepended to the frame such the as @@ -222,24 +282,24 @@ grouping ID. | Name | Type | Description | | :------ | :------ | :------ | -| `frameData` | [`ByteVector`](bytevector.md) | Raw frame data | +| `frameData` | [`ByteVector`](ByteVector.md) | Raw frame data | | `offset` | `number` | Index at which the data is contained | | `version` | `number` | Version of the ID3v2 tag the data was originally encoded with | | `dataIncludesHeader` | `boolean` | `true` if `frameData` includes the header, `false` otherwise | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[fieldData](id3v2frame.md#fielddata) +[Id3v2Frame](Id3v2Frame.md).[fieldData](Id3v2Frame.md#fielddata) ___ ### parseFields -▸ `Protected` **parseFields**(`data`, `_version`): `void` +▸ `Protected` **parseFields**(`data`): `void` Populates the values in this frame by parsing its field data in a specified version. @@ -247,8 +307,7 @@ Populates the values in this frame by parsing its field data in a specified vers | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Extracted field data | -| `_version` | `number` | ID3v2 version the field data is encoded in | +| `data` | [`ByteVector`](ByteVector.md) | Extracted field data | #### Returns @@ -256,13 +315,13 @@ Populates the values in this frame by parsing its field data in a specified vers #### Overrides -[Id3v2Frame](id3v2frame.md).[parseFields](id3v2frame.md#parsefields) +[Id3v2Frame](Id3v2Frame.md).[parseFields](Id3v2Frame.md#parsefields) ___ ### render -▸ **render**(`version`): [`ByteVector`](bytevector.md) +▸ **render**(`version`): [`ByteVector`](ByteVector.md) Renders the current instance, encoded in a specified ID3v2 version. @@ -274,33 +333,27 @@ Renders the current instance, encoded in a specified ID3v2 version. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[render](id3v2frame.md#render) +[Id3v2Frame](Id3v2Frame.md).[render](Id3v2Frame.md#render) ___ ### renderFields -▸ `Protected` **renderFields**(`_version`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderFields**(): [`ByteVector`](ByteVector.md) Renders the values in the current instance into field data for a specified version. -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `_version` | `number` | ID3v2 version the field data is to be encoded in. | - #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[renderFields](id3v2frame.md#renderfields) +[Id3v2Frame](Id3v2Frame.md).[renderFields](Id3v2Frame.md#renderfields) ___ @@ -315,7 +368,7 @@ header. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw ID3v2 frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw ID3v2 frame | | `offset` | `number` | Offset in `data` at which the frame begins. | | `readHeader` | `boolean` | Whether or not to read the reader into the current instance. | | `version` | `number` | Version of the ID3v2 tag the data was encoded with | @@ -326,13 +379,13 @@ header. #### Inherited from -[Id3v2Frame](id3v2frame.md).[setData](id3v2frame.md#setdata) +[Id3v2Frame](Id3v2Frame.md).[setData](Id3v2Frame.md#setdata) ___ ### correctEncoding -▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/stringtype.md) +▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/StringType.md) Converts an encoding to be a supported encoding for a specified tag version. @@ -340,26 +393,26 @@ Converts an encoding to be a supported encoding for a specified tag version. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`StringType`](../enums/stringtype.md) | Value containing the original encoding | +| `type` | [`StringType`](../enums/StringType.md) | Value containing the original encoding | | `version` | `number` | Value containing the ID3v2 version to be encoded. | #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) StringType Value containing the correct encoding to use, based on - [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) and what is supported by + [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) and what is supported by `version` #### Inherited from -[Id3v2Frame](id3v2frame.md).[correctEncoding](id3v2frame.md#correctencoding) +[Id3v2Frame](Id3v2Frame.md).[correctEncoding](Id3v2Frame.md#correctencoding) ___ ### fromData -▸ `Static` **fromData**(`identifier`, `data?`): [`Id3v2UnknownFrame`](id3v2unknownframe.md) +▸ `Static` **fromData**(`identifier`, `data?`): [`Id3v2UnknownFrame`](Id3v2UnknownFrame.md) Constructs and initializes a new instance with a specified type @@ -367,18 +420,18 @@ Constructs and initializes a new instance with a specified type | Name | Type | Description | | :------ | :------ | :------ | -| `identifier` | [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) | ID3v2 frame identifier | -| `data?` | [`ByteVector`](bytevector.md) | Contents of the frame | +| `identifier` | [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) | ID3v2 frame identifier | +| `data?` | [`ByteVector`](ByteVector.md) | Contents of the frame | #### Returns -[`Id3v2UnknownFrame`](id3v2unknownframe.md) +[`Id3v2UnknownFrame`](Id3v2UnknownFrame.md) ___ ### fromOffsetRawData -▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2UnknownFrame`](id3v2unknownframe.md) +▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2UnknownFrame`](Id3v2UnknownFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. This method allows for offset reading from the data byte vector. @@ -387,20 +440,20 @@ version. This method allows for offset reading from the data byte vector. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `offset` | `number` | What offset in `data` the frame actually begins. Must be positive, safe integer | -| `header` | [`Id3v2FrameHeader`](id3v2frameheader.md) | Header of the frame found at `data` in the data | +| `header` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header of the frame found at `data` in the data | | `version` | `number` | ID3v2 version the frame was originally encoded with | #### Returns -[`Id3v2UnknownFrame`](id3v2unknownframe.md) +[`Id3v2UnknownFrame`](Id3v2UnknownFrame.md) ___ ### fromRawData -▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2UnknownFrame`](id3v2unknownframe.md) +▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2UnknownFrame`](Id3v2UnknownFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. @@ -409,9 +462,9 @@ ID3v2 version. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `version` | `number` | ID3v2 version the raw frame is encoded with, must be a positive 8-bit integer | #### Returns -[`Id3v2UnknownFrame`](id3v2unknownframe.md) +[`Id3v2UnknownFrame`](Id3v2UnknownFrame.md) diff --git a/docs/classes/id3v2unsynchronizedframe.md b/docs/classes/Id3v2UnsynchronizedFrame.md similarity index 64% rename from docs/classes/id3v2unsynchronizedframe.md rename to docs/classes/Id3v2UnsynchronizedFrame.md index b2f8bc4a..7f0c7adf 100644 --- a/docs/classes/id3v2unsynchronizedframe.md +++ b/docs/classes/Id3v2UnsynchronizedFrame.md @@ -4,55 +4,42 @@ ## Hierarchy -- [`Id3v2Frame`](id3v2frame.md) +- [`Id3v2Frame`](Id3v2Frame.md) ↳ **`Id3v2UnsynchronizedFrame`** ## Table of contents -### Properties - -- [\_header](id3v2unsynchronizedframe.md#_header) - ### Accessors -- [description](id3v2unsynchronizedframe.md#description) -- [encryptionId](id3v2unsynchronizedframe.md#encryptionid) -- [flags](id3v2unsynchronizedframe.md#flags) -- [frameClassType](id3v2unsynchronizedframe.md#frameclasstype) -- [frameId](id3v2unsynchronizedframe.md#frameid) -- [groupId](id3v2unsynchronizedframe.md#groupid) -- [language](id3v2unsynchronizedframe.md#language) -- [size](id3v2unsynchronizedframe.md#size) -- [text](id3v2unsynchronizedframe.md#text) -- [textEncoding](id3v2unsynchronizedframe.md#textencoding) +- [description](Id3v2UnsynchronizedFrame.md#description) +- [encryptionId](Id3v2UnsynchronizedFrame.md#encryptionid) +- [flags](Id3v2UnsynchronizedFrame.md#flags) +- [frameClassType](Id3v2UnsynchronizedFrame.md#frameclasstype) +- [frameId](Id3v2UnsynchronizedFrame.md#frameid) +- [groupId](Id3v2UnsynchronizedFrame.md#groupid) +- [header](Id3v2UnsynchronizedFrame.md#header) +- [language](Id3v2UnsynchronizedFrame.md#language) +- [size](Id3v2UnsynchronizedFrame.md#size) +- [text](Id3v2UnsynchronizedFrame.md#text) +- [textEncoding](Id3v2UnsynchronizedFrame.md#textencoding) ### Methods -- [clone](id3v2unsynchronizedframe.md#clone) -- [fieldData](id3v2unsynchronizedframe.md#fielddata) -- [parseFields](id3v2unsynchronizedframe.md#parsefields) -- [render](id3v2unsynchronizedframe.md#render) -- [renderFields](id3v2unsynchronizedframe.md#renderfields) -- [setData](id3v2unsynchronizedframe.md#setdata) -- [toString](id3v2unsynchronizedframe.md#tostring) -- [correctEncoding](id3v2unsynchronizedframe.md#correctencoding) -- [find](id3v2unsynchronizedframe.md#find) -- [findAll](id3v2unsynchronizedframe.md#findall) -- [findPreferred](id3v2unsynchronizedframe.md#findpreferred) -- [fromData](id3v2unsynchronizedframe.md#fromdata) -- [fromOffsetRawData](id3v2unsynchronizedframe.md#fromoffsetrawdata) -- [fromRawData](id3v2unsynchronizedframe.md#fromrawdata) - -## Properties - -### \_header - -• `Protected` **\_header**: [`Id3v2FrameHeader`](id3v2frameheader.md) - -#### Inherited from - -[Id3v2Frame](id3v2frame.md).[_header](id3v2frame.md#_header) +- [clone](Id3v2UnsynchronizedFrame.md#clone) +- [fieldData](Id3v2UnsynchronizedFrame.md#fielddata) +- [parseFields](Id3v2UnsynchronizedFrame.md#parsefields) +- [render](Id3v2UnsynchronizedFrame.md#render) +- [renderFields](Id3v2UnsynchronizedFrame.md#renderfields) +- [setData](Id3v2UnsynchronizedFrame.md#setdata) +- [toString](Id3v2UnsynchronizedFrame.md#tostring) +- [correctEncoding](Id3v2UnsynchronizedFrame.md#correctencoding) +- [find](Id3v2UnsynchronizedFrame.md#find) +- [findAll](Id3v2UnsynchronizedFrame.md#findall) +- [findPreferred](Id3v2UnsynchronizedFrame.md#findpreferred) +- [fromData](Id3v2UnsynchronizedFrame.md#fromdata) +- [fromOffsetRawData](Id3v2UnsynchronizedFrame.md#fromoffsetrawdata) +- [fromRawData](Id3v2UnsynchronizedFrame.md#fromrawdata) ## Accessors @@ -96,6 +83,10 @@ Gets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + • `set` **encryptionId**(`value`): `void` Sets the encryption ID applied to the current instance. @@ -113,60 +104,80 @@ Sets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + ___ ### flags -• `get` **flags**(): [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +• `get` **flags**(): [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) Gets the frame flags applied to the current instance. #### Returns -[`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +[`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) + +#### Inherited from + +Frame.flags • `set` **flags**(`value`): `void` Sets the frame flags applied to the current instance. -If the value includes either [Id3v2FrameFlags.Encryption](../enums/id3v2frameflags.md#encryption) or -[Id3v2FrameFlags.Compression](../enums/id3v2frameflags.md#compression), [render](id3v2unsynchronizedframe.md#render) will throw. +If the value includes either [Id3v2FrameFlags.Encryption](../enums/Id3v2FrameFlags.md#encryption) or +[Id3v2FrameFlags.Compression](../enums/Id3v2FrameFlags.md#compression), [render](Id3v2UnsynchronizedFrame.md#render) will throw. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) | +| `value` | [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) | #### Returns `void` +#### Inherited from + +Frame.flags + ___ ### frameClassType -• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) **`inheritdoc`** #### Returns -[`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +[`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) + +#### Overrides + +Frame.frameClassType ___ ### frameId -• `get` **frameId**(): [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +• `get` **frameId**(): [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) Gets the frame ID for the current instance. #### Returns -[`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +[`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) FrameIdentifier Object representing of the identifier of the frame +#### Inherited from + +Frame.frameId + ___ ### groupId @@ -182,6 +193,10 @@ Gets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + • `set` **groupId**(`value`): `void` Sets the grouping ID applied to the current instance. @@ -199,6 +214,44 @@ Sets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + +___ + +### header + +• `Protected` `get` **header**(): [`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +Gets the header for the frame. For new frames this should not exist. + +#### Returns + +[`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +#### Inherited from + +Frame.header + +• `Protected` `set` **header**(`value`): `void` + +Sets the header for the frame. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header for the frame | + +#### Returns + +`void` + +#### Inherited from + +Frame.header + ___ ### language @@ -239,6 +292,10 @@ NOTE: This value is not used outside of reading a frame from disk, so newly crea `number` +#### Inherited from + +Frame.size + ___ ### text @@ -269,13 +326,13 @@ ___ ### textEncoding -• `get` **textEncoding**(): [`StringType`](../enums/stringtype.md) +• `get` **textEncoding**(): [`StringType`](../enums/StringType.md) Gets the text encoding to use when storing the current instance. #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) • `set` **textEncoding**(`value`): `void` @@ -285,7 +342,7 @@ Sets the text encoding to use when storing the current instance. | Name | Type | | :------ | :------ | -| `value` | [`StringType`](../enums/stringtype.md) | +| `value` | [`StringType`](../enums/StringType.md) | #### Returns @@ -295,7 +352,7 @@ Sets the text encoding to use when storing the current instance. ### clone -▸ **clone**(): [`Id3v2Frame`](id3v2frame.md) +▸ **clone**(): [`Id3v2Frame`](Id3v2Frame.md) Creates a deep copy of the current instance. This method is implemented by rendering the current instance as an ID3v2.4 frame and using @@ -304,17 +361,17 @@ classes. #### Returns -[`Id3v2Frame`](id3v2frame.md) +[`Id3v2Frame`](Id3v2Frame.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[clone](id3v2frame.md#clone) +[Id3v2Frame](Id3v2Frame.md).[clone](Id3v2Frame.md#clone) ___ ### fieldData -▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](bytevector.md) +▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](ByteVector.md) Extracts the field data from the raw portion of an ID3v2 frame. This method is necessary for extracting extra data prepended to the frame such the as @@ -324,24 +381,24 @@ grouping ID. | Name | Type | Description | | :------ | :------ | :------ | -| `frameData` | [`ByteVector`](bytevector.md) | Raw frame data | +| `frameData` | [`ByteVector`](ByteVector.md) | Raw frame data | | `offset` | `number` | Index at which the data is contained | | `version` | `number` | Version of the ID3v2 tag the data was originally encoded with | | `dataIncludesHeader` | `boolean` | `true` if `frameData` includes the header, `false` otherwise | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[fieldData](id3v2frame.md#fielddata) +[Id3v2Frame](Id3v2Frame.md).[fieldData](Id3v2Frame.md#fielddata) ___ ### parseFields -▸ `Protected` **parseFields**(`data`, `_version`): `void` +▸ `Protected` **parseFields**(`data`): `void` Populates the values in this frame by parsing its field data in a specified version. @@ -349,8 +406,7 @@ Populates the values in this frame by parsing its field data in a specified vers | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Extracted field data | -| `_version` | `number` | ID3v2 version the field data is encoded in | +| `data` | [`ByteVector`](ByteVector.md) | Extracted field data | #### Returns @@ -358,13 +414,13 @@ Populates the values in this frame by parsing its field data in a specified vers #### Overrides -[Id3v2Frame](id3v2frame.md).[parseFields](id3v2frame.md#parsefields) +[Id3v2Frame](Id3v2Frame.md).[parseFields](Id3v2Frame.md#parsefields) ___ ### render -▸ **render**(`version`): [`ByteVector`](bytevector.md) +▸ **render**(`version`): [`ByteVector`](ByteVector.md) Renders the current instance, encoded in a specified ID3v2 version. @@ -376,17 +432,17 @@ Renders the current instance, encoded in a specified ID3v2 version. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[render](id3v2frame.md#render) +[Id3v2Frame](Id3v2Frame.md).[render](Id3v2Frame.md#render) ___ ### renderFields -▸ `Protected` **renderFields**(`version`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderFields**(`version`): [`ByteVector`](ByteVector.md) Renders the values in the current instance into field data for a specified version. @@ -398,11 +454,11 @@ Renders the values in the current instance into field data for a specified versi #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[renderFields](id3v2frame.md#renderfields) +[Id3v2Frame](Id3v2Frame.md).[renderFields](Id3v2Frame.md#renderfields) ___ @@ -417,7 +473,7 @@ header. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw ID3v2 frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw ID3v2 frame | | `offset` | `number` | Offset in `data` at which the frame begins. | | `readHeader` | `boolean` | Whether or not to read the reader into the current instance. | | `version` | `number` | Version of the ID3v2 tag the data was encoded with | @@ -428,7 +484,7 @@ header. #### Inherited from -[Id3v2Frame](id3v2frame.md).[setData](id3v2frame.md#setdata) +[Id3v2Frame](Id3v2Frame.md).[setData](Id3v2Frame.md#setdata) ___ @@ -444,7 +500,7 @@ ___ ### correctEncoding -▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/stringtype.md) +▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/StringType.md) Converts an encoding to be a supported encoding for a specified tag version. @@ -452,26 +508,26 @@ Converts an encoding to be a supported encoding for a specified tag version. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`StringType`](../enums/stringtype.md) | Value containing the original encoding | +| `type` | [`StringType`](../enums/StringType.md) | Value containing the original encoding | | `version` | `number` | Value containing the ID3v2 version to be encoded. | #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) StringType Value containing the correct encoding to use, based on - [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) and what is supported by + [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) and what is supported by `version` #### Inherited from -[Id3v2Frame](id3v2frame.md).[correctEncoding](id3v2frame.md#correctencoding) +[Id3v2Frame](Id3v2Frame.md).[correctEncoding](Id3v2Frame.md#correctencoding) ___ ### find -▸ `Static` **find**(`frames`, `description`, `language`): [`Id3v2UnsynchronizedFrame`](id3v2unsynchronizedframe.md) +▸ `Static` **find**(`frames`, `description`, `language`): [`Id3v2UnsynchronizedFrame`](Id3v2UnsynchronizedFrame.md) Gets the first unsynchronized lyrics frame from a list of frames that matches the provided parameters. @@ -480,13 +536,13 @@ parameters. | Name | Type | Description | | :------ | :------ | :------ | -| `frames` | [`Id3v2UnsynchronizedFrame`](id3v2unsynchronizedframe.md)[] | List of frames to search | +| `frames` | [`Id3v2UnsynchronizedFrame`](Id3v2UnsynchronizedFrame.md)[] | List of frames to search | | `description` | `string` | Description to match | | `language` | `string` | Optionally, ISO-639-2 language code to match | #### Returns -[`Id3v2UnsynchronizedFrame`](id3v2unsynchronizedframe.md) +[`Id3v2UnsynchronizedFrame`](Id3v2UnsynchronizedFrame.md) UnsynchronizedLyricsFrame Frame that matches provided parameters, `undefined` if a match was not found @@ -495,7 +551,7 @@ ___ ### findAll -▸ `Static` **findAll**(`frames`, `description`, `language`): [`Id3v2UnsynchronizedFrame`](id3v2unsynchronizedframe.md)[] +▸ `Static` **findAll**(`frames`, `description`, `language`): [`Id3v2UnsynchronizedFrame`](Id3v2UnsynchronizedFrame.md)[] Gets all unsynchronized lyrics frames that match the provided parameters from a list of frames @@ -504,13 +560,13 @@ frames | Name | Type | Description | | :------ | :------ | :------ | -| `frames` | [`Id3v2UnsynchronizedFrame`](id3v2unsynchronizedframe.md)[] | List of frames to search | +| `frames` | [`Id3v2UnsynchronizedFrame`](Id3v2UnsynchronizedFrame.md)[] | List of frames to search | | `description` | `string` | Description to match | | `language` | `string` | Optionally, ISO-639-2 language code to match | #### Returns -[`Id3v2UnsynchronizedFrame`](id3v2unsynchronizedframe.md)[] +[`Id3v2UnsynchronizedFrame`](Id3v2UnsynchronizedFrame.md)[] UnsynchronizedLyricsFrame[] List of frames matching provided parameters, empty array if no matches were found @@ -519,7 +575,7 @@ ___ ### findPreferred -▸ `Static` **findPreferred**(`frames`, `description`, `language`): [`Id3v2UnsynchronizedFrame`](id3v2unsynchronizedframe.md) +▸ `Static` **findPreferred**(`frames`, `description`, `language`): [`Id3v2UnsynchronizedFrame`](Id3v2UnsynchronizedFrame.md) Gets a specified unsynchronized frame from the list of frames, trying to match the description and language but, failing a perfect match, accepting an incomplete match. @@ -533,39 +589,39 @@ The method tries matching with the following order of precedence: | Name | Type | Description | | :------ | :------ | :------ | -| `frames` | [`Id3v2UnsynchronizedFrame`](id3v2unsynchronizedframe.md)[] | List of frames to search | +| `frames` | [`Id3v2UnsynchronizedFrame`](Id3v2UnsynchronizedFrame.md)[] | List of frames to search | | `description` | `string` | Description to match | | `language` | `string` | ISO-639-2 language code to match | #### Returns -[`Id3v2UnsynchronizedFrame`](id3v2unsynchronizedframe.md) +[`Id3v2UnsynchronizedFrame`](Id3v2UnsynchronizedFrame.md) ___ ### fromData -▸ `Static` **fromData**(`description`, `language?`, `encoding?`): [`Id3v2UnsynchronizedFrame`](id3v2unsynchronizedframe.md) +▸ `Static` **fromData**(`description`, `language?`, `encoding?`): [`Id3v2UnsynchronizedFrame`](Id3v2UnsynchronizedFrame.md) Constructs and initializes a new instance from the provided data #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `description` | `string` | Description of the frame | -| `language?` | `string` | ISO-639-2 language code for the content of the frame | -| `encoding` | [`StringType`](../enums/stringtype.md) | Encoding to use when storing the content of the frame | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `description` | `string` | `undefined` | Description of the frame | +| `language?` | `string` | `undefined` | ISO-639-2 language code for the content of the frame | +| `encoding` | [`StringType`](../enums/StringType.md) | `Id3v2Settings.defaultEncoding` | Encoding to use when storing the content of the frame | #### Returns -[`Id3v2UnsynchronizedFrame`](id3v2unsynchronizedframe.md) +[`Id3v2UnsynchronizedFrame`](Id3v2UnsynchronizedFrame.md) ___ ### fromOffsetRawData -▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2UnsynchronizedFrame`](id3v2unsynchronizedframe.md) +▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2UnsynchronizedFrame`](Id3v2UnsynchronizedFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. This method allows for offset reading from the data byte vector. @@ -574,20 +630,20 @@ version. This method allows for offset reading from the data byte vector. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `offset` | `number` | What offset in `data` the frame actually begins. Must be positive, safe integer | -| `header` | [`Id3v2FrameHeader`](id3v2frameheader.md) | Header of the frame found at `data` in the data | +| `header` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header of the frame found at `data` in the data | | `version` | `number` | ID3v2 version the frame was originally encoded with | #### Returns -[`Id3v2UnsynchronizedFrame`](id3v2unsynchronizedframe.md) +[`Id3v2UnsynchronizedFrame`](Id3v2UnsynchronizedFrame.md) ___ ### fromRawData -▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2UnsynchronizedFrame`](id3v2unsynchronizedframe.md) +▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2UnsynchronizedFrame`](Id3v2UnsynchronizedFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. @@ -596,9 +652,9 @@ ID3v2 version. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `version` | `number` | ID3v2 version the raw frame is encoded with, must be a positive 8-bit integer | #### Returns -[`Id3v2UnsynchronizedFrame`](id3v2unsynchronizedframe.md) +[`Id3v2UnsynchronizedFrame`](Id3v2UnsynchronizedFrame.md) diff --git a/docs/classes/id3v2urllinkframe.md b/docs/classes/Id3v2UrlLinkFrame.md similarity index 66% rename from docs/classes/id3v2urllinkframe.md rename to docs/classes/Id3v2UrlLinkFrame.md index 567d9959..f79018ad 100644 --- a/docs/classes/id3v2urllinkframe.md +++ b/docs/classes/Id3v2UrlLinkFrame.md @@ -30,52 +30,52 @@ specification. ## Hierarchy -- [`Id3v2Frame`](id3v2frame.md) +- [`Id3v2Frame`](Id3v2Frame.md) ↳ **`Id3v2UrlLinkFrame`** - ↳↳ [`Id3v2UserUrlLinkFrame`](id3v2userurllinkframe.md) + ↳↳ [`Id3v2UserUrlLinkFrame`](Id3v2UserUrlLinkFrame.md) ## Table of contents ### Constructors -- [constructor](id3v2urllinkframe.md#constructor) +- [constructor](Id3v2UrlLinkFrame.md#constructor) ### Properties -- [\_encoding](id3v2urllinkframe.md#_encoding) -- [\_header](id3v2urllinkframe.md#_header) -- [\_rawData](id3v2urllinkframe.md#_rawdata) -- [\_rawVersion](id3v2urllinkframe.md#_rawversion) -- [\_textFields](id3v2urllinkframe.md#_textfields) +- [\_encoding](Id3v2UrlLinkFrame.md#_encoding) +- [\_rawData](Id3v2UrlLinkFrame.md#_rawdata) +- [\_rawVersion](Id3v2UrlLinkFrame.md#_rawversion) +- [\_textFields](Id3v2UrlLinkFrame.md#_textfields) ### Accessors -- [encryptionId](id3v2urllinkframe.md#encryptionid) -- [flags](id3v2urllinkframe.md#flags) -- [frameClassType](id3v2urllinkframe.md#frameclasstype) -- [frameId](id3v2urllinkframe.md#frameid) -- [groupId](id3v2urllinkframe.md#groupid) -- [size](id3v2urllinkframe.md#size) -- [text](id3v2urllinkframe.md#text) -- [textEncoding](id3v2urllinkframe.md#textencoding) +- [encryptionId](Id3v2UrlLinkFrame.md#encryptionid) +- [flags](Id3v2UrlLinkFrame.md#flags) +- [frameClassType](Id3v2UrlLinkFrame.md#frameclasstype) +- [frameId](Id3v2UrlLinkFrame.md#frameid) +- [groupId](Id3v2UrlLinkFrame.md#groupid) +- [header](Id3v2UrlLinkFrame.md#header) +- [size](Id3v2UrlLinkFrame.md#size) +- [text](Id3v2UrlLinkFrame.md#text) +- [textEncoding](Id3v2UrlLinkFrame.md#textencoding) ### Methods -- [clone](id3v2urllinkframe.md#clone) -- [fieldData](id3v2urllinkframe.md#fielddata) -- [parseFields](id3v2urllinkframe.md#parsefields) -- [parseRawData](id3v2urllinkframe.md#parserawdata) -- [render](id3v2urllinkframe.md#render) -- [renderFields](id3v2urllinkframe.md#renderfields) -- [setData](id3v2urllinkframe.md#setdata) -- [toString](id3v2urllinkframe.md#tostring) -- [correctEncoding](id3v2urllinkframe.md#correctencoding) -- [findUrlLinkFrame](id3v2urllinkframe.md#findurllinkframe) -- [fromIdentity](id3v2urllinkframe.md#fromidentity) -- [fromOffsetRawData](id3v2urllinkframe.md#fromoffsetrawdata) -- [fromRawData](id3v2urllinkframe.md#fromrawdata) +- [clone](Id3v2UrlLinkFrame.md#clone) +- [fieldData](Id3v2UrlLinkFrame.md#fielddata) +- [parseFields](Id3v2UrlLinkFrame.md#parsefields) +- [parseRawData](Id3v2UrlLinkFrame.md#parserawdata) +- [render](Id3v2UrlLinkFrame.md#render) +- [renderFields](Id3v2UrlLinkFrame.md#renderfields) +- [setData](Id3v2UrlLinkFrame.md#setdata) +- [toString](Id3v2UrlLinkFrame.md#tostring) +- [correctEncoding](Id3v2UrlLinkFrame.md#correctencoding) +- [findUrlLinkFrame](Id3v2UrlLinkFrame.md#findurllinkframe) +- [fromIdentity](Id3v2UrlLinkFrame.md#fromidentity) +- [fromOffsetRawData](Id3v2UrlLinkFrame.md#fromoffsetrawdata) +- [fromRawData](Id3v2UrlLinkFrame.md#fromrawdata) ## Constructors @@ -87,33 +87,23 @@ specification. | Name | Type | | :------ | :------ | -| `header` | [`Id3v2FrameHeader`](id3v2frameheader.md) | +| `header` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | #### Overrides -[Id3v2Frame](id3v2frame.md).[constructor](id3v2frame.md#constructor) +[Id3v2Frame](Id3v2Frame.md).[constructor](Id3v2Frame.md#constructor) ## Properties ### \_encoding -• `Protected` **\_encoding**: [`StringType`](../enums/stringtype.md) - -___ - -### \_header - -• `Protected` **\_header**: [`Id3v2FrameHeader`](id3v2frameheader.md) - -#### Inherited from - -[Id3v2Frame](id3v2frame.md).[_header](id3v2frame.md#_header) +• `Protected` **\_encoding**: [`StringType`](../enums/StringType.md) = `StringType.Latin1` ___ ### \_rawData -• `Protected` **\_rawData**: [`ByteVector`](bytevector.md) +• `Protected` **\_rawData**: [`ByteVector`](ByteVector.md) ___ @@ -142,6 +132,10 @@ Gets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + • `set` **encryptionId**(`value`): `void` Sets the encryption ID applied to the current instance. @@ -159,58 +153,78 @@ Sets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +Frame.encryptionId + ___ ### flags -• `get` **flags**(): [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +• `get` **flags**(): [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) Gets the frame flags applied to the current instance. #### Returns -[`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +[`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) + +#### Inherited from + +Frame.flags • `set` **flags**(`value`): `void` Sets the frame flags applied to the current instance. -If the value includes either [Id3v2FrameFlags.Encryption](../enums/id3v2frameflags.md#encryption) or -[Id3v2FrameFlags.Compression](../enums/id3v2frameflags.md#compression), [render](id3v2urllinkframe.md#render) will throw. +If the value includes either [Id3v2FrameFlags.Encryption](../enums/Id3v2FrameFlags.md#encryption) or +[Id3v2FrameFlags.Compression](../enums/Id3v2FrameFlags.md#compression), [render](Id3v2UrlLinkFrame.md#render) will throw. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) | +| `value` | [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) | #### Returns `void` +#### Inherited from + +Frame.flags + ___ ### frameClassType -• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) #### Returns -[`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +[`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) + +#### Overrides + +Frame.frameClassType ___ ### frameId -• `get` **frameId**(): [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +• `get` **frameId**(): [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) Gets the frame ID for the current instance. #### Returns -[`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +[`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) FrameIdentifier Object representing of the identifier of the frame +#### Inherited from + +Frame.frameId + ___ ### groupId @@ -226,6 +240,10 @@ Gets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + • `set` **groupId**(`value`): `void` Sets the grouping ID applied to the current instance. @@ -243,6 +261,44 @@ Sets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +Frame.groupId + +___ + +### header + +• `Protected` `get` **header**(): [`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +Gets the header for the frame. For new frames this should not exist. + +#### Returns + +[`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +#### Inherited from + +Frame.header + +• `Protected` `set` **header**(`value`): `void` + +Sets the header for the frame. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header for the frame | + +#### Returns + +`void` + +#### Inherited from + +Frame.header + ___ ### size @@ -257,6 +313,10 @@ NOTE: This value is not used outside of reading a frame from disk, so newly crea `number` +#### Inherited from + +Frame.size + ___ ### text @@ -289,24 +349,24 @@ ___ ### textEncoding -• `get` **textEncoding**(): [`StringType`](../enums/stringtype.md) +• `get` **textEncoding**(): [`StringType`](../enums/StringType.md) Gets the text encoding to use when rendering the current instance. #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) • `set` **textEncoding**(`value`): `void` Sets the text encoding to use when rendering the current instance. -NOTE: This value will be overwritten if [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) is `true`. +NOTE: This value will be overwritten if [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) is `true`. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`StringType`](../enums/stringtype.md) | +| `value` | [`StringType`](../enums/StringType.md) | #### Returns @@ -316,7 +376,7 @@ NOTE: This value will be overwritten if [Id3v2Settings.forceDefaultEncoding](id3 ### clone -▸ **clone**(): [`Id3v2UrlLinkFrame`](id3v2urllinkframe.md) +▸ **clone**(): [`Id3v2UrlLinkFrame`](Id3v2UrlLinkFrame.md) Creates a deep copy of the current instance. This method is implemented by rendering the current instance as an ID3v2.4 frame and using @@ -325,17 +385,17 @@ classes. #### Returns -[`Id3v2UrlLinkFrame`](id3v2urllinkframe.md) +[`Id3v2UrlLinkFrame`](Id3v2UrlLinkFrame.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[clone](id3v2frame.md#clone) +[Id3v2Frame](Id3v2Frame.md).[clone](Id3v2Frame.md#clone) ___ ### fieldData -▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](bytevector.md) +▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](ByteVector.md) Extracts the field data from the raw portion of an ID3v2 frame. This method is necessary for extracting extra data prepended to the frame such the as @@ -345,18 +405,18 @@ grouping ID. | Name | Type | Description | | :------ | :------ | :------ | -| `frameData` | [`ByteVector`](bytevector.md) | Raw frame data | +| `frameData` | [`ByteVector`](ByteVector.md) | Raw frame data | | `offset` | `number` | Index at which the data is contained | | `version` | `number` | Version of the ID3v2 tag the data was originally encoded with | | `dataIncludesHeader` | `boolean` | `true` if `frameData` includes the header, `false` otherwise | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[fieldData](id3v2frame.md#fielddata) +[Id3v2Frame](Id3v2Frame.md).[fieldData](Id3v2Frame.md#fielddata) ___ @@ -370,7 +430,7 @@ Populates the values in this frame by parsing its field data in a specified vers | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Extracted field data | +| `data` | [`ByteVector`](ByteVector.md) | Extracted field data | | `version` | `number` | ID3v2 version the field data is encoded in | #### Returns @@ -379,7 +439,7 @@ Populates the values in this frame by parsing its field data in a specified vers #### Overrides -[Id3v2Frame](id3v2frame.md).[parseFields](id3v2frame.md#parsefields) +[Id3v2Frame](Id3v2Frame.md).[parseFields](Id3v2Frame.md#parsefields) ___ @@ -395,7 +455,7 @@ ___ ### render -▸ **render**(`version`): [`ByteVector`](bytevector.md) +▸ **render**(`version`): [`ByteVector`](ByteVector.md) Renders the current instance, encoded in a specified ID3v2 version. @@ -407,17 +467,17 @@ Renders the current instance, encoded in a specified ID3v2 version. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2Frame](id3v2frame.md).[render](id3v2frame.md#render) +[Id3v2Frame](Id3v2Frame.md).[render](Id3v2Frame.md#render) ___ ### renderFields -▸ `Protected` **renderFields**(`version`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderFields**(`version`): [`ByteVector`](ByteVector.md) Renders the values in the current instance into field data for a specified version. @@ -429,11 +489,11 @@ Renders the values in the current instance into field data for a specified versi #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Overrides -[Id3v2Frame](id3v2frame.md).[renderFields](id3v2frame.md#renderfields) +[Id3v2Frame](Id3v2Frame.md).[renderFields](Id3v2Frame.md#renderfields) ___ @@ -448,7 +508,7 @@ header. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw ID3v2 frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw ID3v2 frame | | `offset` | `number` | Offset in `data` at which the frame begins. | | `readHeader` | `boolean` | Whether or not to read the reader into the current instance. | | `version` | `number` | Version of the ID3v2 tag the data was encoded with | @@ -459,7 +519,7 @@ header. #### Inherited from -[Id3v2Frame](id3v2frame.md).[setData](id3v2frame.md#setdata) +[Id3v2Frame](Id3v2Frame.md).[setData](Id3v2Frame.md#setdata) ___ @@ -477,7 +537,7 @@ ___ ### correctEncoding -▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/stringtype.md) +▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/StringType.md) Converts an encoding to be a supported encoding for a specified tag version. @@ -485,26 +545,26 @@ Converts an encoding to be a supported encoding for a specified tag version. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`StringType`](../enums/stringtype.md) | Value containing the original encoding | +| `type` | [`StringType`](../enums/StringType.md) | Value containing the original encoding | | `version` | `number` | Value containing the ID3v2 version to be encoded. | #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) StringType Value containing the correct encoding to use, based on - [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) and what is supported by + [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) and what is supported by `version` #### Inherited from -[Id3v2Frame](id3v2frame.md).[correctEncoding](id3v2frame.md#correctencoding) +[Id3v2Frame](Id3v2Frame.md).[correctEncoding](Id3v2Frame.md#correctencoding) ___ ### findUrlLinkFrame -▸ `Static` **findUrlLinkFrame**(`frames`, `ident`): [`Id3v2UrlLinkFrame`](id3v2urllinkframe.md) +▸ `Static` **findUrlLinkFrame**(`frames`, `ident`): [`Id3v2UrlLinkFrame`](Id3v2UrlLinkFrame.md) Gets the first frame that matches the provided type @@ -512,12 +572,12 @@ Gets the first frame that matches the provided type | Name | Type | Description | | :------ | :------ | :------ | -| `frames` | [`Id3v2UrlLinkFrame`](id3v2urllinkframe.md)[] | Object to search in | -| `ident` | [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) | Frame identifier to search for | +| `frames` | [`Id3v2UrlLinkFrame`](Id3v2UrlLinkFrame.md)[] | Object to search in | +| `ident` | [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) | Frame identifier to search for | #### Returns -[`Id3v2UrlLinkFrame`](id3v2urllinkframe.md) +[`Id3v2UrlLinkFrame`](Id3v2UrlLinkFrame.md) UrlLinkFrame Frame containing the matching frameId, `undefined` if a match was not found @@ -526,7 +586,7 @@ ___ ### fromIdentity -▸ `Static` **fromIdentity**(`ident`): [`Id3v2UrlLinkFrame`](id3v2urllinkframe.md) +▸ `Static` **fromIdentity**(`ident`): [`Id3v2UrlLinkFrame`](Id3v2UrlLinkFrame.md) Constructs and initializes an empty frame with the provided frame identity @@ -534,17 +594,17 @@ Constructs and initializes an empty frame with the provided frame identity | Name | Type | Description | | :------ | :------ | :------ | -| `ident` | [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) | Identity of the frame to construct | +| `ident` | [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) | Identity of the frame to construct | #### Returns -[`Id3v2UrlLinkFrame`](id3v2urllinkframe.md) +[`Id3v2UrlLinkFrame`](Id3v2UrlLinkFrame.md) ___ ### fromOffsetRawData -▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2UrlLinkFrame`](id3v2urllinkframe.md) +▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2UrlLinkFrame`](Id3v2UrlLinkFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. This method allows for offset reading from the data byte vector. @@ -553,20 +613,20 @@ version. This method allows for offset reading from the data byte vector. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `offset` | `number` | What offset in `data` the frame actually begins. Must be positive, safe integer | -| `header` | [`Id3v2FrameHeader`](id3v2frameheader.md) | Header of the frame found at `data` in the data | +| `header` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header of the frame found at `data` in the data | | `version` | `number` | ID3v2 version the frame was originally encoded with | #### Returns -[`Id3v2UrlLinkFrame`](id3v2urllinkframe.md) +[`Id3v2UrlLinkFrame`](Id3v2UrlLinkFrame.md) ___ ### fromRawData -▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2UrlLinkFrame`](id3v2urllinkframe.md) +▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2UrlLinkFrame`](Id3v2UrlLinkFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. @@ -575,9 +635,9 @@ ID3v2 version. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `version` | `number` | ID3v2 version the raw frame is encoded with, must be a positive 8-bit integer | #### Returns -[`Id3v2UrlLinkFrame`](id3v2urllinkframe.md) +[`Id3v2UrlLinkFrame`](Id3v2UrlLinkFrame.md) diff --git a/docs/classes/id3v2usertextinformationframe.md b/docs/classes/Id3v2UserTextInformationFrame.md similarity index 55% rename from docs/classes/id3v2usertextinformationframe.md rename to docs/classes/Id3v2UserTextInformationFrame.md index 675d3630..8f619200 100644 --- a/docs/classes/id3v2usertextinformationframe.md +++ b/docs/classes/Id3v2UserTextInformationFrame.md @@ -4,7 +4,7 @@ ## Hierarchy -- [`Id3v2TextInformationFrame`](id3v2textinformationframe.md) +- [`Id3v2TextInformationFrame`](Id3v2TextInformationFrame.md) ↳ **`Id3v2UserTextInformationFrame`** @@ -12,71 +12,61 @@ ### Properties -- [\_encoding](id3v2usertextinformationframe.md#_encoding) -- [\_header](id3v2usertextinformationframe.md#_header) -- [\_rawData](id3v2usertextinformationframe.md#_rawdata) -- [\_rawVersion](id3v2usertextinformationframe.md#_rawversion) -- [\_textFields](id3v2usertextinformationframe.md#_textfields) +- [\_encoding](Id3v2UserTextInformationFrame.md#_encoding) +- [\_rawData](Id3v2UserTextInformationFrame.md#_rawdata) +- [\_rawVersion](Id3v2UserTextInformationFrame.md#_rawversion) +- [\_textFields](Id3v2UserTextInformationFrame.md#_textfields) ### Accessors -- [description](id3v2usertextinformationframe.md#description) -- [encryptionId](id3v2usertextinformationframe.md#encryptionid) -- [flags](id3v2usertextinformationframe.md#flags) -- [frameClassType](id3v2usertextinformationframe.md#frameclasstype) -- [frameId](id3v2usertextinformationframe.md#frameid) -- [groupId](id3v2usertextinformationframe.md#groupid) -- [size](id3v2usertextinformationframe.md#size) -- [text](id3v2usertextinformationframe.md#text) -- [textEncoding](id3v2usertextinformationframe.md#textencoding) +- [description](Id3v2UserTextInformationFrame.md#description) +- [encryptionId](Id3v2UserTextInformationFrame.md#encryptionid) +- [flags](Id3v2UserTextInformationFrame.md#flags) +- [frameClassType](Id3v2UserTextInformationFrame.md#frameclasstype) +- [frameId](Id3v2UserTextInformationFrame.md#frameid) +- [groupId](Id3v2UserTextInformationFrame.md#groupid) +- [header](Id3v2UserTextInformationFrame.md#header) +- [size](Id3v2UserTextInformationFrame.md#size) +- [text](Id3v2UserTextInformationFrame.md#text) +- [textEncoding](Id3v2UserTextInformationFrame.md#textencoding) ### Methods -- [clone](id3v2usertextinformationframe.md#clone) -- [fieldData](id3v2usertextinformationframe.md#fielddata) -- [parseFields](id3v2usertextinformationframe.md#parsefields) -- [parseRawData](id3v2usertextinformationframe.md#parserawdata) -- [render](id3v2usertextinformationframe.md#render) -- [renderFields](id3v2usertextinformationframe.md#renderfields) -- [setData](id3v2usertextinformationframe.md#setdata) -- [toString](id3v2usertextinformationframe.md#tostring) -- [correctEncoding](id3v2usertextinformationframe.md#correctencoding) -- [findTextInformationFrame](id3v2usertextinformationframe.md#findtextinformationframe) -- [findUserTextInformationFrame](id3v2usertextinformationframe.md#findusertextinformationframe) -- [fromDescription](id3v2usertextinformationframe.md#fromdescription) -- [fromIdentifier](id3v2usertextinformationframe.md#fromidentifier) -- [fromOffsetRawData](id3v2usertextinformationframe.md#fromoffsetrawdata) -- [fromRawData](id3v2usertextinformationframe.md#fromrawdata) +- [clone](Id3v2UserTextInformationFrame.md#clone) +- [fieldData](Id3v2UserTextInformationFrame.md#fielddata) +- [parseFields](Id3v2UserTextInformationFrame.md#parsefields) +- [parseRawData](Id3v2UserTextInformationFrame.md#parserawdata) +- [render](Id3v2UserTextInformationFrame.md#render) +- [renderFields](Id3v2UserTextInformationFrame.md#renderfields) +- [setData](Id3v2UserTextInformationFrame.md#setdata) +- [toString](Id3v2UserTextInformationFrame.md#tostring) +- [correctEncoding](Id3v2UserTextInformationFrame.md#correctencoding) +- [findTextInformationFrame](Id3v2UserTextInformationFrame.md#findtextinformationframe) +- [findUserTextInformationFrame](Id3v2UserTextInformationFrame.md#findusertextinformationframe) +- [fromDescription](Id3v2UserTextInformationFrame.md#fromdescription) +- [fromIdentifier](Id3v2UserTextInformationFrame.md#fromidentifier) +- [fromOffsetRawData](Id3v2UserTextInformationFrame.md#fromoffsetrawdata) +- [fromRawData](Id3v2UserTextInformationFrame.md#fromrawdata) ## Properties ### \_encoding -• `Protected` **\_encoding**: [`StringType`](../enums/stringtype.md) +• `Protected` **\_encoding**: [`StringType`](../enums/StringType.md) = `Id3v2Settings.defaultEncoding` #### Inherited from -[Id3v2TextInformationFrame](id3v2textinformationframe.md).[_encoding](id3v2textinformationframe.md#_encoding) - -___ - -### \_header - -• `Protected` **\_header**: [`Id3v2FrameHeader`](id3v2frameheader.md) - -#### Inherited from - -[Id3v2TextInformationFrame](id3v2textinformationframe.md).[_header](id3v2textinformationframe.md#_header) +[Id3v2TextInformationFrame](Id3v2TextInformationFrame.md).[_encoding](Id3v2TextInformationFrame.md#_encoding) ___ ### \_rawData -• `Protected` **\_rawData**: [`ByteVector`](bytevector.md) +• `Protected` **\_rawData**: [`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2TextInformationFrame](id3v2textinformationframe.md).[_rawData](id3v2textinformationframe.md#_rawdata) +[Id3v2TextInformationFrame](Id3v2TextInformationFrame.md).[_rawData](Id3v2TextInformationFrame.md#_rawdata) ___ @@ -86,7 +76,7 @@ ___ #### Inherited from -[Id3v2TextInformationFrame](id3v2textinformationframe.md).[_rawVersion](id3v2textinformationframe.md#_rawversion) +[Id3v2TextInformationFrame](Id3v2TextInformationFrame.md).[_rawVersion](Id3v2TextInformationFrame.md#_rawversion) ___ @@ -96,7 +86,7 @@ ___ #### Inherited from -[Id3v2TextInformationFrame](id3v2textinformationframe.md).[_textFields](id3v2textinformationframe.md#_textfields) +[Id3v2TextInformationFrame](Id3v2TextInformationFrame.md).[_textFields](Id3v2TextInformationFrame.md#_textfields) ## Accessors @@ -140,6 +130,10 @@ Gets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +TextInformationFrame.encryptionId + • `set` **encryptionId**(`value`): `void` Sets the encryption ID applied to the current instance. @@ -157,58 +151,78 @@ Sets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +TextInformationFrame.encryptionId + ___ ### flags -• `get` **flags**(): [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +• `get` **flags**(): [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) Gets the frame flags applied to the current instance. #### Returns -[`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +[`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) + +#### Inherited from + +TextInformationFrame.flags • `set` **flags**(`value`): `void` Sets the frame flags applied to the current instance. -If the value includes either [Id3v2FrameFlags.Encryption](../enums/id3v2frameflags.md#encryption) or -[Id3v2FrameFlags.Compression](../enums/id3v2frameflags.md#compression), [render](id3v2usertextinformationframe.md#render) will throw. +If the value includes either [Id3v2FrameFlags.Encryption](../enums/Id3v2FrameFlags.md#encryption) or +[Id3v2FrameFlags.Compression](../enums/Id3v2FrameFlags.md#compression), [render](Id3v2UserTextInformationFrame.md#render) will throw. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) | +| `value` | [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) | #### Returns `void` +#### Inherited from + +TextInformationFrame.flags + ___ ### frameClassType -• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) #### Returns -[`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +[`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) + +#### Overrides + +TextInformationFrame.frameClassType ___ ### frameId -• `get` **frameId**(): [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +• `get` **frameId**(): [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) Gets the frame ID for the current instance. #### Returns -[`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +[`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) FrameIdentifier Object representing of the identifier of the frame +#### Inherited from + +TextInformationFrame.frameId + ___ ### groupId @@ -224,6 +238,10 @@ Gets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +TextInformationFrame.groupId + • `set` **groupId**(`value`): `void` Sets the grouping ID applied to the current instance. @@ -241,6 +259,44 @@ Sets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +TextInformationFrame.groupId + +___ + +### header + +• `Protected` `get` **header**(): [`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +Gets the header for the frame. For new frames this should not exist. + +#### Returns + +[`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +#### Inherited from + +TextInformationFrame.header + +• `Protected` `set` **header**(`value`): `void` + +Sets the header for the frame. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header for the frame | + +#### Returns + +`void` + +#### Inherited from + +TextInformationFrame.header + ___ ### size @@ -255,6 +311,10 @@ NOTE: This value is not used outside of reading a frame from disk, so newly crea `number` +#### Inherited from + +TextInformationFrame.size + ___ ### text @@ -269,6 +329,10 @@ current instance. The value must be reassigned for the value to change. `string`[] +#### Overrides + +TextInformationFrame.text + • `set` **text**(`value`): `void` Sets the text contained in the current instance. @@ -283,38 +347,50 @@ Sets the text contained in the current instance. `void` +#### Overrides + +TextInformationFrame.text + ___ ### textEncoding -• `get` **textEncoding**(): [`StringType`](../enums/stringtype.md) +• `get` **textEncoding**(): [`StringType`](../enums/StringType.md) Gets the text encoding to use when rendering the current instance. #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) + +#### Inherited from + +TextInformationFrame.textEncoding • `set` **textEncoding**(`value`): `void` Sets the text encoding to use when rendering the current instance. -This value will be overridden if [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) is `true`. +This value will be overridden if [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) is `true`. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`StringType`](../enums/stringtype.md) | +| `value` | [`StringType`](../enums/StringType.md) | #### Returns `void` +#### Inherited from + +TextInformationFrame.textEncoding + ## Methods ### clone -▸ **clone**(): [`Id3v2Frame`](id3v2frame.md) +▸ **clone**(): [`Id3v2Frame`](Id3v2Frame.md) Creates a deep copy of the current instance. This method is implemented by rendering the current instance as an ID3v2.4 frame and using @@ -323,17 +399,17 @@ classes. #### Returns -[`Id3v2Frame`](id3v2frame.md) +[`Id3v2Frame`](Id3v2Frame.md) #### Overrides -[Id3v2TextInformationFrame](id3v2textinformationframe.md).[clone](id3v2textinformationframe.md#clone) +[Id3v2TextInformationFrame](Id3v2TextInformationFrame.md).[clone](Id3v2TextInformationFrame.md#clone) ___ ### fieldData -▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](bytevector.md) +▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](ByteVector.md) Extracts the field data from the raw portion of an ID3v2 frame. This method is necessary for extracting extra data prepended to the frame such the as @@ -343,18 +419,18 @@ grouping ID. | Name | Type | Description | | :------ | :------ | :------ | -| `frameData` | [`ByteVector`](bytevector.md) | Raw frame data | +| `frameData` | [`ByteVector`](ByteVector.md) | Raw frame data | | `offset` | `number` | Index at which the data is contained | | `version` | `number` | Version of the ID3v2 tag the data was originally encoded with | | `dataIncludesHeader` | `boolean` | `true` if `frameData` includes the header, `false` otherwise | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2TextInformationFrame](id3v2textinformationframe.md).[fieldData](id3v2textinformationframe.md#fielddata) +[Id3v2TextInformationFrame](Id3v2TextInformationFrame.md).[fieldData](Id3v2TextInformationFrame.md#fielddata) ___ @@ -368,7 +444,7 @@ Populates the values in this frame by parsing its field data in a specified vers | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Extracted field data | +| `data` | [`ByteVector`](ByteVector.md) | Extracted field data | | `version` | `number` | ID3v2 version the field data is encoded in | #### Returns @@ -377,7 +453,7 @@ Populates the values in this frame by parsing its field data in a specified vers #### Inherited from -[Id3v2TextInformationFrame](id3v2textinformationframe.md).[parseFields](id3v2textinformationframe.md#parsefields) +[Id3v2TextInformationFrame](Id3v2TextInformationFrame.md).[parseFields](Id3v2TextInformationFrame.md#parsefields) ___ @@ -386,7 +462,7 @@ ___ ▸ `Protected` **parseRawData**(): `void` Performs the actual parsing of the raw data. -Because of the high parsing cost and relatively low usage of the class [parseFields](id3v2usertextinformationframe.md#parsefields) +Because of the high parsing cost and relatively low usage of the class [parseFields](Id3v2UserTextInformationFrame.md#parsefields) only stores the field data so it can be parsed on demand. Whenever a property or method is called which requires the data, this method is called, and only on the first call does it actually parse the data. @@ -397,13 +473,13 @@ actually parse the data. #### Inherited from -[Id3v2TextInformationFrame](id3v2textinformationframe.md).[parseRawData](id3v2textinformationframe.md#parserawdata) +[Id3v2TextInformationFrame](Id3v2TextInformationFrame.md).[parseRawData](Id3v2TextInformationFrame.md#parserawdata) ___ ### render -▸ **render**(`version`): [`ByteVector`](bytevector.md) +▸ **render**(`version`): [`ByteVector`](ByteVector.md) Renders the current instance, encoded in a specified ID3v2 version. @@ -415,19 +491,19 @@ Renders the current instance, encoded in a specified ID3v2 version. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ByteVector Rendered version of the current instance. #### Inherited from -[Id3v2TextInformationFrame](id3v2textinformationframe.md).[render](id3v2textinformationframe.md#render) +[Id3v2TextInformationFrame](Id3v2TextInformationFrame.md).[render](Id3v2TextInformationFrame.md#render) ___ ### renderFields -▸ `Protected` **renderFields**(`version`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderFields**(`version`): [`ByteVector`](ByteVector.md) Renders the values in the current instance into field data for a specified version. @@ -439,11 +515,11 @@ Renders the values in the current instance into field data for a specified versi #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2TextInformationFrame](id3v2textinformationframe.md).[renderFields](id3v2textinformationframe.md#renderfields) +[Id3v2TextInformationFrame](Id3v2TextInformationFrame.md).[renderFields](Id3v2TextInformationFrame.md#renderfields) ___ @@ -458,7 +534,7 @@ header. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw ID3v2 frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw ID3v2 frame | | `offset` | `number` | Offset in `data` at which the frame begins. | | `readHeader` | `boolean` | Whether or not to read the reader into the current instance. | | `version` | `number` | Version of the ID3v2 tag the data was encoded with | @@ -469,7 +545,7 @@ header. #### Inherited from -[Id3v2TextInformationFrame](id3v2textinformationframe.md).[setData](id3v2textinformationframe.md#setdata) +[Id3v2TextInformationFrame](Id3v2TextInformationFrame.md).[setData](Id3v2TextInformationFrame.md#setdata) ___ @@ -485,13 +561,13 @@ Returns a text representation of the current instance by combining the text with #### Overrides -[Id3v2TextInformationFrame](id3v2textinformationframe.md).[toString](id3v2textinformationframe.md#tostring) +[Id3v2TextInformationFrame](Id3v2TextInformationFrame.md).[toString](Id3v2TextInformationFrame.md#tostring) ___ ### correctEncoding -▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/stringtype.md) +▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/StringType.md) Converts an encoding to be a supported encoding for a specified tag version. @@ -499,53 +575,53 @@ Converts an encoding to be a supported encoding for a specified tag version. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`StringType`](../enums/stringtype.md) | Value containing the original encoding | +| `type` | [`StringType`](../enums/StringType.md) | Value containing the original encoding | | `version` | `number` | Value containing the ID3v2 version to be encoded. | #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) StringType Value containing the correct encoding to use, based on - [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) and what is supported by + [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) and what is supported by `version` #### Inherited from -[Id3v2TextInformationFrame](id3v2textinformationframe.md).[correctEncoding](id3v2textinformationframe.md#correctencoding) +[Id3v2TextInformationFrame](Id3v2TextInformationFrame.md).[correctEncoding](Id3v2TextInformationFrame.md#correctencoding) ___ ### findTextInformationFrame -▸ `Static` **findTextInformationFrame**(`frames`, `ident`): [`Id3v2TextInformationFrame`](id3v2textinformationframe.md) +▸ `Static` **findTextInformationFrame**(`frames`, `ident`): [`Id3v2TextInformationFrame`](Id3v2TextInformationFrame.md) -Gets a [TextInformationFrame](../enums/id3v2frameclasstype.md#textinformationframe) object of a specified type from a specified type from a +Gets a [TextInformationFrame](../enums/Id3v2FrameClassType.md#textinformationframe) object of a specified type from a specified type from a list of text information frames. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `frames` | [`Id3v2TextInformationFrame`](id3v2textinformationframe.md)[] | List of frames to search | -| `ident` | [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) | Frame identifier to search for | +| `frames` | [`Id3v2TextInformationFrame`](Id3v2TextInformationFrame.md)[] | List of frames to search | +| `ident` | [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) | Frame identifier to search for | #### Returns -[`Id3v2TextInformationFrame`](id3v2textinformationframe.md) +[`Id3v2TextInformationFrame`](Id3v2TextInformationFrame.md) TextInformationFrame Matching frame if it exists in `tag`, `undefined` if a matching frame was not found #### Inherited from -[Id3v2TextInformationFrame](id3v2textinformationframe.md).[findTextInformationFrame](id3v2textinformationframe.md#findtextinformationframe) +[Id3v2TextInformationFrame](Id3v2TextInformationFrame.md).[findTextInformationFrame](Id3v2TextInformationFrame.md#findtextinformationframe) ___ ### findUserTextInformationFrame -▸ `Static` **findUserTextInformationFrame**(`frames`, `description`, `caseSensitive?`): [`Id3v2UserTextInformationFrame`](id3v2usertextinformationframe.md) +▸ `Static` **findUserTextInformationFrame**(`frames`, `description`, `caseSensitive?`): [`Id3v2UserTextInformationFrame`](Id3v2UserTextInformationFrame.md) Gets a user text information frame from a specified tag @@ -553,13 +629,13 @@ Gets a user text information frame from a specified tag | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `frames` | [`Id3v2UserTextInformationFrame`](id3v2usertextinformationframe.md)[] | `undefined` | Object to search in | +| `frames` | [`Id3v2UserTextInformationFrame`](Id3v2UserTextInformationFrame.md)[] | `undefined` | Object to search in | | `description` | `string` | `undefined` | Description to use to match the frame in the `tag` | | `caseSensitive` | `boolean` | `true` | Whether or not to search for the frame case-sensitively. | #### Returns -[`Id3v2UserTextInformationFrame`](id3v2usertextinformationframe.md) +[`Id3v2UserTextInformationFrame`](Id3v2UserTextInformationFrame.md) UserTextInformationFrame Frame containing the matching user, `undefined` if a match was not found @@ -568,49 +644,49 @@ ___ ### fromDescription -▸ `Static` **fromDescription**(`description`, `encoding?`): [`Id3v2UserTextInformationFrame`](id3v2usertextinformationframe.md) +▸ `Static` **fromDescription**(`description`, `encoding?`): [`Id3v2UserTextInformationFrame`](Id3v2UserTextInformationFrame.md) Constructs and initializes a new instance with a specified description and text encoding. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `description` | `string` | Description of the new frame | -| `encoding` | [`StringType`](../enums/stringtype.md) | Text encoding to use when rendering the new frame | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `description` | `string` | `undefined` | Description of the new frame | +| `encoding` | [`StringType`](../enums/StringType.md) | `Id3v2Settings.defaultEncoding` | Text encoding to use when rendering the new frame | #### Returns -[`Id3v2UserTextInformationFrame`](id3v2usertextinformationframe.md) +[`Id3v2UserTextInformationFrame`](Id3v2UserTextInformationFrame.md) ___ ### fromIdentifier -▸ `Static` **fromIdentifier**(`identifier`, `encoding?`): [`Id3v2TextInformationFrame`](id3v2textinformationframe.md) +▸ `Static` **fromIdentifier**(`identifier`, `encoding?`): [`Id3v2TextInformationFrame`](Id3v2TextInformationFrame.md) Constructs and initializes a new instance with a specified identifier #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `identifier` | [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) | Byte vector containing the identifier for the frame | -| `encoding` | [`StringType`](../enums/stringtype.md) | Optionally, the encoding to use for the new instance. If omitted, defaults to [Id3v2Settings.defaultEncoding](id3v2settings.md#defaultencoding) | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `identifier` | [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) | `undefined` | Byte vector containing the identifier for the frame | +| `encoding` | [`StringType`](../enums/StringType.md) | `Id3v2Settings.defaultEncoding` | Optionally, the encoding to use for the new instance. If omitted, defaults to [Id3v2Settings.defaultEncoding](Id3v2Settings.md#defaultencoding) | #### Returns -[`Id3v2TextInformationFrame`](id3v2textinformationframe.md) +[`Id3v2TextInformationFrame`](Id3v2TextInformationFrame.md) #### Inherited from -[Id3v2TextInformationFrame](id3v2textinformationframe.md).[fromIdentifier](id3v2textinformationframe.md#fromidentifier) +[Id3v2TextInformationFrame](Id3v2TextInformationFrame.md).[fromIdentifier](Id3v2TextInformationFrame.md#fromidentifier) ___ ### fromOffsetRawData -▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2UserTextInformationFrame`](id3v2usertextinformationframe.md) +▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2UserTextInformationFrame`](Id3v2UserTextInformationFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. This method allows for offset reading from the data byte vector. @@ -619,24 +695,24 @@ version. This method allows for offset reading from the data byte vector. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `offset` | `number` | What offset in `data` the frame actually begins. Must be positive, safe integer | -| `header` | [`Id3v2FrameHeader`](id3v2frameheader.md) | Header of the frame found at `data` in the data | +| `header` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header of the frame found at `data` in the data | | `version` | `number` | ID3v2 version the frame was originally encoded with | #### Returns -[`Id3v2UserTextInformationFrame`](id3v2usertextinformationframe.md) +[`Id3v2UserTextInformationFrame`](Id3v2UserTextInformationFrame.md) #### Overrides -[Id3v2TextInformationFrame](id3v2textinformationframe.md).[fromOffsetRawData](id3v2textinformationframe.md#fromoffsetrawdata) +[Id3v2TextInformationFrame](Id3v2TextInformationFrame.md).[fromOffsetRawData](Id3v2TextInformationFrame.md#fromoffsetrawdata) ___ ### fromRawData -▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2UserTextInformationFrame`](id3v2usertextinformationframe.md) +▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2UserTextInformationFrame`](Id3v2UserTextInformationFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. @@ -645,13 +721,13 @@ ID3v2 version. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `version` | `number` | ID3v2 version the raw frame is encoded with, must be a positive 8-bit integer | #### Returns -[`Id3v2UserTextInformationFrame`](id3v2usertextinformationframe.md) +[`Id3v2UserTextInformationFrame`](Id3v2UserTextInformationFrame.md) #### Overrides -[Id3v2TextInformationFrame](id3v2textinformationframe.md).[fromRawData](id3v2textinformationframe.md#fromrawdata) +[Id3v2TextInformationFrame](Id3v2TextInformationFrame.md).[fromRawData](Id3v2TextInformationFrame.md#fromrawdata) diff --git a/docs/classes/id3v2userurllinkframe.md b/docs/classes/Id3v2UserUrlLinkFrame.md similarity index 58% rename from docs/classes/id3v2userurllinkframe.md rename to docs/classes/Id3v2UserUrlLinkFrame.md index b810f469..4c2e14e4 100644 --- a/docs/classes/id3v2userurllinkframe.md +++ b/docs/classes/Id3v2UserUrlLinkFrame.md @@ -6,7 +6,7 @@ Provides support for ID3v2 User URL Link frames (WXXX). ## Hierarchy -- [`Id3v2UrlLinkFrame`](id3v2urllinkframe.md) +- [`Id3v2UrlLinkFrame`](Id3v2UrlLinkFrame.md) ↳ **`Id3v2UserUrlLinkFrame`** @@ -14,71 +14,61 @@ Provides support for ID3v2 User URL Link frames (WXXX). ### Properties -- [\_encoding](id3v2userurllinkframe.md#_encoding) -- [\_header](id3v2userurllinkframe.md#_header) -- [\_rawData](id3v2userurllinkframe.md#_rawdata) -- [\_rawVersion](id3v2userurllinkframe.md#_rawversion) -- [\_textFields](id3v2userurllinkframe.md#_textfields) +- [\_encoding](Id3v2UserUrlLinkFrame.md#_encoding) +- [\_rawData](Id3v2UserUrlLinkFrame.md#_rawdata) +- [\_rawVersion](Id3v2UserUrlLinkFrame.md#_rawversion) +- [\_textFields](Id3v2UserUrlLinkFrame.md#_textfields) ### Accessors -- [description](id3v2userurllinkframe.md#description) -- [encryptionId](id3v2userurllinkframe.md#encryptionid) -- [flags](id3v2userurllinkframe.md#flags) -- [frameClassType](id3v2userurllinkframe.md#frameclasstype) -- [frameId](id3v2userurllinkframe.md#frameid) -- [groupId](id3v2userurllinkframe.md#groupid) -- [size](id3v2userurllinkframe.md#size) -- [text](id3v2userurllinkframe.md#text) -- [textEncoding](id3v2userurllinkframe.md#textencoding) +- [description](Id3v2UserUrlLinkFrame.md#description) +- [encryptionId](Id3v2UserUrlLinkFrame.md#encryptionid) +- [flags](Id3v2UserUrlLinkFrame.md#flags) +- [frameClassType](Id3v2UserUrlLinkFrame.md#frameclasstype) +- [frameId](Id3v2UserUrlLinkFrame.md#frameid) +- [groupId](Id3v2UserUrlLinkFrame.md#groupid) +- [header](Id3v2UserUrlLinkFrame.md#header) +- [size](Id3v2UserUrlLinkFrame.md#size) +- [text](Id3v2UserUrlLinkFrame.md#text) +- [textEncoding](Id3v2UserUrlLinkFrame.md#textencoding) ### Methods -- [clone](id3v2userurllinkframe.md#clone) -- [fieldData](id3v2userurllinkframe.md#fielddata) -- [parseFields](id3v2userurllinkframe.md#parsefields) -- [parseRawData](id3v2userurllinkframe.md#parserawdata) -- [render](id3v2userurllinkframe.md#render) -- [renderFields](id3v2userurllinkframe.md#renderfields) -- [setData](id3v2userurllinkframe.md#setdata) -- [toString](id3v2userurllinkframe.md#tostring) -- [correctEncoding](id3v2userurllinkframe.md#correctencoding) -- [findUrlLinkFrame](id3v2userurllinkframe.md#findurllinkframe) -- [findUserUrlLinkFrame](id3v2userurllinkframe.md#finduserurllinkframe) -- [fromDescription](id3v2userurllinkframe.md#fromdescription) -- [fromIdentity](id3v2userurllinkframe.md#fromidentity) -- [fromOffsetRawData](id3v2userurllinkframe.md#fromoffsetrawdata) -- [fromRawData](id3v2userurllinkframe.md#fromrawdata) +- [clone](Id3v2UserUrlLinkFrame.md#clone) +- [fieldData](Id3v2UserUrlLinkFrame.md#fielddata) +- [parseFields](Id3v2UserUrlLinkFrame.md#parsefields) +- [parseRawData](Id3v2UserUrlLinkFrame.md#parserawdata) +- [render](Id3v2UserUrlLinkFrame.md#render) +- [renderFields](Id3v2UserUrlLinkFrame.md#renderfields) +- [setData](Id3v2UserUrlLinkFrame.md#setdata) +- [toString](Id3v2UserUrlLinkFrame.md#tostring) +- [correctEncoding](Id3v2UserUrlLinkFrame.md#correctencoding) +- [findUrlLinkFrame](Id3v2UserUrlLinkFrame.md#findurllinkframe) +- [findUserUrlLinkFrame](Id3v2UserUrlLinkFrame.md#finduserurllinkframe) +- [fromDescription](Id3v2UserUrlLinkFrame.md#fromdescription) +- [fromIdentity](Id3v2UserUrlLinkFrame.md#fromidentity) +- [fromOffsetRawData](Id3v2UserUrlLinkFrame.md#fromoffsetrawdata) +- [fromRawData](Id3v2UserUrlLinkFrame.md#fromrawdata) ## Properties ### \_encoding -• `Protected` **\_encoding**: [`StringType`](../enums/stringtype.md) +• `Protected` **\_encoding**: [`StringType`](../enums/StringType.md) = `StringType.Latin1` #### Inherited from -[Id3v2UrlLinkFrame](id3v2urllinkframe.md).[_encoding](id3v2urllinkframe.md#_encoding) - -___ - -### \_header - -• `Protected` **\_header**: [`Id3v2FrameHeader`](id3v2frameheader.md) - -#### Inherited from - -[Id3v2UrlLinkFrame](id3v2urllinkframe.md).[_header](id3v2urllinkframe.md#_header) +[Id3v2UrlLinkFrame](Id3v2UrlLinkFrame.md).[_encoding](Id3v2UrlLinkFrame.md#_encoding) ___ ### \_rawData -• `Protected` **\_rawData**: [`ByteVector`](bytevector.md) +• `Protected` **\_rawData**: [`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2UrlLinkFrame](id3v2urllinkframe.md).[_rawData](id3v2urllinkframe.md#_rawdata) +[Id3v2UrlLinkFrame](Id3v2UrlLinkFrame.md).[_rawData](Id3v2UrlLinkFrame.md#_rawdata) ___ @@ -88,7 +78,7 @@ ___ #### Inherited from -[Id3v2UrlLinkFrame](id3v2urllinkframe.md).[_rawVersion](id3v2urllinkframe.md#_rawversion) +[Id3v2UrlLinkFrame](Id3v2UrlLinkFrame.md).[_rawVersion](Id3v2UrlLinkFrame.md#_rawversion) ___ @@ -98,7 +88,7 @@ ___ #### Inherited from -[Id3v2UrlLinkFrame](id3v2urllinkframe.md).[_textFields](id3v2urllinkframe.md#_textfields) +[Id3v2UrlLinkFrame](Id3v2UrlLinkFrame.md).[_textFields](Id3v2UrlLinkFrame.md#_textfields) ## Accessors @@ -142,6 +132,10 @@ Gets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +UrlLinkFrame.encryptionId + • `set` **encryptionId**(`value`): `void` Sets the encryption ID applied to the current instance. @@ -159,60 +153,80 @@ Sets the encryption ID applied to the current instance. number Value containing the encryption identifier for the current instance or `undefined` if not set. +#### Inherited from + +UrlLinkFrame.encryptionId + ___ ### flags -• `get` **flags**(): [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +• `get` **flags**(): [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) Gets the frame flags applied to the current instance. #### Returns -[`Id3v2FrameFlags`](../enums/id3v2frameflags.md) +[`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) + +#### Inherited from + +UrlLinkFrame.flags • `set` **flags**(`value`): `void` Sets the frame flags applied to the current instance. -If the value includes either [Id3v2FrameFlags.Encryption](../enums/id3v2frameflags.md#encryption) or -[Id3v2FrameFlags.Compression](../enums/id3v2frameflags.md#compression), [render](id3v2userurllinkframe.md#render) will throw. +If the value includes either [Id3v2FrameFlags.Encryption](../enums/Id3v2FrameFlags.md#encryption) or +[Id3v2FrameFlags.Compression](../enums/Id3v2FrameFlags.md#compression), [render](Id3v2UserUrlLinkFrame.md#render) will throw. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`Id3v2FrameFlags`](../enums/id3v2frameflags.md) | +| `value` | [`Id3v2FrameFlags`](../enums/Id3v2FrameFlags.md) | #### Returns `void` +#### Inherited from + +UrlLinkFrame.flags + ___ ### frameClassType -• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +• `get` **frameClassType**(): [`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) **`inheritdoc`** #### Returns -[`Id3v2FrameClassType`](../enums/id3v2frameclasstype.md) +[`Id3v2FrameClassType`](../enums/Id3v2FrameClassType.md) + +#### Overrides + +UrlLinkFrame.frameClassType ___ ### frameId -• `get` **frameId**(): [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +• `get` **frameId**(): [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) Gets the frame ID for the current instance. #### Returns -[`Id3v2FrameIdentifier`](id3v2frameidentifier.md) +[`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) FrameIdentifier Object representing of the identifier of the frame +#### Inherited from + +UrlLinkFrame.frameId + ___ ### groupId @@ -228,6 +242,10 @@ Gets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +UrlLinkFrame.groupId + • `set` **groupId**(`value`): `void` Sets the grouping ID applied to the current instance. @@ -245,6 +263,44 @@ Sets the grouping ID applied to the current instance. number Value containing the grouping identifier for the current instance, or `undefined` if not set. +#### Inherited from + +UrlLinkFrame.groupId + +___ + +### header + +• `Protected` `get` **header**(): [`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +Gets the header for the frame. For new frames this should not exist. + +#### Returns + +[`Id3v2FrameHeader`](Id3v2FrameHeader.md) + +#### Inherited from + +UrlLinkFrame.header + +• `Protected` `set` **header**(`value`): `void` + +Sets the header for the frame. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header for the frame | + +#### Returns + +`void` + +#### Inherited from + +UrlLinkFrame.header + ___ ### size @@ -259,6 +315,10 @@ NOTE: This value is not used outside of reading a frame from disk, so newly crea `number` +#### Inherited from + +UrlLinkFrame.size + ___ ### text @@ -273,6 +333,10 @@ current instance. The value must be reassigned for the value to change. `string`[] +#### Overrides + +UrlLinkFrame.text + • `set` **text**(`value`): `void` Sets the text contained in the current instance. @@ -287,38 +351,50 @@ Sets the text contained in the current instance. `void` +#### Overrides + +UrlLinkFrame.text + ___ ### textEncoding -• `get` **textEncoding**(): [`StringType`](../enums/stringtype.md) +• `get` **textEncoding**(): [`StringType`](../enums/StringType.md) Gets the text encoding to use when rendering the current instance. #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) + +#### Inherited from + +UrlLinkFrame.textEncoding • `set` **textEncoding**(`value`): `void` Sets the text encoding to use when rendering the current instance. -NOTE: This value will be overwritten if [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) is `true`. +NOTE: This value will be overwritten if [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) is `true`. #### Parameters | Name | Type | | :------ | :------ | -| `value` | [`StringType`](../enums/stringtype.md) | +| `value` | [`StringType`](../enums/StringType.md) | #### Returns `void` +#### Inherited from + +UrlLinkFrame.textEncoding + ## Methods ### clone -▸ **clone**(): [`Id3v2UserUrlLinkFrame`](id3v2userurllinkframe.md) +▸ **clone**(): [`Id3v2UserUrlLinkFrame`](Id3v2UserUrlLinkFrame.md) Creates a deep copy of the current instance. This method is implemented by rendering the current instance as an ID3v2.4 frame and using @@ -327,17 +403,17 @@ classes. #### Returns -[`Id3v2UserUrlLinkFrame`](id3v2userurllinkframe.md) +[`Id3v2UserUrlLinkFrame`](Id3v2UserUrlLinkFrame.md) #### Overrides -[Id3v2UrlLinkFrame](id3v2urllinkframe.md).[clone](id3v2urllinkframe.md#clone) +[Id3v2UrlLinkFrame](Id3v2UrlLinkFrame.md).[clone](Id3v2UrlLinkFrame.md#clone) ___ ### fieldData -▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](bytevector.md) +▸ `Protected` **fieldData**(`frameData`, `offset`, `version`, `dataIncludesHeader`): [`ByteVector`](ByteVector.md) Extracts the field data from the raw portion of an ID3v2 frame. This method is necessary for extracting extra data prepended to the frame such the as @@ -347,18 +423,18 @@ grouping ID. | Name | Type | Description | | :------ | :------ | :------ | -| `frameData` | [`ByteVector`](bytevector.md) | Raw frame data | +| `frameData` | [`ByteVector`](ByteVector.md) | Raw frame data | | `offset` | `number` | Index at which the data is contained | | `version` | `number` | Version of the ID3v2 tag the data was originally encoded with | | `dataIncludesHeader` | `boolean` | `true` if `frameData` includes the header, `false` otherwise | #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2UrlLinkFrame](id3v2urllinkframe.md).[fieldData](id3v2urllinkframe.md#fielddata) +[Id3v2UrlLinkFrame](Id3v2UrlLinkFrame.md).[fieldData](Id3v2UrlLinkFrame.md#fielddata) ___ @@ -372,7 +448,7 @@ Populates the values in this frame by parsing its field data in a specified vers | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Extracted field data | +| `data` | [`ByteVector`](ByteVector.md) | Extracted field data | | `version` | `number` | ID3v2 version the field data is encoded in | #### Returns @@ -381,7 +457,7 @@ Populates the values in this frame by parsing its field data in a specified vers #### Inherited from -[Id3v2UrlLinkFrame](id3v2urllinkframe.md).[parseFields](id3v2urllinkframe.md#parsefields) +[Id3v2UrlLinkFrame](Id3v2UrlLinkFrame.md).[parseFields](Id3v2UrlLinkFrame.md#parsefields) ___ @@ -395,13 +471,13 @@ ___ #### Inherited from -[Id3v2UrlLinkFrame](id3v2urllinkframe.md).[parseRawData](id3v2urllinkframe.md#parserawdata) +[Id3v2UrlLinkFrame](Id3v2UrlLinkFrame.md).[parseRawData](Id3v2UrlLinkFrame.md#parserawdata) ___ ### render -▸ **render**(`version`): [`ByteVector`](bytevector.md) +▸ **render**(`version`): [`ByteVector`](ByteVector.md) Renders the current instance, encoded in a specified ID3v2 version. @@ -413,17 +489,17 @@ Renders the current instance, encoded in a specified ID3v2 version. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2UrlLinkFrame](id3v2urllinkframe.md).[render](id3v2urllinkframe.md#render) +[Id3v2UrlLinkFrame](Id3v2UrlLinkFrame.md).[render](Id3v2UrlLinkFrame.md#render) ___ ### renderFields -▸ `Protected` **renderFields**(`version`): [`ByteVector`](bytevector.md) +▸ `Protected` **renderFields**(`version`): [`ByteVector`](ByteVector.md) Renders the values in the current instance into field data for a specified version. @@ -435,11 +511,11 @@ Renders the values in the current instance into field data for a specified versi #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[Id3v2UrlLinkFrame](id3v2urllinkframe.md).[renderFields](id3v2urllinkframe.md#renderfields) +[Id3v2UrlLinkFrame](Id3v2UrlLinkFrame.md).[renderFields](Id3v2UrlLinkFrame.md#renderfields) ___ @@ -454,7 +530,7 @@ header. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw ID3v2 frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw ID3v2 frame | | `offset` | `number` | Offset in `data` at which the frame begins. | | `readHeader` | `boolean` | Whether or not to read the reader into the current instance. | | `version` | `number` | Version of the ID3v2 tag the data was encoded with | @@ -465,7 +541,7 @@ header. #### Inherited from -[Id3v2UrlLinkFrame](id3v2urllinkframe.md).[setData](id3v2urllinkframe.md#setdata) +[Id3v2UrlLinkFrame](Id3v2UrlLinkFrame.md).[setData](Id3v2UrlLinkFrame.md#setdata) ___ @@ -479,13 +555,13 @@ ___ #### Overrides -[Id3v2UrlLinkFrame](id3v2urllinkframe.md).[toString](id3v2urllinkframe.md#tostring) +[Id3v2UrlLinkFrame](Id3v2UrlLinkFrame.md).[toString](Id3v2UrlLinkFrame.md#tostring) ___ ### correctEncoding -▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/stringtype.md) +▸ `Static` `Protected` **correctEncoding**(`type`, `version`): [`StringType`](../enums/StringType.md) Converts an encoding to be a supported encoding for a specified tag version. @@ -493,26 +569,26 @@ Converts an encoding to be a supported encoding for a specified tag version. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`StringType`](../enums/stringtype.md) | Value containing the original encoding | +| `type` | [`StringType`](../enums/StringType.md) | Value containing the original encoding | | `version` | `number` | Value containing the ID3v2 version to be encoded. | #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) StringType Value containing the correct encoding to use, based on - [Id3v2Settings.forceDefaultEncoding](id3v2settings.md#forcedefaultencoding) and what is supported by + [Id3v2Settings.forceDefaultEncoding](Id3v2Settings.md#forcedefaultencoding) and what is supported by `version` #### Inherited from -[Id3v2UrlLinkFrame](id3v2urllinkframe.md).[correctEncoding](id3v2urllinkframe.md#correctencoding) +[Id3v2UrlLinkFrame](Id3v2UrlLinkFrame.md).[correctEncoding](Id3v2UrlLinkFrame.md#correctencoding) ___ ### findUrlLinkFrame -▸ `Static` **findUrlLinkFrame**(`frames`, `ident`): [`Id3v2UrlLinkFrame`](id3v2urllinkframe.md) +▸ `Static` **findUrlLinkFrame**(`frames`, `ident`): [`Id3v2UrlLinkFrame`](Id3v2UrlLinkFrame.md) Gets the first frame that matches the provided type @@ -520,25 +596,25 @@ Gets the first frame that matches the provided type | Name | Type | Description | | :------ | :------ | :------ | -| `frames` | [`Id3v2UrlLinkFrame`](id3v2urllinkframe.md)[] | Object to search in | -| `ident` | [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) | Frame identifier to search for | +| `frames` | [`Id3v2UrlLinkFrame`](Id3v2UrlLinkFrame.md)[] | Object to search in | +| `ident` | [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) | Frame identifier to search for | #### Returns -[`Id3v2UrlLinkFrame`](id3v2urllinkframe.md) +[`Id3v2UrlLinkFrame`](Id3v2UrlLinkFrame.md) UrlLinkFrame Frame containing the matching frameId, `undefined` if a match was not found #### Inherited from -[Id3v2UrlLinkFrame](id3v2urllinkframe.md).[findUrlLinkFrame](id3v2urllinkframe.md#findurllinkframe) +[Id3v2UrlLinkFrame](Id3v2UrlLinkFrame.md).[findUrlLinkFrame](Id3v2UrlLinkFrame.md#findurllinkframe) ___ ### findUserUrlLinkFrame -▸ `Static` **findUserUrlLinkFrame**(`frames`, `description`): [`Id3v2UserUrlLinkFrame`](id3v2userurllinkframe.md) +▸ `Static` **findUserUrlLinkFrame**(`frames`, `description`): [`Id3v2UserUrlLinkFrame`](Id3v2UserUrlLinkFrame.md) Gets a frame from a list of frames. @@ -546,12 +622,12 @@ Gets a frame from a list of frames. | Name | Type | Description | | :------ | :------ | :------ | -| `frames` | [`Id3v2UserUrlLinkFrame`](id3v2userurllinkframe.md)[] | List of frames to search | +| `frames` | [`Id3v2UserUrlLinkFrame`](Id3v2UserUrlLinkFrame.md)[] | List of frames to search | | `description` | `string` | Description of the frame to match | #### Returns -[`Id3v2UserUrlLinkFrame`](id3v2userurllinkframe.md) +[`Id3v2UserUrlLinkFrame`](Id3v2UserUrlLinkFrame.md) UserUrlLinkFrame Frame containing the matching user, `undefined` if a match was not found @@ -560,7 +636,7 @@ ___ ### fromDescription -▸ `Static` **fromDescription**(`description`): [`Id3v2UserUrlLinkFrame`](id3v2userurllinkframe.md) +▸ `Static` **fromDescription**(`description`): [`Id3v2UserUrlLinkFrame`](Id3v2UserUrlLinkFrame.md) Constructs and initializes a new instance using the provided description as the text of the frame. @@ -573,13 +649,13 @@ of the frame. #### Returns -[`Id3v2UserUrlLinkFrame`](id3v2userurllinkframe.md) +[`Id3v2UserUrlLinkFrame`](Id3v2UserUrlLinkFrame.md) ___ ### fromIdentity -▸ `Static` **fromIdentity**(`ident`): [`Id3v2UrlLinkFrame`](id3v2urllinkframe.md) +▸ `Static` **fromIdentity**(`ident`): [`Id3v2UrlLinkFrame`](Id3v2UrlLinkFrame.md) Constructs and initializes an empty frame with the provided frame identity @@ -587,21 +663,21 @@ Constructs and initializes an empty frame with the provided frame identity | Name | Type | Description | | :------ | :------ | :------ | -| `ident` | [`Id3v2FrameIdentifier`](id3v2frameidentifier.md) | Identity of the frame to construct | +| `ident` | [`Id3v2FrameIdentifier`](Id3v2FrameIdentifier.md) | Identity of the frame to construct | #### Returns -[`Id3v2UrlLinkFrame`](id3v2urllinkframe.md) +[`Id3v2UrlLinkFrame`](Id3v2UrlLinkFrame.md) #### Inherited from -[Id3v2UrlLinkFrame](id3v2urllinkframe.md).[fromIdentity](id3v2urllinkframe.md#fromidentity) +[Id3v2UrlLinkFrame](Id3v2UrlLinkFrame.md).[fromIdentity](Id3v2UrlLinkFrame.md#fromidentity) ___ ### fromOffsetRawData -▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2UserUrlLinkFrame`](id3v2userurllinkframe.md) +▸ `Static` **fromOffsetRawData**(`data`, `offset`, `header`, `version`): [`Id3v2UserUrlLinkFrame`](Id3v2UserUrlLinkFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. This method allows for offset reading from the data byte vector. @@ -610,24 +686,24 @@ version. This method allows for offset reading from the data byte vector. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `offset` | `number` | What offset in `data` the frame actually begins. Must be positive, safe integer | -| `header` | [`Id3v2FrameHeader`](id3v2frameheader.md) | Header of the frame found at `data` in the data | +| `header` | [`Id3v2FrameHeader`](Id3v2FrameHeader.md) | Header of the frame found at `data` in the data | | `version` | `number` | ID3v2 version the frame was originally encoded with | #### Returns -[`Id3v2UserUrlLinkFrame`](id3v2userurllinkframe.md) +[`Id3v2UserUrlLinkFrame`](Id3v2UserUrlLinkFrame.md) #### Overrides -[Id3v2UrlLinkFrame](id3v2urllinkframe.md).[fromOffsetRawData](id3v2urllinkframe.md#fromoffsetrawdata) +[Id3v2UrlLinkFrame](Id3v2UrlLinkFrame.md).[fromOffsetRawData](Id3v2UrlLinkFrame.md#fromoffsetrawdata) ___ ### fromRawData -▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2UserUrlLinkFrame`](id3v2userurllinkframe.md) +▸ `Static` **fromRawData**(`data`, `version`): [`Id3v2UserUrlLinkFrame`](Id3v2UserUrlLinkFrame.md) Constructs and initializes a new instance by reading its raw data in a specified ID3v2 version. @@ -636,13 +712,13 @@ ID3v2 version. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw representation of the new frame | +| `data` | [`ByteVector`](ByteVector.md) | Raw representation of the new frame | | `version` | `number` | ID3v2 version the raw frame is encoded with, must be a positive 8-bit integer | #### Returns -[`Id3v2UserUrlLinkFrame`](id3v2userurllinkframe.md) +[`Id3v2UserUrlLinkFrame`](Id3v2UserUrlLinkFrame.md) #### Overrides -[Id3v2UrlLinkFrame](id3v2urllinkframe.md).[fromRawData](id3v2urllinkframe.md#fromrawdata) +[Id3v2UrlLinkFrame](Id3v2UrlLinkFrame.md).[fromRawData](Id3v2UrlLinkFrame.md#fromrawdata) diff --git a/docs/classes/infotag.md b/docs/classes/InfoTag.md similarity index 78% rename from docs/classes/infotag.md rename to docs/classes/InfoTag.md index cdc30293..6f9c4463 100644 --- a/docs/classes/infotag.md +++ b/docs/classes/InfoTag.md @@ -6,7 +6,7 @@ Provides support for reading and writing standard INFO tags. ## Hierarchy -- [`RiffListTag`](rifflisttag.md) +- [`RiffListTag`](RiffListTag.md) ↳ **`InfoTag`** @@ -14,100 +14,101 @@ Provides support for reading and writing standard INFO tags. ### Properties -- [listType](infotag.md#listtype) +- [LIST\_TYPE](InfoTag.md#list_type) ### Accessors -- [album](infotag.md#album) -- [albumArtists](infotag.md#albumartists) -- [albumArtistsSort](infotag.md#albumartistssort) -- [albumSort](infotag.md#albumsort) -- [amazonId](infotag.md#amazonid) -- [beatsPerMinute](infotag.md#beatsperminute) -- [comment](infotag.md#comment) -- [composers](infotag.md#composers) -- [composersSort](infotag.md#composerssort) -- [conductor](infotag.md#conductor) -- [copyright](infotag.md#copyright) -- [dateTagged](infotag.md#datetagged) -- [description](infotag.md#description) -- [disc](infotag.md#disc) -- [discCount](infotag.md#disccount) -- [firstAlbumArtist](infotag.md#firstalbumartist) -- [firstAlbumArtistSort](infotag.md#firstalbumartistsort) -- [firstComposer](infotag.md#firstcomposer) -- [firstComposerSort](infotag.md#firstcomposersort) -- [firstGenre](infotag.md#firstgenre) -- [firstPerformer](infotag.md#firstperformer) -- [firstPerformerSort](infotag.md#firstperformersort) -- [genres](infotag.md#genres) -- [grouping](infotag.md#grouping) -- [initialKey](infotag.md#initialkey) -- [isEmpty](infotag.md#isempty) -- [isrc](infotag.md#isrc) -- [joinedAlbumArtists](infotag.md#joinedalbumartists) -- [joinedComposers](infotag.md#joinedcomposers) -- [joinedGenres](infotag.md#joinedgenres) -- [joinedPerformers](infotag.md#joinedperformers) -- [joinedPerformersSort](infotag.md#joinedperformerssort) -- [list](infotag.md#list) -- [lyrics](infotag.md#lyrics) -- [musicBrainzArtistId](infotag.md#musicbrainzartistid) -- [musicBrainzDiscId](infotag.md#musicbrainzdiscid) -- [musicBrainzReleaseArtistId](infotag.md#musicbrainzreleaseartistid) -- [musicBrainzReleaseCountry](infotag.md#musicbrainzreleasecountry) -- [musicBrainzReleaseGroupId](infotag.md#musicbrainzreleasegroupid) -- [musicBrainzReleaseId](infotag.md#musicbrainzreleaseid) -- [musicBrainzReleaseStatus](infotag.md#musicbrainzreleasestatus) -- [musicBrainzReleaseType](infotag.md#musicbrainzreleasetype) -- [musicBrainzTrackId](infotag.md#musicbrainztrackid) -- [musicIpId](infotag.md#musicipid) -- [performers](infotag.md#performers) -- [performersRole](infotag.md#performersrole) -- [performersSort](infotag.md#performerssort) -- [pictures](infotag.md#pictures) -- [publisher](infotag.md#publisher) -- [remixedBy](infotag.md#remixedby) -- [replayGainAlbumGain](infotag.md#replaygainalbumgain) -- [replayGainAlbumPeak](infotag.md#replaygainalbumpeak) -- [replayGainTrackGain](infotag.md#replaygaintrackgain) -- [replayGainTrackPeak](infotag.md#replaygaintrackpeak) -- [sizeOnDisk](infotag.md#sizeondisk) -- [stringType](infotag.md#stringtype) -- [subtitle](infotag.md#subtitle) -- [tagTypes](infotag.md#tagtypes) -- [title](infotag.md#title) -- [titleSort](infotag.md#titlesort) -- [track](infotag.md#track) -- [trackCount](infotag.md#trackcount) -- [year](infotag.md#year) +- [album](InfoTag.md#album) +- [albumArtists](InfoTag.md#albumartists) +- [albumArtistsSort](InfoTag.md#albumartistssort) +- [albumSort](InfoTag.md#albumsort) +- [amazonId](InfoTag.md#amazonid) +- [beatsPerMinute](InfoTag.md#beatsperminute) +- [comment](InfoTag.md#comment) +- [composers](InfoTag.md#composers) +- [composersSort](InfoTag.md#composerssort) +- [conductor](InfoTag.md#conductor) +- [copyright](InfoTag.md#copyright) +- [dateTagged](InfoTag.md#datetagged) +- [description](InfoTag.md#description) +- [disc](InfoTag.md#disc) +- [discCount](InfoTag.md#disccount) +- [firstAlbumArtist](InfoTag.md#firstalbumartist) +- [firstAlbumArtistSort](InfoTag.md#firstalbumartistsort) +- [firstComposer](InfoTag.md#firstcomposer) +- [firstComposerSort](InfoTag.md#firstcomposersort) +- [firstGenre](InfoTag.md#firstgenre) +- [firstPerformer](InfoTag.md#firstperformer) +- [firstPerformerSort](InfoTag.md#firstperformersort) +- [genres](InfoTag.md#genres) +- [grouping](InfoTag.md#grouping) +- [initialKey](InfoTag.md#initialkey) +- [isCompilation](InfoTag.md#iscompilation) +- [isEmpty](InfoTag.md#isempty) +- [isrc](InfoTag.md#isrc) +- [joinedAlbumArtists](InfoTag.md#joinedalbumartists) +- [joinedComposers](InfoTag.md#joinedcomposers) +- [joinedGenres](InfoTag.md#joinedgenres) +- [joinedPerformers](InfoTag.md#joinedperformers) +- [joinedPerformersSort](InfoTag.md#joinedperformerssort) +- [list](InfoTag.md#list) +- [lyrics](InfoTag.md#lyrics) +- [musicBrainzArtistId](InfoTag.md#musicbrainzartistid) +- [musicBrainzDiscId](InfoTag.md#musicbrainzdiscid) +- [musicBrainzReleaseArtistId](InfoTag.md#musicbrainzreleaseartistid) +- [musicBrainzReleaseCountry](InfoTag.md#musicbrainzreleasecountry) +- [musicBrainzReleaseGroupId](InfoTag.md#musicbrainzreleasegroupid) +- [musicBrainzReleaseId](InfoTag.md#musicbrainzreleaseid) +- [musicBrainzReleaseStatus](InfoTag.md#musicbrainzreleasestatus) +- [musicBrainzReleaseType](InfoTag.md#musicbrainzreleasetype) +- [musicBrainzTrackId](InfoTag.md#musicbrainztrackid) +- [musicIpId](InfoTag.md#musicipid) +- [performers](InfoTag.md#performers) +- [performersRole](InfoTag.md#performersrole) +- [performersSort](InfoTag.md#performerssort) +- [pictures](InfoTag.md#pictures) +- [publisher](InfoTag.md#publisher) +- [remixedBy](InfoTag.md#remixedby) +- [replayGainAlbumGain](InfoTag.md#replaygainalbumgain) +- [replayGainAlbumPeak](InfoTag.md#replaygainalbumpeak) +- [replayGainTrackGain](InfoTag.md#replaygaintrackgain) +- [replayGainTrackPeak](InfoTag.md#replaygaintrackpeak) +- [sizeOnDisk](InfoTag.md#sizeondisk) +- [stringType](InfoTag.md#stringtype) +- [subtitle](InfoTag.md#subtitle) +- [tagTypes](InfoTag.md#tagtypes) +- [title](InfoTag.md#title) +- [titleSort](InfoTag.md#titlesort) +- [track](InfoTag.md#track) +- [trackCount](InfoTag.md#trackcount) +- [year](InfoTag.md#year) ### Methods -- [clear](infotag.md#clear) -- [copyTo](infotag.md#copyto) -- [getFirstValueAsString](infotag.md#getfirstvalueasstring) -- [getValueAsUint](infotag.md#getvalueasuint) -- [getValues](infotag.md#getvalues) -- [getValuesAsStrings](infotag.md#getvaluesasstrings) -- [removeValue](infotag.md#removevalue) -- [render](infotag.md#render) -- [setInfoTag](infotag.md#setinfotag) -- [setValueFromUint](infotag.md#setvaluefromuint) -- [setValues](infotag.md#setvalues) -- [setValuesFromStrings](infotag.md#setvaluesfromstrings) -- [firstInGroup](infotag.md#firstingroup) -- [fromEmpty](infotag.md#fromempty) -- [fromList](infotag.md#fromlist) -- [isFalsyOrLikeEmpty](infotag.md#isfalsyorlikeempty) -- [joinGroup](infotag.md#joingroup) -- [tagTypeFlagsToArray](infotag.md#tagtypeflagstoarray) +- [clear](InfoTag.md#clear) +- [copyTo](InfoTag.md#copyto) +- [getFirstValueAsString](InfoTag.md#getfirstvalueasstring) +- [getValueAsUint](InfoTag.md#getvalueasuint) +- [getValues](InfoTag.md#getvalues) +- [getValuesAsStrings](InfoTag.md#getvaluesasstrings) +- [removeValue](InfoTag.md#removevalue) +- [render](InfoTag.md#render) +- [setInfoTag](InfoTag.md#setinfotag) +- [setValueFromUint](InfoTag.md#setvaluefromuint) +- [setValues](InfoTag.md#setvalues) +- [setValuesFromStrings](InfoTag.md#setvaluesfromstrings) +- [firstInGroup](InfoTag.md#firstingroup) +- [fromEmpty](InfoTag.md#fromempty) +- [fromList](InfoTag.md#fromlist) +- [isFalsyOrLikeEmpty](InfoTag.md#isfalsyorlikeempty) +- [joinGroup](InfoTag.md#joingroup) +- [tagTypeFlagsToArray](InfoTag.md#tagtypeflagstoarray) ## Properties -### listType +### LIST\_TYPE -▪ `Static` `Readonly` **listType**: ``"INFO"`` +▪ `Static` `Readonly` **LIST\_TYPE**: ``"INFO"`` Type of the list that contains an info tag. @@ -125,6 +126,10 @@ Type of the list that contains an info tag. `string` +#### Overrides + +RiffListTag.album + • `set` **album**(`value`): `void` **`inheritdoc`** @@ -141,6 +146,10 @@ Type of the list that contains an info tag. `void` +#### Overrides + +RiffListTag.album + ___ ### albumArtists @@ -155,6 +164,10 @@ ___ `string`[] +#### Overrides + +RiffListTag.albumArtists + • `set` **albumArtists**(`value`): `void` **`inheritdoc`** @@ -171,6 +184,10 @@ ___ `void` +#### Overrides + +RiffListTag.albumArtists + ___ ### albumArtistsSort @@ -186,7 +203,7 @@ album or collection containing the media described by the current instance. skip articles or sort by last by last name. For example "Ben Folds" might be sorted as "Folds, Ben". As this value is to be used as a sorting key, it should be used with less variation than - [performers](infotag.md#performers). Where [performers](infotag.md#performers) can be broken into multiple performers, it is + [performers](InfoTag.md#performers). Where [performers](InfoTag.md#performers) can be broken into multiple performers, it is best to stick to a single album artist. Eg, "Van Buuren, Armin" #### Returns @@ -197,6 +214,10 @@ Sortable names for the bands/artists are credited with the creation of the entir album or collection containing the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +RiffListTag.albumArtistsSort + • `set` **albumArtistsSort**(`value`): `void` Sets the sortable names of the bands/artists who are credited with creating the entire @@ -208,7 +229,7 @@ album or collection containing the media described by the current instance. skip articles or sort by last by last name. For example "Ben Folds" might be sorted as "Folds, Ben". As this value is to be used as a sorting key, it should be used with less variation than - [performers](infotag.md#performers). Where [performers](infotag.md#performers) can be broken into multiple performers, it is + [performers](InfoTag.md#performers). Where [performers](InfoTag.md#performers) can be broken into multiple performers, it is best to stick to a single album artist. Eg, "Van Buuren, Armin" #### Parameters @@ -225,6 +246,10 @@ Sortable names for the bands/artists are credited with the creation of the entir album or collection containing the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +RiffListTag.albumArtistsSort + ___ ### albumSort @@ -245,6 +270,10 @@ Gets the sortable name of the album title of the media represented by the curren Sortable name for the album title of the media or `undefined` if the value is not present +#### Inherited from + +RiffListTag.albumSort + • `set` **albumSort**(`value`): `void` Sets the sortable name of the album title of the media represented by the current instance. @@ -267,6 +296,10 @@ Sets the sortable name of the album title of the media represented by the curren Sortable name for the album title of the media or `undefined` if the value is not present +#### Inherited from + +RiffListTag.albumSort + ___ ### amazonId @@ -285,6 +318,10 @@ Gets the Amazon ID of the media represented by the current instance. Amazon ID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.amazonId + • `set` **amazonId**(`value`): `void` Sets the Amazon ID of the media represented by the current instance. @@ -305,6 +342,10 @@ Sets the Amazon ID of the media represented by the current instance. Amazon ID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.amazonId + ___ ### beatsPerMinute @@ -324,6 +365,10 @@ instance. Beats per minute of the audio in the media represented by the current instance, or `0` if not specified +#### Inherited from + +RiffListTag.beatsPerMinute + • `set` **beatsPerMinute**(`value`): `void` Sets the number of beats per minute in the audio of the media represented by the current @@ -345,6 +390,10 @@ instance. Beats per minute of the audio in the media represented by the current instance, or `0` if not specified +#### Inherited from + +RiffListTag.beatsPerMinute + ___ ### comment @@ -359,6 +408,10 @@ ___ `string` +#### Overrides + +RiffListTag.comment + • `set` **comment**(`value`): `void` **`inheritdoc`** @@ -375,6 +428,10 @@ ___ `void` +#### Overrides + +RiffListTag.comment + ___ ### composers @@ -389,6 +446,10 @@ ___ `string`[] +#### Overrides + +RiffListTag.composers + • `set` **composers**(`value`): `void` **`inheritdoc`** @@ -405,6 +466,10 @@ ___ `void` +#### Overrides + +RiffListTag.composers + ___ ### composersSort @@ -425,6 +490,10 @@ Gets the sortable names of the composers of the media represented by the current Sortable names for the composers of the media represented by the current instance or an empty array if no value is present. +#### Inherited from + +RiffListTag.composersSort + • `set` **composersSort**(`value`): `void` Sets the sortable names of the composers of the media represented by the current instance. @@ -447,6 +516,10 @@ Sets the sortable names of the composers of the media represented by the current Sortable names for the composers of the media represented by the current instance or an empty array if no value is present. +#### Inherited from + +RiffListTag.composersSort + ___ ### conductor @@ -461,6 +534,10 @@ ___ `string` +#### Overrides + +RiffListTag.conductor + • `set` **conductor**(`value`): `void` **`inheritdoc`** @@ -477,6 +554,10 @@ ___ `void` +#### Overrides + +RiffListTag.conductor + ___ ### copyright @@ -491,6 +572,10 @@ ___ `string` +#### Overrides + +RiffListTag.copyright + • `set` **copyright**(`value`): `void` **`inheritdoc`** @@ -507,6 +592,10 @@ ___ `void` +#### Overrides + +RiffListTag.copyright + ___ ### dateTagged @@ -521,6 +610,10 @@ Gets the date and time at which the tag has been written. Date/time at which the tag has been written, or `undefined` if no value is present +#### Inherited from + +RiffListTag.dateTagged + • `set` **dateTagged**(`value`): `void` Sets the date and time at which the tag has been written. @@ -537,6 +630,10 @@ Sets the date and time at which the tag has been written. Date/time at which the tag has been written, or `undefined` if no value is present +#### Inherited from + +RiffListTag.dateTagged + ___ ### description @@ -551,6 +648,10 @@ ___ `string` +#### Overrides + +RiffListTag.description + • `set` **description**(`value`): `void` **`inheritdoc`** @@ -567,6 +668,10 @@ ___ `void` +#### Overrides + +RiffListTag.description + ___ ### disc @@ -578,7 +683,7 @@ boxed set. For a series, this represents the season number. **`remarks`** This value should be the same as the number that appears on the disc. For example, if the disc is the first of three, the value should be `1`. It should be no more than - [discCount](infotag.md#disccount) if [discCount](infotag.md#disccount) is non-zero. + [discCount](InfoTag.md#disccount) if [discCount](InfoTag.md#disccount) is non-zero. #### Returns @@ -587,6 +692,10 @@ boxed set. For a series, this represents the season number. Number of the disc or season of the media represented by the current instance in a boxed set. +#### Inherited from + +RiffListTag.disc + • `set` **disc**(`value`): `void` Sets the number of the disc containing the media represented by the current instance in the @@ -594,7 +703,7 @@ boxed set. For a series, this represents the season number. **`remarks`** This value should be the same as the number that appears on the disc. For example, if the disc is the first of three, the value should be `1`. It should be no more than - [discCount](infotag.md#disccount) if [discCount](infotag.md#disccount) is non-zero. + [discCount](InfoTag.md#disccount) if [discCount](InfoTag.md#disccount) is non-zero. #### Parameters @@ -609,6 +718,10 @@ boxed set. For a series, this represents the season number. Number of the disc or season of the media represented by the current instance in a boxed set. +#### Inherited from + +RiffListTag.disc + ___ ### discCount @@ -618,7 +731,7 @@ ___ Gets the number of discs or seasons in the boxed set containing the media represented by the current instance. -**`remarks`** If non-zero, this should be at least equal to [disc](infotag.md#disc). If [disc](infotag.md#disc) is zero, +**`remarks`** If non-zero, this should be at least equal to [disc](InfoTag.md#disc). If [disc](InfoTag.md#disc) is zero, this value should also be zero. #### Returns @@ -628,12 +741,16 @@ current instance. Number of discs or seasons in the boxed set containing the media represented by the current instance or `0` if not specified. +#### Inherited from + +RiffListTag.discCount + • `set` **discCount**(`value`): `void` Sets the number of discs or seasons in the boxed set containing the media represented by the current instance. -**`remarks`** If non-zero, this should be at least equal to [disc](infotag.md#disc). If [disc](infotag.md#disc) is zero, +**`remarks`** If non-zero, this should be at least equal to [disc](InfoTag.md#disc). If [disc](InfoTag.md#disc) is zero, this value should also be zero. #### Parameters @@ -649,90 +766,122 @@ current instance. Number of discs or seasons in the boxed set containing the media represented by the current instance or `0` if not specified. +#### Inherited from + +RiffListTag.discCount + ___ ### firstAlbumArtist • `get` **firstAlbumArtist**(): `string` -Gets the the first value contained in [albumArtists](infotag.md#albumartists). +Gets the first value contained in [albumArtists](InfoTag.md#albumartists). #### Returns `string` +#### Inherited from + +RiffListTag.firstAlbumArtist + ___ ### firstAlbumArtistSort • `get` **firstAlbumArtistSort**(): `string` -Gets the first value contained in [albumArtistsSort](infotag.md#albumartistssort) +Gets the first value contained in [albumArtistsSort](InfoTag.md#albumartistssort) #### Returns `string` +#### Inherited from + +RiffListTag.firstAlbumArtistSort + ___ ### firstComposer • `get` **firstComposer**(): `string` -Gets the first value contained in [composers](infotag.md#composers) +Gets the first value contained in [composers](InfoTag.md#composers) #### Returns `string` +#### Inherited from + +RiffListTag.firstComposer + ___ ### firstComposerSort • `get` **firstComposerSort**(): `string` -Gets the first value contained in [composersSort](infotag.md#composerssort) +Gets the first value contained in [composersSort](InfoTag.md#composerssort) #### Returns `string` +#### Inherited from + +RiffListTag.firstComposerSort + ___ ### firstGenre • `get` **firstGenre**(): `string` -Gets the first value contained in [genres](infotag.md#genres) +Gets the first value contained in [genres](InfoTag.md#genres) #### Returns `string` +#### Inherited from + +RiffListTag.firstGenre + ___ ### firstPerformer • `get` **firstPerformer**(): `string` -Gets the first value contained in [performers](infotag.md#performers) +Gets the first value contained in [performers](InfoTag.md#performers) #### Returns `string` +#### Inherited from + +RiffListTag.firstPerformer + ___ ### firstPerformerSort • `get` **firstPerformerSort**(): `string` -Gets the first value contained in [performersSort](infotag.md#performerssort) +Gets the first value contained in [performersSort](InfoTag.md#performerssort) #### Returns `string` +#### Inherited from + +RiffListTag.firstPerformerSort + ___ ### genres @@ -747,6 +896,10 @@ ___ `string`[] +#### Overrides + +RiffListTag.genres + • `set` **genres**(`value`): `void` **`inheritdoc`** @@ -763,6 +916,10 @@ ___ `void` +#### Overrides + +RiffListTag.genres + ___ ### grouping @@ -782,6 +939,10 @@ Gets the grouping on the album which the media in the current instance belongs t Grouping on the album which the media in the current instance belongs to or `undefined` if no value is present. +#### Inherited from + +RiffListTag.grouping + • `set` **grouping**(`value`): `void` Sets the grouping on the album which the media in the current instance belongs to. @@ -803,6 +964,10 @@ Sets the grouping on the album which the media in the current instance belongs t Grouping on the album which the media in the current instance belongs to or `undefined` if no value is present. +#### Inherited from + +RiffListTag.grouping + ___ ### initialKey @@ -817,6 +982,10 @@ Gets the initial key of the track. Initial key of the track or `undefined` if no value is set +#### Inherited from + +RiffListTag.initialKey + • `set` **initialKey**(`value`): `void` Sets the initial key of the track. @@ -833,6 +1002,44 @@ Sets the initial key of the track. Initial key of the track or `undefined` if no value is set +#### Inherited from + +RiffListTag.initialKey + +___ + +### isCompilation + +• `get` **isCompilation**(): `boolean` + +Gets whether or not the album described by the current instance is a compilation. + +#### Returns + +`boolean` + +#### Inherited from + +RiffListTag.isCompilation + +• `set` **isCompilation**(`value`): `void` + +Gets whether or not the album described by the current instance is a compilation. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | `boolean` | Whether or not the album described by the current instance is a compilation | + +#### Returns + +`void` + +#### Inherited from + +RiffListTag.isCompilation + ___ ### isEmpty @@ -845,6 +1052,10 @@ ___ `boolean` +#### Inherited from + +RiffListTag.isEmpty + ___ ### isrc @@ -859,6 +1070,10 @@ Gets the ISRC (International Standard Recording Code) of the track. the ISRC of the track or `undefined` if no value is set +#### Inherited from + +RiffListTag.isrc + • `set` **isrc**(`value`): `void` Sets the ISRC (International Standard Recording Code) of the track. @@ -875,80 +1090,108 @@ Sets the ISRC (International Standard Recording Code) of the track. the ISRC of the track or `undefined` if no value is set +#### Inherited from + +RiffListTag.isrc + ___ ### joinedAlbumArtists • `get` **joinedAlbumArtists**(): `string` -Gets a semicolon and space separated string containing the values in [albumArtists](infotag.md#albumartists) +Gets a semicolon and space separated string containing the values in [albumArtists](InfoTag.md#albumartists) #### Returns `string` +#### Inherited from + +RiffListTag.joinedAlbumArtists + ___ ### joinedComposers • `get` **joinedComposers**(): `string` -Gets a semicolon and space separated string containing the values in [composers](infotag.md#composers) +Gets a semicolon and space separated string containing the values in [composers](InfoTag.md#composers) #### Returns `string` +#### Inherited from + +RiffListTag.joinedComposers + ___ ### joinedGenres • `get` **joinedGenres**(): `string` -Gets a semicolon and space separated string containing the values in [genres](infotag.md#genres) +Gets a semicolon and space separated string containing the values in [genres](InfoTag.md#genres) #### Returns `string` +#### Inherited from + +RiffListTag.joinedGenres + ___ ### joinedPerformers • `get` **joinedPerformers**(): `string` -Gets a semicolon and space separated string containing the values in [performers](infotag.md#performers) +Gets a semicolon and space separated string containing the values in [performers](InfoTag.md#performers) #### Returns `string` +#### Inherited from + +RiffListTag.joinedPerformers + ___ ### joinedPerformersSort • `get` **joinedPerformersSort**(): `string` -Gets a semicolon and space separated string containing the values in [performersSort](infotag.md#performerssort) +Gets a semicolon and space separated string containing the values in [performersSort](InfoTag.md#performerssort) #### Returns `string` +#### Inherited from + +RiffListTag.joinedPerformersSort + ___ ### list -• `get` **list**(): [`RiffList`](rifflist.md) +• `get` **list**(): [`RiffList`](RiffList.md) -Gets the [RiffList](rifflist.md) that backs the data for this tag. +Gets the [RiffList](RiffList.md) that backs the data for this tag. **`remarks`** Tags based on RiffLists are only supposed to support certain fields. Modify at your own risk. #### Returns -[`RiffList`](rifflist.md) +[`RiffList`](RiffList.md) + +#### Inherited from + +RiffListTag.list ___ @@ -970,6 +1213,10 @@ Gets the lyrics or script of the media represented by the current instance. Lyrics or script of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.lyrics + • `set` **lyrics**(`value`): `void` Sets the lyrics or script of the media represented by the current instance. @@ -992,6 +1239,10 @@ Sets the lyrics or script of the media represented by the current instance. Lyrics or script of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.lyrics + ___ ### musicBrainzArtistId @@ -1010,6 +1261,10 @@ Gets the MusicBrainz artist ID of the media represented by the current instance. MusicBrainz ArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzArtistId + • `set` **musicBrainzArtistId**(`value`): `void` Sets the MusicBrainz artist ID of the media represented by the current instance. @@ -1030,6 +1285,10 @@ Sets the MusicBrainz artist ID of the media represented by the current instance. MusicBrainz ArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzArtistId + ___ ### musicBrainzDiscId @@ -1048,6 +1307,10 @@ Gets the MusicBrainz disc ID of the media represented by the current instance. MusicBrainz DiscID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzDiscId + • `set` **musicBrainzDiscId**(`value`): `void` Sets the MusicBrainz disc ID of the media represented by the current instance. @@ -1068,6 +1331,10 @@ Sets the MusicBrainz disc ID of the media represented by the current instance. MusicBrainz DiscID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzDiscId + ___ ### musicBrainzReleaseArtistId @@ -1086,6 +1353,10 @@ Gets the MusicBrainz release artist ID of the media represented by the current i MusicBrainz ReleaseArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseArtistId + • `set` **musicBrainzReleaseArtistId**(`value`): `void` Sets the MusicBrainz release artist ID of the media represented by the current instance. @@ -1106,6 +1377,10 @@ Sets the MusicBrainz release artist ID of the media represented by the current i MusicBrainz ReleaseArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseArtistId + ___ ### musicBrainzReleaseCountry @@ -1127,6 +1402,10 @@ Gets the MusicBrainz release country of the media represented by the current ins MusicBrainz ReleaseCountry of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseCountry + • `set` **musicBrainzReleaseCountry**(`value`): `void` Sets the MusicBrainz release country of the media represented by the current instance. @@ -1150,6 +1429,10 @@ Sets the MusicBrainz release country of the media represented by the current ins MusicBrainz ReleaseCountry of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseCountry + ___ ### musicBrainzReleaseGroupId @@ -1168,6 +1451,10 @@ Gets the MusicBrainz release group ID of the media represented by the current in MusicBrainz ReleaseGroupID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseGroupId + • `set` **musicBrainzReleaseGroupId**(`value`): `void` Sets the MusicBrainz release group ID of the media represented by the current instance. @@ -1188,6 +1475,10 @@ Sets the MusicBrainz release group ID of the media represented by the current in MusicBrainz ReleaseGroupID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseGroupId + ___ ### musicBrainzReleaseId @@ -1206,6 +1497,10 @@ Gets the MusicBrainz release ID of the media represented by the current instance MusicBrainz ReleaseID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseId + • `set` **musicBrainzReleaseId**(`value`): `void` Sets the MusicBrainz release ID of the media represented by the current instance. @@ -1226,6 +1521,10 @@ Sets the MusicBrainz release ID of the media represented by the current instance MusicBrainz ReleaseID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseId + ___ ### musicBrainzReleaseStatus @@ -1244,6 +1543,10 @@ Gets the MusicBrainz release status of the media represented by the current inst MusicBrainz ReleaseStatus of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseStatus + • `set` **musicBrainzReleaseStatus**(`value`): `void` Sets the MusicBrainz release status of the media represented by the current instance. @@ -1264,6 +1567,10 @@ Sets the MusicBrainz release status of the media represented by the current inst MusicBrainz ReleaseStatus of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseStatus + ___ ### musicBrainzReleaseType @@ -1284,6 +1591,10 @@ Gets the MusicBrainz release type of the media represented by the current instan MusicBrainz ReleaseType of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseType + • `set` **musicBrainzReleaseType**(`value`): `void` Sets the MusicBrainz release type of the media represented by the current instance. @@ -1306,6 +1617,10 @@ Sets the MusicBrainz release type of the media represented by the current instan MusicBrainz ReleaseType of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseType + ___ ### musicBrainzTrackId @@ -1325,6 +1640,10 @@ current instance. MusicBrainz TrackID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzTrackId + • `set` **musicBrainzTrackId**(`value`): `void` Sets the MusicBrainz track ID of the media represented by the media represented by the @@ -1346,6 +1665,10 @@ current instance. MusicBrainz TrackID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzTrackId + ___ ### musicIpId @@ -1364,6 +1687,10 @@ Gets the MusicIP PUID of the media represented by the current instance. MusicIP PUID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicIpId + • `set` **musicIpId**(`value`): `void` Sets the MusicIP PUID of the media represented by the current instance. @@ -1384,6 +1711,10 @@ Sets the MusicIP PUID of the media represented by the current instance. MusicIP PUID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicIpId + ___ ### performers @@ -1398,6 +1729,10 @@ ___ `string`[] +#### Overrides + +RiffListTag.performers + • `set` **performers**(`value`): `void` **`inheritdoc`** @@ -1414,6 +1749,10 @@ ___ `void` +#### Overrides + +RiffListTag.performers + ___ ### performersRole @@ -1421,12 +1760,12 @@ ___ • `get` **performersRole**(): `string`[] Gets the characters portrayed by an actor for a video or instruments played by a musician -for music. This must match the [performers](infotag.md#performers) array (for each person, correspond one/more +for music. This must match the [performers](InfoTag.md#performers) array (for each person, correspond one/more role). Several roles for the same artist/actor can be separated with semicolons. For example: "Bass; Backing Vocals; Vibraphone". **`remarks`** It is highly important to match each role to the performers. This means that an entry - in the [performersRole](infotag.md#performersrole) array is `undefined` to maintain the relationship between + in the [performersRole](InfoTag.md#performersrole) array is `undefined` to maintain the relationship between `performers[i]` and `performersRole[i]`. #### Returns @@ -1436,15 +1775,19 @@ example: "Bass; Backing Vocals; Vibraphone". Array containing the roles played by the performers in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +RiffListTag.performersRole + • `set` **performersRole**(`value`): `void` Sets the characters portrayed by an actor for a video or instruments played by a musician -for music. This must match the [performers](infotag.md#performers) array (for each person, correspond one/more +for music. This must match the [performers](InfoTag.md#performers) array (for each person, correspond one/more role). Several roles for the same artist/actor can be separated with semicolons. For example: "Bass; Backing Vocals; Vibraphone". **`remarks`** It is highly important to match each role to the performers. This means that an entry - in the [performersRole](infotag.md#performersrole) array is `undefined` to maintain the relationship between + in the [performersRole](InfoTag.md#performersrole) array is `undefined` to maintain the relationship between `performers[i]` and `performersRole[i]`. #### Parameters @@ -1460,6 +1803,10 @@ example: "Bass; Backing Vocals; Vibraphone". Array containing the roles played by the performers in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +RiffListTag.performersRole + ___ ### performersSort @@ -1482,6 +1829,10 @@ the current instance. Sortable names for the performers who performed in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +RiffListTag.performersSort + • `set` **performersSort**(`value`): `void` Gets the sortable names of the performers or artists who performed in the media described by @@ -1506,11 +1857,15 @@ the current instance. Sortable names for the performers who performed in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +RiffListTag.performersSort + ___ ### pictures -• `get` **pictures**(): [`IPicture`](../interfaces/ipicture.md)[] +• `get` **pictures**(): [`IPicture`](../interfaces/IPicture.md)[] Gets a collection of pictures associated with the media represented by the current instance. @@ -1520,11 +1875,15 @@ Gets a collection of pictures associated with the media represented by the curre #### Returns -[`IPicture`](../interfaces/ipicture.md)[] +[`IPicture`](../interfaces/IPicture.md)[] Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. +#### Inherited from + +RiffListTag.pictures + • `set` **pictures**(`value`): `void` Sets a collection of pictures associated with the media represented by the current instance. @@ -1537,7 +1896,7 @@ Sets a collection of pictures associated with the media represented by the curre | Name | Type | Description | | :------ | :------ | :------ | -| `value` | [`IPicture`](../interfaces/ipicture.md)[] | Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. | +| `value` | [`IPicture`](../interfaces/IPicture.md)[] | Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. | #### Returns @@ -1546,6 +1905,10 @@ Sets a collection of pictures associated with the media represented by the curre Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. +#### Inherited from + +RiffListTag.pictures + ___ ### publisher @@ -1560,6 +1923,10 @@ Gets the publisher of the track. Publisher of the track or `undefined` if no value is set +#### Inherited from + +RiffListTag.publisher + • `set` **publisher**(`value`): `void` Sets the publisher of the track. @@ -1576,6 +1943,10 @@ Sets the publisher of the track. Publisher of the track or `undefined` if no value is set +#### Inherited from + +RiffListTag.publisher + ___ ### remixedBy @@ -1590,6 +1961,10 @@ Gets the remixer of the track. Remixer of the track or `undefined` if no value is set +#### Inherited from + +RiffListTag.remixedBy + • `set` **remixedBy**(`value`): `void` Sets the remixer of the track. @@ -1606,6 +1981,10 @@ Sets the remixer of the track. Remixer of the track or `undefined` if no value is set +#### Inherited from + +RiffListTag.remixedBy + ___ ### replayGainAlbumGain @@ -1620,6 +1999,10 @@ Gets the ReplayGain album gain in dB. Album gain as per the ReplayGain specifications, in dB, or `NaN` if no value is set +#### Inherited from + +RiffListTag.replayGainAlbumGain + • `set` **replayGainAlbumGain**(`value`): `void` Sets the ReplayGain album gain in dB. @@ -1636,6 +2019,10 @@ Sets the ReplayGain album gain in dB. Album gain as per the ReplayGain specifications, in dB, or `NaN` if no value is set +#### Inherited from + +RiffListTag.replayGainAlbumGain + ___ ### replayGainAlbumPeak @@ -1650,6 +2037,10 @@ Gets the ReplayGain album peak sample. Album peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Inherited from + +RiffListTag.replayGainAlbumPeak + • `set` **replayGainAlbumPeak**(`value`): `void` Sets the ReplayGain album peak sample. @@ -1666,6 +2057,10 @@ Sets the ReplayGain album peak sample. Album peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Inherited from + +RiffListTag.replayGainAlbumPeak + ___ ### replayGainTrackGain @@ -1680,6 +2075,10 @@ Gets the ReplayGain track gain in dB. Track gain as per ReplayGain specifications, in dB, or `NaN` if no value is set +#### Inherited from + +RiffListTag.replayGainTrackGain + • `set` **replayGainTrackGain**(`value`): `void` Sets the ReplayGain track gain in dB. @@ -1696,6 +2095,10 @@ Sets the ReplayGain track gain in dB. Track gain as per ReplayGain specifications, in dB, or `NaN` if no value is set +#### Inherited from + +RiffListTag.replayGainTrackGain + ___ ### replayGainTrackPeak @@ -1710,6 +2113,10 @@ Gets the ReplayGain track peak sample. Track peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Inherited from + +RiffListTag.replayGainTrackPeak + • `set` **replayGainTrackPeak**(`value`): `void` Sets the ReplayGain track peak sample. @@ -1726,6 +2133,10 @@ Sets the ReplayGain track peak sample. Track peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Inherited from + +RiffListTag.replayGainTrackPeak + ___ ### sizeOnDisk @@ -1738,17 +2149,25 @@ ___ `number` +#### Inherited from + +RiffListTag.sizeOnDisk + ___ ### stringType -• `get` **stringType**(): [`StringType`](../enums/stringtype.md) +• `get` **stringType**(): [`StringType`](../enums/StringType.md) Gets the type of string used for parsing and rendering the contents of this tag. #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) + +#### Inherited from + +RiffListTag.stringType • `set` **stringType**(`value`): `void` @@ -1760,12 +2179,16 @@ Sets the type of string used for parsing and rendering the contents of this tag. | Name | Type | | :------ | :------ | -| `value` | [`StringType`](../enums/stringtype.md) | +| `value` | [`StringType`](../enums/StringType.md) | #### Returns `void` +#### Inherited from + +RiffListTag.stringType + ___ ### subtitle @@ -1785,6 +2208,10 @@ Gets a description, one-line. It represents the tagline of the vide/music. Subtitle of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.subtitle + • `set` **subtitle**(`value`): `void` Sets a description, one-line. It represents the tagline of the vide/music. @@ -1806,17 +2233,25 @@ Sets a description, one-line. It represents the tagline of the vide/music. Subtitle of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.subtitle + ___ ### tagTypes -• `get` **tagTypes**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypes**(): [`TagTypes`](../enums/TagTypes.md) **`inheritdoc`** #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) + +#### Overrides + +RiffListTag.tagTypes ___ @@ -1832,6 +2267,10 @@ ___ `string` +#### Overrides + +RiffListTag.title + • `set` **title**(`value`): `void` **`inheritdoc`** @@ -1848,6 +2287,10 @@ ___ `void` +#### Overrides + +RiffListTag.title + ___ ### titleSort @@ -1865,6 +2308,10 @@ Gets the sortable name for the title of the media described by the current insta Sortable name of the media described by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.titleSort + • `set` **titleSort**(`value`): `void` Sets the sortable name for the title of the media described by the current instance. @@ -1884,6 +2331,10 @@ Sets the sortable name for the title of the media described by the current insta Sortable name of the media described by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.titleSort + ___ ### track @@ -1898,6 +2349,10 @@ ___ `number` +#### Overrides + +RiffListTag.track + • `set` **track**(`value`): `void` **`inheritdoc`** @@ -1914,6 +2369,10 @@ ___ `void` +#### Overrides + +RiffListTag.track + ___ ### trackCount @@ -1928,6 +2387,10 @@ ___ `number` +#### Overrides + +RiffListTag.trackCount + • `set` **trackCount**(`value`): `void` **`inheritdoc`** @@ -1944,6 +2407,10 @@ ___ `void` +#### Overrides + +RiffListTag.trackCount + ___ ### year @@ -1958,6 +2425,10 @@ ___ `number` +#### Overrides + +RiffListTag.year + • `set` **year**(`value`): `void` **`inheritdoc`** @@ -1974,6 +2445,10 @@ ___ `void` +#### Overrides + +RiffListTag.year + ## Methods ### clear @@ -1990,7 +2465,7 @@ Clears all values stored in the current instance. #### Inherited from -[RiffListTag](rifflisttag.md).[clear](rifflisttag.md#clear) +[RiffListTag](RiffListTag.md).[clear](RiffListTag.md#clear) ___ @@ -1998,19 +2473,19 @@ ___ ▸ **copyTo**(`target`, `overwrite`): `void` -Copies the values from the current instance to another [Tag](tag.md), optionally overwriting +Copies the values from the current instance to another [Tag](Tag.md), optionally overwriting existing values. **`remarks`** This method only copies the most basic values when copying between different tag formats. However, if `target` is of the same type as the current instance, more advanced copying may be done. For example if both `this` and `target` are - [Id3v2Tag](id3v2tag.md), all frames will be copied to the target. + [Id3v2Tag](Id3v2Tag.md), all frames will be copied to the target. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `target` | [`Tag`](tag.md) | Target tag to copy values to | +| `target` | [`Tag`](Tag.md) | Target tag to copy values to | | `overwrite` | `boolean` | Whether or not to copy values over existing ones | #### Returns @@ -2019,7 +2494,7 @@ Copies the values from the current instance to another [Tag](tag.md), optionally #### Inherited from -[RiffListTag](rifflisttag.md).[copyTo](rifflisttag.md#copyto) +[RiffListTag](RiffListTag.md).[copyTo](RiffListTag.md#copyto) ___ @@ -2042,7 +2517,7 @@ is returned. #### Inherited from -[RiffListTag](rifflisttag.md).[getFirstValueAsString](rifflisttag.md#getfirstvalueasstring) +[RiffListTag](RiffListTag.md).[getFirstValueAsString](RiffListTag.md#getfirstvalueasstring) ___ @@ -2064,13 +2539,13 @@ Gets the value for a specified item in the current instance as an unsigned integ #### Inherited from -[RiffListTag](rifflisttag.md).[getValueAsUint](rifflisttag.md#getvalueasuint) +[RiffListTag](RiffListTag.md).[getValueAsUint](RiffListTag.md#getvalueasuint) ___ ### getValues -▸ **getValues**(`id`): [`ByteVector`](bytevector.md)[] +▸ **getValues**(`id`): [`ByteVector`](ByteVector.md)[] Gets the values for a specified item in the current instance. @@ -2082,11 +2557,11 @@ Gets the values for a specified item in the current instance. #### Returns -[`ByteVector`](bytevector.md)[] +[`ByteVector`](ByteVector.md)[] #### Inherited from -[RiffListTag](rifflisttag.md).[getValues](rifflisttag.md#getvalues) +[RiffListTag](RiffListTag.md).[getValues](RiffListTag.md#getvalues) ___ @@ -2108,7 +2583,7 @@ Gets the values for a specified item in the current instance as strings. #### Inherited from -[RiffListTag](rifflisttag.md).[getValuesAsStrings](rifflisttag.md#getvaluesasstrings) +[RiffListTag](RiffListTag.md).[getValuesAsStrings](RiffListTag.md#getvaluesasstrings) ___ @@ -2130,24 +2605,24 @@ Removes the item with the specified ID from the current instance. #### Inherited from -[RiffListTag](rifflisttag.md).[removeValue](rifflisttag.md#removevalue) +[RiffListTag](RiffListTag.md).[removeValue](RiffListTag.md#removevalue) ___ ### render -▸ **render**(): [`ByteVector`](bytevector.md) +▸ **render**(): [`ByteVector`](ByteVector.md) Renders the current instance, including list header and padding bytes, ready to be written to a file. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[RiffListTag](rifflisttag.md).[render](rifflisttag.md#render) +[RiffListTag](RiffListTag.md).[render](RiffListTag.md#render) ___ @@ -2165,7 +2640,7 @@ Set the tags that represent the tagger software (node-taglib-sharp) itself. #### Inherited from -[RiffListTag](rifflisttag.md).[setInfoTag](rifflisttag.md#setinfotag) +[RiffListTag](RiffListTag.md).[setInfoTag](RiffListTag.md#setinfotag) ___ @@ -2188,7 +2663,7 @@ Sets the value for a specified item in the current instance using an unsigned in #### Inherited from -[RiffListTag](rifflisttag.md).[setValueFromUint](rifflisttag.md#setvaluefromuint) +[RiffListTag](RiffListTag.md).[setValueFromUint](RiffListTag.md#setvaluefromuint) ___ @@ -2203,7 +2678,7 @@ Sets the value for a specified item in the current instance | Name | Type | Description | | :------ | :------ | :------ | | `id` | `string` | ID of the item to set | -| `values` | [`ByteVector`](bytevector.md)[] | Values to store in the specified item | +| `values` | [`ByteVector`](ByteVector.md)[] | Values to store in the specified item | #### Returns @@ -2211,7 +2686,7 @@ Sets the value for a specified item in the current instance #### Inherited from -[RiffListTag](rifflisttag.md).[setValues](rifflisttag.md#setvalues) +[RiffListTag](RiffListTag.md).[setValues](RiffListTag.md#setvalues) ___ @@ -2234,7 +2709,7 @@ Sets the value for a specified item in the current instance using a list of stri #### Inherited from -[RiffListTag](rifflisttag.md).[setValuesFromStrings](rifflisttag.md#setvaluesfromstrings) +[RiffListTag](RiffListTag.md).[setValuesFromStrings](RiffListTag.md#setvaluesfromstrings) ___ @@ -2259,25 +2734,25 @@ First string contained in `group` or `undefined` if the array is #### Inherited from -[RiffListTag](rifflisttag.md).[firstInGroup](rifflisttag.md#firstingroup) +[RiffListTag](RiffListTag.md).[firstInGroup](RiffListTag.md#firstingroup) ___ ### fromEmpty -▸ `Static` **fromEmpty**(): [`InfoTag`](infotag.md) +▸ `Static` **fromEmpty**(): [`InfoTag`](InfoTag.md) Constructs and initializes a new, empty instance. #### Returns -[`InfoTag`](infotag.md) +[`InfoTag`](InfoTag.md) ___ ### fromList -▸ `Static` **fromList**(`list`): [`InfoTag`](infotag.md) +▸ `Static` **fromList**(`list`): [`InfoTag`](InfoTag.md) Constructs and initializes a new instance by reading the contents of a raw RIFF list stored a file. @@ -2286,11 +2761,11 @@ a file. | Name | Type | Description | | :------ | :------ | :------ | -| `list` | [`RiffList`](rifflist.md) | List that contains the contents of the tag | +| `list` | [`RiffList`](RiffList.md) | List that contains the contents of the tag | #### Returns -[`InfoTag`](infotag.md) +[`InfoTag`](InfoTag.md) ___ @@ -2316,7 +2791,7 @@ If `value` is a string, `true` is returned if the value is falsy or all #### Inherited from -[RiffListTag](rifflisttag.md).[isFalsyOrLikeEmpty](rifflisttag.md#isfalsyorlikeempty) +[RiffListTag](RiffListTag.md).[isFalsyOrLikeEmpty](RiffListTag.md#isfalsyorlikeempty) ___ @@ -2341,24 +2816,24 @@ A semicolon and space separated string containing the values from `group` #### Inherited from -[RiffListTag](rifflisttag.md).[joinGroup](rifflisttag.md#joingroup) +[RiffListTag](RiffListTag.md).[joinGroup](RiffListTag.md#joingroup) ___ ### tagTypeFlagsToArray -▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/tagtypes.md)[] +▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/TagTypes.md)[] #### Parameters | Name | Type | | :------ | :------ | -| `tagTypes` | [`TagTypes`](../enums/tagtypes.md) | +| `tagTypes` | [`TagTypes`](../enums/TagTypes.md) | #### Returns -[`TagTypes`](../enums/tagtypes.md)[] +[`TagTypes`](../enums/TagTypes.md)[] #### Inherited from -[RiffListTag](rifflisttag.md).[tagTypeFlagsToArray](rifflisttag.md#tagtypeflagstoarray) +[RiffListTag](RiffListTag.md).[tagTypeFlagsToArray](RiffListTag.md#tagtypeflagstoarray) diff --git a/docs/classes/localfileabstraction.md b/docs/classes/LocalFileAbstraction.md similarity index 76% rename from docs/classes/localfileabstraction.md rename to docs/classes/LocalFileAbstraction.md index 6a42a7d7..9e0cea1c 100644 --- a/docs/classes/localfileabstraction.md +++ b/docs/classes/LocalFileAbstraction.md @@ -14,17 +14,17 @@ This class is used as the standard file abstraction throughout the library. ### Constructors -- [constructor](localfileabstraction.md#constructor) +- [constructor](LocalFileAbstraction.md#constructor) ### Accessors -- [name](localfileabstraction.md#name) -- [readStream](localfileabstraction.md#readstream) -- [writeStream](localfileabstraction.md#writestream) +- [name](LocalFileAbstraction.md#name) +- [readStream](LocalFileAbstraction.md#readstream) +- [writeStream](LocalFileAbstraction.md#writestream) ### Methods -- [closeStream](localfileabstraction.md#closestream) +- [closeStream](LocalFileAbstraction.md#closestream) ## Constructors @@ -54,6 +54,10 @@ Constructs and initializes a new instance from a specified path in the local fil `string` +#### Implementation of + +IFileAbstraction.name + ___ ### readStream @@ -66,6 +70,10 @@ ___ `IStream` +#### Implementation of + +IFileAbstraction.readStream + ___ ### writeStream @@ -78,6 +86,10 @@ ___ `IStream` +#### Implementation of + +IFileAbstraction.writeStream + ## Methods ### closeStream diff --git a/docs/classes/movieidtag.md b/docs/classes/MovieIdTag.md similarity index 80% rename from docs/classes/movieidtag.md rename to docs/classes/MovieIdTag.md index ab5fdfda..f63a1127 100644 --- a/docs/classes/movieidtag.md +++ b/docs/classes/MovieIdTag.md @@ -6,7 +6,7 @@ Provides support for reading and writing MovieID tags. ## Hierarchy -- [`RiffListTag`](rifflisttag.md) +- [`RiffListTag`](RiffListTag.md) ↳ **`MovieIdTag`** @@ -14,100 +14,101 @@ Provides support for reading and writing MovieID tags. ### Properties -- [listType](movieidtag.md#listtype) +- [LIST\_TYPE](MovieIdTag.md#list_type) ### Accessors -- [album](movieidtag.md#album) -- [albumArtists](movieidtag.md#albumartists) -- [albumArtistsSort](movieidtag.md#albumartistssort) -- [albumSort](movieidtag.md#albumsort) -- [amazonId](movieidtag.md#amazonid) -- [beatsPerMinute](movieidtag.md#beatsperminute) -- [comment](movieidtag.md#comment) -- [composers](movieidtag.md#composers) -- [composersSort](movieidtag.md#composerssort) -- [conductor](movieidtag.md#conductor) -- [copyright](movieidtag.md#copyright) -- [dateTagged](movieidtag.md#datetagged) -- [description](movieidtag.md#description) -- [disc](movieidtag.md#disc) -- [discCount](movieidtag.md#disccount) -- [firstAlbumArtist](movieidtag.md#firstalbumartist) -- [firstAlbumArtistSort](movieidtag.md#firstalbumartistsort) -- [firstComposer](movieidtag.md#firstcomposer) -- [firstComposerSort](movieidtag.md#firstcomposersort) -- [firstGenre](movieidtag.md#firstgenre) -- [firstPerformer](movieidtag.md#firstperformer) -- [firstPerformerSort](movieidtag.md#firstperformersort) -- [genres](movieidtag.md#genres) -- [grouping](movieidtag.md#grouping) -- [initialKey](movieidtag.md#initialkey) -- [isEmpty](movieidtag.md#isempty) -- [isrc](movieidtag.md#isrc) -- [joinedAlbumArtists](movieidtag.md#joinedalbumartists) -- [joinedComposers](movieidtag.md#joinedcomposers) -- [joinedGenres](movieidtag.md#joinedgenres) -- [joinedPerformers](movieidtag.md#joinedperformers) -- [joinedPerformersSort](movieidtag.md#joinedperformerssort) -- [list](movieidtag.md#list) -- [lyrics](movieidtag.md#lyrics) -- [musicBrainzArtistId](movieidtag.md#musicbrainzartistid) -- [musicBrainzDiscId](movieidtag.md#musicbrainzdiscid) -- [musicBrainzReleaseArtistId](movieidtag.md#musicbrainzreleaseartistid) -- [musicBrainzReleaseCountry](movieidtag.md#musicbrainzreleasecountry) -- [musicBrainzReleaseGroupId](movieidtag.md#musicbrainzreleasegroupid) -- [musicBrainzReleaseId](movieidtag.md#musicbrainzreleaseid) -- [musicBrainzReleaseStatus](movieidtag.md#musicbrainzreleasestatus) -- [musicBrainzReleaseType](movieidtag.md#musicbrainzreleasetype) -- [musicBrainzTrackId](movieidtag.md#musicbrainztrackid) -- [musicIpId](movieidtag.md#musicipid) -- [performers](movieidtag.md#performers) -- [performersRole](movieidtag.md#performersrole) -- [performersSort](movieidtag.md#performerssort) -- [pictures](movieidtag.md#pictures) -- [publisher](movieidtag.md#publisher) -- [remixedBy](movieidtag.md#remixedby) -- [replayGainAlbumGain](movieidtag.md#replaygainalbumgain) -- [replayGainAlbumPeak](movieidtag.md#replaygainalbumpeak) -- [replayGainTrackGain](movieidtag.md#replaygaintrackgain) -- [replayGainTrackPeak](movieidtag.md#replaygaintrackpeak) -- [sizeOnDisk](movieidtag.md#sizeondisk) -- [stringType](movieidtag.md#stringtype) -- [subtitle](movieidtag.md#subtitle) -- [tagTypes](movieidtag.md#tagtypes) -- [title](movieidtag.md#title) -- [titleSort](movieidtag.md#titlesort) -- [track](movieidtag.md#track) -- [trackCount](movieidtag.md#trackcount) -- [year](movieidtag.md#year) +- [album](MovieIdTag.md#album) +- [albumArtists](MovieIdTag.md#albumartists) +- [albumArtistsSort](MovieIdTag.md#albumartistssort) +- [albumSort](MovieIdTag.md#albumsort) +- [amazonId](MovieIdTag.md#amazonid) +- [beatsPerMinute](MovieIdTag.md#beatsperminute) +- [comment](MovieIdTag.md#comment) +- [composers](MovieIdTag.md#composers) +- [composersSort](MovieIdTag.md#composerssort) +- [conductor](MovieIdTag.md#conductor) +- [copyright](MovieIdTag.md#copyright) +- [dateTagged](MovieIdTag.md#datetagged) +- [description](MovieIdTag.md#description) +- [disc](MovieIdTag.md#disc) +- [discCount](MovieIdTag.md#disccount) +- [firstAlbumArtist](MovieIdTag.md#firstalbumartist) +- [firstAlbumArtistSort](MovieIdTag.md#firstalbumartistsort) +- [firstComposer](MovieIdTag.md#firstcomposer) +- [firstComposerSort](MovieIdTag.md#firstcomposersort) +- [firstGenre](MovieIdTag.md#firstgenre) +- [firstPerformer](MovieIdTag.md#firstperformer) +- [firstPerformerSort](MovieIdTag.md#firstperformersort) +- [genres](MovieIdTag.md#genres) +- [grouping](MovieIdTag.md#grouping) +- [initialKey](MovieIdTag.md#initialkey) +- [isCompilation](MovieIdTag.md#iscompilation) +- [isEmpty](MovieIdTag.md#isempty) +- [isrc](MovieIdTag.md#isrc) +- [joinedAlbumArtists](MovieIdTag.md#joinedalbumartists) +- [joinedComposers](MovieIdTag.md#joinedcomposers) +- [joinedGenres](MovieIdTag.md#joinedgenres) +- [joinedPerformers](MovieIdTag.md#joinedperformers) +- [joinedPerformersSort](MovieIdTag.md#joinedperformerssort) +- [list](MovieIdTag.md#list) +- [lyrics](MovieIdTag.md#lyrics) +- [musicBrainzArtistId](MovieIdTag.md#musicbrainzartistid) +- [musicBrainzDiscId](MovieIdTag.md#musicbrainzdiscid) +- [musicBrainzReleaseArtistId](MovieIdTag.md#musicbrainzreleaseartistid) +- [musicBrainzReleaseCountry](MovieIdTag.md#musicbrainzreleasecountry) +- [musicBrainzReleaseGroupId](MovieIdTag.md#musicbrainzreleasegroupid) +- [musicBrainzReleaseId](MovieIdTag.md#musicbrainzreleaseid) +- [musicBrainzReleaseStatus](MovieIdTag.md#musicbrainzreleasestatus) +- [musicBrainzReleaseType](MovieIdTag.md#musicbrainzreleasetype) +- [musicBrainzTrackId](MovieIdTag.md#musicbrainztrackid) +- [musicIpId](MovieIdTag.md#musicipid) +- [performers](MovieIdTag.md#performers) +- [performersRole](MovieIdTag.md#performersrole) +- [performersSort](MovieIdTag.md#performerssort) +- [pictures](MovieIdTag.md#pictures) +- [publisher](MovieIdTag.md#publisher) +- [remixedBy](MovieIdTag.md#remixedby) +- [replayGainAlbumGain](MovieIdTag.md#replaygainalbumgain) +- [replayGainAlbumPeak](MovieIdTag.md#replaygainalbumpeak) +- [replayGainTrackGain](MovieIdTag.md#replaygaintrackgain) +- [replayGainTrackPeak](MovieIdTag.md#replaygaintrackpeak) +- [sizeOnDisk](MovieIdTag.md#sizeondisk) +- [stringType](MovieIdTag.md#stringtype) +- [subtitle](MovieIdTag.md#subtitle) +- [tagTypes](MovieIdTag.md#tagtypes) +- [title](MovieIdTag.md#title) +- [titleSort](MovieIdTag.md#titlesort) +- [track](MovieIdTag.md#track) +- [trackCount](MovieIdTag.md#trackcount) +- [year](MovieIdTag.md#year) ### Methods -- [clear](movieidtag.md#clear) -- [copyTo](movieidtag.md#copyto) -- [getFirstValueAsString](movieidtag.md#getfirstvalueasstring) -- [getValueAsUint](movieidtag.md#getvalueasuint) -- [getValues](movieidtag.md#getvalues) -- [getValuesAsStrings](movieidtag.md#getvaluesasstrings) -- [removeValue](movieidtag.md#removevalue) -- [render](movieidtag.md#render) -- [setInfoTag](movieidtag.md#setinfotag) -- [setValueFromUint](movieidtag.md#setvaluefromuint) -- [setValues](movieidtag.md#setvalues) -- [setValuesFromStrings](movieidtag.md#setvaluesfromstrings) -- [firstInGroup](movieidtag.md#firstingroup) -- [fromEmpty](movieidtag.md#fromempty) -- [fromList](movieidtag.md#fromlist) -- [isFalsyOrLikeEmpty](movieidtag.md#isfalsyorlikeempty) -- [joinGroup](movieidtag.md#joingroup) -- [tagTypeFlagsToArray](movieidtag.md#tagtypeflagstoarray) +- [clear](MovieIdTag.md#clear) +- [copyTo](MovieIdTag.md#copyto) +- [getFirstValueAsString](MovieIdTag.md#getfirstvalueasstring) +- [getValueAsUint](MovieIdTag.md#getvalueasuint) +- [getValues](MovieIdTag.md#getvalues) +- [getValuesAsStrings](MovieIdTag.md#getvaluesasstrings) +- [removeValue](MovieIdTag.md#removevalue) +- [render](MovieIdTag.md#render) +- [setInfoTag](MovieIdTag.md#setinfotag) +- [setValueFromUint](MovieIdTag.md#setvaluefromuint) +- [setValues](MovieIdTag.md#setvalues) +- [setValuesFromStrings](MovieIdTag.md#setvaluesfromstrings) +- [firstInGroup](MovieIdTag.md#firstingroup) +- [fromEmpty](MovieIdTag.md#fromempty) +- [fromList](MovieIdTag.md#fromlist) +- [isFalsyOrLikeEmpty](MovieIdTag.md#isfalsyorlikeempty) +- [joinGroup](MovieIdTag.md#joingroup) +- [tagTypeFlagsToArray](MovieIdTag.md#tagtypeflagstoarray) ## Properties -### listType +### LIST\_TYPE -▪ `Static` `Readonly` **listType**: ``"MID "`` +▪ `Static` `Readonly` **LIST\_TYPE**: ``"MID "`` ## Accessors @@ -132,6 +133,10 @@ represents the collection the video belongs to. Album of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.album + • `set` **album**(`value`): `void` Sets the album of the media represented by the current instance. For video media, this @@ -157,6 +162,10 @@ represents the collection the video belongs to. Album of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.album + ___ ### albumArtists @@ -171,7 +180,7 @@ collection containing the media described by the current instance. will split up albums by the same artist. Having a single album artist for an entire album solves this problem. As this value is to be used as a sorting key, it should be used with less variation - than [performers](movieidtag.md#performers). Where performers can be broken into multiple artists, it is + than [performers](MovieIdTag.md#performers). Where performers can be broken into multiple artists, it is best to stick to a single name. Eg, "Super8 & Tab" #### Returns @@ -182,6 +191,10 @@ Band or artist credited with the creation of the entire album or collection containing the media described by the current instance or an empty array if no value is present +#### Inherited from + +RiffListTag.albumArtists + • `set` **albumArtists**(`value`): `void` Sets the bands or artists who is credited credited in the creation of the entire album or @@ -192,7 +205,7 @@ collection containing the media described by the current instance. will split up albums by the same artist. Having a single album artist for an entire album solves this problem. As this value is to be used as a sorting key, it should be used with less variation - than [performers](movieidtag.md#performers). Where performers can be broken into multiple artists, it is + than [performers](MovieIdTag.md#performers). Where performers can be broken into multiple artists, it is best to stick to a single name. Eg, "Super8 & Tab" #### Parameters @@ -209,6 +222,10 @@ Band or artist credited with the creation of the entire album or collection containing the media described by the current instance or an empty array if no value is present +#### Inherited from + +RiffListTag.albumArtists + ___ ### albumArtistsSort @@ -224,7 +241,7 @@ album or collection containing the media described by the current instance. skip articles or sort by last by last name. For example "Ben Folds" might be sorted as "Folds, Ben". As this value is to be used as a sorting key, it should be used with less variation than - [performers](movieidtag.md#performers). Where [performers](movieidtag.md#performers) can be broken into multiple performers, it is + [performers](MovieIdTag.md#performers). Where [performers](MovieIdTag.md#performers) can be broken into multiple performers, it is best to stick to a single album artist. Eg, "Van Buuren, Armin" #### Returns @@ -235,6 +252,10 @@ Sortable names for the bands/artists are credited with the creation of the entir album or collection containing the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +RiffListTag.albumArtistsSort + • `set` **albumArtistsSort**(`value`): `void` Sets the sortable names of the bands/artists who are credited with creating the entire @@ -246,7 +267,7 @@ album or collection containing the media described by the current instance. skip articles or sort by last by last name. For example "Ben Folds" might be sorted as "Folds, Ben". As this value is to be used as a sorting key, it should be used with less variation than - [performers](movieidtag.md#performers). Where [performers](movieidtag.md#performers) can be broken into multiple performers, it is + [performers](MovieIdTag.md#performers). Where [performers](MovieIdTag.md#performers) can be broken into multiple performers, it is best to stick to a single album artist. Eg, "Van Buuren, Armin" #### Parameters @@ -263,6 +284,10 @@ Sortable names for the bands/artists are credited with the creation of the entir album or collection containing the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +RiffListTag.albumArtistsSort + ___ ### albumSort @@ -283,6 +308,10 @@ Gets the sortable name of the album title of the media represented by the curren Sortable name for the album title of the media or `undefined` if the value is not present +#### Inherited from + +RiffListTag.albumSort + • `set` **albumSort**(`value`): `void` Sets the sortable name of the album title of the media represented by the current instance. @@ -305,6 +334,10 @@ Sets the sortable name of the album title of the media represented by the curren Sortable name for the album title of the media or `undefined` if the value is not present +#### Inherited from + +RiffListTag.albumSort + ___ ### amazonId @@ -323,6 +356,10 @@ Gets the Amazon ID of the media represented by the current instance. Amazon ID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.amazonId + • `set` **amazonId**(`value`): `void` Sets the Amazon ID of the media represented by the current instance. @@ -343,6 +380,10 @@ Sets the Amazon ID of the media represented by the current instance. Amazon ID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.amazonId + ___ ### beatsPerMinute @@ -362,6 +403,10 @@ instance. Beats per minute of the audio in the media represented by the current instance, or `0` if not specified +#### Inherited from + +RiffListTag.beatsPerMinute + • `set` **beatsPerMinute**(`value`): `void` Sets the number of beats per minute in the audio of the media represented by the current @@ -383,6 +428,10 @@ instance. Beats per minute of the audio in the media represented by the current instance, or `0` if not specified +#### Inherited from + +RiffListTag.beatsPerMinute + ___ ### comment @@ -397,6 +446,10 @@ ___ `string` +#### Overrides + +RiffListTag.comment + • `set` **comment**(`value`): `void` **`inheritdoc`** @@ -413,6 +466,10 @@ ___ `void` +#### Overrides + +RiffListTag.comment + ___ ### composers @@ -431,6 +488,10 @@ Gets the composers of the media represented by the current instance. Composers of the media represented by the current instance of an empty array if no value is present. +#### Inherited from + +RiffListTag.composers + • `set` **composers**(`value`): `void` Sets the composers of the media represented by the current instance. @@ -451,6 +512,10 @@ Sets the composers of the media represented by the current instance. Composers of the media represented by the current instance of an empty array if no value is present. +#### Inherited from + +RiffListTag.composers + ___ ### composersSort @@ -471,6 +536,10 @@ Gets the sortable names of the composers of the media represented by the current Sortable names for the composers of the media represented by the current instance or an empty array if no value is present. +#### Inherited from + +RiffListTag.composersSort + • `set` **composersSort**(`value`): `void` Sets the sortable names of the composers of the media represented by the current instance. @@ -493,6 +562,10 @@ Sets the sortable names of the composers of the media represented by the current Sortable names for the composers of the media represented by the current instance or an empty array if no value is present. +#### Inherited from + +RiffListTag.composersSort + ___ ### conductor @@ -510,6 +583,10 @@ Gets the conductor or director of the media represented by the current instance. Conductor or director of the media represented by the current instance or `undefined` if no value present. +#### Inherited from + +RiffListTag.conductor + • `set` **conductor**(`value`): `void` Sets the conductor or director of the media represented by the current instance. @@ -529,6 +606,10 @@ Sets the conductor or director of the media represented by the current instance. Conductor or director of the media represented by the current instance or `undefined` if no value present. +#### Inherited from + +RiffListTag.conductor + ___ ### copyright @@ -549,6 +630,10 @@ Gets the copyright information for the media represented by the current instance Copyright information for the media represented by the current instance or `undefined` if no value is present. +#### Inherited from + +RiffListTag.copyright + • `set` **copyright**(`value`): `void` Sets the copyright information for the media represented by the current instance. @@ -571,6 +656,10 @@ Sets the copyright information for the media represented by the current instance Copyright information for the media represented by the current instance or `undefined` if no value is present. +#### Inherited from + +RiffListTag.copyright + ___ ### dateTagged @@ -585,6 +674,10 @@ Gets the date and time at which the tag has been written. Date/time at which the tag has been written, or `undefined` if no value is present +#### Inherited from + +RiffListTag.dateTagged + • `set` **dateTagged**(`value`): `void` Sets the date and time at which the tag has been written. @@ -601,6 +694,10 @@ Sets the date and time at which the tag has been written. Date/time at which the tag has been written, or `undefined` if no value is present +#### Inherited from + +RiffListTag.dateTagged + ___ ### description @@ -622,6 +719,10 @@ generally no spoliers. This should give the impression of what to expect in the Description of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.description + • `set` **description**(`value`): `void` Sets a short description of the media. For music, this could be the comment that the artist @@ -645,6 +746,10 @@ generally no spoliers. This should give the impression of what to expect in the Description of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.description + ___ ### disc @@ -656,7 +761,7 @@ boxed set. For a series, this represents the season number. **`remarks`** This value should be the same as the number that appears on the disc. For example, if the disc is the first of three, the value should be `1`. It should be no more than - [discCount](movieidtag.md#disccount) if [discCount](movieidtag.md#disccount) is non-zero. + [discCount](MovieIdTag.md#disccount) if [discCount](MovieIdTag.md#disccount) is non-zero. #### Returns @@ -665,6 +770,10 @@ boxed set. For a series, this represents the season number. Number of the disc or season of the media represented by the current instance in a boxed set. +#### Inherited from + +RiffListTag.disc + • `set` **disc**(`value`): `void` Sets the number of the disc containing the media represented by the current instance in the @@ -672,7 +781,7 @@ boxed set. For a series, this represents the season number. **`remarks`** This value should be the same as the number that appears on the disc. For example, if the disc is the first of three, the value should be `1`. It should be no more than - [discCount](movieidtag.md#disccount) if [discCount](movieidtag.md#disccount) is non-zero. + [discCount](MovieIdTag.md#disccount) if [discCount](MovieIdTag.md#disccount) is non-zero. #### Parameters @@ -687,6 +796,10 @@ boxed set. For a series, this represents the season number. Number of the disc or season of the media represented by the current instance in a boxed set. +#### Inherited from + +RiffListTag.disc + ___ ### discCount @@ -696,7 +809,7 @@ ___ Gets the number of discs or seasons in the boxed set containing the media represented by the current instance. -**`remarks`** If non-zero, this should be at least equal to [disc](movieidtag.md#disc). If [disc](movieidtag.md#disc) is zero, +**`remarks`** If non-zero, this should be at least equal to [disc](MovieIdTag.md#disc). If [disc](MovieIdTag.md#disc) is zero, this value should also be zero. #### Returns @@ -706,12 +819,16 @@ current instance. Number of discs or seasons in the boxed set containing the media represented by the current instance or `0` if not specified. +#### Inherited from + +RiffListTag.discCount + • `set` **discCount**(`value`): `void` Sets the number of discs or seasons in the boxed set containing the media represented by the current instance. -**`remarks`** If non-zero, this should be at least equal to [disc](movieidtag.md#disc). If [disc](movieidtag.md#disc) is zero, +**`remarks`** If non-zero, this should be at least equal to [disc](MovieIdTag.md#disc). If [disc](MovieIdTag.md#disc) is zero, this value should also be zero. #### Parameters @@ -727,90 +844,122 @@ current instance. Number of discs or seasons in the boxed set containing the media represented by the current instance or `0` if not specified. +#### Inherited from + +RiffListTag.discCount + ___ ### firstAlbumArtist • `get` **firstAlbumArtist**(): `string` -Gets the the first value contained in [albumArtists](movieidtag.md#albumartists). +Gets the first value contained in [albumArtists](MovieIdTag.md#albumartists). #### Returns `string` +#### Inherited from + +RiffListTag.firstAlbumArtist + ___ ### firstAlbumArtistSort • `get` **firstAlbumArtistSort**(): `string` -Gets the first value contained in [albumArtistsSort](movieidtag.md#albumartistssort) +Gets the first value contained in [albumArtistsSort](MovieIdTag.md#albumartistssort) #### Returns `string` +#### Inherited from + +RiffListTag.firstAlbumArtistSort + ___ ### firstComposer • `get` **firstComposer**(): `string` -Gets the first value contained in [composers](movieidtag.md#composers) +Gets the first value contained in [composers](MovieIdTag.md#composers) #### Returns `string` +#### Inherited from + +RiffListTag.firstComposer + ___ ### firstComposerSort • `get` **firstComposerSort**(): `string` -Gets the first value contained in [composersSort](movieidtag.md#composerssort) +Gets the first value contained in [composersSort](MovieIdTag.md#composerssort) #### Returns `string` +#### Inherited from + +RiffListTag.firstComposerSort + ___ ### firstGenre • `get` **firstGenre**(): `string` -Gets the first value contained in [genres](movieidtag.md#genres) +Gets the first value contained in [genres](MovieIdTag.md#genres) #### Returns `string` +#### Inherited from + +RiffListTag.firstGenre + ___ ### firstPerformer • `get` **firstPerformer**(): `string` -Gets the first value contained in [performers](movieidtag.md#performers) +Gets the first value contained in [performers](MovieIdTag.md#performers) #### Returns `string` +#### Inherited from + +RiffListTag.firstPerformer + ___ ### firstPerformerSort • `get` **firstPerformerSort**(): `string` -Gets the first value contained in [performersSort](movieidtag.md#performerssort) +Gets the first value contained in [performersSort](MovieIdTag.md#performerssort) #### Returns `string` +#### Inherited from + +RiffListTag.firstPerformerSort + ___ ### genres @@ -825,6 +974,10 @@ ___ `string`[] +#### Overrides + +RiffListTag.genres + • `set` **genres**(`value`): `void` **`inheritdoc`** @@ -841,6 +994,10 @@ ___ `void` +#### Overrides + +RiffListTag.genres + ___ ### grouping @@ -860,6 +1017,10 @@ Gets the grouping on the album which the media in the current instance belongs t Grouping on the album which the media in the current instance belongs to or `undefined` if no value is present. +#### Inherited from + +RiffListTag.grouping + • `set` **grouping**(`value`): `void` Sets the grouping on the album which the media in the current instance belongs to. @@ -881,6 +1042,10 @@ Sets the grouping on the album which the media in the current instance belongs t Grouping on the album which the media in the current instance belongs to or `undefined` if no value is present. +#### Inherited from + +RiffListTag.grouping + ___ ### initialKey @@ -895,6 +1060,10 @@ Gets the initial key of the track. Initial key of the track or `undefined` if no value is set +#### Inherited from + +RiffListTag.initialKey + • `set` **initialKey**(`value`): `void` Sets the initial key of the track. @@ -911,6 +1080,44 @@ Sets the initial key of the track. Initial key of the track or `undefined` if no value is set +#### Inherited from + +RiffListTag.initialKey + +___ + +### isCompilation + +• `get` **isCompilation**(): `boolean` + +Gets whether or not the album described by the current instance is a compilation. + +#### Returns + +`boolean` + +#### Inherited from + +RiffListTag.isCompilation + +• `set` **isCompilation**(`value`): `void` + +Gets whether or not the album described by the current instance is a compilation. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | `boolean` | Whether or not the album described by the current instance is a compilation | + +#### Returns + +`void` + +#### Inherited from + +RiffListTag.isCompilation + ___ ### isEmpty @@ -923,6 +1130,10 @@ ___ `boolean` +#### Inherited from + +RiffListTag.isEmpty + ___ ### isrc @@ -937,6 +1148,10 @@ Gets the ISRC (International Standard Recording Code) of the track. the ISRC of the track or `undefined` if no value is set +#### Inherited from + +RiffListTag.isrc + • `set` **isrc**(`value`): `void` Sets the ISRC (International Standard Recording Code) of the track. @@ -953,80 +1168,108 @@ Sets the ISRC (International Standard Recording Code) of the track. the ISRC of the track or `undefined` if no value is set +#### Inherited from + +RiffListTag.isrc + ___ ### joinedAlbumArtists • `get` **joinedAlbumArtists**(): `string` -Gets a semicolon and space separated string containing the values in [albumArtists](movieidtag.md#albumartists) +Gets a semicolon and space separated string containing the values in [albumArtists](MovieIdTag.md#albumartists) #### Returns `string` +#### Inherited from + +RiffListTag.joinedAlbumArtists + ___ ### joinedComposers • `get` **joinedComposers**(): `string` -Gets a semicolon and space separated string containing the values in [composers](movieidtag.md#composers) +Gets a semicolon and space separated string containing the values in [composers](MovieIdTag.md#composers) #### Returns `string` +#### Inherited from + +RiffListTag.joinedComposers + ___ ### joinedGenres • `get` **joinedGenres**(): `string` -Gets a semicolon and space separated string containing the values in [genres](movieidtag.md#genres) +Gets a semicolon and space separated string containing the values in [genres](MovieIdTag.md#genres) #### Returns `string` +#### Inherited from + +RiffListTag.joinedGenres + ___ ### joinedPerformers • `get` **joinedPerformers**(): `string` -Gets a semicolon and space separated string containing the values in [performers](movieidtag.md#performers) +Gets a semicolon and space separated string containing the values in [performers](MovieIdTag.md#performers) #### Returns `string` +#### Inherited from + +RiffListTag.joinedPerformers + ___ ### joinedPerformersSort • `get` **joinedPerformersSort**(): `string` -Gets a semicolon and space separated string containing the values in [performersSort](movieidtag.md#performerssort) +Gets a semicolon and space separated string containing the values in [performersSort](MovieIdTag.md#performerssort) #### Returns `string` +#### Inherited from + +RiffListTag.joinedPerformersSort + ___ ### list -• `get` **list**(): [`RiffList`](rifflist.md) +• `get` **list**(): [`RiffList`](RiffList.md) -Gets the [RiffList](rifflist.md) that backs the data for this tag. +Gets the [RiffList](RiffList.md) that backs the data for this tag. **`remarks`** Tags based on RiffLists are only supposed to support certain fields. Modify at your own risk. #### Returns -[`RiffList`](rifflist.md) +[`RiffList`](RiffList.md) + +#### Inherited from + +RiffListTag.list ___ @@ -1048,6 +1291,10 @@ Gets the lyrics or script of the media represented by the current instance. Lyrics or script of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.lyrics + • `set` **lyrics**(`value`): `void` Sets the lyrics or script of the media represented by the current instance. @@ -1070,6 +1317,10 @@ Sets the lyrics or script of the media represented by the current instance. Lyrics or script of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.lyrics + ___ ### musicBrainzArtistId @@ -1088,6 +1339,10 @@ Gets the MusicBrainz artist ID of the media represented by the current instance. MusicBrainz ArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzArtistId + • `set` **musicBrainzArtistId**(`value`): `void` Sets the MusicBrainz artist ID of the media represented by the current instance. @@ -1108,6 +1363,10 @@ Sets the MusicBrainz artist ID of the media represented by the current instance. MusicBrainz ArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzArtistId + ___ ### musicBrainzDiscId @@ -1126,6 +1385,10 @@ Gets the MusicBrainz disc ID of the media represented by the current instance. MusicBrainz DiscID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzDiscId + • `set` **musicBrainzDiscId**(`value`): `void` Sets the MusicBrainz disc ID of the media represented by the current instance. @@ -1146,6 +1409,10 @@ Sets the MusicBrainz disc ID of the media represented by the current instance. MusicBrainz DiscID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzDiscId + ___ ### musicBrainzReleaseArtistId @@ -1164,6 +1431,10 @@ Gets the MusicBrainz release artist ID of the media represented by the current i MusicBrainz ReleaseArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseArtistId + • `set` **musicBrainzReleaseArtistId**(`value`): `void` Sets the MusicBrainz release artist ID of the media represented by the current instance. @@ -1184,6 +1455,10 @@ Sets the MusicBrainz release artist ID of the media represented by the current i MusicBrainz ReleaseArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseArtistId + ___ ### musicBrainzReleaseCountry @@ -1205,6 +1480,10 @@ Gets the MusicBrainz release country of the media represented by the current ins MusicBrainz ReleaseCountry of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseCountry + • `set` **musicBrainzReleaseCountry**(`value`): `void` Sets the MusicBrainz release country of the media represented by the current instance. @@ -1228,6 +1507,10 @@ Sets the MusicBrainz release country of the media represented by the current ins MusicBrainz ReleaseCountry of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseCountry + ___ ### musicBrainzReleaseGroupId @@ -1246,6 +1529,10 @@ Gets the MusicBrainz release group ID of the media represented by the current in MusicBrainz ReleaseGroupID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseGroupId + • `set` **musicBrainzReleaseGroupId**(`value`): `void` Sets the MusicBrainz release group ID of the media represented by the current instance. @@ -1266,6 +1553,10 @@ Sets the MusicBrainz release group ID of the media represented by the current in MusicBrainz ReleaseGroupID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseGroupId + ___ ### musicBrainzReleaseId @@ -1284,6 +1575,10 @@ Gets the MusicBrainz release ID of the media represented by the current instance MusicBrainz ReleaseID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseId + • `set` **musicBrainzReleaseId**(`value`): `void` Sets the MusicBrainz release ID of the media represented by the current instance. @@ -1304,6 +1599,10 @@ Sets the MusicBrainz release ID of the media represented by the current instance MusicBrainz ReleaseID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseId + ___ ### musicBrainzReleaseStatus @@ -1322,6 +1621,10 @@ Gets the MusicBrainz release status of the media represented by the current inst MusicBrainz ReleaseStatus of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseStatus + • `set` **musicBrainzReleaseStatus**(`value`): `void` Sets the MusicBrainz release status of the media represented by the current instance. @@ -1342,6 +1645,10 @@ Sets the MusicBrainz release status of the media represented by the current inst MusicBrainz ReleaseStatus of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseStatus + ___ ### musicBrainzReleaseType @@ -1362,6 +1669,10 @@ Gets the MusicBrainz release type of the media represented by the current instan MusicBrainz ReleaseType of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseType + • `set` **musicBrainzReleaseType**(`value`): `void` Sets the MusicBrainz release type of the media represented by the current instance. @@ -1384,6 +1695,10 @@ Sets the MusicBrainz release type of the media represented by the current instan MusicBrainz ReleaseType of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzReleaseType + ___ ### musicBrainzTrackId @@ -1403,6 +1718,10 @@ current instance. MusicBrainz TrackID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzTrackId + • `set` **musicBrainzTrackId**(`value`): `void` Sets the MusicBrainz track ID of the media represented by the media represented by the @@ -1424,6 +1743,10 @@ current instance. MusicBrainz TrackID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicBrainzTrackId + ___ ### musicIpId @@ -1442,6 +1765,10 @@ Gets the MusicIP PUID of the media represented by the current instance. MusicIP PUID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicIpId + • `set` **musicIpId**(`value`): `void` Sets the MusicIP PUID of the media represented by the current instance. @@ -1462,6 +1789,10 @@ Sets the MusicIP PUID of the media represented by the current instance. MusicIP PUID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.musicIpId + ___ ### performers @@ -1476,6 +1807,10 @@ ___ `string`[] +#### Overrides + +RiffListTag.performers + • `set` **performers**(`value`): `void` **`inheritdoc`** @@ -1492,6 +1827,10 @@ ___ `void` +#### Overrides + +RiffListTag.performers + ___ ### performersRole @@ -1499,12 +1838,12 @@ ___ • `get` **performersRole**(): `string`[] Gets the characters portrayed by an actor for a video or instruments played by a musician -for music. This must match the [performers](movieidtag.md#performers) array (for each person, correspond one/more +for music. This must match the [performers](MovieIdTag.md#performers) array (for each person, correspond one/more role). Several roles for the same artist/actor can be separated with semicolons. For example: "Bass; Backing Vocals; Vibraphone". **`remarks`** It is highly important to match each role to the performers. This means that an entry - in the [performersRole](movieidtag.md#performersrole) array is `undefined` to maintain the relationship between + in the [performersRole](MovieIdTag.md#performersrole) array is `undefined` to maintain the relationship between `performers[i]` and `performersRole[i]`. #### Returns @@ -1514,15 +1853,19 @@ example: "Bass; Backing Vocals; Vibraphone". Array containing the roles played by the performers in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +RiffListTag.performersRole + • `set` **performersRole**(`value`): `void` Sets the characters portrayed by an actor for a video or instruments played by a musician -for music. This must match the [performers](movieidtag.md#performers) array (for each person, correspond one/more +for music. This must match the [performers](MovieIdTag.md#performers) array (for each person, correspond one/more role). Several roles for the same artist/actor can be separated with semicolons. For example: "Bass; Backing Vocals; Vibraphone". **`remarks`** It is highly important to match each role to the performers. This means that an entry - in the [performersRole](movieidtag.md#performersrole) array is `undefined` to maintain the relationship between + in the [performersRole](MovieIdTag.md#performersrole) array is `undefined` to maintain the relationship between `performers[i]` and `performersRole[i]`. #### Parameters @@ -1538,6 +1881,10 @@ example: "Bass; Backing Vocals; Vibraphone". Array containing the roles played by the performers in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +RiffListTag.performersRole + ___ ### performersSort @@ -1560,6 +1907,10 @@ the current instance. Sortable names for the performers who performed in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +RiffListTag.performersSort + • `set` **performersSort**(`value`): `void` Gets the sortable names of the performers or artists who performed in the media described by @@ -1584,11 +1935,15 @@ the current instance. Sortable names for the performers who performed in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +RiffListTag.performersSort + ___ ### pictures -• `get` **pictures**(): [`IPicture`](../interfaces/ipicture.md)[] +• `get` **pictures**(): [`IPicture`](../interfaces/IPicture.md)[] Gets a collection of pictures associated with the media represented by the current instance. @@ -1598,11 +1953,15 @@ Gets a collection of pictures associated with the media represented by the curre #### Returns -[`IPicture`](../interfaces/ipicture.md)[] +[`IPicture`](../interfaces/IPicture.md)[] Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. +#### Inherited from + +RiffListTag.pictures + • `set` **pictures**(`value`): `void` Sets a collection of pictures associated with the media represented by the current instance. @@ -1615,7 +1974,7 @@ Sets a collection of pictures associated with the media represented by the curre | Name | Type | Description | | :------ | :------ | :------ | -| `value` | [`IPicture`](../interfaces/ipicture.md)[] | Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. | +| `value` | [`IPicture`](../interfaces/IPicture.md)[] | Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. | #### Returns @@ -1624,6 +1983,10 @@ Sets a collection of pictures associated with the media represented by the curre Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. +#### Inherited from + +RiffListTag.pictures + ___ ### publisher @@ -1638,6 +2001,10 @@ Gets the publisher of the track. Publisher of the track or `undefined` if no value is set +#### Inherited from + +RiffListTag.publisher + • `set` **publisher**(`value`): `void` Sets the publisher of the track. @@ -1654,6 +2021,10 @@ Sets the publisher of the track. Publisher of the track or `undefined` if no value is set +#### Inherited from + +RiffListTag.publisher + ___ ### remixedBy @@ -1668,6 +2039,10 @@ Gets the remixer of the track. Remixer of the track or `undefined` if no value is set +#### Inherited from + +RiffListTag.remixedBy + • `set` **remixedBy**(`value`): `void` Sets the remixer of the track. @@ -1684,6 +2059,10 @@ Sets the remixer of the track. Remixer of the track or `undefined` if no value is set +#### Inherited from + +RiffListTag.remixedBy + ___ ### replayGainAlbumGain @@ -1698,6 +2077,10 @@ Gets the ReplayGain album gain in dB. Album gain as per the ReplayGain specifications, in dB, or `NaN` if no value is set +#### Inherited from + +RiffListTag.replayGainAlbumGain + • `set` **replayGainAlbumGain**(`value`): `void` Sets the ReplayGain album gain in dB. @@ -1714,6 +2097,10 @@ Sets the ReplayGain album gain in dB. Album gain as per the ReplayGain specifications, in dB, or `NaN` if no value is set +#### Inherited from + +RiffListTag.replayGainAlbumGain + ___ ### replayGainAlbumPeak @@ -1728,6 +2115,10 @@ Gets the ReplayGain album peak sample. Album peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Inherited from + +RiffListTag.replayGainAlbumPeak + • `set` **replayGainAlbumPeak**(`value`): `void` Sets the ReplayGain album peak sample. @@ -1744,6 +2135,10 @@ Sets the ReplayGain album peak sample. Album peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Inherited from + +RiffListTag.replayGainAlbumPeak + ___ ### replayGainTrackGain @@ -1758,6 +2153,10 @@ Gets the ReplayGain track gain in dB. Track gain as per ReplayGain specifications, in dB, or `NaN` if no value is set +#### Inherited from + +RiffListTag.replayGainTrackGain + • `set` **replayGainTrackGain**(`value`): `void` Sets the ReplayGain track gain in dB. @@ -1774,6 +2173,10 @@ Sets the ReplayGain track gain in dB. Track gain as per ReplayGain specifications, in dB, or `NaN` if no value is set +#### Inherited from + +RiffListTag.replayGainTrackGain + ___ ### replayGainTrackPeak @@ -1788,6 +2191,10 @@ Gets the ReplayGain track peak sample. Track peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Inherited from + +RiffListTag.replayGainTrackPeak + • `set` **replayGainTrackPeak**(`value`): `void` Sets the ReplayGain track peak sample. @@ -1804,6 +2211,10 @@ Sets the ReplayGain track peak sample. Track peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Inherited from + +RiffListTag.replayGainTrackPeak + ___ ### sizeOnDisk @@ -1816,17 +2227,25 @@ ___ `number` +#### Inherited from + +RiffListTag.sizeOnDisk + ___ ### stringType -• `get` **stringType**(): [`StringType`](../enums/stringtype.md) +• `get` **stringType**(): [`StringType`](../enums/StringType.md) Gets the type of string used for parsing and rendering the contents of this tag. #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) + +#### Inherited from + +RiffListTag.stringType • `set` **stringType**(`value`): `void` @@ -1838,12 +2257,16 @@ Sets the type of string used for parsing and rendering the contents of this tag. | Name | Type | | :------ | :------ | -| `value` | [`StringType`](../enums/stringtype.md) | +| `value` | [`StringType`](../enums/StringType.md) | #### Returns `void` +#### Inherited from + +RiffListTag.stringType + ___ ### subtitle @@ -1863,6 +2286,10 @@ Gets a description, one-line. It represents the tagline of the vide/music. Subtitle of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.subtitle + • `set` **subtitle**(`value`): `void` Sets a description, one-line. It represents the tagline of the vide/music. @@ -1884,17 +2311,25 @@ Sets a description, one-line. It represents the tagline of the vide/music. Subtitle of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.subtitle + ___ ### tagTypes -• `get` **tagTypes**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypes**(): [`TagTypes`](../enums/TagTypes.md) **`inheritdoc`** #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) + +#### Overrides + +RiffListTag.tagTypes ___ @@ -1910,6 +2345,10 @@ ___ `string` +#### Overrides + +RiffListTag.title + • `set` **title**(`value`): `void` **`inheritdoc`** @@ -1926,6 +2365,10 @@ ___ `void` +#### Overrides + +RiffListTag.title + ___ ### titleSort @@ -1943,6 +2386,10 @@ Gets the sortable name for the title of the media described by the current insta Sortable name of the media described by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.titleSort + • `set` **titleSort**(`value`): `void` Sets the sortable name for the title of the media described by the current instance. @@ -1962,6 +2409,10 @@ Sets the sortable name for the title of the media described by the current insta Sortable name of the media described by the current instance or `undefined` if no value is present +#### Inherited from + +RiffListTag.titleSort + ___ ### track @@ -1976,6 +2427,10 @@ ___ `number` +#### Overrides + +RiffListTag.track + • `set` **track**(`value`): `void` **`inheritdoc`** @@ -1992,6 +2447,10 @@ ___ `void` +#### Overrides + +RiffListTag.track + ___ ### trackCount @@ -2006,6 +2465,10 @@ ___ `number` +#### Overrides + +RiffListTag.trackCount + • `set` **trackCount**(`value`): `void` **`inheritdoc`** @@ -2022,6 +2485,10 @@ ___ `void` +#### Overrides + +RiffListTag.trackCount + ___ ### year @@ -2042,6 +2509,10 @@ Gets the year that the media represented by the current instance was recorded. Year that the media represented by the current instance was created or `0` if no value is present. +#### Inherited from + +RiffListTag.year + • `set` **year**(`value`): `void` Sets the year that the media represented by the current instance was recorded. @@ -2064,6 +2535,10 @@ Sets the year that the media represented by the current instance was recorded. Year that the media represented by the current instance was created or `0` if no value is present. +#### Inherited from + +RiffListTag.year + ## Methods ### clear @@ -2080,7 +2555,7 @@ Clears all values stored in the current instance. #### Inherited from -[RiffListTag](rifflisttag.md).[clear](rifflisttag.md#clear) +[RiffListTag](RiffListTag.md).[clear](RiffListTag.md#clear) ___ @@ -2088,19 +2563,19 @@ ___ ▸ **copyTo**(`target`, `overwrite`): `void` -Copies the values from the current instance to another [Tag](tag.md), optionally overwriting +Copies the values from the current instance to another [Tag](Tag.md), optionally overwriting existing values. **`remarks`** This method only copies the most basic values when copying between different tag formats. However, if `target` is of the same type as the current instance, more advanced copying may be done. For example if both `this` and `target` are - [Id3v2Tag](id3v2tag.md), all frames will be copied to the target. + [Id3v2Tag](Id3v2Tag.md), all frames will be copied to the target. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `target` | [`Tag`](tag.md) | Target tag to copy values to | +| `target` | [`Tag`](Tag.md) | Target tag to copy values to | | `overwrite` | `boolean` | Whether or not to copy values over existing ones | #### Returns @@ -2109,7 +2584,7 @@ Copies the values from the current instance to another [Tag](tag.md), optionally #### Inherited from -[RiffListTag](rifflisttag.md).[copyTo](rifflisttag.md#copyto) +[RiffListTag](RiffListTag.md).[copyTo](RiffListTag.md#copyto) ___ @@ -2132,7 +2607,7 @@ is returned. #### Inherited from -[RiffListTag](rifflisttag.md).[getFirstValueAsString](rifflisttag.md#getfirstvalueasstring) +[RiffListTag](RiffListTag.md).[getFirstValueAsString](RiffListTag.md#getfirstvalueasstring) ___ @@ -2154,13 +2629,13 @@ Gets the value for a specified item in the current instance as an unsigned integ #### Inherited from -[RiffListTag](rifflisttag.md).[getValueAsUint](rifflisttag.md#getvalueasuint) +[RiffListTag](RiffListTag.md).[getValueAsUint](RiffListTag.md#getvalueasuint) ___ ### getValues -▸ **getValues**(`id`): [`ByteVector`](bytevector.md)[] +▸ **getValues**(`id`): [`ByteVector`](ByteVector.md)[] Gets the values for a specified item in the current instance. @@ -2172,11 +2647,11 @@ Gets the values for a specified item in the current instance. #### Returns -[`ByteVector`](bytevector.md)[] +[`ByteVector`](ByteVector.md)[] #### Inherited from -[RiffListTag](rifflisttag.md).[getValues](rifflisttag.md#getvalues) +[RiffListTag](RiffListTag.md).[getValues](RiffListTag.md#getvalues) ___ @@ -2198,7 +2673,7 @@ Gets the values for a specified item in the current instance as strings. #### Inherited from -[RiffListTag](rifflisttag.md).[getValuesAsStrings](rifflisttag.md#getvaluesasstrings) +[RiffListTag](RiffListTag.md).[getValuesAsStrings](RiffListTag.md#getvaluesasstrings) ___ @@ -2220,24 +2695,24 @@ Removes the item with the specified ID from the current instance. #### Inherited from -[RiffListTag](rifflisttag.md).[removeValue](rifflisttag.md#removevalue) +[RiffListTag](RiffListTag.md).[removeValue](RiffListTag.md#removevalue) ___ ### render -▸ **render**(): [`ByteVector`](bytevector.md) +▸ **render**(): [`ByteVector`](ByteVector.md) Renders the current instance, including list header and padding bytes, ready to be written to a file. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Inherited from -[RiffListTag](rifflisttag.md).[render](rifflisttag.md#render) +[RiffListTag](RiffListTag.md).[render](RiffListTag.md#render) ___ @@ -2255,7 +2730,7 @@ Set the tags that represent the tagger software (node-taglib-sharp) itself. #### Inherited from -[RiffListTag](rifflisttag.md).[setInfoTag](rifflisttag.md#setinfotag) +[RiffListTag](RiffListTag.md).[setInfoTag](RiffListTag.md#setinfotag) ___ @@ -2278,7 +2753,7 @@ Sets the value for a specified item in the current instance using an unsigned in #### Inherited from -[RiffListTag](rifflisttag.md).[setValueFromUint](rifflisttag.md#setvaluefromuint) +[RiffListTag](RiffListTag.md).[setValueFromUint](RiffListTag.md#setvaluefromuint) ___ @@ -2293,7 +2768,7 @@ Sets the value for a specified item in the current instance | Name | Type | Description | | :------ | :------ | :------ | | `id` | `string` | ID of the item to set | -| `values` | [`ByteVector`](bytevector.md)[] | Values to store in the specified item | +| `values` | [`ByteVector`](ByteVector.md)[] | Values to store in the specified item | #### Returns @@ -2301,7 +2776,7 @@ Sets the value for a specified item in the current instance #### Inherited from -[RiffListTag](rifflisttag.md).[setValues](rifflisttag.md#setvalues) +[RiffListTag](RiffListTag.md).[setValues](RiffListTag.md#setvalues) ___ @@ -2324,7 +2799,7 @@ Sets the value for a specified item in the current instance using a list of stri #### Inherited from -[RiffListTag](rifflisttag.md).[setValuesFromStrings](rifflisttag.md#setvaluesfromstrings) +[RiffListTag](RiffListTag.md).[setValuesFromStrings](RiffListTag.md#setvaluesfromstrings) ___ @@ -2349,25 +2824,25 @@ First string contained in `group` or `undefined` if the array is #### Inherited from -[RiffListTag](rifflisttag.md).[firstInGroup](rifflisttag.md#firstingroup) +[RiffListTag](RiffListTag.md).[firstInGroup](RiffListTag.md#firstingroup) ___ ### fromEmpty -▸ `Static` **fromEmpty**(): [`MovieIdTag`](movieidtag.md) +▸ `Static` **fromEmpty**(): [`MovieIdTag`](MovieIdTag.md) Constructs and initializes a new, empty instance. #### Returns -[`MovieIdTag`](movieidtag.md) +[`MovieIdTag`](MovieIdTag.md) ___ ### fromList -▸ `Static` **fromList**(`list`): [`MovieIdTag`](movieidtag.md) +▸ `Static` **fromList**(`list`): [`MovieIdTag`](MovieIdTag.md) Constructs and initializes a new instance by reading the contents of a raw RIFF list stored a file. @@ -2376,11 +2851,11 @@ a file. | Name | Type | Description | | :------ | :------ | :------ | -| `list` | [`RiffList`](rifflist.md) | List that contains the contents of the tag | +| `list` | [`RiffList`](RiffList.md) | List that contains the contents of the tag | #### Returns -[`MovieIdTag`](movieidtag.md) +[`MovieIdTag`](MovieIdTag.md) ___ @@ -2406,7 +2881,7 @@ If `value` is a string, `true` is returned if the value is falsy or all #### Inherited from -[RiffListTag](rifflisttag.md).[isFalsyOrLikeEmpty](rifflisttag.md#isfalsyorlikeempty) +[RiffListTag](RiffListTag.md).[isFalsyOrLikeEmpty](RiffListTag.md#isfalsyorlikeempty) ___ @@ -2431,24 +2906,24 @@ A semicolon and space separated string containing the values from `group` #### Inherited from -[RiffListTag](rifflisttag.md).[joinGroup](rifflisttag.md#joingroup) +[RiffListTag](RiffListTag.md).[joinGroup](RiffListTag.md#joingroup) ___ ### tagTypeFlagsToArray -▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/tagtypes.md)[] +▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/TagTypes.md)[] #### Parameters | Name | Type | | :------ | :------ | -| `tagTypes` | [`TagTypes`](../enums/tagtypes.md) | +| `tagTypes` | [`TagTypes`](../enums/TagTypes.md) | #### Returns -[`TagTypes`](../enums/tagtypes.md)[] +[`TagTypes`](../enums/TagTypes.md)[] #### Inherited from -[RiffListTag](rifflisttag.md).[tagTypeFlagsToArray](rifflisttag.md#tagtypeflagstoarray) +[RiffListTag](RiffListTag.md).[tagTypeFlagsToArray](RiffListTag.md#tagtypeflagstoarray) diff --git a/docs/classes/mpegaudiofile.md b/docs/classes/MpegAudioFile.md similarity index 64% rename from docs/classes/mpegaudiofile.md rename to docs/classes/MpegAudioFile.md index 442d0d51..820c98b5 100644 --- a/docs/classes/mpegaudiofile.md +++ b/docs/classes/MpegAudioFile.md @@ -5,14 +5,14 @@ This class extends {@link SandwichFile} to provide tagging and properties support for MPEG-1, MPEG-2, and MPEG-2.5 non-containerized audio files. -**`remarks`** A [Id3v1Tag](id3v1tag.md) and [Id3v2Tag](id3v2tag.md) will be added automatically to any file +**`remarks`** A [Id3v1Tag](Id3v1Tag.md) and [Id3v2Tag](Id3v2Tag.md) will be added automatically to any file that doesn't contain one. This change does not affect the file until it is saved and can be reversed using the following method: `file.removeTags(file.tagTypes & ~file.tagTypesOnDisk);` ## Hierarchy -- `SandwichFile` +- `default` ↳ **`MpegAudioFile`** @@ -20,58 +20,53 @@ MPEG-1, MPEG-2, and MPEG-2.5 non-containerized audio files. ### Constructors -- [constructor](mpegaudiofile.md#constructor) - -### Properties - -- [\_fileAbstraction](mpegaudiofile.md#_fileabstraction) -- [\_fileStream](mpegaudiofile.md#_filestream) -- [\_tagTypesOnDisk](mpegaudiofile.md#_tagtypesondisk) +- [constructor](MpegAudioFile.md#constructor) ### Accessors -- [corruptionReasons](mpegaudiofile.md#corruptionreasons) -- [endTag](mpegaudiofile.md#endtag) -- [fileAbstraction](mpegaudiofile.md#fileabstraction) -- [isPossiblyCorrupt](mpegaudiofile.md#ispossiblycorrupt) -- [isWritable](mpegaudiofile.md#iswritable) -- [length](mpegaudiofile.md#length) -- [mediaEndPosition](mpegaudiofile.md#mediaendposition) -- [mediaStartPosition](mpegaudiofile.md#mediastartposition) -- [mimeType](mpegaudiofile.md#mimetype) -- [mode](mpegaudiofile.md#mode) -- [name](mpegaudiofile.md#name) -- [position](mpegaudiofile.md#position) -- [properties](mpegaudiofile.md#properties) -- [startTag](mpegaudiofile.md#starttag) -- [tag](mpegaudiofile.md#tag) -- [tagTypes](mpegaudiofile.md#tagtypes) -- [tagTypesOnDisk](mpegaudiofile.md#tagtypesondisk) -- [bufferSize](mpegaudiofile.md#buffersize) +- [corruptionReasons](MpegAudioFile.md#corruptionreasons) +- [endTag](MpegAudioFile.md#endtag) +- [fileAbstraction](MpegAudioFile.md#fileabstraction) +- [hasTags](MpegAudioFile.md#hastags) +- [isPossiblyCorrupt](MpegAudioFile.md#ispossiblycorrupt) +- [isWritable](MpegAudioFile.md#iswritable) +- [length](MpegAudioFile.md#length) +- [mediaEndPosition](MpegAudioFile.md#mediaendposition) +- [mediaStartPosition](MpegAudioFile.md#mediastartposition) +- [mimeType](MpegAudioFile.md#mimetype) +- [mode](MpegAudioFile.md#mode) +- [name](MpegAudioFile.md#name) +- [position](MpegAudioFile.md#position) +- [properties](MpegAudioFile.md#properties) +- [startTag](MpegAudioFile.md#starttag) +- [tag](MpegAudioFile.md#tag) +- [tagTypes](MpegAudioFile.md#tagtypes) +- [tagTypesOnDisk](MpegAudioFile.md#tagtypesondisk) +- [bufferSize](MpegAudioFile.md#buffersize) ### Methods -- [dispose](mpegaudiofile.md#dispose) -- [find](mpegaudiofile.md#find) -- [getTag](mpegaudiofile.md#gettag) -- [insert](mpegaudiofile.md#insert) -- [markAsCorrupt](mpegaudiofile.md#markascorrupt) -- [preSave](mpegaudiofile.md#presave) -- [rFind](mpegaudiofile.md#rfind) -- [readBlock](mpegaudiofile.md#readblock) -- [readProperties](mpegaudiofile.md#readproperties) -- [removeBlock](mpegaudiofile.md#removeblock) -- [removeTags](mpegaudiofile.md#removetags) -- [save](mpegaudiofile.md#save) -- [seek](mpegaudiofile.md#seek) -- [truncate](mpegaudiofile.md#truncate) -- [writeBlock](mpegaudiofile.md#writeblock) -- [addFileType](mpegaudiofile.md#addfiletype) -- [addFileTypeResolver](mpegaudiofile.md#addfiletyperesolver) -- [createFromAbstraction](mpegaudiofile.md#createfromabstraction) -- [createFromPath](mpegaudiofile.md#createfrompath) -- [removeFileType](mpegaudiofile.md#removefiletype) -- [removeFileTypeResolver](mpegaudiofile.md#removefiletyperesolver) +- [dispose](MpegAudioFile.md#dispose) +- [find](MpegAudioFile.md#find) +- [getTag](MpegAudioFile.md#gettag) +- [insert](MpegAudioFile.md#insert) +- [markAsCorrupt](MpegAudioFile.md#markascorrupt) +- [preSave](MpegAudioFile.md#presave) +- [rFind](MpegAudioFile.md#rfind) +- [readBlock](MpegAudioFile.md#readblock) +- [readProperties](MpegAudioFile.md#readproperties) +- [removeBlock](MpegAudioFile.md#removeblock) +- [removeTags](MpegAudioFile.md#removetags) +- [save](MpegAudioFile.md#save) +- [seek](MpegAudioFile.md#seek) +- [truncate](MpegAudioFile.md#truncate) +- [writeBlock](MpegAudioFile.md#writeblock) +- [addFileType](MpegAudioFile.md#addfiletype) +- [addFileTypeResolver](MpegAudioFile.md#addfiletyperesolver) +- [createFromAbstraction](MpegAudioFile.md#createfromabstraction) +- [createFromPath](MpegAudioFile.md#createfrompath) +- [removeFileType](MpegAudioFile.md#removefiletype) +- [removeFileTypeResolver](MpegAudioFile.md#removefiletyperesolver) ## Constructors @@ -84,42 +79,12 @@ MPEG-1, MPEG-2, and MPEG-2.5 non-containerized audio files. | Name | Type | | :------ | :------ | | `file` | `string` \| `IFileAbstraction` | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | #### Overrides SandwichFile.constructor -## Properties - -### \_fileAbstraction - -• `Protected` **\_fileAbstraction**: `IFileAbstraction` - -#### Inherited from - -SandwichFile.\_fileAbstraction - -___ - -### \_fileStream - -• `Protected` **\_fileStream**: `IStream` - -#### Inherited from - -SandwichFile.\_fileStream - -___ - -### \_tagTypesOnDisk - -• `Protected` **\_tagTypesOnDisk**: [`TagTypes`](../enums/tagtypes.md) - -#### Inherited from - -SandwichFile.\_tagTypesOnDisk - ## Accessors ### corruptionReasons @@ -132,6 +97,10 @@ Reasons for which this file is marked as corrupt. `string`[] +#### Inherited from + +SandwichFile.corruptionReasons + ___ ### endTag @@ -144,6 +113,10 @@ Gets the collection of tags appearing at the end of the file. `default` +#### Inherited from + +SandwichFile.endTag + ___ ### fileAbstraction @@ -156,6 +129,27 @@ Gets the {@link IFileAbstraction} representing the file. `IFileAbstraction` +#### Inherited from + +SandwichFile.fileAbstraction + +___ + +### hasTags + +• `get` **hasTags**(): `boolean` + +Shortcut property to determine if a file has tags in memory. +NOTE: Just because `tag !== undefined` does not mean there are tags in memory. + +#### Returns + +`boolean` + +#### Inherited from + +SandwichFile.hasTags + ___ ### isPossiblyCorrupt @@ -169,6 +163,10 @@ be written. `boolean` +#### Inherited from + +SandwichFile.isPossiblyCorrupt + ___ ### isWritable @@ -181,6 +179,10 @@ Indicates whether or not tags can be written back to the current file. `boolean` +#### Inherited from + +SandwichFile.isWritable + ___ ### length @@ -194,30 +196,42 @@ is not open for reading; `number` +#### Inherited from + +SandwichFile.length + ___ ### mediaEndPosition • `get` **mediaEndPosition**(): `number` -Gets the position at which the media content of this file ends. +**`inheritdoc`** #### Returns `number` +#### Inherited from + +SandwichFile.mediaEndPosition + ___ ### mediaStartPosition • `get` **mediaStartPosition**(): `number` -Gets the position at which the media content of this file starts. +**`inheritdoc`** #### Returns `number` +#### Inherited from + +SandwichFile.mediaStartPosition + ___ ### mimeType @@ -230,34 +244,46 @@ Gets the MimeType of the file as determined during creation of the instance. `string` +#### Inherited from + +SandwichFile.mimeType + ___ ### mode -• `get` **mode**(): [`FileAccessMode`](../enums/fileaccessmode.md) +• `get` **mode**(): [`FileAccessMode`](../enums/FileAccessMode.md) Gets the file access mode in use by the current instance. #### Returns -[`FileAccessMode`](../enums/fileaccessmode.md) +[`FileAccessMode`](../enums/FileAccessMode.md) + +#### Inherited from + +SandwichFile.mode • `set` **mode**(`val`): `void` Sets the file access mode in use by the current instance. Changing the value will cause the stream currently in use to be closed, except when a change is made from -[FileAccessMode.Write](../enums/fileaccessmode.md#write) to [FileAccessMode.Read](../enums/fileaccessmode.md#read) which has no effect. +[FileAccessMode.Write](../enums/FileAccessMode.md#write) to [FileAccessMode.Read](../enums/FileAccessMode.md#read) which has no effect. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `val` | [`FileAccessMode`](../enums/fileaccessmode.md) | File access mode to change to | +| `val` | [`FileAccessMode`](../enums/FileAccessMode.md) | File access mode to change to | #### Returns `void` +#### Inherited from + +SandwichFile.mode + ___ ### name @@ -270,6 +296,10 @@ Gets the name of the file as stored in its file abstraction. `string` +#### Inherited from + +SandwichFile.name + ___ ### position @@ -283,17 +313,25 @@ if the file is not open for reading `number` +#### Inherited from + +SandwichFile.position + ___ ### properties -• `get` **properties**(): [`Properties`](properties.md) +• `get` **properties**(): [`Properties`](Properties.md) Gets the media properties of the file represented by the current instance. #### Returns -[`Properties`](properties.md) +[`Properties`](Properties.md) + +#### Inherited from + +SandwichFile.properties ___ @@ -307,6 +345,10 @@ Gets the collection of tags appearing at the start of the file. `default` +#### Inherited from + +SandwichFile.startTag + ___ ### tag @@ -319,29 +361,59 @@ Gets an abstract representation of all tags stored in the current instance. `default` +#### Inherited from + +SandwichFile.tag + ___ ### tagTypes -• `get` **tagTypes**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypes**(): [`TagTypes`](../enums/TagTypes.md) Gets the tag types contained in the current instance. #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) + +#### Inherited from + +SandwichFile.tagTypes ___ ### tagTypesOnDisk -• `get` **tagTypesOnDisk**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypesOnDisk**(): [`TagTypes`](../enums/TagTypes.md) + +Gets the tag types contained in the physical file represented by the current instance. + +#### Returns + +[`TagTypes`](../enums/TagTypes.md) + +#### Inherited from + +SandwichFile.tagTypesOnDisk + +• `set` **tagTypesOnDisk**(`value`): `void` Gets the tag types contained in the physical file represented by the current instance. +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | [`TagTypes`](../enums/TagTypes.md) | + #### Returns -[`TagTypes`](../enums/tagtypes.md) +`void` + +#### Inherited from + +SandwichFile.tagTypesOnDisk ___ @@ -355,6 +427,10 @@ Gets the buffer size to use when reading large blocks of data `number` +#### Inherited from + +SandwichFile.bufferSize + ## Methods ### dispose @@ -386,9 +462,9 @@ Searches forward through a file for a specified pattern, starting at a specified | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | `undefined` | Pattern to search for in the current instance. Must be smaller than the | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern to search for in the current instance. Must be smaller than the | | `startPosition` | `number` | `0` | Seek position to start searching. Must be positive, safe integer. | -| `before?` | [`ByteVector`](bytevector.md) | `undefined` | Optional pattern that the searched for pattern must appear before. If this pattern is found first, `-1` is returned. | +| `before?` | [`ByteVector`](ByteVector.md) | `undefined` | Optional pattern that the searched for pattern must appear before. If this pattern is found first, `-1` is returned. | #### Returns @@ -404,7 +480,7 @@ ___ ### getTag -▸ **getTag**(`type`, `create`): [`Tag`](tag.md) +▸ **getTag**(`type`, `create`): [`Tag`](Tag.md) **`inheritdoc`** @@ -412,12 +488,12 @@ ___ | Name | Type | | :------ | :------ | -| `type` | [`TagTypes`](../enums/tagtypes.md) | +| `type` | [`TagTypes`](../enums/TagTypes.md) | | `create` | `boolean` | #### Returns -[`Tag`](tag.md) +[`Tag`](Tag.md) #### Inherited from @@ -439,7 +515,7 @@ specified location, replacing a specified number of bytes. | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | `undefined` | Data to insert into the file. | +| `data` | [`ByteVector`](ByteVector.md) | `undefined` | Data to insert into the file. | | `start` | `number` | `undefined` | Index into the file at which to insert the data. Must be safe positive integer. | | `replace` | `number` | `0` | Number of bytes to replace. Typically this is the original size of the data block so that a new block will replace the old one. | @@ -504,7 +580,7 @@ Searches backwards through a file for a specified pattern, starting at a specifi | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | `undefined` | Pattern to search for in the current instance. Must be shorter than the [bufferSize](mpegaudiofile.md#buffersize) | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern to search for in the current instance. Must be shorter than the [bufferSize](MpegAudioFile.md#buffersize) | | `startPosition` | `number` | `0` | Number of bytes from end of the file to begin searching. | #### Returns @@ -521,11 +597,11 @@ ___ ### readBlock -▸ **readBlock**(`length`): [`ByteVector`](bytevector.md) +▸ **readBlock**(`length`): [`ByteVector`](ByteVector.md) Reads a specified number of bytes at the current seek position from the current position. This method reads the block of data at the current seek position. To change the seek -position, use [File.seek](file.md#seek). +position, use [File.seek](File.md#seek). **`throws`** Error Thrown when `length` is not a positive, safe integer. @@ -537,7 +613,7 @@ position, use [File.seek](file.md#seek). #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ByteVector Object containing the data read from the current instance. @@ -549,17 +625,17 @@ ___ ### readProperties -▸ `Protected` **readProperties**(`readStyle`): [`Properties`](properties.md) +▸ `Protected` **readProperties**(`readStyle`): [`Properties`](Properties.md) #### Parameters | Name | Type | | :------ | :------ | -| `readStyle` | [`ReadStyle`](../enums/readstyle.md) | +| `readStyle` | [`ReadStyle`](../enums/ReadStyle.md) | #### Returns -[`Properties`](properties.md) +[`Properties`](Properties.md) #### Overrides @@ -603,7 +679,7 @@ ___ | Name | Type | | :------ | :------ | -| `types` | [`TagTypes`](../enums/tagtypes.md) | +| `types` | [`TagTypes`](../enums/TagTypes.md) | #### Returns @@ -640,10 +716,10 @@ specified origin. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `offset` | `number` | Byte offset to seek to. Must be a safe, positive integer. | -| `origin` | `SeekOrigin` | Origin from which to seek | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `offset` | `number` | `undefined` | Byte offset to seek to. Must be a safe, positive integer. | +| `origin` | `SeekOrigin` | `SeekOrigin.Begin` | Origin from which to seek | #### Returns @@ -691,7 +767,7 @@ the file if writing past the current end. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | ByteVector containing data to the current instance. | +| `data` | [`ByteVector`](ByteVector.md) | ByteVector containing data to the current instance. | #### Returns @@ -707,7 +783,7 @@ ___ ▸ `Static` **addFileType**(`mimeType`, `constructor`, `override?`): `void` -Registers the constructor for a subclass of [File](file.md) with the MimeType it is associated +Registers the constructor for a subclass of [File](File.md) with the MimeType it is associated with. Optionally, the MimeType can be forcefully overridden if it was already registered. #### Parameters @@ -715,8 +791,8 @@ with. Optionally, the MimeType can be forcefully overridden if it was already re | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | | `mimeType` | `string` | `undefined` | MimeType to register this subclass constructor to. | -| `constructor` | [`FileTypeConstructor`](../modules.md#filetypeconstructor) | `undefined` | Constructor for a subclass of [File](file.md) that will be called if a file with a MimeType of `mimeType` is created. | -| `override` | `boolean` | `false` | If `true` and a subclass of [File](file.md) was already registered to `mimeType`, it will be forcefully overridden. If `false`, an {@link Error} will be thrown if a subclass already registered to the MimeType.} | +| `constructor` | [`FileTypeConstructor`](../modules.md#filetypeconstructor) | `undefined` | Constructor for a subclass of [File](File.md) that will be called if a file with a MimeType of `mimeType` is created. | +| `override` | `boolean` | `false` | If `true` and a subclass of [File](File.md) was already registered to `mimeType`, it will be forcefully overridden. If `false`, an {@link Error} will be thrown if a subclass already registered to the MimeType.} | #### Returns @@ -738,7 +814,7 @@ Registers a [FileTypeResolver](../modules.md#filetyperesolver) to the front of t | Name | Type | Description | | :------ | :------ | :------ | -| `resolver` | [`FileTypeResolver`](../modules.md#filetyperesolver) | Function to handle resolving a subclass of [File](file.md) from an {@link IFileAbstraction} | +| `resolver` | [`FileTypeResolver`](../modules.md#filetyperesolver) | Function to handle resolving a subclass of [File](File.md) from an {@link IFileAbstraction} | #### Returns @@ -752,24 +828,24 @@ ___ ### createFromAbstraction -▸ `Static` **createFromAbstraction**(`abstraction`, `mimeType?`, `propertiesStyle?`): [`File`](file.md) +▸ `Static` **createFromAbstraction**(`abstraction`, `mimeType?`, `propertiesStyle?`): [`File`](File.md) -Creates a new instance of a [File](file.md) subclass for a specified file abstraction, MimeType, +Creates a new instance of a [File](File.md) subclass for a specified file abstraction, MimeType, and property read style. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `abstraction` | `IFileAbstraction` | Object to use when reading/writing from the current instance. | -| `mimeType?` | `string` | Optional, MimeType to use for determining the subclass of [File](file.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | Optional, level of detail to use when reading the media information from the new instance. If omitted, [ReadStyle.Average](../enums/readstyle.md#average) is used. | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `abstraction` | `IFileAbstraction` | `undefined` | Object to use when reading/writing from the current instance. | +| `mimeType?` | `string` | `undefined` | Optional, MimeType to use for determining the subclass of [File](File.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | `ReadStyle.Average` | Optional, level of detail to use when reading the media information from the new instance. If omitted, [ReadStyle.Average](../enums/ReadStyle.md#average) is used. | #### Returns -[`File`](file.md) +[`File`](File.md) -New instance of [File](file.md) as read from the specified abstraction. +New instance of [File](File.md) as read from the specified abstraction. #### Inherited from @@ -779,24 +855,24 @@ ___ ### createFromPath -▸ `Static` **createFromPath**(`filePath`, `mimeType?`, `propertiesStyle?`): [`File`](file.md) +▸ `Static` **createFromPath**(`filePath`, `mimeType?`, `propertiesStyle?`): [`File`](File.md) -Creates a new instance of [File](file.md) subclass for a specified file path, MimeType, and +Creates a new instance of [File](File.md) subclass for a specified file path, MimeType, and property read style. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `filePath` | `string` | Path to the file to read/write. | -| `mimeType?` | `string` | Optional, MimeType to use for determining the subclass of [File](file.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | Optional, level of detail to use when reading the media information from the new instance. If omitted [ReadStyle.Average](../enums/readstyle.md#average) is used. | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `filePath` | `string` | `undefined` | Path to the file to read/write. | +| `mimeType?` | `string` | `undefined` | Optional, MimeType to use for determining the subclass of [File](File.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | `ReadStyle.Average` | Optional, level of detail to use when reading the media information from the new instance. If omitted [ReadStyle.Average](../enums/ReadStyle.md#average) is used. | #### Returns -[`File`](file.md) +[`File`](File.md) -New instance of [File](file.md) as read from the specified path. +New instance of [File](File.md) as read from the specified path. #### Inherited from diff --git a/docs/classes/mpegaudioheader.md b/docs/classes/MpegAudioHeader.md similarity index 58% rename from docs/classes/mpegaudioheader.md rename to docs/classes/MpegAudioHeader.md index 88ea3ee1..26c8baab 100644 --- a/docs/classes/mpegaudioheader.md +++ b/docs/classes/MpegAudioHeader.md @@ -7,45 +7,45 @@ header, see http://www.mpgedit.org/mpgedit/mpeg_format/mpeghdr.htm ## Implements -- [`IAudioCodec`](../interfaces/iaudiocodec.md) +- [`IAudioCodec`](../interfaces/IAudioCodec.md) ## Table of contents ### Properties -- [Unknown](mpegaudioheader.md#unknown) +- [UNKNOWN](MpegAudioHeader.md#unknown) ### Accessors -- [audioBitrate](mpegaudioheader.md#audiobitrate) -- [audioChannels](mpegaudioheader.md#audiochannels) -- [audioFrameLength](mpegaudioheader.md#audioframelength) -- [audioLayer](mpegaudioheader.md#audiolayer) -- [audioSampleRate](mpegaudioheader.md#audiosamplerate) -- [channelMode](mpegaudioheader.md#channelmode) -- [description](mpegaudioheader.md#description) -- [durationMilliseconds](mpegaudioheader.md#durationmilliseconds) -- [isCopyrighted](mpegaudioheader.md#iscopyrighted) -- [isOriginal](mpegaudioheader.md#isoriginal) -- [isPadded](mpegaudioheader.md#ispadded) -- [isProtected](mpegaudioheader.md#isprotected) -- [mediaTypes](mpegaudioheader.md#mediatypes) -- [streamLength](mpegaudioheader.md#streamlength) -- [vbriHeader](mpegaudioheader.md#vbriheader) -- [version](mpegaudioheader.md#version) -- [xingHeader](mpegaudioheader.md#xingheader) +- [audioBitrate](MpegAudioHeader.md#audiobitrate) +- [audioChannels](MpegAudioHeader.md#audiochannels) +- [audioFrameLength](MpegAudioHeader.md#audioframelength) +- [audioLayer](MpegAudioHeader.md#audiolayer) +- [audioSampleRate](MpegAudioHeader.md#audiosamplerate) +- [channelMode](MpegAudioHeader.md#channelmode) +- [description](MpegAudioHeader.md#description) +- [durationMilliseconds](MpegAudioHeader.md#durationmilliseconds) +- [isCopyrighted](MpegAudioHeader.md#iscopyrighted) +- [isOriginal](MpegAudioHeader.md#isoriginal) +- [isPadded](MpegAudioHeader.md#ispadded) +- [isProtected](MpegAudioHeader.md#isprotected) +- [mediaTypes](MpegAudioHeader.md#mediatypes) +- [streamLength](MpegAudioHeader.md#streamlength) +- [vbriHeader](MpegAudioHeader.md#vbriheader) +- [version](MpegAudioHeader.md#version) +- [xingHeader](MpegAudioHeader.md#xingheader) ### Methods -- [find](mpegaudioheader.md#find) -- [fromData](mpegaudioheader.md#fromdata) -- [fromInfo](mpegaudioheader.md#frominfo) +- [find](MpegAudioHeader.md#find) +- [fromData](MpegAudioHeader.md#fromdata) +- [fromInfo](MpegAudioHeader.md#frominfo) ## Properties -### Unknown +### UNKNOWN -▪ `Static` `Readonly` **Unknown**: [`MpegAudioHeader`](mpegaudioheader.md) +▪ `Static` `Readonly` **UNKNOWN**: [`MpegAudioHeader`](MpegAudioHeader.md) ## Accessors @@ -61,7 +61,7 @@ Bitrate of the audio in kilobits per second represented by the current instance. #### Implementation of -[IAudioCodec](../interfaces/iaudiocodec.md).[audioBitrate](../interfaces/iaudiocodec.md#audiobitrate) +[IAudioCodec](../interfaces/IAudioCodec.md).[audioBitrate](../interfaces/IAudioCodec.md#audiobitrate) ___ @@ -77,7 +77,7 @@ Number of channels in the audio represented by the current instance. #### Implementation of -[IAudioCodec](../interfaces/iaudiocodec.md).[audioChannels](../interfaces/iaudiocodec.md#audiochannels) +[IAudioCodec](../interfaces/IAudioCodec.md).[audioChannels](../interfaces/IAudioCodec.md#audiochannels) ___ @@ -117,19 +117,19 @@ Sample rate of the audio represented by the current instance. #### Implementation of -[IAudioCodec](../interfaces/iaudiocodec.md).[audioSampleRate](../interfaces/iaudiocodec.md#audiosamplerate) +[IAudioCodec](../interfaces/IAudioCodec.md).[audioSampleRate](../interfaces/IAudioCodec.md#audiosamplerate) ___ ### channelMode -• `get` **channelMode**(): [`MpegAudioChannelMode`](../enums/mpegaudiochannelmode.md) +• `get` **channelMode**(): [`MpegAudioChannelMode`](../enums/MpegAudioChannelMode.md) Gets the MPEG audio channel mode of the audio represented by the current instance. #### Returns -[`MpegAudioChannelMode`](../enums/mpegaudiochannelmode.md) +[`MpegAudioChannelMode`](../enums/MpegAudioChannelMode.md) ___ @@ -145,7 +145,7 @@ Gets a text description of the media represented by the current instance. #### Implementation of -[IAudioCodec](../interfaces/iaudiocodec.md).[description](../interfaces/iaudiocodec.md#description) +[IAudioCodec](../interfaces/IAudioCodec.md).[description](../interfaces/IAudioCodec.md#description) ___ @@ -161,7 +161,7 @@ Duration of the media in milliseconds represented by the current instance. #### Implementation of -[IAudioCodec](../interfaces/iaudiocodec.md).[durationMilliseconds](../interfaces/iaudiocodec.md#durationmilliseconds) +[IAudioCodec](../interfaces/IAudioCodec.md).[durationMilliseconds](../interfaces/IAudioCodec.md#durationmilliseconds) ___ @@ -215,17 +215,17 @@ ___ ### mediaTypes -• `get` **mediaTypes**(): [`MediaTypes`](../enums/mediatypes.md) +• `get` **mediaTypes**(): [`MediaTypes`](../enums/MediaTypes.md) Types of media represented by the current instance, bitwise combined. #### Returns -[`MediaTypes`](../enums/mediatypes.md) +[`MediaTypes`](../enums/MediaTypes.md) #### Implementation of -[IAudioCodec](../interfaces/iaudiocodec.md).[mediaTypes](../interfaces/iaudiocodec.md#mediatypes) +[IAudioCodec](../interfaces/IAudioCodec.md).[mediaTypes](../interfaces/IAudioCodec.md#mediatypes) ___ @@ -234,7 +234,7 @@ ___ • `set` **streamLength**(`value`): `void` Sets the length of the audio stream represented by the current instance. -If this value has not been set, [durationMilliseconds](mpegaudioheader.md#durationmilliseconds) will return an incorrect value. +If this value has not been set, [durationMilliseconds](MpegAudioHeader.md#durationmilliseconds) will return an incorrect value. **`internal`** This is intended to be set when the file is read. @@ -252,45 +252,45 @@ ___ ### vbriHeader -• `get` **vbriHeader**(): [`MpegVbriHeader`](mpegvbriheader.md) +• `get` **vbriHeader**(): [`MpegVbriHeader`](MpegVbriHeader.md) -Gets the VBRI header found in the audio. {@link VbriHeader.unknown} is returned if no header +Gets the VBRI header found in the audio. {@link VbriHeader.UNKNOWN} is returned if no header was found. #### Returns -[`MpegVbriHeader`](mpegvbriheader.md) +[`MpegVbriHeader`](MpegVbriHeader.md) ___ ### version -• `get` **version**(): [`MpegVersion`](../enums/mpegversion.md) +• `get` **version**(): [`MpegVersion`](../enums/MpegVersion.md) Gets the MPEG version used to encode the audio represented by the current instance. #### Returns -[`MpegVersion`](../enums/mpegversion.md) +[`MpegVersion`](../enums/MpegVersion.md) ___ ### xingHeader -• `get` **xingHeader**(): [`MpegXingHeader`](mpegxingheader.md) +• `get` **xingHeader**(): [`MpegXingHeader`](MpegXingHeader.md) -Gets the Xing header found in the audio. {@link XingHeader.unknown} is returned if no header +Gets the Xing header found in the audio. {@link XingHeader.UNKNOWN} is returned if no header was found. #### Returns -[`MpegXingHeader`](mpegxingheader.md) +[`MpegXingHeader`](MpegXingHeader.md) ## Methods ### find -▸ `Static` **find**(`file`, `position`, `length?`): [`MpegAudioHeader`](mpegaudioheader.md) +▸ `Static` **find**(`file`, `position`, `length?`): [`MpegAudioHeader`](MpegAudioHeader.md) Searches for an audio header in a file starting at a specified position and searching through a specified number of bytes. @@ -299,13 +299,13 @@ through a specified number of bytes. | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File to search | +| `file` | [`File`](File.md) | File to search | | `position` | `number` | Position in `file` at which to start searching | | `length?` | `number` | Maximum number of bytes to search before giving up. Defaults to `-1` to have no maximum | #### Returns -[`MpegAudioHeader`](mpegaudioheader.md) +[`MpegAudioHeader`](MpegAudioHeader.md) the header that was found or `undefined` if a header was not found @@ -313,29 +313,29 @@ ___ ### fromData -▸ `Static` **fromData**(`data`, `file`, `position`): [`MpegAudioHeader`](mpegaudioheader.md) +▸ `Static` **fromData**(`data`, `file`, `position`): [`MpegAudioHeader`](MpegAudioHeader.md) Constructs and initializes a new instance by reading its contents from a data -[ByteVector](bytevector.md) and its Xing header from the appropriate location in the +[ByteVector](ByteVector.md) and its Xing header from the appropriate location in the specified file. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | The header data to read | -| `file` | [`File`](file.md) | File to read the Xing/VBRI header from | +| `data` | [`ByteVector`](ByteVector.md) | The header data to read | +| `file` | [`File`](File.md) | File to read the Xing/VBRI header from | | `position` | `number` | Position into `file` where the header begins, must be a positive 8-bit integer. | #### Returns -[`MpegAudioHeader`](mpegaudioheader.md) +[`MpegAudioHeader`](MpegAudioHeader.md) ___ ### fromInfo -▸ `Static` **fromInfo**(`flags`, `streamLength`, `xingHeader`, `vbriHeader`): [`MpegAudioHeader`](mpegaudioheader.md) +▸ `Static` **fromInfo**(`flags`, `streamLength`, `xingHeader`, `vbriHeader`): [`MpegAudioHeader`](MpegAudioHeader.md) Constructs and initializes a new instance by populating it with specified values. @@ -345,9 +345,9 @@ Constructs and initializes a new instance by populating it with specified values | :------ | :------ | :------ | | `flags` | `number` | Flags for the new instance | | `streamLength` | `number` | Stream length of the new instance | -| `xingHeader` | [`MpegXingHeader`](mpegxingheader.md) | Xing header associated with the new instance | -| `vbriHeader` | [`MpegVbriHeader`](mpegvbriheader.md) | VBRI header associated with the new instance | +| `xingHeader` | [`MpegXingHeader`](MpegXingHeader.md) | Xing header associated with the new instance | +| `vbriHeader` | [`MpegVbriHeader`](MpegVbriHeader.md) | VBRI header associated with the new instance | #### Returns -[`MpegAudioHeader`](mpegaudioheader.md) +[`MpegAudioHeader`](MpegAudioHeader.md) diff --git a/docs/classes/mpegcontainerfile.md b/docs/classes/MpegContainerFile.md similarity index 63% rename from docs/classes/mpegcontainerfile.md rename to docs/classes/MpegContainerFile.md index 205197cd..2365f22f 100644 --- a/docs/classes/mpegcontainerfile.md +++ b/docs/classes/MpegContainerFile.md @@ -5,14 +5,14 @@ This class extends {@link SandwichFile} to provide tagging and properties support for MPEG-1, MPEG-2, and MPEG-2.5 containerized video files. -**`remarks`** A [Id3v1Tag](id3v1tag.md) and [Id3v2Tag](id3v2tag.md) will be added automatically to any file that +**`remarks`** A [Id3v1Tag](Id3v1Tag.md) and [Id3v2Tag](Id3v2Tag.md) will be added automatically to any file that does not contain one. This change does not affect the file until it is saved and can be reversed using the following method: `file.removeTags(file.tagTypes & ~file.tagTypesOnDisk);` ## Hierarchy -- `SandwichFile` +- `default` ↳ **`MpegContainerFile`** @@ -20,58 +20,53 @@ MPEG-1, MPEG-2, and MPEG-2.5 containerized video files. ### Constructors -- [constructor](mpegcontainerfile.md#constructor) - -### Properties - -- [\_fileAbstraction](mpegcontainerfile.md#_fileabstraction) -- [\_fileStream](mpegcontainerfile.md#_filestream) -- [\_tagTypesOnDisk](mpegcontainerfile.md#_tagtypesondisk) +- [constructor](MpegContainerFile.md#constructor) ### Accessors -- [corruptionReasons](mpegcontainerfile.md#corruptionreasons) -- [endTag](mpegcontainerfile.md#endtag) -- [fileAbstraction](mpegcontainerfile.md#fileabstraction) -- [isPossiblyCorrupt](mpegcontainerfile.md#ispossiblycorrupt) -- [isWritable](mpegcontainerfile.md#iswritable) -- [length](mpegcontainerfile.md#length) -- [mediaEndPosition](mpegcontainerfile.md#mediaendposition) -- [mediaStartPosition](mpegcontainerfile.md#mediastartposition) -- [mimeType](mpegcontainerfile.md#mimetype) -- [mode](mpegcontainerfile.md#mode) -- [name](mpegcontainerfile.md#name) -- [position](mpegcontainerfile.md#position) -- [properties](mpegcontainerfile.md#properties) -- [startTag](mpegcontainerfile.md#starttag) -- [tag](mpegcontainerfile.md#tag) -- [tagTypes](mpegcontainerfile.md#tagtypes) -- [tagTypesOnDisk](mpegcontainerfile.md#tagtypesondisk) -- [bufferSize](mpegcontainerfile.md#buffersize) +- [corruptionReasons](MpegContainerFile.md#corruptionreasons) +- [endTag](MpegContainerFile.md#endtag) +- [fileAbstraction](MpegContainerFile.md#fileabstraction) +- [hasTags](MpegContainerFile.md#hastags) +- [isPossiblyCorrupt](MpegContainerFile.md#ispossiblycorrupt) +- [isWritable](MpegContainerFile.md#iswritable) +- [length](MpegContainerFile.md#length) +- [mediaEndPosition](MpegContainerFile.md#mediaendposition) +- [mediaStartPosition](MpegContainerFile.md#mediastartposition) +- [mimeType](MpegContainerFile.md#mimetype) +- [mode](MpegContainerFile.md#mode) +- [name](MpegContainerFile.md#name) +- [position](MpegContainerFile.md#position) +- [properties](MpegContainerFile.md#properties) +- [startTag](MpegContainerFile.md#starttag) +- [tag](MpegContainerFile.md#tag) +- [tagTypes](MpegContainerFile.md#tagtypes) +- [tagTypesOnDisk](MpegContainerFile.md#tagtypesondisk) +- [bufferSize](MpegContainerFile.md#buffersize) ### Methods -- [dispose](mpegcontainerfile.md#dispose) -- [find](mpegcontainerfile.md#find) -- [getTag](mpegcontainerfile.md#gettag) -- [insert](mpegcontainerfile.md#insert) -- [markAsCorrupt](mpegcontainerfile.md#markascorrupt) -- [preSave](mpegcontainerfile.md#presave) -- [rFind](mpegcontainerfile.md#rfind) -- [readBlock](mpegcontainerfile.md#readblock) -- [readProperties](mpegcontainerfile.md#readproperties) -- [removeBlock](mpegcontainerfile.md#removeblock) -- [removeTags](mpegcontainerfile.md#removetags) -- [save](mpegcontainerfile.md#save) -- [seek](mpegcontainerfile.md#seek) -- [truncate](mpegcontainerfile.md#truncate) -- [writeBlock](mpegcontainerfile.md#writeblock) -- [addFileType](mpegcontainerfile.md#addfiletype) -- [addFileTypeResolver](mpegcontainerfile.md#addfiletyperesolver) -- [createFromAbstraction](mpegcontainerfile.md#createfromabstraction) -- [createFromPath](mpegcontainerfile.md#createfrompath) -- [removeFileType](mpegcontainerfile.md#removefiletype) -- [removeFileTypeResolver](mpegcontainerfile.md#removefiletyperesolver) +- [dispose](MpegContainerFile.md#dispose) +- [find](MpegContainerFile.md#find) +- [getTag](MpegContainerFile.md#gettag) +- [insert](MpegContainerFile.md#insert) +- [markAsCorrupt](MpegContainerFile.md#markascorrupt) +- [preSave](MpegContainerFile.md#presave) +- [rFind](MpegContainerFile.md#rfind) +- [readBlock](MpegContainerFile.md#readblock) +- [readProperties](MpegContainerFile.md#readproperties) +- [removeBlock](MpegContainerFile.md#removeblock) +- [removeTags](MpegContainerFile.md#removetags) +- [save](MpegContainerFile.md#save) +- [seek](MpegContainerFile.md#seek) +- [truncate](MpegContainerFile.md#truncate) +- [writeBlock](MpegContainerFile.md#writeblock) +- [addFileType](MpegContainerFile.md#addfiletype) +- [addFileTypeResolver](MpegContainerFile.md#addfiletyperesolver) +- [createFromAbstraction](MpegContainerFile.md#createfromabstraction) +- [createFromPath](MpegContainerFile.md#createfrompath) +- [removeFileType](MpegContainerFile.md#removefiletype) +- [removeFileTypeResolver](MpegContainerFile.md#removefiletyperesolver) ## Constructors @@ -84,42 +79,12 @@ MPEG-1, MPEG-2, and MPEG-2.5 containerized video files. | Name | Type | | :------ | :------ | | `file` | `string` \| `IFileAbstraction` | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | #### Overrides SandwichFile.constructor -## Properties - -### \_fileAbstraction - -• `Protected` **\_fileAbstraction**: `IFileAbstraction` - -#### Inherited from - -SandwichFile.\_fileAbstraction - -___ - -### \_fileStream - -• `Protected` **\_fileStream**: `IStream` - -#### Inherited from - -SandwichFile.\_fileStream - -___ - -### \_tagTypesOnDisk - -• `Protected` **\_tagTypesOnDisk**: [`TagTypes`](../enums/tagtypes.md) - -#### Inherited from - -SandwichFile.\_tagTypesOnDisk - ## Accessors ### corruptionReasons @@ -132,6 +97,10 @@ Reasons for which this file is marked as corrupt. `string`[] +#### Inherited from + +SandwichFile.corruptionReasons + ___ ### endTag @@ -144,6 +113,10 @@ Gets the collection of tags appearing at the end of the file. `default` +#### Inherited from + +SandwichFile.endTag + ___ ### fileAbstraction @@ -156,6 +129,27 @@ Gets the {@link IFileAbstraction} representing the file. `IFileAbstraction` +#### Inherited from + +SandwichFile.fileAbstraction + +___ + +### hasTags + +• `get` **hasTags**(): `boolean` + +Shortcut property to determine if a file has tags in memory. +NOTE: Just because `tag !== undefined` does not mean there are tags in memory. + +#### Returns + +`boolean` + +#### Inherited from + +SandwichFile.hasTags + ___ ### isPossiblyCorrupt @@ -169,6 +163,10 @@ be written. `boolean` +#### Inherited from + +SandwichFile.isPossiblyCorrupt + ___ ### isWritable @@ -181,6 +179,10 @@ Indicates whether or not tags can be written back to the current file. `boolean` +#### Inherited from + +SandwichFile.isWritable + ___ ### length @@ -194,30 +196,42 @@ is not open for reading; `number` +#### Inherited from + +SandwichFile.length + ___ ### mediaEndPosition • `get` **mediaEndPosition**(): `number` -Gets the position at which the media content of this file ends. +**`inheritdoc`** #### Returns `number` +#### Inherited from + +SandwichFile.mediaEndPosition + ___ ### mediaStartPosition • `get` **mediaStartPosition**(): `number` -Gets the position at which the media content of this file starts. +**`inheritdoc`** #### Returns `number` +#### Inherited from + +SandwichFile.mediaStartPosition + ___ ### mimeType @@ -230,34 +244,46 @@ Gets the MimeType of the file as determined during creation of the instance. `string` +#### Inherited from + +SandwichFile.mimeType + ___ ### mode -• `get` **mode**(): [`FileAccessMode`](../enums/fileaccessmode.md) +• `get` **mode**(): [`FileAccessMode`](../enums/FileAccessMode.md) Gets the file access mode in use by the current instance. #### Returns -[`FileAccessMode`](../enums/fileaccessmode.md) +[`FileAccessMode`](../enums/FileAccessMode.md) + +#### Inherited from + +SandwichFile.mode • `set` **mode**(`val`): `void` Sets the file access mode in use by the current instance. Changing the value will cause the stream currently in use to be closed, except when a change is made from -[FileAccessMode.Write](../enums/fileaccessmode.md#write) to [FileAccessMode.Read](../enums/fileaccessmode.md#read) which has no effect. +[FileAccessMode.Write](../enums/FileAccessMode.md#write) to [FileAccessMode.Read](../enums/FileAccessMode.md#read) which has no effect. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `val` | [`FileAccessMode`](../enums/fileaccessmode.md) | File access mode to change to | +| `val` | [`FileAccessMode`](../enums/FileAccessMode.md) | File access mode to change to | #### Returns `void` +#### Inherited from + +SandwichFile.mode + ___ ### name @@ -270,6 +296,10 @@ Gets the name of the file as stored in its file abstraction. `string` +#### Inherited from + +SandwichFile.name + ___ ### position @@ -283,17 +313,25 @@ if the file is not open for reading `number` +#### Inherited from + +SandwichFile.position + ___ ### properties -• `get` **properties**(): [`Properties`](properties.md) +• `get` **properties**(): [`Properties`](Properties.md) Gets the media properties of the file represented by the current instance. #### Returns -[`Properties`](properties.md) +[`Properties`](Properties.md) + +#### Inherited from + +SandwichFile.properties ___ @@ -307,6 +345,10 @@ Gets the collection of tags appearing at the start of the file. `default` +#### Inherited from + +SandwichFile.startTag + ___ ### tag @@ -319,29 +361,59 @@ Gets an abstract representation of all tags stored in the current instance. `default` +#### Inherited from + +SandwichFile.tag + ___ ### tagTypes -• `get` **tagTypes**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypes**(): [`TagTypes`](../enums/TagTypes.md) Gets the tag types contained in the current instance. #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) + +#### Inherited from + +SandwichFile.tagTypes ___ ### tagTypesOnDisk -• `get` **tagTypesOnDisk**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypesOnDisk**(): [`TagTypes`](../enums/TagTypes.md) + +Gets the tag types contained in the physical file represented by the current instance. + +#### Returns + +[`TagTypes`](../enums/TagTypes.md) + +#### Inherited from + +SandwichFile.tagTypesOnDisk + +• `set` **tagTypesOnDisk**(`value`): `void` Gets the tag types contained in the physical file represented by the current instance. +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | [`TagTypes`](../enums/TagTypes.md) | + #### Returns -[`TagTypes`](../enums/tagtypes.md) +`void` + +#### Inherited from + +SandwichFile.tagTypesOnDisk ___ @@ -355,6 +427,10 @@ Gets the buffer size to use when reading large blocks of data `number` +#### Inherited from + +SandwichFile.bufferSize + ## Methods ### dispose @@ -386,9 +462,9 @@ Searches forward through a file for a specified pattern, starting at a specified | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | `undefined` | Pattern to search for in the current instance. Must be smaller than the | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern to search for in the current instance. Must be smaller than the | | `startPosition` | `number` | `0` | Seek position to start searching. Must be positive, safe integer. | -| `before?` | [`ByteVector`](bytevector.md) | `undefined` | Optional pattern that the searched for pattern must appear before. If this pattern is found first, `-1` is returned. | +| `before?` | [`ByteVector`](ByteVector.md) | `undefined` | Optional pattern that the searched for pattern must appear before. If this pattern is found first, `-1` is returned. | #### Returns @@ -404,7 +480,7 @@ ___ ### getTag -▸ **getTag**(`type`, `create`): [`Tag`](tag.md) +▸ **getTag**(`type`, `create`): [`Tag`](Tag.md) **`inheritdoc`** @@ -412,12 +488,12 @@ ___ | Name | Type | | :------ | :------ | -| `type` | [`TagTypes`](../enums/tagtypes.md) | +| `type` | [`TagTypes`](../enums/TagTypes.md) | | `create` | `boolean` | #### Returns -[`Tag`](tag.md) +[`Tag`](Tag.md) #### Inherited from @@ -439,7 +515,7 @@ specified location, replacing a specified number of bytes. | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | `undefined` | Data to insert into the file. | +| `data` | [`ByteVector`](ByteVector.md) | `undefined` | Data to insert into the file. | | `start` | `number` | `undefined` | Index into the file at which to insert the data. Must be safe positive integer. | | `replace` | `number` | `0` | Number of bytes to replace. Typically this is the original size of the data block so that a new block will replace the old one. | @@ -504,7 +580,7 @@ Searches backwards through a file for a specified pattern, starting at a specifi | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | `undefined` | Pattern to search for in the current instance. Must be shorter than the [bufferSize](mpegcontainerfile.md#buffersize) | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern to search for in the current instance. Must be shorter than the [bufferSize](MpegContainerFile.md#buffersize) | | `startPosition` | `number` | `0` | Number of bytes from end of the file to begin searching. | #### Returns @@ -521,11 +597,11 @@ ___ ### readBlock -▸ **readBlock**(`length`): [`ByteVector`](bytevector.md) +▸ **readBlock**(`length`): [`ByteVector`](ByteVector.md) Reads a specified number of bytes at the current seek position from the current position. This method reads the block of data at the current seek position. To change the seek -position, use [File.seek](file.md#seek). +position, use [File.seek](File.md#seek). **`throws`** Error Thrown when `length` is not a positive, safe integer. @@ -537,7 +613,7 @@ position, use [File.seek](file.md#seek). #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ByteVector Object containing the data read from the current instance. @@ -549,7 +625,7 @@ ___ ### readProperties -▸ `Protected` **readProperties**(`readStyle`): [`Properties`](properties.md) +▸ `Protected` **readProperties**(`readStyle`): [`Properties`](Properties.md) **`inheritdoc`** @@ -557,11 +633,11 @@ ___ | Name | Type | | :------ | :------ | -| `readStyle` | [`ReadStyle`](../enums/readstyle.md) | +| `readStyle` | [`ReadStyle`](../enums/ReadStyle.md) | #### Returns -[`Properties`](properties.md) +[`Properties`](Properties.md) #### Overrides @@ -605,7 +681,7 @@ ___ | Name | Type | | :------ | :------ | -| `types` | [`TagTypes`](../enums/tagtypes.md) | +| `types` | [`TagTypes`](../enums/TagTypes.md) | #### Returns @@ -642,10 +718,10 @@ specified origin. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `offset` | `number` | Byte offset to seek to. Must be a safe, positive integer. | -| `origin` | `SeekOrigin` | Origin from which to seek | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `offset` | `number` | `undefined` | Byte offset to seek to. Must be a safe, positive integer. | +| `origin` | `SeekOrigin` | `SeekOrigin.Begin` | Origin from which to seek | #### Returns @@ -693,7 +769,7 @@ the file if writing past the current end. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | ByteVector containing data to the current instance. | +| `data` | [`ByteVector`](ByteVector.md) | ByteVector containing data to the current instance. | #### Returns @@ -709,7 +785,7 @@ ___ ▸ `Static` **addFileType**(`mimeType`, `constructor`, `override?`): `void` -Registers the constructor for a subclass of [File](file.md) with the MimeType it is associated +Registers the constructor for a subclass of [File](File.md) with the MimeType it is associated with. Optionally, the MimeType can be forcefully overridden if it was already registered. #### Parameters @@ -717,8 +793,8 @@ with. Optionally, the MimeType can be forcefully overridden if it was already re | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | | `mimeType` | `string` | `undefined` | MimeType to register this subclass constructor to. | -| `constructor` | [`FileTypeConstructor`](../modules.md#filetypeconstructor) | `undefined` | Constructor for a subclass of [File](file.md) that will be called if a file with a MimeType of `mimeType` is created. | -| `override` | `boolean` | `false` | If `true` and a subclass of [File](file.md) was already registered to `mimeType`, it will be forcefully overridden. If `false`, an {@link Error} will be thrown if a subclass already registered to the MimeType.} | +| `constructor` | [`FileTypeConstructor`](../modules.md#filetypeconstructor) | `undefined` | Constructor for a subclass of [File](File.md) that will be called if a file with a MimeType of `mimeType` is created. | +| `override` | `boolean` | `false` | If `true` and a subclass of [File](File.md) was already registered to `mimeType`, it will be forcefully overridden. If `false`, an {@link Error} will be thrown if a subclass already registered to the MimeType.} | #### Returns @@ -740,7 +816,7 @@ Registers a [FileTypeResolver](../modules.md#filetyperesolver) to the front of t | Name | Type | Description | | :------ | :------ | :------ | -| `resolver` | [`FileTypeResolver`](../modules.md#filetyperesolver) | Function to handle resolving a subclass of [File](file.md) from an {@link IFileAbstraction} | +| `resolver` | [`FileTypeResolver`](../modules.md#filetyperesolver) | Function to handle resolving a subclass of [File](File.md) from an {@link IFileAbstraction} | #### Returns @@ -754,24 +830,24 @@ ___ ### createFromAbstraction -▸ `Static` **createFromAbstraction**(`abstraction`, `mimeType?`, `propertiesStyle?`): [`File`](file.md) +▸ `Static` **createFromAbstraction**(`abstraction`, `mimeType?`, `propertiesStyle?`): [`File`](File.md) -Creates a new instance of a [File](file.md) subclass for a specified file abstraction, MimeType, +Creates a new instance of a [File](File.md) subclass for a specified file abstraction, MimeType, and property read style. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `abstraction` | `IFileAbstraction` | Object to use when reading/writing from the current instance. | -| `mimeType?` | `string` | Optional, MimeType to use for determining the subclass of [File](file.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | Optional, level of detail to use when reading the media information from the new instance. If omitted, [ReadStyle.Average](../enums/readstyle.md#average) is used. | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `abstraction` | `IFileAbstraction` | `undefined` | Object to use when reading/writing from the current instance. | +| `mimeType?` | `string` | `undefined` | Optional, MimeType to use for determining the subclass of [File](File.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | `ReadStyle.Average` | Optional, level of detail to use when reading the media information from the new instance. If omitted, [ReadStyle.Average](../enums/ReadStyle.md#average) is used. | #### Returns -[`File`](file.md) +[`File`](File.md) -New instance of [File](file.md) as read from the specified abstraction. +New instance of [File](File.md) as read from the specified abstraction. #### Inherited from @@ -781,24 +857,24 @@ ___ ### createFromPath -▸ `Static` **createFromPath**(`filePath`, `mimeType?`, `propertiesStyle?`): [`File`](file.md) +▸ `Static` **createFromPath**(`filePath`, `mimeType?`, `propertiesStyle?`): [`File`](File.md) -Creates a new instance of [File](file.md) subclass for a specified file path, MimeType, and +Creates a new instance of [File](File.md) subclass for a specified file path, MimeType, and property read style. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `filePath` | `string` | Path to the file to read/write. | -| `mimeType?` | `string` | Optional, MimeType to use for determining the subclass of [File](file.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | Optional, level of detail to use when reading the media information from the new instance. If omitted [ReadStyle.Average](../enums/readstyle.md#average) is used. | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `filePath` | `string` | `undefined` | Path to the file to read/write. | +| `mimeType?` | `string` | `undefined` | Optional, MimeType to use for determining the subclass of [File](File.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | `ReadStyle.Average` | Optional, level of detail to use when reading the media information from the new instance. If omitted [ReadStyle.Average](../enums/ReadStyle.md#average) is used. | #### Returns -[`File`](file.md) +[`File`](File.md) -New instance of [File](file.md) as read from the specified path. +New instance of [File](File.md) as read from the specified path. #### Inherited from diff --git a/docs/classes/mpegvbriheader.md b/docs/classes/MpegVbriHeader.md similarity index 64% rename from docs/classes/mpegvbriheader.md rename to docs/classes/MpegVbriHeader.md index 0da61fc1..16473c02 100644 --- a/docs/classes/mpegvbriheader.md +++ b/docs/classes/MpegVbriHeader.md @@ -8,42 +8,42 @@ Information about a variable bitrate MPEG audio stream encoded by the Fraunhofer ### Properties -- [fileIdentifier](mpegvbriheader.md#fileidentifier) -- [unknown](mpegvbriheader.md#unknown) -- [vbriHeaderOffset](mpegvbriheader.md#vbriheaderoffset) +- [FILE\_IDENTIFIER](MpegVbriHeader.md#file_identifier) +- [UNKNOWN](MpegVbriHeader.md#unknown) +- [VBRI\_HEADER\_OFFSET](MpegVbriHeader.md#vbri_header_offset) ### Accessors -- [isPresent](mpegvbriheader.md#ispresent) -- [totalFrames](mpegvbriheader.md#totalframes) -- [totalSize](mpegvbriheader.md#totalsize) +- [isPresent](MpegVbriHeader.md#ispresent) +- [totalFrames](MpegVbriHeader.md#totalframes) +- [totalSize](MpegVbriHeader.md#totalsize) ### Methods -- [fromData](mpegvbriheader.md#fromdata) -- [fromInfo](mpegvbriheader.md#frominfo) +- [fromData](MpegVbriHeader.md#fromdata) +- [fromInfo](MpegVbriHeader.md#frominfo) ## Properties -### fileIdentifier +### FILE\_IDENTIFIER -▪ `Static` `Readonly` **fileIdentifier**: [`ByteVector`](bytevector.md) +▪ `Static` `Readonly` **FILE\_IDENTIFIER**: [`ByteVector`](ByteVector.md) Identifier that appears in the file to indicate the start of the VBRI header. ___ -### unknown +### UNKNOWN -▪ `Static` `Readonly` **unknown**: [`MpegVbriHeader`](mpegvbriheader.md) +▪ `Static` `Readonly` **UNKNOWN**: [`MpegVbriHeader`](MpegVbriHeader.md) An empty and unset VBRI header. ___ -### vbriHeaderOffset +### VBRI\_HEADER\_OFFSET -▪ `Static` `Readonly` **vbriHeaderOffset**: ``36`` +▪ `Static` `Readonly` **VBRI\_HEADER\_OFFSET**: ``36`` Offset at which a VBRI header would appear in an MPEG audio packet. Always 32 bytes after the end of the first MPEG header. @@ -88,7 +88,7 @@ Gets the total size of the file, as indicated by the current instance. ### fromData -▸ `Static` **fromData**(`data`): [`MpegVbriHeader`](mpegvbriheader.md) +▸ `Static` **fromData**(`data`): [`MpegVbriHeader`](MpegVbriHeader.md) Constructs a new instance from the raw data of the header. @@ -96,17 +96,17 @@ Constructs a new instance from the raw data of the header. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Data to read the VBRI header from | +| `data` | [`ByteVector`](ByteVector.md) | Data to read the VBRI header from | #### Returns -[`MpegVbriHeader`](mpegvbriheader.md) +[`MpegVbriHeader`](MpegVbriHeader.md) ___ ### fromInfo -▸ `Static` **fromInfo**(`frames`, `size`): [`MpegVbriHeader`](mpegvbriheader.md) +▸ `Static` **fromInfo**(`frames`, `size`): [`MpegVbriHeader`](MpegVbriHeader.md) Constructs a new instance with a specified frame count and size. @@ -119,4 +119,4 @@ Constructs a new instance with a specified frame count and size. #### Returns -[`MpegVbriHeader`](mpegvbriheader.md) +[`MpegVbriHeader`](MpegVbriHeader.md) diff --git a/docs/classes/mpegvideoheader.md b/docs/classes/MpegVideoHeader.md similarity index 57% rename from docs/classes/mpegvideoheader.md rename to docs/classes/MpegVideoHeader.md index 2394bf0c..1622895d 100644 --- a/docs/classes/mpegvideoheader.md +++ b/docs/classes/MpegVideoHeader.md @@ -6,23 +6,23 @@ Provides information about an MPEG video stream. ## Implements -- [`IVideoCodec`](../interfaces/ivideocodec.md) +- [`IVideoCodec`](../interfaces/IVideoCodec.md) ## Table of contents ### Constructors -- [constructor](mpegvideoheader.md#constructor) +- [constructor](MpegVideoHeader.md#constructor) ### Accessors -- [description](mpegvideoheader.md#description) -- [durationMilliseconds](mpegvideoheader.md#durationmilliseconds) -- [mediaTypes](mpegvideoheader.md#mediatypes) -- [videoBitrate](mpegvideoheader.md#videobitrate) -- [videoFrameRate](mpegvideoheader.md#videoframerate) -- [videoHeight](mpegvideoheader.md#videoheight) -- [videoWidth](mpegvideoheader.md#videowidth) +- [description](MpegVideoHeader.md#description) +- [durationMilliseconds](MpegVideoHeader.md#durationmilliseconds) +- [mediaTypes](MpegVideoHeader.md#mediatypes) +- [videoBitrate](MpegVideoHeader.md#videobitrate) +- [videoFrameRate](MpegVideoHeader.md#videoframerate) +- [videoHeight](MpegVideoHeader.md#videoheight) +- [videoWidth](MpegVideoHeader.md#videowidth) ## Constructors @@ -30,14 +30,14 @@ Provides information about an MPEG video stream. • **new MpegVideoHeader**(`file`, `position`) -Constructs and initializes a new instance of [MpegVideoHeader](mpegvideoheader.md) by reading it from a +Constructs and initializes a new instance of [MpegVideoHeader](MpegVideoHeader.md) by reading it from a specified location in a specified file. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File to read the header from | +| `file` | [`File`](File.md) | File to read the header from | | `position` | `number` | Position in `file` at which the header begins | ## Accessors @@ -54,7 +54,7 @@ Gets a text description of the media represented by the current instance. #### Implementation of -[IVideoCodec](../interfaces/ivideocodec.md).[description](../interfaces/ivideocodec.md#description) +[IVideoCodec](../interfaces/IVideoCodec.md).[description](../interfaces/IVideoCodec.md#description) ___ @@ -72,23 +72,23 @@ Duration of the media in milliseconds represented by the current instance. #### Implementation of -[IVideoCodec](../interfaces/ivideocodec.md).[durationMilliseconds](../interfaces/ivideocodec.md#durationmilliseconds) +[IVideoCodec](../interfaces/IVideoCodec.md).[durationMilliseconds](../interfaces/IVideoCodec.md#durationmilliseconds) ___ ### mediaTypes -• `get` **mediaTypes**(): [`MediaTypes`](../enums/mediatypes.md) +• `get` **mediaTypes**(): [`MediaTypes`](../enums/MediaTypes.md) Types of media represented by the current instance, bitwise combined. #### Returns -[`MediaTypes`](../enums/mediatypes.md) +[`MediaTypes`](../enums/MediaTypes.md) #### Implementation of -[IVideoCodec](../interfaces/ivideocodec.md).[mediaTypes](../interfaces/ivideocodec.md#mediatypes) +[IVideoCodec](../interfaces/IVideoCodec.md).[mediaTypes](../interfaces/IVideoCodec.md#mediatypes) ___ @@ -128,7 +128,7 @@ Height of the video in pixels represented by the current instance. #### Implementation of -[IVideoCodec](../interfaces/ivideocodec.md).[videoHeight](../interfaces/ivideocodec.md#videoheight) +[IVideoCodec](../interfaces/IVideoCodec.md).[videoHeight](../interfaces/IVideoCodec.md#videoheight) ___ @@ -144,4 +144,4 @@ Width of the video in pixels represented by the current instance. #### Implementation of -[IVideoCodec](../interfaces/ivideocodec.md).[videoWidth](../interfaces/ivideocodec.md#videowidth) +[IVideoCodec](../interfaces/IVideoCodec.md).[videoWidth](../interfaces/IVideoCodec.md#videowidth) diff --git a/docs/classes/mpegxingheader.md b/docs/classes/MpegXingHeader.md similarity index 65% rename from docs/classes/mpegxingheader.md rename to docs/classes/MpegXingHeader.md index ff9ccac1..c637a726 100644 --- a/docs/classes/mpegxingheader.md +++ b/docs/classes/MpegXingHeader.md @@ -8,34 +8,34 @@ Information about a variable bitrate MPEG audio stream ### Properties -- [fileIdentifier](mpegxingheader.md#fileidentifier) -- [unknown](mpegxingheader.md#unknown) +- [FILE\_IDENTIFIER](MpegXingHeader.md#file_identifier) +- [UNKNOWN](MpegXingHeader.md#unknown) ### Accessors -- [isPresent](mpegxingheader.md#ispresent) -- [totalFrames](mpegxingheader.md#totalframes) -- [totalSize](mpegxingheader.md#totalsize) +- [isPresent](MpegXingHeader.md#ispresent) +- [totalFrames](MpegXingHeader.md#totalframes) +- [totalSize](MpegXingHeader.md#totalsize) ### Methods -- [fromData](mpegxingheader.md#fromdata) -- [fromInfo](mpegxingheader.md#frominfo) -- [xingHeaderOffset](mpegxingheader.md#xingheaderoffset) +- [fromData](MpegXingHeader.md#fromdata) +- [fromInfo](MpegXingHeader.md#frominfo) +- [xingHeaderOffset](MpegXingHeader.md#xingheaderoffset) ## Properties -### fileIdentifier +### FILE\_IDENTIFIER -▪ `Static` `Readonly` **fileIdentifier**: [`ByteVector`](bytevector.md) +▪ `Static` `Readonly` **FILE\_IDENTIFIER**: [`ByteVector`](ByteVector.md) Identifier that appears in a file to indicate the start of a Xing header. ___ -### unknown +### UNKNOWN -▪ `Static` `Readonly` **unknown**: [`MpegXingHeader`](mpegxingheader.md) +▪ `Static` `Readonly` **UNKNOWN**: [`MpegXingHeader`](MpegXingHeader.md) An empty an unset Xing header @@ -79,7 +79,7 @@ Gets the total size of the file, as indicated by the current instance. ### fromData -▸ `Static` **fromData**(`data`): [`MpegXingHeader`](mpegxingheader.md) +▸ `Static` **fromData**(`data`): [`MpegXingHeader`](MpegXingHeader.md) Constructs a new instance by reading its raw contents. @@ -87,17 +87,17 @@ Constructs a new instance by reading its raw contents. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw data of the Xing header | +| `data` | [`ByteVector`](ByteVector.md) | Raw data of the Xing header | #### Returns -[`MpegXingHeader`](mpegxingheader.md) +[`MpegXingHeader`](MpegXingHeader.md) ___ ### fromInfo -▸ `Static` **fromInfo**(`frames`, `size`): [`MpegXingHeader`](mpegxingheader.md) +▸ `Static` **fromInfo**(`frames`, `size`): [`MpegXingHeader`](MpegXingHeader.md) Constructs a new instance with a specified frame count and size. @@ -110,7 +110,7 @@ Constructs a new instance with a specified frame count and size. #### Returns -[`MpegXingHeader`](mpegxingheader.md) +[`MpegXingHeader`](MpegXingHeader.md) ___ @@ -125,8 +125,8 @@ version and channel mode. | Name | Type | Description | | :------ | :------ | :------ | -| `version` | [`MpegVersion`](../enums/mpegversion.md) | Version of the MPEG audio packet | -| `channelModel` | [`MpegAudioChannelMode`](../enums/mpegaudiochannelmode.md) | Channel mode of the MPEG audio packet | +| `version` | [`MpegVersion`](../enums/MpegVersion.md) | Version of the MPEG audio packet | +| `channelModel` | [`MpegAudioChannelMode`](../enums/MpegAudioChannelMode.md) | Channel mode of the MPEG audio packet | #### Returns diff --git a/docs/classes/notimplementederror.md b/docs/classes/NotImplementedError.md similarity index 70% rename from docs/classes/notimplementederror.md rename to docs/classes/NotImplementedError.md index 149de699..8e21232d 100644 --- a/docs/classes/notimplementederror.md +++ b/docs/classes/NotImplementedError.md @@ -12,21 +12,21 @@ ### Constructors -- [constructor](notimplementederror.md#constructor) +- [constructor](NotImplementedError.md#constructor) ### Properties -- [isNotImplementedError](notimplementederror.md#isnotimplementederror) -- [message](notimplementederror.md#message) -- [name](notimplementederror.md#name) -- [stack](notimplementederror.md#stack) -- [prepareStackTrace](notimplementederror.md#preparestacktrace) -- [stackTraceLimit](notimplementederror.md#stacktracelimit) +- [isNotImplementedError](NotImplementedError.md#isnotimplementederror) +- [message](NotImplementedError.md#message) +- [name](NotImplementedError.md#name) +- [stack](NotImplementedError.md#stack) +- [stackTraceLimit](NotImplementedError.md#stacktracelimit) ### Methods -- [captureStackTrace](notimplementederror.md#capturestacktrace) -- [errorIs](notimplementederror.md#erroris) +- [captureStackTrace](NotImplementedError.md#capturestacktrace) +- [errorIs](NotImplementedError.md#erroris) +- [prepareStackTrace](NotImplementedError.md#preparestacktrace) ## Constructors @@ -82,33 +82,6 @@ Error.stack ___ -### prepareStackTrace - -▪ `Static` `Optional` **prepareStackTrace**: (`err`: `Error`, `stackTraces`: `CallSite`[]) => `any` - -#### Type declaration - -▸ (`err`, `stackTraces`): `any` - -Optional override for formatting stack traces - -##### Parameters - -| Name | Type | -| :------ | :------ | -| `err` | `Error` | -| `stackTraces` | `CallSite`[] | - -##### Returns - -`any` - -#### Inherited from - -Error.prepareStackTrace - -___ - ### stackTraceLimit ▪ `Static` **stackTraceLimit**: `number` @@ -150,8 +123,33 @@ ___ | Name | Type | | :------ | :------ | -| `e` | `Error` | +| `e` | `unknown` | #### Returns `boolean` + +___ + +### prepareStackTrace + +▸ `Static` `Optional` **prepareStackTrace**(`err`, `stackTraces`): `any` + +Optional override for formatting stack traces + +**`see`** https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `err` | `Error` | +| `stackTraces` | `CallSite`[] | + +#### Returns + +`any` + +#### Inherited from + +Error.prepareStackTrace diff --git a/docs/classes/OggCodecFactory.md b/docs/classes/OggCodecFactory.md new file mode 100644 index 00000000..34bb49f0 --- /dev/null +++ b/docs/classes/OggCodecFactory.md @@ -0,0 +1,76 @@ +[node-taglib-sharp](../README.md) / [Exports](../modules.md) / OggCodecFactory + +# Class: OggCodecFactory + +Factory for creating codecs from the first packet of the Ogg bitstream. + +**`remarks`** By default, only codecs provided by the library will be matched. However, custom codec + support can be added by using {@see addCodecProvider}. + +## Table of contents + +### Constructors + +- [constructor](OggCodecFactory.md#constructor) + +### Methods + +- [addCodecProvider](OggCodecFactory.md#addcodecprovider) +- [clearCustomProviders](OggCodecFactory.md#clearcustomproviders) +- [getCodec](OggCodecFactory.md#getcodec) + +## Constructors + +### constructor + +• **new OggCodecFactory**() + +## Methods + +### addCodecProvider + +▸ `Static` **addCodecProvider**(`provider`): `void` + +Adds a custom codec provider to try before using standard codec creation methods. +Codec providers are used before standard methods so custom checking can be used and new +formats can be added. They are executed in reverse order in which they are added. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `provider` | `CodecProvider` | Codec provider function * firstPacket: ByteVector First packet of the bitstream * returns IOggCodec if method was able to match the packet, falsy otherwise | + +#### Returns + +`void` + +___ + +### clearCustomProviders + +▸ `Static` **clearCustomProviders**(): `void` + +Clears the custom providers from the factory. + +#### Returns + +`void` + +___ + +### getCodec + +▸ `Static` **getCodec**(`packet`): `default` + +Determines the correc codec to use for a stream header packet. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `packet` | [`ByteVector`](ByteVector.md) | First packet of an Ogg logical bitstream. | + +#### Returns + +`default` diff --git a/docs/classes/OggFile.md b/docs/classes/OggFile.md new file mode 100644 index 00000000..673d989c --- /dev/null +++ b/docs/classes/OggFile.md @@ -0,0 +1,836 @@ +[node-taglib-sharp](../README.md) / [Exports](../modules.md) / OggFile + +# Class: OggFile + +Provides tagging and properties support for Ogg files. + +## Hierarchy + +- [`File`](File.md) + + ↳ **`OggFile`** + +## Table of contents + +### Constructors + +- [constructor](OggFile.md#constructor) + +### Accessors + +- [corruptionReasons](OggFile.md#corruptionreasons) +- [fileAbstraction](OggFile.md#fileabstraction) +- [hasTags](OggFile.md#hastags) +- [isPossiblyCorrupt](OggFile.md#ispossiblycorrupt) +- [isWritable](OggFile.md#iswritable) +- [length](OggFile.md#length) +- [mimeType](OggFile.md#mimetype) +- [mode](OggFile.md#mode) +- [name](OggFile.md#name) +- [position](OggFile.md#position) +- [properties](OggFile.md#properties) +- [tag](OggFile.md#tag) +- [tagTypes](OggFile.md#tagtypes) +- [tagTypesOnDisk](OggFile.md#tagtypesondisk) +- [bufferSize](OggFile.md#buffersize) + +### Methods + +- [dispose](OggFile.md#dispose) +- [find](OggFile.md#find) +- [getTag](OggFile.md#gettag) +- [insert](OggFile.md#insert) +- [markAsCorrupt](OggFile.md#markascorrupt) +- [preSave](OggFile.md#presave) +- [rFind](OggFile.md#rfind) +- [readBlock](OggFile.md#readblock) +- [removeBlock](OggFile.md#removeblock) +- [removeTags](OggFile.md#removetags) +- [save](OggFile.md#save) +- [seek](OggFile.md#seek) +- [truncate](OggFile.md#truncate) +- [writeBlock](OggFile.md#writeblock) +- [addFileType](OggFile.md#addfiletype) +- [addFileTypeResolver](OggFile.md#addfiletyperesolver) +- [createFromAbstraction](OggFile.md#createfromabstraction) +- [createFromPath](OggFile.md#createfrompath) +- [removeFileType](OggFile.md#removefiletype) +- [removeFileTypeResolver](OggFile.md#removefiletyperesolver) + +## Constructors + +### constructor + +• **new OggFile**(`file`, `readStyle`) + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `file` | `string` \| `IFileAbstraction` | +| `readStyle` | [`ReadStyle`](../enums/ReadStyle.md) | + +#### Overrides + +[File](File.md).[constructor](File.md#constructor) + +## Accessors + +### corruptionReasons + +• `get` **corruptionReasons**(): `string`[] + +Reasons for which this file is marked as corrupt. + +#### Returns + +`string`[] + +#### Inherited from + +File.corruptionReasons + +___ + +### fileAbstraction + +• `get` **fileAbstraction**(): `IFileAbstraction` + +Gets the {@link IFileAbstraction} representing the file. + +#### Returns + +`IFileAbstraction` + +#### Inherited from + +File.fileAbstraction + +___ + +### hasTags + +• `get` **hasTags**(): `boolean` + +Shortcut property to determine if a file has tags in memory. +NOTE: Just because `tag !== undefined` does not mean there are tags in memory. + +#### Returns + +`boolean` + +#### Inherited from + +File.hasTags + +___ + +### isPossiblyCorrupt + +• `get` **isPossiblyCorrupt**(): `boolean` + +Indicates whether or not this file may be corrupt. Files with unknown corruptions should not +be written. + +#### Returns + +`boolean` + +#### Inherited from + +File.isPossiblyCorrupt + +___ + +### isWritable + +• `get` **isWritable**(): `boolean` + +Indicates whether or not tags can be written back to the current file. + +#### Returns + +`boolean` + +#### Inherited from + +File.isWritable + +___ + +### length + +• `get` **length**(): `number` + +Gets the length of the file represented by the current instance. Value will be 0 if the file +is not open for reading; + +#### Returns + +`number` + +#### Inherited from + +File.length + +___ + +### mimeType + +• `get` **mimeType**(): `string` + +Gets the MimeType of the file as determined during creation of the instance. + +#### Returns + +`string` + +#### Inherited from + +File.mimeType + +___ + +### mode + +• `get` **mode**(): [`FileAccessMode`](../enums/FileAccessMode.md) + +Gets the file access mode in use by the current instance. + +#### Returns + +[`FileAccessMode`](../enums/FileAccessMode.md) + +#### Inherited from + +File.mode + +• `set` **mode**(`val`): `void` + +Sets the file access mode in use by the current instance. Changing the value will cause the +stream currently in use to be closed, except when a change is made from +[FileAccessMode.Write](../enums/FileAccessMode.md#write) to [FileAccessMode.Read](../enums/FileAccessMode.md#read) which has no effect. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `val` | [`FileAccessMode`](../enums/FileAccessMode.md) | File access mode to change to | + +#### Returns + +`void` + +#### Inherited from + +File.mode + +___ + +### name + +• `get` **name**(): `string` + +Gets the name of the file as stored in its file abstraction. + +#### Returns + +`string` + +#### Inherited from + +File.name + +___ + +### position + +• `get` **position**(): `number` + +Gets the seek position in the internal stream used by the current instance. Value will be 0 +if the file is not open for reading + +#### Returns + +`number` + +#### Inherited from + +File.position + +___ + +### properties + +• `get` **properties**(): [`Properties`](Properties.md) + +**`inheritdoc`** + +#### Returns + +[`Properties`](Properties.md) + +#### Overrides + +File.properties + +___ + +### tag + +• `get` **tag**(): [`Tag`](Tag.md) + +**`inheritdoc`** + +#### Returns + +[`Tag`](Tag.md) + +#### Overrides + +File.tag + +___ + +### tagTypes + +• `get` **tagTypes**(): [`TagTypes`](../enums/TagTypes.md) + +Gets the tag types contained in the current instance. + +#### Returns + +[`TagTypes`](../enums/TagTypes.md) + +#### Inherited from + +File.tagTypes + +___ + +### tagTypesOnDisk + +• `get` **tagTypesOnDisk**(): [`TagTypes`](../enums/TagTypes.md) + +Gets the tag types contained in the physical file represented by the current instance. + +#### Returns + +[`TagTypes`](../enums/TagTypes.md) + +#### Inherited from + +File.tagTypesOnDisk + +• `set` **tagTypesOnDisk**(`value`): `void` + +Gets the tag types contained in the physical file represented by the current instance. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | [`TagTypes`](../enums/TagTypes.md) | + +#### Returns + +`void` + +#### Inherited from + +File.tagTypesOnDisk + +___ + +### bufferSize + +• `Static` `get` **bufferSize**(): `number` + +Gets the buffer size to use when reading large blocks of data + +#### Returns + +`number` + +#### Inherited from + +File.bufferSize + +## Methods + +### dispose + +▸ **dispose**(): `void` + +Dispose the current instance. Equivalent to setting the mode to closed. + +#### Returns + +`void` + +#### Inherited from + +[File](File.md).[dispose](File.md#dispose) + +___ + +### find + +▸ **find**(`pattern`, `startPosition?`, `before?`): `number` + +Searches forward through a file for a specified pattern, starting at a specified offset. + +**`throws`** Error Thrown if `pattern` is not provided or `startPosition` is not a + positive, safe integer. + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern to search for in the current instance. Must be smaller than the | +| `startPosition` | `number` | `0` | Seek position to start searching. Must be positive, safe integer. | +| `before?` | [`ByteVector`](ByteVector.md) | `undefined` | Optional pattern that the searched for pattern must appear before. If this pattern is found first, `-1` is returned. | + +#### Returns + +`number` + +Index at which the value was found. If not found, `-1` is returned. + +#### Inherited from + +[File](File.md).[find](File.md#find) + +___ + +### getTag + +▸ **getTag**(`type`): [`Tag`](Tag.md) + +Gets a tag of the specified type from the current instance, optionally creating a new tag if +possible. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `type` | [`TagTypes`](../enums/TagTypes.md) | Type of tag to read. | + +#### Returns + +[`Tag`](Tag.md) + +Tag object containing the tag that was found in or added to the current instance. + If no matching tag was found and none was created, `undefined` is returned. It is safe + to assume that if `undefined` is not returned, the returned tag can be cast to the + appropriate type. + +#### Overrides + +[File](File.md).[getTag](File.md#gettag) + +___ + +### insert + +▸ **insert**(`data`, `start`, `replace?`): `void` + +Inserts a specified block of data into the file represented by the current instance, at a +specified location, replacing a specified number of bytes. + +**`throws`** Error Thrown when: 1) data is falsey, 2) start is not a safe, positive number, or 3) + replace is not a safe, positive number + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `data` | [`ByteVector`](ByteVector.md) | `undefined` | Data to insert into the file. | +| `start` | `number` | `undefined` | Index into the file at which to insert the data. Must be safe positive integer. | +| `replace` | `number` | `0` | Number of bytes to replace. Typically this is the original size of the data block so that a new block will replace the old one. | + +#### Returns + +`void` + +#### Inherited from + +[File](File.md).[insert](File.md#insert) + +___ + +### markAsCorrupt + +▸ **markAsCorrupt**(`reason`): `void` + +Mark the current instance as corrupt. NOTE: Not intended to be used outside of this library. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `reason` | `string` | Reason why this file is considered to be corrupt | + +#### Returns + +`void` + +#### Inherited from + +[File](File.md).[markAsCorrupt](File.md#markascorrupt) + +___ + +### preSave + +▸ `Protected` **preSave**(): `void` + +Prepares to save the file. This must be called at the beginning of every File.save() method. + +#### Returns + +`void` + +#### Inherited from + +[File](File.md).[preSave](File.md#presave) + +___ + +### rFind + +▸ **rFind**(`pattern`, `startPosition?`): `number` + +Searches backwards through a file for a specified pattern, starting at a specified offset. + +**`throws`** Error Thrown if `pattern` was not provided or if `startPosition` is + not a safe, positive integer. + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern to search for in the current instance. Must be shorter than the [bufferSize](OggFile.md#buffersize) | +| `startPosition` | `number` | `0` | Number of bytes from end of the file to begin searching. | + +#### Returns + +`number` + +Index at which the value wa found. If not found, `-1` is returned. + +#### Inherited from + +[File](File.md).[rFind](File.md#rfind) + +___ + +### readBlock + +▸ **readBlock**(`length`): [`ByteVector`](ByteVector.md) + +Reads a specified number of bytes at the current seek position from the current position. +This method reads the block of data at the current seek position. To change the seek +position, use [File.seek](File.md#seek). + +**`throws`** Error Thrown when `length` is not a positive, safe integer. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `length` | `number` | Number of bytes to read. | + +#### Returns + +[`ByteVector`](ByteVector.md) + +ByteVector Object containing the data read from the current instance. + +#### Inherited from + +[File](File.md).[readBlock](File.md#readblock) + +___ + +### removeBlock + +▸ **removeBlock**(`start`, `length`): `void` + +Removes a specified block of data from the file represented by the current instance. + +**`throws`** Error thrown if 1) start is not a safe, positive integer or 2) length must be a safe + integer. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `start` | `number` | Index into the file at which to remove data. Must be safe, positive integer. | +| `length` | `number` | Number of bytes to remove. Must be a safe integer. | + +#### Returns + +`void` + +#### Inherited from + +[File](File.md).[removeBlock](File.md#removeblock) + +___ + +### removeTags + +▸ **removeTags**(`types`): `void` + +Removes a set of tag types from the current instance. In order to remove all tags from a +file, pass [TagTypes.AllTags](../enums/TagTypes.md#alltags) as `types` + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `types` | [`TagTypes`](../enums/TagTypes.md) | Bitwise combined [TagTypes](../enums/TagTypes.md) value containing the tag types to be removed from the file | + +#### Returns + +`void` + +#### Overrides + +[File](File.md).[removeTags](File.md#removetags) + +___ + +### save + +▸ **save**(): `void` + +Saves the changes made in the current instance to the file it represents. + +#### Returns + +`void` + +#### Overrides + +[File](File.md).[save](File.md#save) + +___ + +### seek + +▸ **seek**(`offset`, `origin?`): `void` + +Moves the read/write pointer to a specified offset in the current instance, relative to a +specified origin. + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `offset` | `number` | `undefined` | Byte offset to seek to. Must be a safe, positive integer. | +| `origin` | `SeekOrigin` | `SeekOrigin.Begin` | Origin from which to seek | + +#### Returns + +`void` + +#### Inherited from + +[File](File.md).[seek](File.md#seek) + +___ + +### truncate + +▸ `Protected` **truncate**(`length`): `void` + +Resizes the current instance to a specific number of bytes. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `length` | `number` | Number of bytes to resize the file to, must be a safe, positive integer. | + +#### Returns + +`void` + +#### Inherited from + +[File](File.md).[truncate](File.md#truncate) + +___ + +### writeBlock + +▸ **writeBlock**(`data`): `void` + +Writes a block of data to the file represented by the current instance at the current seek +position. This will overwrite any existing data at the seek position and append new data to +the file if writing past the current end. + +**`throws`** Error Thrown when `data` is not provided. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `data` | [`ByteVector`](ByteVector.md) | ByteVector containing data to the current instance. | + +#### Returns + +`void` + +#### Inherited from + +[File](File.md).[writeBlock](File.md#writeblock) + +___ + +### addFileType + +▸ `Static` **addFileType**(`mimeType`, `constructor`, `override?`): `void` + +Registers the constructor for a subclass of [File](File.md) with the MimeType it is associated +with. Optionally, the MimeType can be forcefully overridden if it was already registered. + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `mimeType` | `string` | `undefined` | MimeType to register this subclass constructor to. | +| `constructor` | [`FileTypeConstructor`](../modules.md#filetypeconstructor) | `undefined` | Constructor for a subclass of [File](File.md) that will be called if a file with a MimeType of `mimeType` is created. | +| `override` | `boolean` | `false` | If `true` and a subclass of [File](File.md) was already registered to `mimeType`, it will be forcefully overridden. If `false`, an {@link Error} will be thrown if a subclass already registered to the MimeType.} | + +#### Returns + +`void` + +#### Inherited from + +[File](File.md).[addFileType](File.md#addfiletype) + +___ + +### addFileTypeResolver + +▸ `Static` **addFileTypeResolver**(`resolver`): `void` + +Registers a [FileTypeResolver](../modules.md#filetyperesolver) to the front of the list of file type resolvers. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `resolver` | [`FileTypeResolver`](../modules.md#filetyperesolver) | Function to handle resolving a subclass of [File](File.md) from an {@link IFileAbstraction} | + +#### Returns + +`void` + +#### Inherited from + +[File](File.md).[addFileTypeResolver](File.md#addfiletyperesolver) + +___ + +### createFromAbstraction + +▸ `Static` **createFromAbstraction**(`abstraction`, `mimeType?`, `propertiesStyle?`): [`File`](File.md) + +Creates a new instance of a [File](File.md) subclass for a specified file abstraction, MimeType, +and property read style. + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `abstraction` | `IFileAbstraction` | `undefined` | Object to use when reading/writing from the current instance. | +| `mimeType?` | `string` | `undefined` | Optional, MimeType to use for determining the subclass of [File](File.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | `ReadStyle.Average` | Optional, level of detail to use when reading the media information from the new instance. If omitted, [ReadStyle.Average](../enums/ReadStyle.md#average) is used. | + +#### Returns + +[`File`](File.md) + +New instance of [File](File.md) as read from the specified abstraction. + +#### Inherited from + +[File](File.md).[createFromAbstraction](File.md#createfromabstraction) + +___ + +### createFromPath + +▸ `Static` **createFromPath**(`filePath`, `mimeType?`, `propertiesStyle?`): [`File`](File.md) + +Creates a new instance of [File](File.md) subclass for a specified file path, MimeType, and +property read style. + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `filePath` | `string` | `undefined` | Path to the file to read/write. | +| `mimeType?` | `string` | `undefined` | Optional, MimeType to use for determining the subclass of [File](File.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | `ReadStyle.Average` | Optional, level of detail to use when reading the media information from the new instance. If omitted [ReadStyle.Average](../enums/ReadStyle.md#average) is used. | + +#### Returns + +[`File`](File.md) + +New instance of [File](File.md) as read from the specified path. + +#### Inherited from + +[File](File.md).[createFromPath](File.md#createfrompath) + +___ + +### removeFileType + +▸ `Static` **removeFileType**(`mimeType`): `void` + +Used for removing a file type constructor during unit testing + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `mimeType` | `string` | + +#### Returns + +`void` + +#### Inherited from + +[File](File.md).[removeFileType](File.md#removefiletype) + +___ + +### removeFileTypeResolver + +▸ `Static` **removeFileTypeResolver**(`resolver`): `void` + +Used for removing a file type resolver during unit testing + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `resolver` | [`FileTypeResolver`](../modules.md#filetyperesolver) | + +#### Returns + +`void` + +#### Inherited from + +[File](File.md).[removeFileTypeResolver](File.md#removefiletyperesolver) diff --git a/docs/classes/OggFileSettings.md b/docs/classes/OggFileSettings.md new file mode 100644 index 00000000..cd756e92 --- /dev/null +++ b/docs/classes/OggFileSettings.md @@ -0,0 +1,56 @@ +[node-taglib-sharp](../README.md) / [Exports](../modules.md) / OggFileSettings + +# Class: OggFileSettings + +This class contains settings related to Ogg file operations. Open files will need to be re-read +in order for changes to take effect. + +## Table of contents + +### Constructors + +- [constructor](OggFileSettings.md#constructor) + +### Accessors + +- [writeToAllComments](OggFileSettings.md#writetoallcomments) + +## Constructors + +### constructor + +• **new OggFileSettings**() + +## Accessors + +### writeToAllComments + +• `Static` `get` **writeToAllComments**(): `boolean` + +Gets whether changes to Ogg tag fields should be written to all Xiph comments or just the +first Xiph comment in the file. + +**`remarks`** Ogg files are required to have one Xiph comment per stream. In files with multiple + streams, this means there are multiple Xiph comments per file. + +#### Returns + +`boolean` + +• `Static` `set` **writeToAllComments**(`value`): `void` + +Sets whether changes to Ogg tag fields should be written to all Xiph comments or just the +first Xiph comment in the file. + +**`remarks`** Ogg files are required to have one Xiph comment per stream. In files with multiple + streams, this means there are multiple Xiph comments per file. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `boolean` | + +#### Returns + +`void` diff --git a/docs/classes/OggOpusCodec.md b/docs/classes/OggOpusCodec.md new file mode 100644 index 00000000..e0a5e01d --- /dev/null +++ b/docs/classes/OggOpusCodec.md @@ -0,0 +1,265 @@ +[node-taglib-sharp](../README.md) / [Exports](../modules.md) / OggOpusCodec + +# Class: OggOpusCodec + +Represents an Ogg Opus bitstream for use within an Ogg file. + +## Implements + +- `default` +- [`IAudioCodec`](../interfaces/IAudioCodec.md) + +## Table of contents + +### Constructors + +- [constructor](OggOpusCodec.md#constructor) + +### Accessors + +- [audioBitrate](OggOpusCodec.md#audiobitrate) +- [audioChannels](OggOpusCodec.md#audiochannels) +- [audioSampleRate](OggOpusCodec.md#audiosamplerate) +- [commentData](OggOpusCodec.md#commentdata) +- [description](OggOpusCodec.md#description) +- [durationMilliseconds](OggOpusCodec.md#durationmilliseconds) +- [mediaTypes](OggOpusCodec.md#mediatypes) +- [streamCount](OggOpusCodec.md#streamcount) + +### Methods + +- [readPacket](OggOpusCodec.md#readpacket) +- [setDuration](OggOpusCodec.md#setduration) +- [writeCommentPacket](OggOpusCodec.md#writecommentpacket) +- [isHeaderPacket](OggOpusCodec.md#isheaderpacket) + +## Constructors + +### constructor + +• **new OggOpusCodec**(`headerPacket`) + +Constructs and initializes a new instance using the provided header packet to read the +codec's header information. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `headerPacket` | [`ByteVector`](ByteVector.md) | Packet containing the header of the stream | + +## Accessors + +### audioBitrate + +• `get` **audioBitrate**(): `number` + +Bitrate of the audio in kilobits per second represented by the current instance. + +**`remarks`** Always returns zero since bitrate is variable and no information is stored in the + Ogg header (unlike Vorbis). + +#### Returns + +`number` + +#### Implementation of + +[IAudioCodec](../interfaces/IAudioCodec.md).[audioBitrate](../interfaces/IAudioCodec.md#audiobitrate) + +___ + +### audioChannels + +• `get` **audioChannels**(): `number` + +Number of channels in the audio represented by the current instance. + +#### Returns + +`number` + +#### Implementation of + +[IAudioCodec](../interfaces/IAudioCodec.md).[audioChannels](../interfaces/IAudioCodec.md#audiochannels) + +___ + +### audioSampleRate + +• `get` **audioSampleRate**(): `number` + +Sample rate of the audio represented by the current instance. + +**`remarks`** This is the *input* sample rate used when the file was created. Opus uses a variety + of sample rates internally, and as such the output sample rate is dependent on the + decoder used. In most modern hardware cases, this will be 48kHz. + +#### Returns + +`number` + +#### Implementation of + +[IAudioCodec](../interfaces/IAudioCodec.md).[audioSampleRate](../interfaces/IAudioCodec.md#audiosamplerate) + +___ + +### commentData + +• `get` **commentData**(): [`ByteVector`](ByteVector.md) + +Gets the raw Xiph comment data contained in the codec. + +#### Returns + +[`ByteVector`](ByteVector.md) + +#### Implementation of + +IOggCodec.commentData + +___ + +### description + +• `get` **description**(): `string` + +Gets a text description of the media represented by the current instance. + +#### Returns + +`string` + +#### Implementation of + +[IAudioCodec](../interfaces/IAudioCodec.md).[description](../interfaces/IAudioCodec.md#description) + +___ + +### durationMilliseconds + +• `get` **durationMilliseconds**(): `number` + +Duration of the media in milliseconds represented by the current instance. + +#### Returns + +`number` + +#### Implementation of + +[IAudioCodec](../interfaces/IAudioCodec.md).[durationMilliseconds](../interfaces/IAudioCodec.md#durationmilliseconds) + +___ + +### mediaTypes + +• `get` **mediaTypes**(): [`MediaTypes`](../enums/MediaTypes.md) + +Types of media represented by the current instance, bitwise combined. + +#### Returns + +[`MediaTypes`](../enums/MediaTypes.md) + +#### Implementation of + +[IAudioCodec](../interfaces/IAudioCodec.md).[mediaTypes](../interfaces/IAudioCodec.md#mediatypes) + +___ + +### streamCount + +• `get` **streamCount**(): `number` + +Gets the number of streams contained in the bitstream. + +#### Returns + +`number` + +## Methods + +### readPacket + +▸ **readPacket**(`packet`): `boolean` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `packet` | [`ByteVector`](ByteVector.md) | + +#### Returns + +`boolean` + +#### Implementation of + +IOggCodec.readPacket + +___ + +### setDuration + +▸ **setDuration**(`firstGranularPosition`, `lastGranularPosition`): `void` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `firstGranularPosition` | `number` | +| `lastGranularPosition` | `number` | + +#### Returns + +`void` + +#### Implementation of + +IOggCodec.setDuration + +___ + +### writeCommentPacket + +▸ **writeCommentPacket**(`packets`, `comment`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `packets` | [`ByteVector`](ByteVector.md)[] | +| `comment` | [`XiphComment`](XiphComment.md) | + +#### Returns + +`void` + +#### Implementation of + +IOggCodec.writeCommentPacket + +___ + +### isHeaderPacket + +▸ `Static` **isHeaderPacket**(`headerPacket`): `boolean` + +Determines whether an Opus header packet based on the presence of the Opus header +packet magic signature. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `headerPacket` | [`ByteVector`](ByteVector.md) | Packet to check | + +#### Returns + +`boolean` diff --git a/docs/classes/OggTag.md b/docs/classes/OggTag.md new file mode 100644 index 00000000..560db97a --- /dev/null +++ b/docs/classes/OggTag.md @@ -0,0 +1,2592 @@ +[node-taglib-sharp](../README.md) / [Exports](../modules.md) / OggTag + +# Class: OggTag + +This class combines a collection of [XiphComment](XiphComment.md) objects so that tagging properties can +be read from each but are only set to the first comment of the file. + +## Hierarchy + +- [`CombinedTag`](CombinedTag.md) + + ↳ **`OggTag`** + +## Table of contents + +### Constructors + +- [constructor](OggTag.md#constructor) + +### Accessors + +- [album](OggTag.md#album) +- [albumArtists](OggTag.md#albumartists) +- [albumArtistsSort](OggTag.md#albumartistssort) +- [albumSort](OggTag.md#albumsort) +- [amazonId](OggTag.md#amazonid) +- [beatsPerMinute](OggTag.md#beatsperminute) +- [comment](OggTag.md#comment) +- [comments](OggTag.md#comments) +- [composers](OggTag.md#composers) +- [composersSort](OggTag.md#composerssort) +- [conductor](OggTag.md#conductor) +- [copyright](OggTag.md#copyright) +- [dateTagged](OggTag.md#datetagged) +- [description](OggTag.md#description) +- [disc](OggTag.md#disc) +- [discCount](OggTag.md#disccount) +- [firstAlbumArtist](OggTag.md#firstalbumartist) +- [firstAlbumArtistSort](OggTag.md#firstalbumartistsort) +- [firstComposer](OggTag.md#firstcomposer) +- [firstComposerSort](OggTag.md#firstcomposersort) +- [firstGenre](OggTag.md#firstgenre) +- [firstPerformer](OggTag.md#firstperformer) +- [firstPerformerSort](OggTag.md#firstperformersort) +- [genres](OggTag.md#genres) +- [grouping](OggTag.md#grouping) +- [initialKey](OggTag.md#initialkey) +- [isCompilation](OggTag.md#iscompilation) +- [isEmpty](OggTag.md#isempty) +- [isrc](OggTag.md#isrc) +- [joinedAlbumArtists](OggTag.md#joinedalbumartists) +- [joinedComposers](OggTag.md#joinedcomposers) +- [joinedGenres](OggTag.md#joinedgenres) +- [joinedPerformers](OggTag.md#joinedperformers) +- [joinedPerformersSort](OggTag.md#joinedperformerssort) +- [lyrics](OggTag.md#lyrics) +- [musicBrainzArtistId](OggTag.md#musicbrainzartistid) +- [musicBrainzDiscId](OggTag.md#musicbrainzdiscid) +- [musicBrainzReleaseArtistId](OggTag.md#musicbrainzreleaseartistid) +- [musicBrainzReleaseCountry](OggTag.md#musicbrainzreleasecountry) +- [musicBrainzReleaseGroupId](OggTag.md#musicbrainzreleasegroupid) +- [musicBrainzReleaseId](OggTag.md#musicbrainzreleaseid) +- [musicBrainzReleaseStatus](OggTag.md#musicbrainzreleasestatus) +- [musicBrainzReleaseType](OggTag.md#musicbrainzreleasetype) +- [musicBrainzTrackId](OggTag.md#musicbrainztrackid) +- [musicIpId](OggTag.md#musicipid) +- [performers](OggTag.md#performers) +- [performersRole](OggTag.md#performersrole) +- [performersSort](OggTag.md#performerssort) +- [pictures](OggTag.md#pictures) +- [publisher](OggTag.md#publisher) +- [remixedBy](OggTag.md#remixedby) +- [replayGainAlbumGain](OggTag.md#replaygainalbumgain) +- [replayGainAlbumPeak](OggTag.md#replaygainalbumpeak) +- [replayGainTrackGain](OggTag.md#replaygaintrackgain) +- [replayGainTrackPeak](OggTag.md#replaygaintrackpeak) +- [serialNumbers](OggTag.md#serialnumbers) +- [sizeOnDisk](OggTag.md#sizeondisk) +- [subtitle](OggTag.md#subtitle) +- [supportedTagTypes](OggTag.md#supportedtagtypes) +- [tagTypes](OggTag.md#tagtypes) +- [tags](OggTag.md#tags) +- [title](OggTag.md#title) +- [titleSort](OggTag.md#titlesort) +- [track](OggTag.md#track) +- [trackCount](OggTag.md#trackcount) +- [year](OggTag.md#year) + +### Methods + +- [addTag](OggTag.md#addtag) +- [clear](OggTag.md#clear) +- [copyTo](OggTag.md#copyto) +- [createTag](OggTag.md#createtag) +- [getComment](OggTag.md#getcomment) +- [getTag](OggTag.md#gettag) +- [removeTags](OggTag.md#removetags) +- [replaceTag](OggTag.md#replacetag) +- [setComment](OggTag.md#setcomment) +- [setInfoTag](OggTag.md#setinfotag) +- [validateTagCreation](OggTag.md#validatetagcreation) +- [firstInGroup](OggTag.md#firstingroup) +- [isFalsyOrLikeEmpty](OggTag.md#isfalsyorlikeempty) +- [joinGroup](OggTag.md#joingroup) +- [tagTypeFlagsToArray](OggTag.md#tagtypeflagstoarray) + +## Constructors + +### constructor + +• **new OggTag**(`comments`) + +Constructs and initializes a new instance with no contents. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `comments` | `Map`<`number`, [`XiphComment`](XiphComment.md)\> | + +#### Overrides + +[CombinedTag](CombinedTag.md).[constructor](CombinedTag.md#constructor) + +## Accessors + +### album + +• `get` **album**(): `string` + +Gets the album of the media represented by the current instance. For video media, this +represents the collection the video belongs to. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.album + +• `set` **album**(`val`): `void` + +Gets the album of the media represented by the current instance. For video media, this +represents the collection the video belongs to. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.album + +___ + +### albumArtists + +• `get` **albumArtists**(): `string`[] + +Gets the band or artist who is credited credited in the creation of the entire album or +collection containing the media described by the current instance. + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Inherited from + +CombinedTag.albumArtists + +• `set` **albumArtists**(`val`): `void` + +Gets the band or artist who is credited credited in the creation of the entire album or +collection containing the media described by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.albumArtists + +___ + +### albumArtistsSort + +• `get` **albumArtistsSort**(): `string`[] + +Gets the sortable names of the bands/artists who are credited with creating the entire +album or collection containing the media described by the current instance. + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Inherited from + +CombinedTag.albumArtistsSort + +• `set` **albumArtistsSort**(`val`): `void` + +Gets the sortable names of the bands/artists who are credited with creating the entire +album or collection containing the media described by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.albumArtistsSort + +___ + +### albumSort + +• `get` **albumSort**(): `string` + +Gets the sortable name of the album title of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.albumSort + +• `set` **albumSort**(`val`): `void` + +Gets the sortable name of the album title of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.albumSort + +___ + +### amazonId + +• `get` **amazonId**(): `string` + +Gets the Amazon ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.amazonId + +• `set` **amazonId**(`val`): `void` + +Gets the Amazon ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.amazonId + +___ + +### beatsPerMinute + +• `get` **beatsPerMinute**(): `number` + +Gets the number of beats per minute in the audio of the media represented by the current +instance. + +**`inheritdoc`** + +#### Returns + +`number` + +#### Inherited from + +CombinedTag.beatsPerMinute + +• `set` **beatsPerMinute**(`val`): `void` + +Gets the number of beats per minute in the audio of the media represented by the current +instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.beatsPerMinute + +___ + +### comment + +• `get` **comment**(): `string` + +Gets a user comment on the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.comment + +• `set` **comment**(`val`): `void` + +Gets a user comment on the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.comment + +___ + +### comments + +• `get` **comments**(): [`XiphComment`](XiphComment.md)[] + +Gets the list of comments in the current instance, in the order they were added. + +**`remarks`** Modifying this array makes no changes to the file. Use [setComment](OggTag.md#setcomment). + +#### Returns + +[`XiphComment`](XiphComment.md)[] + +___ + +### composers + +• `get` **composers**(): `string`[] + +Gets the composers of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Inherited from + +CombinedTag.composers + +• `set` **composers**(`val`): `void` + +Gets the composers of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.composers + +___ + +### composersSort + +• `get` **composersSort**(): `string`[] + +Gets the sortable names of the composers of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Inherited from + +CombinedTag.composersSort + +• `set` **composersSort**(`val`): `void` + +Gets the sortable names of the composers of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.composersSort + +___ + +### conductor + +• `get` **conductor**(): `string` + +Gets the conductor or director of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.conductor + +• `set` **conductor**(`val`): `void` + +Gets the conductor or director of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.conductor + +___ + +### copyright + +• `get` **copyright**(): `string` + +Gets the copyright information for the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.copyright + +• `set` **copyright**(`val`): `void` + +Gets the copyright information for the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.copyright + +___ + +### dateTagged + +• `get` **dateTagged**(): `Date` + +Gets the date and time at which the tag has been written. + +**`inheritdoc`** + +#### Returns + +`Date` + +#### Inherited from + +CombinedTag.dateTagged + +• `set` **dateTagged**(`val`): `void` + +Gets the date and time at which the tag has been written. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `Date` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.dateTagged + +___ + +### description + +• `get` **description**(): `string` + +Gets a short description of the media. For music, this could be the comment that the artist +made of his/her work. For a video, this should be a short summary of the story/plot, but +generally no spoliers. This should give the impression of what to expect in the media. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.description + +• `set` **description**(`val`): `void` + +Gets a short description of the media. For music, this could be the comment that the artist +made of his/her work. For a video, this should be a short summary of the story/plot, but +generally no spoliers. This should give the impression of what to expect in the media. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.description + +___ + +### disc + +• `get` **disc**(): `number` + +Gets the number of the disc containing the media represented by the current instance in the +boxed set. For a series, this represents the season number. + +**`inheritdoc`** + +#### Returns + +`number` + +#### Inherited from + +CombinedTag.disc + +• `set` **disc**(`val`): `void` + +Gets the number of the disc containing the media represented by the current instance in the +boxed set. For a series, this represents the season number. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.disc + +___ + +### discCount + +• `get` **discCount**(): `number` + +Gets the number of discs or seasons in the boxed set containing the media represented by the +current instance. + +**`inheritdoc`** + +#### Returns + +`number` + +#### Inherited from + +CombinedTag.discCount + +• `set` **discCount**(`val`): `void` + +Gets the number of discs or seasons in the boxed set containing the media represented by the +current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.discCount + +___ + +### firstAlbumArtist + +• `get` **firstAlbumArtist**(): `string` + +Gets the first value contained in [albumArtists](OggTag.md#albumartists). + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.firstAlbumArtist + +___ + +### firstAlbumArtistSort + +• `get` **firstAlbumArtistSort**(): `string` + +Gets the first value contained in [albumArtistsSort](OggTag.md#albumartistssort) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.firstAlbumArtistSort + +___ + +### firstComposer + +• `get` **firstComposer**(): `string` + +Gets the first value contained in [composers](OggTag.md#composers) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.firstComposer + +___ + +### firstComposerSort + +• `get` **firstComposerSort**(): `string` + +Gets the first value contained in [composersSort](OggTag.md#composerssort) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.firstComposerSort + +___ + +### firstGenre + +• `get` **firstGenre**(): `string` + +Gets the first value contained in [genres](OggTag.md#genres) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.firstGenre + +___ + +### firstPerformer + +• `get` **firstPerformer**(): `string` + +Gets the first value contained in [performers](OggTag.md#performers) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.firstPerformer + +___ + +### firstPerformerSort + +• `get` **firstPerformerSort**(): `string` + +Gets the first value contained in [performersSort](OggTag.md#performerssort) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.firstPerformerSort + +___ + +### genres + +• `get` **genres**(): `string`[] + +Gets the genres of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Inherited from + +CombinedTag.genres + +• `set` **genres**(`val`): `void` + +Gets the genres of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.genres + +___ + +### grouping + +• `get` **grouping**(): `string` + +Gets the grouping on the album which the media in the current instance belongs to. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.grouping + +• `set` **grouping**(`val`): `void` + +Gets the grouping on the album which the media in the current instance belongs to. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.grouping + +___ + +### initialKey + +• `get` **initialKey**(): `string` + +Gets the initial key of the track. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.initialKey + +• `set` **initialKey**(`val`): `void` + +Gets the initial key of the track. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.initialKey + +___ + +### isCompilation + +• `get` **isCompilation**(): `boolean` + +Gets whether or not the album described by the current instance is a compilation. + +**`inheritdoc`** + +#### Returns + +`boolean` + +#### Inherited from + +CombinedTag.isCompilation + +• `set` **isCompilation**(`val`): `void` + +Gets whether or not the album described by the current instance is a compilation. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `boolean` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.isCompilation + +___ + +### isEmpty + +• `get` **isEmpty**(): `boolean` + +Gets whether or not the current instance is empty. + +**`inheritdoc`** + +#### Returns + +`boolean` + +#### Inherited from + +CombinedTag.isEmpty + +___ + +### isrc + +• `get` **isrc**(): `string` + +Gets the ISRC (International Standard Recording Code) of the track. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.isrc + +• `set` **isrc**(`val`): `void` + +Gets the ISRC (International Standard Recording Code) of the track. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.isrc + +___ + +### joinedAlbumArtists + +• `get` **joinedAlbumArtists**(): `string` + +Gets a semicolon and space separated string containing the values in [albumArtists](OggTag.md#albumartists) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.joinedAlbumArtists + +___ + +### joinedComposers + +• `get` **joinedComposers**(): `string` + +Gets a semicolon and space separated string containing the values in [composers](OggTag.md#composers) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.joinedComposers + +___ + +### joinedGenres + +• `get` **joinedGenres**(): `string` + +Gets a semicolon and space separated string containing the values in [genres](OggTag.md#genres) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.joinedGenres + +___ + +### joinedPerformers + +• `get` **joinedPerformers**(): `string` + +Gets a semicolon and space separated string containing the values in [performers](OggTag.md#performers) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.joinedPerformers + +___ + +### joinedPerformersSort + +• `get` **joinedPerformersSort**(): `string` + +Gets a semicolon and space separated string containing the values in [performersSort](OggTag.md#performerssort) + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.joinedPerformersSort + +___ + +### lyrics + +• `get` **lyrics**(): `string` + +Gets the lyrics or script of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.lyrics + +• `set` **lyrics**(`val`): `void` + +Gets the lyrics or script of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.lyrics + +___ + +### musicBrainzArtistId + +• `get` **musicBrainzArtistId**(): `string` + +Gets the MusicBrainz artist ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.musicBrainzArtistId + +• `set` **musicBrainzArtistId**(`val`): `void` + +Gets the MusicBrainz artist ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.musicBrainzArtistId + +___ + +### musicBrainzDiscId + +• `get` **musicBrainzDiscId**(): `string` + +Gets the MusicBrainz disc ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.musicBrainzDiscId + +• `set` **musicBrainzDiscId**(`val`): `void` + +Gets the MusicBrainz disc ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.musicBrainzDiscId + +___ + +### musicBrainzReleaseArtistId + +• `get` **musicBrainzReleaseArtistId**(): `string` + +Gets the MusicBrainz release artist ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.musicBrainzReleaseArtistId + +• `set` **musicBrainzReleaseArtistId**(`val`): `void` + +Gets the MusicBrainz release artist ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.musicBrainzReleaseArtistId + +___ + +### musicBrainzReleaseCountry + +• `get` **musicBrainzReleaseCountry**(): `string` + +Gets the MusicBrainz release country of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.musicBrainzReleaseCountry + +• `set` **musicBrainzReleaseCountry**(`val`): `void` + +Gets the MusicBrainz release country of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.musicBrainzReleaseCountry + +___ + +### musicBrainzReleaseGroupId + +• `get` **musicBrainzReleaseGroupId**(): `string` + +Gets the MusicBrainz release group ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.musicBrainzReleaseGroupId + +• `set` **musicBrainzReleaseGroupId**(`val`): `void` + +Gets the MusicBrainz release group ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.musicBrainzReleaseGroupId + +___ + +### musicBrainzReleaseId + +• `get` **musicBrainzReleaseId**(): `string` + +Gets the MusicBrainz release ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.musicBrainzReleaseId + +• `set` **musicBrainzReleaseId**(`val`): `void` + +Gets the MusicBrainz release ID of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.musicBrainzReleaseId + +___ + +### musicBrainzReleaseStatus + +• `get` **musicBrainzReleaseStatus**(): `string` + +Gets the MusicBrainz release status of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.musicBrainzReleaseStatus + +• `set` **musicBrainzReleaseStatus**(`val`): `void` + +Gets the MusicBrainz release status of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.musicBrainzReleaseStatus + +___ + +### musicBrainzReleaseType + +• `get` **musicBrainzReleaseType**(): `string` + +Gets the MusicBrainz release type of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.musicBrainzReleaseType + +• `set` **musicBrainzReleaseType**(`val`): `void` + +Gets the MusicBrainz release type of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.musicBrainzReleaseType + +___ + +### musicBrainzTrackId + +• `get` **musicBrainzTrackId**(): `string` + +Gets the MusicBrainz track ID of the media represented by the media represented by the +current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.musicBrainzTrackId + +• `set` **musicBrainzTrackId**(`val`): `void` + +Gets the MusicBrainz track ID of the media represented by the media represented by the +current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.musicBrainzTrackId + +___ + +### musicIpId + +• `get` **musicIpId**(): `string` + +Gets the MusicIP PUID of the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.musicIpId + +• `set` **musicIpId**(`val`): `void` + +Gets the MusicIP PUID of the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.musicIpId + +___ + +### performers + +• `get` **performers**(): `string`[] + +Gets the performers or artists who performed in the media described by the current instance. + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Inherited from + +CombinedTag.performers + +• `set` **performers**(`val`): `void` + +Gets the performers or artists who performed in the media described by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.performers + +___ + +### performersRole + +• `get` **performersRole**(): `string`[] + +Gets the characters portrayed by an actor for a video or instruments played by a musician +for music. This must match the [performers](OggTag.md#performers) array (for each person, correspond one/more +role). Several roles for the same artist/actor can be separated with semicolons. For +example: "Bass; Backing Vocals; Vibraphone". + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Inherited from + +CombinedTag.performersRole + +• `set` **performersRole**(`val`): `void` + +Gets the characters portrayed by an actor for a video or instruments played by a musician +for music. This must match the [performers](OggTag.md#performers) array (for each person, correspond one/more +role). Several roles for the same artist/actor can be separated with semicolons. For +example: "Bass; Backing Vocals; Vibraphone". + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.performersRole + +___ + +### performersSort + +• `get` **performersSort**(): `string`[] + +Gets the sortable names of the performers or artists who performed in the media described by +the current instance. + +**`inheritdoc`** + +#### Returns + +`string`[] + +#### Inherited from + +CombinedTag.performersSort + +• `set` **performersSort**(`val`): `void` + +Gets the sortable names of the performers or artists who performed in the media described by +the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string`[] | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.performersSort + +___ + +### pictures + +• `get` **pictures**(): [`IPicture`](../interfaces/IPicture.md)[] + +Gets a collection of pictures associated with the media represented by the current instance. + +**`inheritdoc`** + +#### Returns + +[`IPicture`](../interfaces/IPicture.md)[] + +#### Inherited from + +CombinedTag.pictures + +• `set` **pictures**(`val`): `void` + +Gets a collection of pictures associated with the media represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | [`IPicture`](../interfaces/IPicture.md)[] | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.pictures + +___ + +### publisher + +• `get` **publisher**(): `string` + +Gets the publisher of the track. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.publisher + +• `set` **publisher**(`val`): `void` + +Gets the publisher of the track. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.publisher + +___ + +### remixedBy + +• `get` **remixedBy**(): `string` + +Gets the remixer of the track. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.remixedBy + +• `set` **remixedBy**(`val`): `void` + +Gets the remixer of the track. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.remixedBy + +___ + +### replayGainAlbumGain + +• `get` **replayGainAlbumGain**(): `number` + +Gets the ReplayGain album gain in dB. + +**`inheritdoc`** + +#### Returns + +`number` + +#### Inherited from + +CombinedTag.replayGainAlbumGain + +• `set` **replayGainAlbumGain**(`val`): `void` + +Gets the ReplayGain album gain in dB. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.replayGainAlbumGain + +___ + +### replayGainAlbumPeak + +• `get` **replayGainAlbumPeak**(): `number` + +Gets the ReplayGain album peak sample. + +**`inheritdoc`** + +#### Returns + +`number` + +#### Inherited from + +CombinedTag.replayGainAlbumPeak + +• `set` **replayGainAlbumPeak**(`val`): `void` + +Gets the ReplayGain album peak sample. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.replayGainAlbumPeak + +___ + +### replayGainTrackGain + +• `get` **replayGainTrackGain**(): `number` + +Gets the ReplayGain track gain in dB. + +**`inheritdoc`** + +#### Returns + +`number` + +#### Inherited from + +CombinedTag.replayGainTrackGain + +• `set` **replayGainTrackGain**(`val`): `void` + +Gets the ReplayGain track gain in dB. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.replayGainTrackGain + +___ + +### replayGainTrackPeak + +• `get` **replayGainTrackPeak**(): `number` + +Gets the ReplayGain track peak sample. + +**`inheritdoc`** + +#### Returns + +`number` + +#### Inherited from + +CombinedTag.replayGainTrackPeak + +• `set` **replayGainTrackPeak**(`val`): `void` + +Gets the ReplayGain track peak sample. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.replayGainTrackPeak + +___ + +### serialNumbers + +• `get` **serialNumbers**(): `number`[] + +Gets the list of stream serial numbers that have comments associated with them. + +**`remarks`** Modifying this array makes no changes to the file. Use [setComment](OggTag.md#setcomment). + +#### Returns + +`number`[] + +___ + +### sizeOnDisk + +• `get` **sizeOnDisk**(): `number` + +Gets the size of the tag in bytes on disk as it was read from disk. + +**`inheritdoc`** + +#### Returns + +`number` + +#### Overrides + +CombinedTag.sizeOnDisk + +___ + +### subtitle + +• `get` **subtitle**(): `string` + +Gets a description, one-line. It represents the tagline of the vide/music. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.subtitle + +• `set` **subtitle**(`val`): `void` + +Gets a description, one-line. It represents the tagline of the vide/music. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.subtitle + +___ + +### supportedTagTypes + +• `get` **supportedTagTypes**(): [`TagTypes`](../enums/TagTypes.md) + +Gets the types of tags that are supported by this instance of a combined tag. Only these tag +types can be added to the instance. + +#### Returns + +[`TagTypes`](../enums/TagTypes.md) + +#### Inherited from + +CombinedTag.supportedTagTypes + +___ + +### tagTypes + +• `get` **tagTypes**(): [`TagTypes`](../enums/TagTypes.md) + +Gets the tag types contained in the current instance. A bit wise combined [TagTypes](../enums/TagTypes.md) +containing the tag types contained in the current instance. + +**`inheritdoc`** + +#### Returns + +[`TagTypes`](../enums/TagTypes.md) + +#### Inherited from + +CombinedTag.tagTypes + +___ + +### tags + +• `get` **tags**(): [`Tag`](Tag.md)[] + +Gets all tags contained within the current instance. If the tags within this tag are also +[CombinedTag](CombinedTag.md)s, the retrieval will recurse and return a flat list of nested tags. + +**`remarks`** Modifications of the returned array will not be retained. + +#### Returns + +[`Tag`](Tag.md)[] + +#### Inherited from + +CombinedTag.tags + +___ + +### title + +• `get` **title**(): `string` + +Gets the title for the media described by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.title + +• `set` **title**(`val`): `void` + +Gets the title for the media described by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.title + +___ + +### titleSort + +• `get` **titleSort**(): `string` + +Gets the sortable name for the title of the media described by the current instance. + +**`inheritdoc`** + +#### Returns + +`string` + +#### Inherited from + +CombinedTag.titleSort + +• `set` **titleSort**(`val`): `void` + +Gets the sortable name for the title of the media described by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `string` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.titleSort + +___ + +### track + +• `get` **track**(): `number` + +Gets the position of the media represented by the current instance in its containing album +or season (for a series). + +**`inheritdoc`** + +#### Returns + +`number` + +#### Inherited from + +CombinedTag.track + +• `set` **track**(`val`): `void` + +Gets the position of the media represented by the current instance in its containing album +or season (for a series). + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.track + +___ + +### trackCount + +• `get` **trackCount**(): `number` + +Gets the number of tracks in the album or the number of episodes in a series of the media +represented by the current instance. + +**`inheritdoc`** + +#### Returns + +`number` + +#### Inherited from + +CombinedTag.trackCount + +• `set` **trackCount**(`val`): `void` + +Gets the number of tracks in the album or the number of episodes in a series of the media +represented by the current instance. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.trackCount + +___ + +### year + +• `get` **year**(): `number` + +Gets the year that the media represented by the current instance was recorded. + +**`inheritdoc`** + +#### Returns + +`number` + +#### Inherited from + +CombinedTag.year + +• `set` **year**(`val`): `void` + +Gets the year that the media represented by the current instance was recorded. + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `val` | `number` | + +#### Returns + +`void` + +#### Inherited from + +CombinedTag.year + +## Methods + +### addTag + +▸ `Protected` **addTag**(`tag`): `void` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `tag` | [`Tag`](Tag.md) | + +#### Returns + +`void` + +#### Inherited from + +[CombinedTag](CombinedTag.md).[addTag](CombinedTag.md#addtag) + +___ + +### clear + +▸ **clear**(): `void` + +Clears all values stored in the current instance. + +**`remarks`** The clearing procedure is format specific and should clear all values. + +#### Returns + +`void` + +#### Inherited from + +[CombinedTag](CombinedTag.md).[clear](CombinedTag.md#clear) + +___ + +### copyTo + +▸ **copyTo**(`target`, `overwrite`): `void` + +Copies the values from the current instance to another [Tag](Tag.md), optionally overwriting + existing values. + +**`remarks`** This method only copies the most basic values when copying between different tag + formats. However, if `target` is of the same type as the current instance, + more advanced copying may be done. For example if both `this` and `target` are + [Id3v2Tag](Id3v2Tag.md), all frames will be copied to the target. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `target` | [`Tag`](Tag.md) | Target tag to copy values to | +| `overwrite` | `boolean` | Whether or not to copy values over existing ones | + +#### Returns + +`void` + +#### Inherited from + +[CombinedTag](CombinedTag.md).[copyTo](CombinedTag.md#copyto) + +___ + +### createTag + +▸ **createTag**(): [`Tag`](Tag.md) + +Creates a new instance of the desired tag type and adds it to the current instance. If the +tag type is unsupported in the current context or the tag type already exists, an error will +be thrown. + +**`remarks`** Tags cannot be added or removed from Ogg files. This will always throw. + +#### Returns + +[`Tag`](Tag.md) + +Tag The newly created tag + +#### Overrides + +[CombinedTag](CombinedTag.md).[createTag](CombinedTag.md#createtag) + +___ + +### getComment + +▸ **getComment**(`streamSerialNumber`): [`XiphComment`](XiphComment.md) + +Retrieves a Xiph comment for a given stream. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `streamSerialNumber` | `number` | Serial number of the stream that contains the desired comment. Must be a positive 32-bit integer. | + +#### Returns + +[`XiphComment`](XiphComment.md) + +XiphComment Xiph comment of the provided stream is returned if it exists, otherwise + `undefined` is returned. + +___ + +### getTag + +▸ **getTag**<`TTag`\>(`tagType`): `TTag` + +Gets a tag of the specified tag type if a matching tag exists in the current instance. + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `TTag` | extends [`Tag`](Tag.md)<`TTag`\> | + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `tagType` | [`TagTypes`](../enums/TagTypes.md) | Type of tag to retrieve | + +#### Returns + +`TTag` + +Tag Tag with specified type, if it exists. `undefined` otherwise. + +#### Inherited from + +[CombinedTag](CombinedTag.md).[getTag](CombinedTag.md#gettag) + +___ + +### removeTags + +▸ **removeTags**(): `void` + +Remove all tags that match the specified tagTypes. This is performed recursively. Any nested +`CombinedTag` instances are left in place. + +**`remarks`** Tags cannot be added or removed from Ogg files. This will do nothing. + +#### Returns + +`void` + +#### Overrides + +[CombinedTag](CombinedTag.md).[removeTags](CombinedTag.md#removetags) + +___ + +### replaceTag + +▸ `Protected` **replaceTag**(`oldTag`, `newTag`): `void` + +This is used for special cases where the order of tags is important. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `oldTag` | [`Tag`](Tag.md) | +| `newTag` | [`Tag`](Tag.md) | + +#### Returns + +`void` + +#### Inherited from + +[CombinedTag](CombinedTag.md).[replaceTag](CombinedTag.md#replacetag) + +___ + +### setComment + +▸ **setComment**(`streamSerialNumber`, `comment`): `void` + +Stores or removes a Xiph comment in a given stream. + +**`remarks`** As per Ogg spec, each stream must have a Xiph comment header. Therefore, comments + cannot be set to a falsy value. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `streamSerialNumber` | `number` | Serial number of the stream in which to store the comment. Must be a positive 32-bit integer | +| `comment` | [`XiphComment`](XiphComment.md) | Xiph comment to store in the stream. Use `undefined` to clear the comment from the stream | + +#### Returns + +`void` + +___ + +### setInfoTag + +▸ **setInfoTag**(): `void` + +Set the tags that represent the tagger software (node-taglib-sharp) itself. + +**`remarks`** This is typically a method to call just before saving a tag. + +#### Returns + +`void` + +#### Inherited from + +[CombinedTag](CombinedTag.md).[setInfoTag](CombinedTag.md#setinfotag) + +___ + +### validateTagCreation + +▸ `Protected` **validateTagCreation**(`tagType`): `void` + +Verifies if a tag can be added to the current instance. The criteria for validation are: +* A tag of the given tag type does not already exist +* The given tag type is supported by the current instance + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `tagType` | [`TagTypes`](../enums/TagTypes.md) | Tag type that the caller wants to create | + +#### Returns + +`void` + +#### Inherited from + +[CombinedTag](CombinedTag.md).[validateTagCreation](CombinedTag.md#validatetagcreation) + +___ + +### firstInGroup + +▸ `Static` `Protected` **firstInGroup**(`group`): `string` + +Gets the first string in an array. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `group` | `string`[] | Array of strings to get the first string from. | + +#### Returns + +`string` + +First string contained in `group` or `undefined` if the array is + `undefined` or empty + +#### Inherited from + +[CombinedTag](CombinedTag.md).[firstInGroup](CombinedTag.md#firstingroup) + +___ + +### isFalsyOrLikeEmpty + +▸ `Static` `Protected` **isFalsyOrLikeEmpty**(`value`): `boolean` + +Checks if a value is falsy or empty. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | `string` \| `string`[] | Object to check | + +#### Returns + +`boolean` + +If `value` is a string, `true` is returned if the value is falsy or all + whitespace, `false` is returned otherwise. If `value` is an array of strings, + the array must be falsy or all elements must be falsy or whitespace to return `true`. + +#### Inherited from + +[CombinedTag](CombinedTag.md).[isFalsyOrLikeEmpty](CombinedTag.md#isfalsyorlikeempty) + +___ + +### joinGroup + +▸ `Static` `Protected` **joinGroup**(`group`): `string` + +Joins an array of string into a single, semicolon and space separated string. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `group` | `string`[] | Array of string to join | + +#### Returns + +`string` + +A semicolon and space separated string containing the values from `group` + or undefined if the array is `undefined` or empty. + +#### Inherited from + +[CombinedTag](CombinedTag.md).[joinGroup](CombinedTag.md#joingroup) + +___ + +### tagTypeFlagsToArray + +▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/TagTypes.md)[] + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `tagTypes` | [`TagTypes`](../enums/TagTypes.md) | + +#### Returns + +[`TagTypes`](../enums/TagTypes.md)[] + +#### Inherited from + +[CombinedTag](CombinedTag.md).[tagTypeFlagsToArray](CombinedTag.md#tagtypeflagstoarray) diff --git a/docs/classes/OggTheoraCodec.md b/docs/classes/OggTheoraCodec.md new file mode 100644 index 00000000..aa76cf39 --- /dev/null +++ b/docs/classes/OggTheoraCodec.md @@ -0,0 +1,228 @@ +[node-taglib-sharp](../README.md) / [Exports](../modules.md) / OggTheoraCodec + +# Class: OggTheoraCodec + +Represents an Ogg Theora bitstream for use in an Ogg file. + +## Implements + +- `default` +- [`IVideoCodec`](../interfaces/IVideoCodec.md) + +## Table of contents + +### Constructors + +- [constructor](OggTheoraCodec.md#constructor) + +### Accessors + +- [commentData](OggTheoraCodec.md#commentdata) +- [description](OggTheoraCodec.md#description) +- [durationMilliseconds](OggTheoraCodec.md#durationmilliseconds) +- [mediaTypes](OggTheoraCodec.md#mediatypes) +- [videoHeight](OggTheoraCodec.md#videoheight) +- [videoWidth](OggTheoraCodec.md#videowidth) + +### Methods + +- [readPacket](OggTheoraCodec.md#readpacket) +- [setDuration](OggTheoraCodec.md#setduration) +- [writeCommentPacket](OggTheoraCodec.md#writecommentpacket) +- [isHeaderPacket](OggTheoraCodec.md#isheaderpacket) + +## Constructors + +### constructor + +• **new OggTheoraCodec**(`headerPacket`) + +Constructs and initializes a new instance using the provided header packet. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `headerPacket` | [`ByteVector`](ByteVector.md) | Packet that contains the Theora header data | + +## Accessors + +### commentData + +• `get` **commentData**(): [`ByteVector`](ByteVector.md) + +**`inheritdoc`** + +#### Returns + +[`ByteVector`](ByteVector.md) + +#### Implementation of + +IOggCodec.commentData + +___ + +### description + +• `get` **description**(): `string` + +Gets a text description of the media represented by the current instance. + +#### Returns + +`string` + +#### Implementation of + +[IVideoCodec](../interfaces/IVideoCodec.md).[description](../interfaces/IVideoCodec.md#description) + +___ + +### durationMilliseconds + +• `get` **durationMilliseconds**(): `number` + +Duration of the media in milliseconds represented by the current instance. + +#### Returns + +`number` + +#### Implementation of + +[IVideoCodec](../interfaces/IVideoCodec.md).[durationMilliseconds](../interfaces/IVideoCodec.md#durationmilliseconds) + +___ + +### mediaTypes + +• `get` **mediaTypes**(): [`MediaTypes`](../enums/MediaTypes.md) + +Types of media represented by the current instance, bitwise combined. + +#### Returns + +[`MediaTypes`](../enums/MediaTypes.md) + +#### Implementation of + +[IVideoCodec](../interfaces/IVideoCodec.md).[mediaTypes](../interfaces/IVideoCodec.md#mediatypes) + +___ + +### videoHeight + +• `get` **videoHeight**(): `number` + +Height of the video in pixels represented by the current instance. + +#### Returns + +`number` + +#### Implementation of + +[IVideoCodec](../interfaces/IVideoCodec.md).[videoHeight](../interfaces/IVideoCodec.md#videoheight) + +___ + +### videoWidth + +• `get` **videoWidth**(): `number` + +Width of the video in pixels represented by the current instance. + +#### Returns + +`number` + +#### Implementation of + +[IVideoCodec](../interfaces/IVideoCodec.md).[videoWidth](../interfaces/IVideoCodec.md#videowidth) + +## Methods + +### readPacket + +▸ **readPacket**(`packet`): `boolean` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `packet` | [`ByteVector`](ByteVector.md) | + +#### Returns + +`boolean` + +#### Implementation of + +IOggCodec.readPacket + +___ + +### setDuration + +▸ **setDuration**(`firstGranularPosition`, `lastGranularPosition`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `firstGranularPosition` | `number` | +| `lastGranularPosition` | `number` | + +#### Returns + +`void` + +#### Implementation of + +IOggCodec.setDuration + +___ + +### writeCommentPacket + +▸ **writeCommentPacket**(`packets`, `comment`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `packets` | [`ByteVector`](ByteVector.md)[] | +| `comment` | [`XiphComment`](XiphComment.md) | + +#### Returns + +`void` + +#### Implementation of + +IOggCodec.writeCommentPacket + +___ + +### isHeaderPacket + +▸ `Static` **isHeaderPacket**(`packet`): `boolean` + +Checks to see if packet is a Theora header packet. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `packet` | [`ByteVector`](ByteVector.md) | Packet to check | + +#### Returns + +`boolean` diff --git a/docs/classes/OggVorbisCodec.md b/docs/classes/OggVorbisCodec.md new file mode 100644 index 00000000..1e5cede0 --- /dev/null +++ b/docs/classes/OggVorbisCodec.md @@ -0,0 +1,249 @@ +[node-taglib-sharp](../README.md) / [Exports](../modules.md) / OggVorbisCodec + +# Class: OggVorbisCodec + +Represents an Ogg Vorbis bitstream for use in an Ogg file. + +## Implements + +- `default` +- [`IAudioCodec`](../interfaces/IAudioCodec.md) + +## Table of contents + +### Constructors + +- [constructor](OggVorbisCodec.md#constructor) + +### Accessors + +- [audioBitrate](OggVorbisCodec.md#audiobitrate) +- [audioChannels](OggVorbisCodec.md#audiochannels) +- [audioSampleRate](OggVorbisCodec.md#audiosamplerate) +- [commentData](OggVorbisCodec.md#commentdata) +- [description](OggVorbisCodec.md#description) +- [durationMilliseconds](OggVorbisCodec.md#durationmilliseconds) +- [mediaTypes](OggVorbisCodec.md#mediatypes) + +### Methods + +- [readPacket](OggVorbisCodec.md#readpacket) +- [setDuration](OggVorbisCodec.md#setduration) +- [writeCommentPacket](OggVorbisCodec.md#writecommentpacket) +- [isHeaderPacket](OggVorbisCodec.md#isheaderpacket) + +## Constructors + +### constructor + +• **new OggVorbisCodec**(`headerPacket`) + +Constructs and initializes a new instance using the provided header packet. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `headerPacket` | [`ByteVector`](ByteVector.md) | Packet that contains the Vorbis header data | + +## Accessors + +### audioBitrate + +• `get` **audioBitrate**(): `number` + +Bitrate of the audio in kilobits per second represented by the current instance. + +**`remarks`** For Vorbis files, this is the nominal bitrate as specified in the identification + header. This may be significantly different than the actual average since this header + only provides decoding hints. + +#### Returns + +`number` + +#### Implementation of + +[IAudioCodec](../interfaces/IAudioCodec.md).[audioBitrate](../interfaces/IAudioCodec.md#audiobitrate) + +___ + +### audioChannels + +• `get` **audioChannels**(): `number` + +Number of channels in the audio represented by the current instance. + +#### Returns + +`number` + +#### Implementation of + +[IAudioCodec](../interfaces/IAudioCodec.md).[audioChannels](../interfaces/IAudioCodec.md#audiochannels) + +___ + +### audioSampleRate + +• `get` **audioSampleRate**(): `number` + +Sample rate of the audio represented by the current instance. + +#### Returns + +`number` + +#### Implementation of + +[IAudioCodec](../interfaces/IAudioCodec.md).[audioSampleRate](../interfaces/IAudioCodec.md#audiosamplerate) + +___ + +### commentData + +• `get` **commentData**(): [`ByteVector`](ByteVector.md) + +Gets the raw Xiph comment data contained in the codec. + +#### Returns + +[`ByteVector`](ByteVector.md) + +#### Implementation of + +IOggCodec.commentData + +___ + +### description + +• `get` **description**(): `string` + +Gets a text description of the media represented by the current instance. + +#### Returns + +`string` + +#### Implementation of + +[IAudioCodec](../interfaces/IAudioCodec.md).[description](../interfaces/IAudioCodec.md#description) + +___ + +### durationMilliseconds + +• `get` **durationMilliseconds**(): `number` + +Duration of the media in milliseconds represented by the current instance. + +#### Returns + +`number` + +#### Implementation of + +[IAudioCodec](../interfaces/IAudioCodec.md).[durationMilliseconds](../interfaces/IAudioCodec.md#durationmilliseconds) + +___ + +### mediaTypes + +• `get` **mediaTypes**(): [`MediaTypes`](../enums/MediaTypes.md) + +Types of media represented by the current instance, bitwise combined. + +#### Returns + +[`MediaTypes`](../enums/MediaTypes.md) + +#### Implementation of + +[IAudioCodec](../interfaces/IAudioCodec.md).[mediaTypes](../interfaces/IAudioCodec.md#mediatypes) + +## Methods + +### readPacket + +▸ **readPacket**(`packet`): `boolean` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `packet` | [`ByteVector`](ByteVector.md) | + +#### Returns + +`boolean` + +#### Implementation of + +IOggCodec.readPacket + +___ + +### setDuration + +▸ **setDuration**(`firstGranularPosition`, `lastGranularPosition`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `firstGranularPosition` | `number` | +| `lastGranularPosition` | `number` | + +#### Returns + +`void` + +#### Implementation of + +IOggCodec.setDuration + +___ + +### writeCommentPacket + +▸ **writeCommentPacket**(`packets`, `comment`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `packets` | [`ByteVector`](ByteVector.md)[] | +| `comment` | [`XiphComment`](XiphComment.md) | + +#### Returns + +`void` + +#### Implementation of + +IOggCodec.writeCommentPacket + +___ + +### isHeaderPacket + +▸ `Static` **isHeaderPacket**(`packet`): `boolean` + +Determines if a packet is a Vorbis header packet. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `packet` | [`ByteVector`](ByteVector.md) | Packet to check | + +#### Returns + +`boolean` diff --git a/docs/classes/picture.md b/docs/classes/Picture.md similarity index 69% rename from docs/classes/picture.md rename to docs/classes/Picture.md index c890308b..cc2c0625 100644 --- a/docs/classes/picture.md +++ b/docs/classes/Picture.md @@ -2,43 +2,43 @@ # Class: Picture -This class implements [IPicture](../interfaces/ipicture.md) and provides a mechanism for loading pictures from files. +This class implements [IPicture](../interfaces/IPicture.md) and provides a mechanism for loading pictures from files. ## Implements -- [`IPicture`](../interfaces/ipicture.md) +- [`IPicture`](../interfaces/IPicture.md) ## Table of contents ### Properties -- [data](picture.md#data) -- [description](picture.md#description) -- [filename](picture.md#filename) -- [mimeType](picture.md#mimetype) -- [type](picture.md#type) +- [data](Picture.md#data) +- [description](Picture.md#description) +- [filename](Picture.md#filename) +- [mimeType](Picture.md#mimetype) +- [type](Picture.md#type) ### Methods -- [fromData](picture.md#fromdata) -- [fromFileAbstraction](picture.md#fromfileabstraction) -- [fromFullData](picture.md#fromfulldata) -- [fromPath](picture.md#frompath) -- [getExtensionFromData](picture.md#getextensionfromdata) -- [getExtensionFromMimeType](picture.md#getextensionfrommimetype) -- [getMimeTypeFromFilename](picture.md#getmimetypefromfilename) +- [fromData](Picture.md#fromdata) +- [fromFileAbstraction](Picture.md#fromfileabstraction) +- [fromFullData](Picture.md#fromfulldata) +- [fromPath](Picture.md#frompath) +- [getExtensionFromData](Picture.md#getextensionfromdata) +- [getExtensionFromMimeType](Picture.md#getextensionfrommimetype) +- [getMimeTypeFromFilename](Picture.md#getmimetypefromfilename) ## Properties ### data -• **data**: [`ByteVector`](bytevector.md) +• **data**: [`ByteVector`](ByteVector.md) Gets and sets the picture data stored in the current instance. #### Implementation of -[IPicture](../interfaces/ipicture.md).[data](../interfaces/ipicture.md#data) +[IPicture](../interfaces/IPicture.md).[data](../interfaces/IPicture.md#data) ___ @@ -50,7 +50,7 @@ Gets and sets a description of the picture stored in the current instance. Optio #### Implementation of -[IPicture](../interfaces/ipicture.md).[description](../interfaces/ipicture.md#description) +[IPicture](../interfaces/IPicture.md).[description](../interfaces/IPicture.md#description) ___ @@ -62,7 +62,7 @@ Gets and sets a filename of the picture stored in the current instance. Optional #### Implementation of -[IPicture](../interfaces/ipicture.md).[filename](../interfaces/ipicture.md#filename) +[IPicture](../interfaces/IPicture.md).[filename](../interfaces/IPicture.md#filename) ___ @@ -74,25 +74,25 @@ Gets and sets the mime-type of the picture data stored in the current instance. #### Implementation of -[IPicture](../interfaces/ipicture.md).[mimeType](../interfaces/ipicture.md#mimetype) +[IPicture](../interfaces/IPicture.md).[mimeType](../interfaces/IPicture.md#mimetype) ___ ### type -• **type**: [`PictureType`](../enums/picturetype.md) +• **type**: [`PictureType`](../enums/PictureType.md) Gets and sets the type of the content visible in the picture stored in the current instance. #### Implementation of -[IPicture](../interfaces/ipicture.md).[type](../interfaces/ipicture.md#type) +[IPicture](../interfaces/IPicture.md).[type](../interfaces/IPicture.md#type) ## Methods ### fromData -▸ `Static` **fromData**(`data`): [`Picture`](picture.md) +▸ `Static` **fromData**(`data`): [`Picture`](Picture.md) Constructs and initializes a new instance from the data provided. The data is processed to discover the type of the picture. @@ -101,17 +101,17 @@ discover the type of the picture. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw bytes of the picture to store in the instance. Cannot be falsey | +| `data` | [`ByteVector`](ByteVector.md) | Raw bytes of the picture to store in the instance. Cannot be falsey | #### Returns -[`Picture`](picture.md) +[`Picture`](Picture.md) ___ ### fromFileAbstraction -▸ `Static` **fromFileAbstraction**(`abstraction`): [`Picture`](picture.md) +▸ `Static` **fromFileAbstraction**(`abstraction`): [`Picture`](Picture.md) Constructs and initializes a new instance from a file abstraction. The description and type of the file are determined by the name of the abstraction. @@ -124,13 +124,13 @@ of the file are determined by the name of the abstraction. #### Returns -[`Picture`](picture.md) +[`Picture`](Picture.md) ___ ### fromFullData -▸ `Static` **fromFullData**(`data`, `type`, `mimeType`, `description`): [`Picture`](picture.md) +▸ `Static` **fromFullData**(`data`, `type`, `mimeType`, `description`): [`Picture`](Picture.md) Constructs a new instance with the data provided. No processing of the data is done. @@ -138,20 +138,20 @@ Constructs a new instance with the data provided. No processing of the data is d | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Raw bytes of the picture to store in the instance. Cannot be falsey | -| `type` | [`PictureType`](../enums/picturetype.md) | Type of the picture. Cannot be null or undefined | +| `data` | [`ByteVector`](ByteVector.md) | Raw bytes of the picture to store in the instance. Cannot be falsey | +| `type` | [`PictureType`](../enums/PictureType.md) | Type of the picture. Cannot be null or undefined | | `mimeType` | `string` | MimeType of the picture. Cannot be falsey | | `description` | `string` | Description of the picture. Cannot be null or undefined | #### Returns -[`Picture`](picture.md) +[`Picture`](Picture.md) ___ ### fromPath -▸ `Static` **fromPath**(`filePath`): [`Picture`](picture.md) +▸ `Static` **fromPath**(`filePath`): [`Picture`](Picture.md) Constructs and initializes a new instance from a file located at the provided path. The type and description of the picture are determined by the extension of the file. The file is @@ -161,11 +161,11 @@ loaded completely. | Name | Type | Description | | :------ | :------ | :------ | -| `filePath` | `string` | Path to the file to use to use for the file | +| `filePath` | `string` | Path to the file to use for the file | #### Returns -[`Picture`](picture.md) +[`Picture`](Picture.md) ___ @@ -174,13 +174,13 @@ ___ ▸ `Static` **getExtensionFromData**(`data`): `string` Retrieve a mimetype from raw file data by reading the first few bytes of the file. Less -accurate than [getExtensionFromMimeType](picture.md#getextensionfrommimetype) since this is limited to image file types. +accurate than [getExtensionFromMimeType](Picture.md#getextensionfrommimetype) since this is limited to image file types. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Bytes of the file to read to identify the extension | +| `data` | [`ByteVector`](ByteVector.md) | Bytes of the file to read to identify the extension | #### Returns diff --git a/docs/classes/picturelazy.md b/docs/classes/PictureLazy.md similarity index 64% rename from docs/classes/picturelazy.md rename to docs/classes/PictureLazy.md index 261f1972..9a63123c 100644 --- a/docs/classes/picturelazy.md +++ b/docs/classes/PictureLazy.md @@ -2,49 +2,49 @@ # Class: PictureLazy -This class implements [IPicture](../interfaces/ipicture.md) and provides mechanisms for loading pictures from files. -Contrary to [Picture](picture.md), a reference to a file where the picture is located can be given and +This class implements [IPicture](../interfaces/IPicture.md) and provides mechanisms for loading pictures from files. +Contrary to [Picture](Picture.md), a reference to a file where the picture is located can be given and the picture is lazily loaded from the file, meaning that it will be read from the file only when needed. This saves time and memory if the picture loading is not required. ## Implements -- [`IPicture`](../interfaces/ipicture.md) +- [`IPicture`](../interfaces/IPicture.md) - `ILazy` ## Table of contents ### Accessors -- [data](picturelazy.md#data) -- [description](picturelazy.md#description) -- [filename](picturelazy.md#filename) -- [isLoaded](picturelazy.md#isloaded) -- [mimeType](picturelazy.md#mimetype) -- [type](picturelazy.md#type) +- [data](PictureLazy.md#data) +- [description](PictureLazy.md#description) +- [filename](PictureLazy.md#filename) +- [isLoaded](PictureLazy.md#isloaded) +- [mimeType](PictureLazy.md#mimetype) +- [type](PictureLazy.md#type) ### Methods -- [load](picturelazy.md#load) -- [fromData](picturelazy.md#fromdata) -- [fromFile](picturelazy.md#fromfile) -- [fromPath](picturelazy.md#frompath) +- [load](PictureLazy.md#load) +- [fromData](PictureLazy.md#fromdata) +- [fromFile](PictureLazy.md#fromfile) +- [fromPath](PictureLazy.md#frompath) ## Accessors ### data -• `get` **data**(): [`ByteVector`](bytevector.md) +• `get` **data**(): [`ByteVector`](ByteVector.md) Gets and sets the picture data stored in the current instance. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Implementation of -[IPicture](../interfaces/ipicture.md).[data](../interfaces/ipicture.md#data) +[IPicture](../interfaces/IPicture.md).[data](../interfaces/IPicture.md#data) • `set` **data**(`value`): `void` @@ -54,7 +54,7 @@ Gets and sets the picture data stored in the current instance. | Name | Type | | :------ | :------ | -| `value` | [`ByteVector`](bytevector.md) | +| `value` | [`ByteVector`](ByteVector.md) | #### Returns @@ -62,7 +62,7 @@ Gets and sets the picture data stored in the current instance. #### Implementation of -[IPicture](../interfaces/ipicture.md).[data](../interfaces/ipicture.md#data) +[IPicture](../interfaces/IPicture.md).[data](../interfaces/IPicture.md#data) ___ @@ -78,7 +78,7 @@ Gets and sets a description of the picture stored in the current instance. Optio #### Implementation of -[IPicture](../interfaces/ipicture.md).[description](../interfaces/ipicture.md#description) +[IPicture](../interfaces/IPicture.md).[description](../interfaces/IPicture.md#description) • `set` **description**(`value`): `void` @@ -96,7 +96,7 @@ Gets and sets a description of the picture stored in the current instance. Optio #### Implementation of -[IPicture](../interfaces/ipicture.md).[description](../interfaces/ipicture.md#description) +[IPicture](../interfaces/IPicture.md).[description](../interfaces/IPicture.md#description) ___ @@ -112,7 +112,7 @@ Gets and sets a filename of the picture stored in the current instance. Optional #### Implementation of -[IPicture](../interfaces/ipicture.md).[filename](../interfaces/ipicture.md#filename) +[IPicture](../interfaces/IPicture.md).[filename](../interfaces/IPicture.md#filename) • `set` **filename**(`value`): `void` @@ -130,7 +130,7 @@ Gets and sets a filename of the picture stored in the current instance. Optional #### Implementation of -[IPicture](../interfaces/ipicture.md).[filename](../interfaces/ipicture.md#filename) +[IPicture](../interfaces/IPicture.md).[filename](../interfaces/IPicture.md#filename) ___ @@ -144,6 +144,10 @@ ___ `boolean` +#### Implementation of + +ILazy.isLoaded + ___ ### mimeType @@ -158,7 +162,7 @@ Gets and sets the mime-type of the picture data stored in the current instance. #### Implementation of -[IPicture](../interfaces/ipicture.md).[mimeType](../interfaces/ipicture.md#mimetype) +[IPicture](../interfaces/IPicture.md).[mimeType](../interfaces/IPicture.md#mimetype) • `set` **mimeType**(`value`): `void` @@ -176,23 +180,23 @@ Gets and sets the mime-type of the picture data stored in the current instance. #### Implementation of -[IPicture](../interfaces/ipicture.md).[mimeType](../interfaces/ipicture.md#mimetype) +[IPicture](../interfaces/IPicture.md).[mimeType](../interfaces/IPicture.md#mimetype) ___ ### type -• `get` **type**(): [`PictureType`](../enums/picturetype.md) +• `get` **type**(): [`PictureType`](../enums/PictureType.md) Gets and sets the type of the content visible in the picture stored in the current instance. #### Returns -[`PictureType`](../enums/picturetype.md) +[`PictureType`](../enums/PictureType.md) #### Implementation of -[IPicture](../interfaces/ipicture.md).[type](../interfaces/ipicture.md#type) +[IPicture](../interfaces/IPicture.md).[type](../interfaces/IPicture.md#type) • `set` **type**(`value`): `void` @@ -202,7 +206,7 @@ Gets and sets the type of the content visible in the picture stored in the curre | Name | Type | | :------ | :------ | -| `value` | [`PictureType`](../enums/picturetype.md) | +| `value` | [`PictureType`](../enums/PictureType.md) | #### Returns @@ -210,7 +214,7 @@ Gets and sets the type of the content visible in the picture stored in the curre #### Implementation of -[IPicture](../interfaces/ipicture.md).[type](../interfaces/ipicture.md#type) +[IPicture](../interfaces/IPicture.md).[type](../interfaces/IPicture.md#type) ## Methods @@ -232,7 +236,7 @@ ___ ### fromData -▸ `Static` **fromData**(`data`): [`PictureLazy`](picturelazy.md) +▸ `Static` **fromData**(`data`): [`PictureLazy`](PictureLazy.md) Constructs a new picture using data that's already been read into memory. The content will not be lazily loaded. @@ -241,17 +245,17 @@ will not be lazily loaded. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | ByteVector Object containing picture data | +| `data` | [`ByteVector`](ByteVector.md) | ByteVector Object containing picture data | #### Returns -[`PictureLazy`](picturelazy.md) +[`PictureLazy`](PictureLazy.md) ___ ### fromFile -▸ `Static` **fromFile**(`file`, `offset`, `size?`): [`PictureLazy`](picturelazy.md) +▸ `Static` **fromFile**(`file`, `offset`, `size?`): [`PictureLazy`](PictureLazy.md) Constructs a new instance from a file abstraction. The content will be lazily loaded. @@ -265,22 +269,22 @@ Constructs a new instance from a file abstraction. The content will be lazily lo #### Returns -[`PictureLazy`](picturelazy.md) +[`PictureLazy`](PictureLazy.md) ___ ### fromPath -▸ `Static` **fromPath**(`path`): [`PictureLazy`](picturelazy.md) +▸ `Static` **fromPath**(`filePath`): [`PictureLazy`](PictureLazy.md) -Constructs a new instance that will be lazily loaded from the path provided. +Constructs a new instance that will be lazily loaded from the filePath provided. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `path` | `string` | Path to the file to read | +| `filePath` | `string` | Path to the file to read | #### Returns -[`PictureLazy`](picturelazy.md) +[`PictureLazy`](PictureLazy.md) diff --git a/docs/classes/properties.md b/docs/classes/Properties.md similarity index 60% rename from docs/classes/properties.md rename to docs/classes/Properties.md index ac00e58d..6296a6cc 100644 --- a/docs/classes/properties.md +++ b/docs/classes/Properties.md @@ -4,31 +4,31 @@ ## Implements -- [`ILosslessAudioCodec`](../interfaces/ilosslessaudiocodec.md) -- [`IVideoCodec`](../interfaces/ivideocodec.md) -- [`IPhotoCodec`](../interfaces/iphotocodec.md) +- [`ILosslessAudioCodec`](../interfaces/ILosslessAudioCodec.md) +- [`IVideoCodec`](../interfaces/IVideoCodec.md) +- [`IPhotoCodec`](../interfaces/IPhotoCodec.md) ## Table of contents ### Constructors -- [constructor](properties.md#constructor) +- [constructor](Properties.md#constructor) ### Accessors -- [audioBitrate](properties.md#audiobitrate) -- [audioChannels](properties.md#audiochannels) -- [audioSampleRate](properties.md#audiosamplerate) -- [bitsPerSample](properties.md#bitspersample) -- [codecs](properties.md#codecs) -- [description](properties.md#description) -- [durationMilliseconds](properties.md#durationmilliseconds) -- [mediaTypes](properties.md#mediatypes) -- [photoHeight](properties.md#photoheight) -- [photoQuality](properties.md#photoquality) -- [photoWidth](properties.md#photowidth) -- [videoHeight](properties.md#videoheight) -- [videoWidth](properties.md#videowidth) +- [audioBitrate](Properties.md#audiobitrate) +- [audioChannels](Properties.md#audiochannels) +- [audioSampleRate](Properties.md#audiosamplerate) +- [bitsPerSample](Properties.md#bitspersample) +- [codecs](Properties.md#codecs) +- [description](Properties.md#description) +- [durationMilliseconds](Properties.md#durationmilliseconds) +- [mediaTypes](Properties.md#mediatypes) +- [photoHeight](Properties.md#photoheight) +- [photoQuality](Properties.md#photoquality) +- [photoWidth](Properties.md#photowidth) +- [videoHeight](Properties.md#videoheight) +- [videoWidth](Properties.md#videowidth) ## Constructors @@ -36,7 +36,7 @@ • **new Properties**(`durationMilli?`, `codecs?`) -Constructs and initializes a new instance of [Properties](properties.md) with the specified codecs and +Constructs and initializes a new instance of [Properties](Properties.md) with the specified codecs and duration. #### Parameters @@ -44,7 +44,7 @@ duration. | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | | `durationMilli` | `number` | `0` | Duration of the media in milliseconds or 0 if the duration is to be read from the codecs. | -| `codecs` | [`ICodec`](../interfaces/icodec.md)[] | `[]` | Array of codecs to be used in the new instance. | +| `codecs` | [`ICodec`](../interfaces/ICodec.md)[] | `[]` | Array of codecs to be used in the new instance. | ## Accessors @@ -61,7 +61,7 @@ the first non-zero audio bitrate, or zero if no codecs with audio information we #### Implementation of -[ILosslessAudioCodec](../interfaces/ilosslessaudiocodec.md).[audioBitrate](../interfaces/ilosslessaudiocodec.md#audiobitrate) +[ILosslessAudioCodec](../interfaces/ILosslessAudioCodec.md).[audioBitrate](../interfaces/ILosslessAudioCodec.md#audiobitrate) ___ @@ -77,7 +77,7 @@ Gets the number of channels in the audio represented by the current instance. #### Implementation of -[ILosslessAudioCodec](../interfaces/ilosslessaudiocodec.md).[audioChannels](../interfaces/ilosslessaudiocodec.md#audiochannels) +[ILosslessAudioCodec](../interfaces/ILosslessAudioCodec.md).[audioChannels](../interfaces/ILosslessAudioCodec.md#audiochannels) ___ @@ -94,7 +94,7 @@ to the first non-zero audio bitrate, or zero if no audio codecs were found. #### Implementation of -[ILosslessAudioCodec](../interfaces/ilosslessaudiocodec.md).[audioSampleRate](../interfaces/ilosslessaudiocodec.md#audiosamplerate) +[ILosslessAudioCodec](../interfaces/ILosslessAudioCodec.md).[audioSampleRate](../interfaces/ILosslessAudioCodec.md#audiosamplerate) ___ @@ -112,13 +112,13 @@ found in the current instance. #### Implementation of -[ILosslessAudioCodec](../interfaces/ilosslessaudiocodec.md).[bitsPerSample](../interfaces/ilosslessaudiocodec.md#bitspersample) +[ILosslessAudioCodec](../interfaces/ILosslessAudioCodec.md).[bitsPerSample](../interfaces/ILosslessAudioCodec.md#bitspersample) ___ ### codecs -• `get` **codecs**(): [`ICodec`](../interfaces/icodec.md)[] +• `get` **codecs**(): [`ICodec`](../interfaces/ICodec.md)[] Gets the codecs contained in the current instance. @@ -127,7 +127,7 @@ Gets the codecs contained in the current instance. #### Returns -[`ICodec`](../interfaces/icodec.md)[] +[`ICodec`](../interfaces/ICodec.md)[] ___ @@ -144,7 +144,7 @@ joined by semi-colons. #### Implementation of -[IPhotoCodec](../interfaces/iphotocodec.md).[description](../interfaces/iphotocodec.md#description) +[IPhotoCodec](../interfaces/IPhotoCodec.md).[description](../interfaces/IPhotoCodec.md#description) ___ @@ -161,23 +161,23 @@ the constructor, that value is returned, otherwise the longest codec duration is #### Implementation of -[IPhotoCodec](../interfaces/iphotocodec.md).[durationMilliseconds](../interfaces/iphotocodec.md#durationmilliseconds) +[IPhotoCodec](../interfaces/IPhotoCodec.md).[durationMilliseconds](../interfaces/IPhotoCodec.md#durationmilliseconds) ___ ### mediaTypes -• `get` **mediaTypes**(): [`MediaTypes`](../enums/mediatypes.md) +• `get` **mediaTypes**(): [`MediaTypes`](../enums/MediaTypes.md) Gets the types of media represented by the current instance. #### Returns -[`MediaTypes`](../enums/mediatypes.md) +[`MediaTypes`](../enums/MediaTypes.md) #### Implementation of -[IPhotoCodec](../interfaces/iphotocodec.md).[mediaTypes](../interfaces/iphotocodec.md#mediatypes) +[IPhotoCodec](../interfaces/IPhotoCodec.md).[mediaTypes](../interfaces/IPhotoCodec.md#mediatypes) ___ @@ -193,7 +193,7 @@ Gets the height of the photo in pixels represented by the current instance. #### Implementation of -[IPhotoCodec](../interfaces/iphotocodec.md).[photoHeight](../interfaces/iphotocodec.md#photoheight) +[IPhotoCodec](../interfaces/IPhotoCodec.md).[photoHeight](../interfaces/IPhotoCodec.md#photoheight) ___ @@ -210,7 +210,7 @@ instance. A value of `0` means that there was no quality indicator for the forma #### Implementation of -[IPhotoCodec](../interfaces/iphotocodec.md).[photoQuality](../interfaces/iphotocodec.md#photoquality) +[IPhotoCodec](../interfaces/IPhotoCodec.md).[photoQuality](../interfaces/IPhotoCodec.md#photoquality) ___ @@ -226,7 +226,7 @@ Gets the width of the photo in pixels represented by the current instance. #### Implementation of -[IPhotoCodec](../interfaces/iphotocodec.md).[photoWidth](../interfaces/iphotocodec.md#photowidth) +[IPhotoCodec](../interfaces/IPhotoCodec.md).[photoWidth](../interfaces/IPhotoCodec.md#photowidth) ___ @@ -243,7 +243,7 @@ This value is equal to the first non-zero video height; #### Implementation of -[IVideoCodec](../interfaces/ivideocodec.md).[videoHeight](../interfaces/ivideocodec.md#videoheight) +[IVideoCodec](../interfaces/IVideoCodec.md).[videoHeight](../interfaces/IVideoCodec.md#videoheight) ___ @@ -260,4 +260,4 @@ This value is equal to the first non-zero video height. #### Implementation of -[IVideoCodec](../interfaces/ivideocodec.md).[videoWidth](../interfaces/ivideocodec.md#videowidth) +[IVideoCodec](../interfaces/IVideoCodec.md).[videoWidth](../interfaces/IVideoCodec.md#videowidth) diff --git a/docs/classes/riffbitmapinfoheader.md b/docs/classes/RiffBitmapInfoHeader.md similarity index 69% rename from docs/classes/riffbitmapinfoheader.md rename to docs/classes/RiffBitmapInfoHeader.md index 682361f0..e3938f65 100644 --- a/docs/classes/riffbitmapinfoheader.md +++ b/docs/classes/RiffBitmapInfoHeader.md @@ -9,33 +9,33 @@ information about the dimensions and color format of a device-independent bitmap ## Implements -- [`IVideoCodec`](../interfaces/ivideocodec.md) +- [`IVideoCodec`](../interfaces/IVideoCodec.md) ## Table of contents ### Constructors -- [constructor](riffbitmapinfoheader.md#constructor) +- [constructor](RiffBitmapInfoHeader.md#constructor) ### Properties -- [FOURCC\_CODES](riffbitmapinfoheader.md#fourcc_codes) +- [FOURCC\_CODES](RiffBitmapInfoHeader.md#fourcc_codes) ### Accessors -- [bitCount](riffbitmapinfoheader.md#bitcount) -- [colorsUsed](riffbitmapinfoheader.md#colorsused) -- [compressionId](riffbitmapinfoheader.md#compressionid) -- [description](riffbitmapinfoheader.md#description) -- [durationMilliseconds](riffbitmapinfoheader.md#durationmilliseconds) -- [imageSize](riffbitmapinfoheader.md#imagesize) -- [importantColors](riffbitmapinfoheader.md#importantcolors) -- [mediaTypes](riffbitmapinfoheader.md#mediatypes) -- [planes](riffbitmapinfoheader.md#planes) -- [videoHeight](riffbitmapinfoheader.md#videoheight) -- [videoWidth](riffbitmapinfoheader.md#videowidth) -- [xPixelsPerMeter](riffbitmapinfoheader.md#xpixelspermeter) -- [yPixelsPerMeter](riffbitmapinfoheader.md#ypixelspermeter) +- [bitCount](RiffBitmapInfoHeader.md#bitcount) +- [colorsUsed](RiffBitmapInfoHeader.md#colorsused) +- [compressionId](RiffBitmapInfoHeader.md#compressionid) +- [description](RiffBitmapInfoHeader.md#description) +- [durationMilliseconds](RiffBitmapInfoHeader.md#durationmilliseconds) +- [imageSize](RiffBitmapInfoHeader.md#imagesize) +- [importantColors](RiffBitmapInfoHeader.md#importantcolors) +- [mediaTypes](RiffBitmapInfoHeader.md#mediatypes) +- [planes](RiffBitmapInfoHeader.md#planes) +- [videoHeight](RiffBitmapInfoHeader.md#videoheight) +- [videoWidth](RiffBitmapInfoHeader.md#videowidth) +- [xPixelsPerMeter](RiffBitmapInfoHeader.md#xpixelspermeter) +- [yPixelsPerMeter](RiffBitmapInfoHeader.md#ypixelspermeter) ## Constructors @@ -44,24 +44,20 @@ information about the dimensions and color format of a device-independent bitmap • **new RiffBitmapInfoHeader**(`data`, `offset`) Constructs and initializes a new instance by reading the raw structure from a specified -position in the provided [ByteVector](bytevector.md). +position in the provided [ByteVector](ByteVector.md). #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | ByteVector containing the raw data structure | +| `data` | [`ByteVector`](ByteVector.md) | ByteVector containing the raw data structure | | `offset` | `number` | Index into `data` where the raw bitmap info header begins. Must be a positive, 32-bit integer. | ## Properties ### FOURCC\_CODES -▪ `Static` `Readonly` **FOURCC\_CODES**: `Object` - -#### Index signature - -▪ [key: `number`]: `string` +▪ `Static` `Readonly` **FOURCC\_CODES**: `Map`<`number`, `string`\> ## Accessors @@ -106,7 +102,7 @@ Gets the compression ID for the image. * `BI_BITFIELDS` = `0x00000003` => Uncompressed RGB with color masks, valid for 16 and 32 bpp bitmaps. - [description](riffbitmapinfoheader.md#description) makes a best guess attempt to determine the name of the compression + [description](RiffBitmapInfoHeader.md#description) makes a best guess attempt to determine the name of the compression codec used. #### Returns @@ -127,7 +123,7 @@ Gets a text description of the media represented by the current instance. #### Implementation of -[IVideoCodec](../interfaces/ivideocodec.md).[description](../interfaces/ivideocodec.md#description) +[IVideoCodec](../interfaces/IVideoCodec.md).[description](../interfaces/IVideoCodec.md#description) ___ @@ -143,7 +139,7 @@ Duration of the media in milliseconds represented by the current instance. #### Implementation of -[IVideoCodec](../interfaces/ivideocodec.md).[durationMilliseconds](../interfaces/ivideocodec.md#durationmilliseconds) +[IVideoCodec](../interfaces/IVideoCodec.md).[durationMilliseconds](../interfaces/IVideoCodec.md#durationmilliseconds) ___ @@ -174,17 +170,17 @@ ___ ### mediaTypes -• `get` **mediaTypes**(): [`MediaTypes`](../enums/mediatypes.md) +• `get` **mediaTypes**(): [`MediaTypes`](../enums/MediaTypes.md) Types of media represented by the current instance, bitwise combined. #### Returns -[`MediaTypes`](../enums/mediatypes.md) +[`MediaTypes`](../enums/MediaTypes.md) #### Implementation of -[IVideoCodec](../interfaces/ivideocodec.md).[mediaTypes](../interfaces/ivideocodec.md#mediatypes) +[IVideoCodec](../interfaces/IVideoCodec.md).[mediaTypes](../interfaces/IVideoCodec.md#mediatypes) ___ @@ -212,7 +208,7 @@ Height of the video in pixels represented by the current instance. #### Implementation of -[IVideoCodec](../interfaces/ivideocodec.md).[videoHeight](../interfaces/ivideocodec.md#videoheight) +[IVideoCodec](../interfaces/IVideoCodec.md).[videoHeight](../interfaces/IVideoCodec.md#videoheight) ___ @@ -228,7 +224,7 @@ Width of the video in pixels represented by the current instance. #### Implementation of -[IVideoCodec](../interfaces/ivideocodec.md).[videoWidth](../interfaces/ivideocodec.md#videowidth) +[IVideoCodec](../interfaces/IVideoCodec.md).[videoWidth](../interfaces/IVideoCodec.md#videowidth) ___ diff --git a/docs/classes/rifffile.md b/docs/classes/RiffFile.md similarity index 62% rename from docs/classes/rifffile.md rename to docs/classes/RiffFile.md index 2638ba5a..3d910020 100644 --- a/docs/classes/rifffile.md +++ b/docs/classes/RiffFile.md @@ -2,7 +2,7 @@ # Class: RiffFile -This class extends [File](file.md) to provide tagging and properties support for RIFF files. These +This class extends [File](File.md) to provide tagging and properties support for RIFF files. These are usually WAV and AVI file. **`remarks`** The RIFF standard supports a general purpose "chunk" system that software can use for @@ -10,7 +10,7 @@ are usually WAV and AVI file. ## Hierarchy -- [`File`](file.md) +- [`File`](File.md) ↳ **`RiffFile`** @@ -18,54 +18,52 @@ are usually WAV and AVI file. ### Constructors -- [constructor](rifffile.md#constructor) +- [constructor](RiffFile.md#constructor) ### Properties -- [\_fileAbstraction](rifffile.md#_fileabstraction) -- [\_fileStream](rifffile.md#_filestream) -- [\_tagTypesOnDisk](rifffile.md#_tagtypesondisk) -- [fileIdentifier](rifffile.md#fileidentifier) +- [FILE\_IDENTIFIER](RiffFile.md#file_identifier) ### Accessors -- [corruptionReasons](rifffile.md#corruptionreasons) -- [fileAbstraction](rifffile.md#fileabstraction) -- [isPossiblyCorrupt](rifffile.md#ispossiblycorrupt) -- [isWritable](rifffile.md#iswritable) -- [length](rifffile.md#length) -- [mimeType](rifffile.md#mimetype) -- [mode](rifffile.md#mode) -- [name](rifffile.md#name) -- [position](rifffile.md#position) -- [properties](rifffile.md#properties) -- [tag](rifffile.md#tag) -- [tagTypes](rifffile.md#tagtypes) -- [tagTypesOnDisk](rifffile.md#tagtypesondisk) -- [bufferSize](rifffile.md#buffersize) +- [corruptionReasons](RiffFile.md#corruptionreasons) +- [fileAbstraction](RiffFile.md#fileabstraction) +- [hasTags](RiffFile.md#hastags) +- [isPossiblyCorrupt](RiffFile.md#ispossiblycorrupt) +- [isWritable](RiffFile.md#iswritable) +- [length](RiffFile.md#length) +- [mimeType](RiffFile.md#mimetype) +- [mode](RiffFile.md#mode) +- [name](RiffFile.md#name) +- [position](RiffFile.md#position) +- [properties](RiffFile.md#properties) +- [tag](RiffFile.md#tag) +- [tagTypes](RiffFile.md#tagtypes) +- [tagTypesOnDisk](RiffFile.md#tagtypesondisk) +- [bufferSize](RiffFile.md#buffersize) ### Methods -- [dispose](rifffile.md#dispose) -- [find](rifffile.md#find) -- [getTag](rifffile.md#gettag) -- [insert](rifffile.md#insert) -- [markAsCorrupt](rifffile.md#markascorrupt) -- [preSave](rifffile.md#presave) -- [rFind](rifffile.md#rfind) -- [readBlock](rifffile.md#readblock) -- [removeBlock](rifffile.md#removeblock) -- [removeTags](rifffile.md#removetags) -- [save](rifffile.md#save) -- [seek](rifffile.md#seek) -- [truncate](rifffile.md#truncate) -- [writeBlock](rifffile.md#writeblock) -- [addFileType](rifffile.md#addfiletype) -- [addFileTypeResolver](rifffile.md#addfiletyperesolver) -- [createFromAbstraction](rifffile.md#createfromabstraction) -- [createFromPath](rifffile.md#createfrompath) -- [removeFileType](rifffile.md#removefiletype) -- [removeFileTypeResolver](rifffile.md#removefiletyperesolver) +- [dispose](RiffFile.md#dispose) +- [find](RiffFile.md#find) +- [getTag](RiffFile.md#gettag) +- [insert](RiffFile.md#insert) +- [markAsCorrupt](RiffFile.md#markascorrupt) +- [preSave](RiffFile.md#presave) +- [rFind](RiffFile.md#rfind) +- [readBlock](RiffFile.md#readblock) +- [removeBlock](RiffFile.md#removeblock) +- [removeTags](RiffFile.md#removetags) +- [save](RiffFile.md#save) +- [seek](RiffFile.md#seek) +- [truncate](RiffFile.md#truncate) +- [writeBlock](RiffFile.md#writeblock) +- [addFileType](RiffFile.md#addfiletype) +- [addFileTypeResolver](RiffFile.md#addfiletyperesolver) +- [createFromAbstraction](RiffFile.md#createfromabstraction) +- [createFromPath](RiffFile.md#createfrompath) +- [removeFileType](RiffFile.md#removefiletype) +- [removeFileTypeResolver](RiffFile.md#removefiletyperesolver) ## Constructors @@ -80,73 +78,68 @@ Constructs and initializes a new instance of a RIFF file based on the provided f | Name | Type | Description | | :------ | :------ | :------ | | `file` | `string` \| `IFileAbstraction` | File abstraction or path to a file to open as a RIFF file | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | How in-depth to read the properties of the file | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | How in-depth to read the properties of the file | #### Overrides -[File](file.md).[constructor](file.md#constructor) +[File](File.md).[constructor](File.md#constructor) ## Properties -### \_fileAbstraction +### FILE\_IDENTIFIER -• `Protected` **\_fileAbstraction**: `IFileAbstraction` +▪ `Static` `Readonly` **FILE\_IDENTIFIER**: [`ByteVector`](ByteVector.md) -#### Inherited from - -[File](file.md).[_fileAbstraction](file.md#_fileabstraction) - -___ - -### \_fileStream +Identifier at the beginning of a RIFF file. -• `Protected` **\_fileStream**: `IStream` +## Accessors -#### Inherited from +### corruptionReasons -[File](file.md).[_fileStream](file.md#_filestream) +• `get` **corruptionReasons**(): `string`[] -___ +Reasons for which this file is marked as corrupt. -### \_tagTypesOnDisk +#### Returns -• `Protected` **\_tagTypesOnDisk**: [`TagTypes`](../enums/tagtypes.md) +`string`[] #### Inherited from -[File](file.md).[_tagTypesOnDisk](file.md#_tagtypesondisk) +File.corruptionReasons ___ -### fileIdentifier - -▪ `Static` `Readonly` **fileIdentifier**: [`ByteVector`](bytevector.md) - -Identifier at the beginning of a RIFF file. +### fileAbstraction -## Accessors +• `get` **fileAbstraction**(): `IFileAbstraction` -### corruptionReasons +Gets the {@link IFileAbstraction} representing the file. -• `get` **corruptionReasons**(): `string`[] +#### Returns -Reasons for which this file is marked as corrupt. +`IFileAbstraction` -#### Returns +#### Inherited from -`string`[] +File.fileAbstraction ___ -### fileAbstraction +### hasTags -• `get` **fileAbstraction**(): `IFileAbstraction` +• `get` **hasTags**(): `boolean` -Gets the {@link IFileAbstraction} representing the file. +Shortcut property to determine if a file has tags in memory. +NOTE: Just because `tag !== undefined` does not mean there are tags in memory. #### Returns -`IFileAbstraction` +`boolean` + +#### Inherited from + +File.hasTags ___ @@ -161,6 +154,10 @@ be written. `boolean` +#### Inherited from + +File.isPossiblyCorrupt + ___ ### isWritable @@ -173,6 +170,10 @@ Indicates whether or not tags can be written back to the current file. `boolean` +#### Inherited from + +File.isWritable + ___ ### length @@ -186,6 +187,10 @@ is not open for reading; `number` +#### Inherited from + +File.length + ___ ### mimeType @@ -198,34 +203,46 @@ Gets the MimeType of the file as determined during creation of the instance. `string` +#### Inherited from + +File.mimeType + ___ ### mode -• `get` **mode**(): [`FileAccessMode`](../enums/fileaccessmode.md) +• `get` **mode**(): [`FileAccessMode`](../enums/FileAccessMode.md) Gets the file access mode in use by the current instance. #### Returns -[`FileAccessMode`](../enums/fileaccessmode.md) +[`FileAccessMode`](../enums/FileAccessMode.md) + +#### Inherited from + +File.mode • `set` **mode**(`val`): `void` Sets the file access mode in use by the current instance. Changing the value will cause the stream currently in use to be closed, except when a change is made from -[FileAccessMode.Write](../enums/fileaccessmode.md#write) to [FileAccessMode.Read](../enums/fileaccessmode.md#read) which has no effect. +[FileAccessMode.Write](../enums/FileAccessMode.md#write) to [FileAccessMode.Read](../enums/FileAccessMode.md#read) which has no effect. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `val` | [`FileAccessMode`](../enums/fileaccessmode.md) | File access mode to change to | +| `val` | [`FileAccessMode`](../enums/FileAccessMode.md) | File access mode to change to | #### Returns `void` +#### Inherited from + +File.mode + ___ ### name @@ -238,6 +255,10 @@ Gets the name of the file as stored in its file abstraction. `string` +#### Inherited from + +File.name + ___ ### position @@ -251,57 +272,91 @@ if the file is not open for reading `number` +#### Inherited from + +File.position + ___ ### properties -• `get` **properties**(): [`Properties`](properties.md) - -Gets the media properties of the file represented by the current instance. +• `get` **properties**(): [`Properties`](Properties.md) **`inheritdoc`** #### Returns -[`Properties`](properties.md) +[`Properties`](Properties.md) + +#### Overrides + +File.properties ___ ### tag -• `get` **tag**(): [`Tag`](tag.md) - -Gets an abstract representation of all tags stored in the current instance. +• `get` **tag**(): [`Tag`](Tag.md) **`inheritdoc`** #### Returns -[`Tag`](tag.md) +[`Tag`](Tag.md) + +#### Overrides + +File.tag ___ ### tagTypes -• `get` **tagTypes**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypes**(): [`TagTypes`](../enums/TagTypes.md) Gets the tag types contained in the current instance. #### Returns -[`TagTypes`](../enums/tagtypes.md) +[`TagTypes`](../enums/TagTypes.md) + +#### Inherited from + +File.tagTypes ___ ### tagTypesOnDisk -• `get` **tagTypesOnDisk**(): [`TagTypes`](../enums/tagtypes.md) +• `get` **tagTypesOnDisk**(): [`TagTypes`](../enums/TagTypes.md) + +Gets the tag types contained in the physical file represented by the current instance. + +#### Returns + +[`TagTypes`](../enums/TagTypes.md) + +#### Inherited from + +File.tagTypesOnDisk + +• `set` **tagTypesOnDisk**(`value`): `void` Gets the tag types contained in the physical file represented by the current instance. +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | [`TagTypes`](../enums/TagTypes.md) | + #### Returns -[`TagTypes`](../enums/tagtypes.md) +`void` + +#### Inherited from + +File.tagTypesOnDisk ___ @@ -315,6 +370,10 @@ Gets the buffer size to use when reading large blocks of data `number` +#### Inherited from + +File.bufferSize + ## Methods ### dispose @@ -329,7 +388,7 @@ Dispose the current instance. Equivalent to setting the mode to closed. #### Inherited from -[File](file.md).[dispose](file.md#dispose) +[File](File.md).[dispose](File.md#dispose) ___ @@ -346,9 +405,9 @@ Searches forward through a file for a specified pattern, starting at a specified | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | `undefined` | Pattern to search for in the current instance. Must be smaller than the | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern to search for in the current instance. Must be smaller than the | | `startPosition` | `number` | `0` | Seek position to start searching. Must be positive, safe integer. | -| `before?` | [`ByteVector`](bytevector.md) | `undefined` | Optional pattern that the searched for pattern must appear before. If this pattern is found first, `-1` is returned. | +| `before?` | [`ByteVector`](ByteVector.md) | `undefined` | Optional pattern that the searched for pattern must appear before. If this pattern is found first, `-1` is returned. | #### Returns @@ -358,13 +417,13 @@ Index at which the value was found. If not found, `-1` is returned. #### Inherited from -[File](file.md).[find](file.md#find) +[File](File.md).[find](File.md#find) ___ ### getTag -▸ **getTag**(`type`, `create`): [`Tag`](tag.md) +▸ **getTag**(`type`, `create`): [`Tag`](Tag.md) Gets a tag of the specified type from the current instance, optionally creating a new tag if possible. @@ -373,12 +432,12 @@ possible. | Name | Type | Description | | :------ | :------ | :------ | -| `type` | [`TagTypes`](../enums/tagtypes.md) | Type of tag to read. | +| `type` | [`TagTypes`](../enums/TagTypes.md) | Type of tag to read. | | `create` | `boolean` | Whether or not to try and create the tag if one is not found. `true` does not guarantee the tag will be created. For example, trying to create an ID3v2 tag on an OGG Vorbis file will always fail. | #### Returns -[`Tag`](tag.md) +[`Tag`](Tag.md) Tag object containing the tag that was found in or added to the current instance. If no matching tag was found and none was created, `undefined` is returned. It is safe @@ -387,7 +446,7 @@ Tag object containing the tag that was found in or added to the current instance #### Overrides -[File](file.md).[getTag](file.md#gettag) +[File](File.md).[getTag](File.md#gettag) ___ @@ -405,7 +464,7 @@ specified location, replacing a specified number of bytes. | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | `undefined` | Data to insert into the file. | +| `data` | [`ByteVector`](ByteVector.md) | `undefined` | Data to insert into the file. | | `start` | `number` | `undefined` | Index into the file at which to insert the data. Must be safe positive integer. | | `replace` | `number` | `0` | Number of bytes to replace. Typically this is the original size of the data block so that a new block will replace the old one. | @@ -415,7 +474,7 @@ specified location, replacing a specified number of bytes. #### Inherited from -[File](file.md).[insert](file.md#insert) +[File](File.md).[insert](File.md#insert) ___ @@ -437,7 +496,7 @@ Mark the current instance as corrupt. NOTE: Not intended to be used outside of t #### Inherited from -[File](file.md).[markAsCorrupt](file.md#markascorrupt) +[File](File.md).[markAsCorrupt](File.md#markascorrupt) ___ @@ -453,7 +512,7 @@ Prepares to save the file. This must be called at the beginning of every File.sa #### Inherited from -[File](file.md).[preSave](file.md#presave) +[File](File.md).[preSave](File.md#presave) ___ @@ -470,7 +529,7 @@ Searches backwards through a file for a specified pattern, starting at a specifi | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | `undefined` | Pattern to search for in the current instance. Must be shorter than the [bufferSize](rifffile.md#buffersize) | +| `pattern` | [`ByteVector`](ByteVector.md) | `undefined` | Pattern to search for in the current instance. Must be shorter than the [bufferSize](RiffFile.md#buffersize) | | `startPosition` | `number` | `0` | Number of bytes from end of the file to begin searching. | #### Returns @@ -481,17 +540,17 @@ Index at which the value wa found. If not found, `-1` is returned. #### Inherited from -[File](file.md).[rFind](file.md#rfind) +[File](File.md).[rFind](File.md#rfind) ___ ### readBlock -▸ **readBlock**(`length`): [`ByteVector`](bytevector.md) +▸ **readBlock**(`length`): [`ByteVector`](ByteVector.md) Reads a specified number of bytes at the current seek position from the current position. This method reads the block of data at the current seek position. To change the seek -position, use [File.seek](file.md#seek). +position, use [File.seek](File.md#seek). **`throws`** Error Thrown when `length` is not a positive, safe integer. @@ -503,13 +562,13 @@ position, use [File.seek](file.md#seek). #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ByteVector Object containing the data read from the current instance. #### Inherited from -[File](file.md).[readBlock](file.md#readblock) +[File](File.md).[readBlock](File.md#readblock) ___ @@ -535,7 +594,7 @@ Removes a specified block of data from the file represented by the current insta #### Inherited from -[File](file.md).[removeBlock](file.md#removeblock) +[File](File.md).[removeBlock](File.md#removeblock) ___ @@ -544,13 +603,13 @@ ___ ▸ **removeTags**(`types`): `void` Removes a set of tag types from the current instance. In order to remove all tags from a -file, pass [TagTypes.AllTags](../enums/tagtypes.md#alltags) as `types` +file, pass [TagTypes.AllTags](../enums/TagTypes.md#alltags) as `types` #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `types` | [`TagTypes`](../enums/tagtypes.md) | Bitwise combined [TagTypes](../enums/tagtypes.md) value containing the tag types to be removed from the file | +| `types` | [`TagTypes`](../enums/TagTypes.md) | Bitwise combined [TagTypes](../enums/TagTypes.md) value containing the tag types to be removed from the file | #### Returns @@ -558,7 +617,7 @@ file, pass [TagTypes.AllTags](../enums/tagtypes.md#alltags) as `types` #### Overrides -[File](file.md).[removeTags](file.md#removetags) +[File](File.md).[removeTags](File.md#removetags) ___ @@ -574,7 +633,7 @@ Saves the changes made in the current instance to the file it represents. #### Overrides -[File](file.md).[save](file.md#save) +[File](File.md).[save](File.md#save) ___ @@ -587,10 +646,10 @@ specified origin. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `offset` | `number` | Byte offset to seek to. Must be a safe, positive integer. | -| `origin` | `SeekOrigin` | Origin from which to seek | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `offset` | `number` | `undefined` | Byte offset to seek to. Must be a safe, positive integer. | +| `origin` | `SeekOrigin` | `SeekOrigin.Begin` | Origin from which to seek | #### Returns @@ -598,7 +657,7 @@ specified origin. #### Inherited from -[File](file.md).[seek](file.md#seek) +[File](File.md).[seek](File.md#seek) ___ @@ -620,7 +679,7 @@ Resizes the current instance to a specific number of bytes. #### Inherited from -[File](file.md).[truncate](file.md#truncate) +[File](File.md).[truncate](File.md#truncate) ___ @@ -638,7 +697,7 @@ the file if writing past the current end. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | ByteVector containing data to the current instance. | +| `data` | [`ByteVector`](ByteVector.md) | ByteVector containing data to the current instance. | #### Returns @@ -646,7 +705,7 @@ the file if writing past the current end. #### Inherited from -[File](file.md).[writeBlock](file.md#writeblock) +[File](File.md).[writeBlock](File.md#writeblock) ___ @@ -654,7 +713,7 @@ ___ ▸ `Static` **addFileType**(`mimeType`, `constructor`, `override?`): `void` -Registers the constructor for a subclass of [File](file.md) with the MimeType it is associated +Registers the constructor for a subclass of [File](File.md) with the MimeType it is associated with. Optionally, the MimeType can be forcefully overridden if it was already registered. #### Parameters @@ -662,8 +721,8 @@ with. Optionally, the MimeType can be forcefully overridden if it was already re | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | | `mimeType` | `string` | `undefined` | MimeType to register this subclass constructor to. | -| `constructor` | [`FileTypeConstructor`](../modules.md#filetypeconstructor) | `undefined` | Constructor for a subclass of [File](file.md) that will be called if a file with a MimeType of `mimeType` is created. | -| `override` | `boolean` | `false` | If `true` and a subclass of [File](file.md) was already registered to `mimeType`, it will be forcefully overridden. If `false`, an {@link Error} will be thrown if a subclass already registered to the MimeType.} | +| `constructor` | [`FileTypeConstructor`](../modules.md#filetypeconstructor) | `undefined` | Constructor for a subclass of [File](File.md) that will be called if a file with a MimeType of `mimeType` is created. | +| `override` | `boolean` | `false` | If `true` and a subclass of [File](File.md) was already registered to `mimeType`, it will be forcefully overridden. If `false`, an {@link Error} will be thrown if a subclass already registered to the MimeType.} | #### Returns @@ -671,7 +730,7 @@ with. Optionally, the MimeType can be forcefully overridden if it was already re #### Inherited from -[File](file.md).[addFileType](file.md#addfiletype) +[File](File.md).[addFileType](File.md#addfiletype) ___ @@ -685,7 +744,7 @@ Registers a [FileTypeResolver](../modules.md#filetyperesolver) to the front of t | Name | Type | Description | | :------ | :------ | :------ | -| `resolver` | [`FileTypeResolver`](../modules.md#filetyperesolver) | Function to handle resolving a subclass of [File](file.md) from an {@link IFileAbstraction} | +| `resolver` | [`FileTypeResolver`](../modules.md#filetyperesolver) | Function to handle resolving a subclass of [File](File.md) from an {@link IFileAbstraction} | #### Returns @@ -693,61 +752,61 @@ Registers a [FileTypeResolver](../modules.md#filetyperesolver) to the front of t #### Inherited from -[File](file.md).[addFileTypeResolver](file.md#addfiletyperesolver) +[File](File.md).[addFileTypeResolver](File.md#addfiletyperesolver) ___ ### createFromAbstraction -▸ `Static` **createFromAbstraction**(`abstraction`, `mimeType?`, `propertiesStyle?`): [`File`](file.md) +▸ `Static` **createFromAbstraction**(`abstraction`, `mimeType?`, `propertiesStyle?`): [`File`](File.md) -Creates a new instance of a [File](file.md) subclass for a specified file abstraction, MimeType, +Creates a new instance of a [File](File.md) subclass for a specified file abstraction, MimeType, and property read style. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `abstraction` | `IFileAbstraction` | Object to use when reading/writing from the current instance. | -| `mimeType?` | `string` | Optional, MimeType to use for determining the subclass of [File](file.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | Optional, level of detail to use when reading the media information from the new instance. If omitted, [ReadStyle.Average](../enums/readstyle.md#average) is used. | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `abstraction` | `IFileAbstraction` | `undefined` | Object to use when reading/writing from the current instance. | +| `mimeType?` | `string` | `undefined` | Optional, MimeType to use for determining the subclass of [File](File.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | `ReadStyle.Average` | Optional, level of detail to use when reading the media information from the new instance. If omitted, [ReadStyle.Average](../enums/ReadStyle.md#average) is used. | #### Returns -[`File`](file.md) +[`File`](File.md) -New instance of [File](file.md) as read from the specified abstraction. +New instance of [File](File.md) as read from the specified abstraction. #### Inherited from -[File](file.md).[createFromAbstraction](file.md#createfromabstraction) +[File](File.md).[createFromAbstraction](File.md#createfromabstraction) ___ ### createFromPath -▸ `Static` **createFromPath**(`filePath`, `mimeType?`, `propertiesStyle?`): [`File`](file.md) +▸ `Static` **createFromPath**(`filePath`, `mimeType?`, `propertiesStyle?`): [`File`](File.md) -Creates a new instance of [File](file.md) subclass for a specified file path, MimeType, and +Creates a new instance of [File](File.md) subclass for a specified file path, MimeType, and property read style. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `filePath` | `string` | Path to the file to read/write. | -| `mimeType?` | `string` | Optional, MimeType to use for determining the subclass of [File](file.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | -| `propertiesStyle` | [`ReadStyle`](../enums/readstyle.md) | Optional, level of detail to use when reading the media information from the new instance. If omitted [ReadStyle.Average](../enums/readstyle.md#average) is used. | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `filePath` | `string` | `undefined` | Path to the file to read/write. | +| `mimeType?` | `string` | `undefined` | Optional, MimeType to use for determining the subclass of [File](File.md) to return. If omitted, the MimeType will be guessed based on the file's extension. | +| `propertiesStyle` | [`ReadStyle`](../enums/ReadStyle.md) | `ReadStyle.Average` | Optional, level of detail to use when reading the media information from the new instance. If omitted [ReadStyle.Average](../enums/ReadStyle.md#average) is used. | #### Returns -[`File`](file.md) +[`File`](File.md) -New instance of [File](file.md) as read from the specified path. +New instance of [File](File.md) as read from the specified path. #### Inherited from -[File](file.md).[createFromPath](file.md#createfrompath) +[File](File.md).[createFromPath](File.md#createfrompath) ___ @@ -769,7 +828,7 @@ Used for removing a file type constructor during unit testing #### Inherited from -[File](file.md).[removeFileType](file.md#removefiletype) +[File](File.md).[removeFileType](File.md#removefiletype) ___ @@ -791,4 +850,4 @@ Used for removing a file type resolver during unit testing #### Inherited from -[File](file.md).[removeFileTypeResolver](file.md#removefiletyperesolver) +[File](File.md).[removeFileTypeResolver](File.md#removefiletyperesolver) diff --git a/docs/classes/rifflist.md b/docs/classes/RiffList.md similarity index 68% rename from docs/classes/rifflist.md rename to docs/classes/RiffList.md index dc0ca25f..0ba64c29 100644 --- a/docs/classes/rifflist.md +++ b/docs/classes/RiffList.md @@ -4,44 +4,44 @@ ## Implements -- `IRiffChunk` +- `default` - `ILazy` ## Table of contents ### Properties -- [identifierFourcc](rifflist.md#identifierfourcc) +- [IDENTIFIER\_FOURCC](RiffList.md#identifier_fourcc) ### Accessors -- [chunkStart](rifflist.md#chunkstart) -- [fourcc](rifflist.md#fourcc) -- [isLoaded](rifflist.md#isloaded) -- [listCount](rifflist.md#listcount) -- [originalDataSize](rifflist.md#originaldatasize) -- [originalTotalSize](rifflist.md#originaltotalsize) -- [type](rifflist.md#type) -- [valueCount](rifflist.md#valuecount) +- [chunkStart](RiffList.md#chunkstart) +- [fourcc](RiffList.md#fourcc) +- [isLoaded](RiffList.md#isloaded) +- [listCount](RiffList.md#listcount) +- [originalDataSize](RiffList.md#originaldatasize) +- [originalTotalSize](RiffList.md#originaltotalsize) +- [type](RiffList.md#type) +- [valueCount](RiffList.md#valuecount) ### Methods -- [clear](rifflist.md#clear) -- [getLists](rifflist.md#getlists) -- [getValues](rifflist.md#getvalues) -- [load](rifflist.md#load) -- [render](rifflist.md#render) -- [setLists](rifflist.md#setlists) -- [setValues](rifflist.md#setvalues) -- [fromEmpty](rifflist.md#fromempty) -- [fromFile](rifflist.md#fromfile) -- [isChunkList](rifflist.md#ischunklist) +- [clear](RiffList.md#clear) +- [getLists](RiffList.md#getlists) +- [getValues](RiffList.md#getvalues) +- [load](RiffList.md#load) +- [render](RiffList.md#render) +- [setLists](RiffList.md#setlists) +- [setValues](RiffList.md#setvalues) +- [fromEmpty](RiffList.md#fromempty) +- [fromFile](RiffList.md#fromfile) +- [isChunkList](RiffList.md#ischunklist) ## Properties -### identifierFourcc +### IDENTIFIER\_FOURCC -▪ `Static` `Readonly` **identifierFourcc**: ``"LIST"`` +▪ `Static` `Readonly` **IDENTIFIER\_FOURCC**: ``"LIST"`` FOURCC code for a list chunk @@ -57,6 +57,10 @@ FOURCC code for a list chunk `number` +#### Implementation of + +IRiffChunk.chunkStart + • `set` **chunkStart**(`value`): `void` **`inheritdoc`** @@ -71,6 +75,10 @@ FOURCC code for a list chunk `void` +#### Implementation of + +IRiffChunk.chunkStart + ___ ### fourcc @@ -83,6 +91,10 @@ ___ `string` +#### Implementation of + +IRiffChunk.fourcc + ___ ### isLoaded @@ -95,6 +107,10 @@ ___ `boolean` +#### Implementation of + +ILazy.isLoaded + ___ ### listCount @@ -119,6 +135,10 @@ ___ `number` +#### Implementation of + +IRiffChunk.originalDataSize + ___ ### originalTotalSize @@ -131,6 +151,10 @@ ___ `number` +#### Implementation of + +IRiffChunk.originalTotalSize + • `set` **originalTotalSize**(`value`): `void` **`internal`** @@ -145,6 +169,10 @@ ___ `void` +#### Implementation of + +IRiffChunk.originalTotalSize + ___ ### type @@ -185,7 +213,7 @@ ___ ### getLists -▸ **getLists**(`id`): [`RiffList`](rifflist.md)[] +▸ **getLists**(`id`): [`RiffList`](RiffList.md)[] Retrieves a collection of lists by the lists' key. @@ -197,7 +225,7 @@ Retrieves a collection of lists by the lists' key. #### Returns -[`RiffList`](rifflist.md)[] +[`RiffList`](RiffList.md)[] RiffList[] Array of the nested lists with the provided key, or an empty array if the key does not exist in this instance. @@ -206,7 +234,7 @@ ___ ### getValues -▸ **getValues**(`id`): [`ByteVector`](bytevector.md)[] +▸ **getValues**(`id`): [`ByteVector`](ByteVector.md)[] Retrieves a collection of values by the values' key. @@ -218,7 +246,7 @@ Retrieves a collection of values by the values' key. #### Returns -[`ByteVector`](bytevector.md)[] +[`ByteVector`](ByteVector.md)[] ByteVector[] Array of the values with the provided key, or an empty array if the key does not exist in the instance. @@ -243,13 +271,13 @@ ___ ### render -▸ **render**(): [`ByteVector`](bytevector.md) +▸ **render**(): [`ByteVector`](ByteVector.md) **`inheritdoc`** #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Implementation of @@ -268,7 +296,7 @@ Stores a collection of lists in the current instance, overwriting any that curre | Name | Type | Description | | :------ | :------ | :------ | | `id` | `string` | Key for the lists to store | -| `lists` | [`RiffList`](rifflist.md)[] | Collection of lists to store in the current instance | +| `lists` | [`RiffList`](RiffList.md)[] | Collection of lists to store in the current instance | #### Returns @@ -287,7 +315,7 @@ Stores a collection of values in the current instance, overwriting any that curr | Name | Type | Description | | :------ | :------ | :------ | | `id` | `string` | Key for the values to store | -| `values` | [`ByteVector`](bytevector.md)[] | Collection of values to store in the current instance | +| `values` | [`ByteVector`](ByteVector.md)[] | Collection of values to store in the current instance | #### Returns @@ -297,7 +325,7 @@ ___ ### fromEmpty -▸ `Static` **fromEmpty**(`type`): [`RiffList`](rifflist.md) +▸ `Static` **fromEmpty**(`type`): [`RiffList`](RiffList.md) Constructs and initializes a new instance with no contents. @@ -309,13 +337,13 @@ Constructs and initializes a new instance with no contents. #### Returns -[`RiffList`](rifflist.md) +[`RiffList`](RiffList.md) ___ ### fromFile -▸ `Static` **fromFile**(`file`, `position`): [`RiffList`](rifflist.md) +▸ `Static` **fromFile**(`file`, `position`): [`RiffList`](RiffList.md) Constructs and initializes a new instance, lazily, from a position in a file. @@ -323,12 +351,12 @@ Constructs and initializes a new instance, lazily, from a position in a file. | Name | Type | Description | | :------ | :------ | :------ | -| `file` | [`File`](file.md) | File from which to read the current instance | +| `file` | [`File`](File.md) | File from which to read the current instance | | `position` | `number` | Position in the file where the list begins | #### Returns -[`RiffList`](rifflist.md) +[`RiffList`](RiffList.md) ___ diff --git a/docs/classes/rifflisttag.md b/docs/classes/RiffListTag.md similarity index 83% rename from docs/classes/rifflisttag.md rename to docs/classes/RiffListTag.md index eb6ea39d..16303840 100644 --- a/docs/classes/rifflisttag.md +++ b/docs/classes/RiffListTag.md @@ -6,107 +6,108 @@ Abstract class that provides support for reading/writing tags in the RIFF list f ## Hierarchy -- [`Tag`](tag.md) +- [`Tag`](Tag.md) ↳ **`RiffListTag`** - ↳↳ [`InfoTag`](infotag.md) + ↳↳ [`InfoTag`](InfoTag.md) - ↳↳ [`MovieIdTag`](movieidtag.md) + ↳↳ [`MovieIdTag`](MovieIdTag.md) ## Table of contents ### Constructors -- [constructor](rifflisttag.md#constructor) +- [constructor](RiffListTag.md#constructor) ### Properties -- [tagTypes](rifflisttag.md#tagtypes) +- [tagTypes](RiffListTag.md#tagtypes) ### Accessors -- [album](rifflisttag.md#album) -- [albumArtists](rifflisttag.md#albumartists) -- [albumArtistsSort](rifflisttag.md#albumartistssort) -- [albumSort](rifflisttag.md#albumsort) -- [amazonId](rifflisttag.md#amazonid) -- [beatsPerMinute](rifflisttag.md#beatsperminute) -- [comment](rifflisttag.md#comment) -- [composers](rifflisttag.md#composers) -- [composersSort](rifflisttag.md#composerssort) -- [conductor](rifflisttag.md#conductor) -- [copyright](rifflisttag.md#copyright) -- [dateTagged](rifflisttag.md#datetagged) -- [description](rifflisttag.md#description) -- [disc](rifflisttag.md#disc) -- [discCount](rifflisttag.md#disccount) -- [firstAlbumArtist](rifflisttag.md#firstalbumartist) -- [firstAlbumArtistSort](rifflisttag.md#firstalbumartistsort) -- [firstComposer](rifflisttag.md#firstcomposer) -- [firstComposerSort](rifflisttag.md#firstcomposersort) -- [firstGenre](rifflisttag.md#firstgenre) -- [firstPerformer](rifflisttag.md#firstperformer) -- [firstPerformerSort](rifflisttag.md#firstperformersort) -- [genres](rifflisttag.md#genres) -- [grouping](rifflisttag.md#grouping) -- [initialKey](rifflisttag.md#initialkey) -- [isEmpty](rifflisttag.md#isempty) -- [isrc](rifflisttag.md#isrc) -- [joinedAlbumArtists](rifflisttag.md#joinedalbumartists) -- [joinedComposers](rifflisttag.md#joinedcomposers) -- [joinedGenres](rifflisttag.md#joinedgenres) -- [joinedPerformers](rifflisttag.md#joinedperformers) -- [joinedPerformersSort](rifflisttag.md#joinedperformerssort) -- [list](rifflisttag.md#list) -- [lyrics](rifflisttag.md#lyrics) -- [musicBrainzArtistId](rifflisttag.md#musicbrainzartistid) -- [musicBrainzDiscId](rifflisttag.md#musicbrainzdiscid) -- [musicBrainzReleaseArtistId](rifflisttag.md#musicbrainzreleaseartistid) -- [musicBrainzReleaseCountry](rifflisttag.md#musicbrainzreleasecountry) -- [musicBrainzReleaseGroupId](rifflisttag.md#musicbrainzreleasegroupid) -- [musicBrainzReleaseId](rifflisttag.md#musicbrainzreleaseid) -- [musicBrainzReleaseStatus](rifflisttag.md#musicbrainzreleasestatus) -- [musicBrainzReleaseType](rifflisttag.md#musicbrainzreleasetype) -- [musicBrainzTrackId](rifflisttag.md#musicbrainztrackid) -- [musicIpId](rifflisttag.md#musicipid) -- [performers](rifflisttag.md#performers) -- [performersRole](rifflisttag.md#performersrole) -- [performersSort](rifflisttag.md#performerssort) -- [pictures](rifflisttag.md#pictures) -- [publisher](rifflisttag.md#publisher) -- [remixedBy](rifflisttag.md#remixedby) -- [replayGainAlbumGain](rifflisttag.md#replaygainalbumgain) -- [replayGainAlbumPeak](rifflisttag.md#replaygainalbumpeak) -- [replayGainTrackGain](rifflisttag.md#replaygaintrackgain) -- [replayGainTrackPeak](rifflisttag.md#replaygaintrackpeak) -- [sizeOnDisk](rifflisttag.md#sizeondisk) -- [stringType](rifflisttag.md#stringtype) -- [subtitle](rifflisttag.md#subtitle) -- [title](rifflisttag.md#title) -- [titleSort](rifflisttag.md#titlesort) -- [track](rifflisttag.md#track) -- [trackCount](rifflisttag.md#trackcount) -- [year](rifflisttag.md#year) +- [album](RiffListTag.md#album) +- [albumArtists](RiffListTag.md#albumartists) +- [albumArtistsSort](RiffListTag.md#albumartistssort) +- [albumSort](RiffListTag.md#albumsort) +- [amazonId](RiffListTag.md#amazonid) +- [beatsPerMinute](RiffListTag.md#beatsperminute) +- [comment](RiffListTag.md#comment) +- [composers](RiffListTag.md#composers) +- [composersSort](RiffListTag.md#composerssort) +- [conductor](RiffListTag.md#conductor) +- [copyright](RiffListTag.md#copyright) +- [dateTagged](RiffListTag.md#datetagged) +- [description](RiffListTag.md#description) +- [disc](RiffListTag.md#disc) +- [discCount](RiffListTag.md#disccount) +- [firstAlbumArtist](RiffListTag.md#firstalbumartist) +- [firstAlbumArtistSort](RiffListTag.md#firstalbumartistsort) +- [firstComposer](RiffListTag.md#firstcomposer) +- [firstComposerSort](RiffListTag.md#firstcomposersort) +- [firstGenre](RiffListTag.md#firstgenre) +- [firstPerformer](RiffListTag.md#firstperformer) +- [firstPerformerSort](RiffListTag.md#firstperformersort) +- [genres](RiffListTag.md#genres) +- [grouping](RiffListTag.md#grouping) +- [initialKey](RiffListTag.md#initialkey) +- [isCompilation](RiffListTag.md#iscompilation) +- [isEmpty](RiffListTag.md#isempty) +- [isrc](RiffListTag.md#isrc) +- [joinedAlbumArtists](RiffListTag.md#joinedalbumartists) +- [joinedComposers](RiffListTag.md#joinedcomposers) +- [joinedGenres](RiffListTag.md#joinedgenres) +- [joinedPerformers](RiffListTag.md#joinedperformers) +- [joinedPerformersSort](RiffListTag.md#joinedperformerssort) +- [list](RiffListTag.md#list) +- [lyrics](RiffListTag.md#lyrics) +- [musicBrainzArtistId](RiffListTag.md#musicbrainzartistid) +- [musicBrainzDiscId](RiffListTag.md#musicbrainzdiscid) +- [musicBrainzReleaseArtistId](RiffListTag.md#musicbrainzreleaseartistid) +- [musicBrainzReleaseCountry](RiffListTag.md#musicbrainzreleasecountry) +- [musicBrainzReleaseGroupId](RiffListTag.md#musicbrainzreleasegroupid) +- [musicBrainzReleaseId](RiffListTag.md#musicbrainzreleaseid) +- [musicBrainzReleaseStatus](RiffListTag.md#musicbrainzreleasestatus) +- [musicBrainzReleaseType](RiffListTag.md#musicbrainzreleasetype) +- [musicBrainzTrackId](RiffListTag.md#musicbrainztrackid) +- [musicIpId](RiffListTag.md#musicipid) +- [performers](RiffListTag.md#performers) +- [performersRole](RiffListTag.md#performersrole) +- [performersSort](RiffListTag.md#performerssort) +- [pictures](RiffListTag.md#pictures) +- [publisher](RiffListTag.md#publisher) +- [remixedBy](RiffListTag.md#remixedby) +- [replayGainAlbumGain](RiffListTag.md#replaygainalbumgain) +- [replayGainAlbumPeak](RiffListTag.md#replaygainalbumpeak) +- [replayGainTrackGain](RiffListTag.md#replaygaintrackgain) +- [replayGainTrackPeak](RiffListTag.md#replaygaintrackpeak) +- [sizeOnDisk](RiffListTag.md#sizeondisk) +- [stringType](RiffListTag.md#stringtype) +- [subtitle](RiffListTag.md#subtitle) +- [title](RiffListTag.md#title) +- [titleSort](RiffListTag.md#titlesort) +- [track](RiffListTag.md#track) +- [trackCount](RiffListTag.md#trackcount) +- [year](RiffListTag.md#year) ### Methods -- [clear](rifflisttag.md#clear) -- [copyTo](rifflisttag.md#copyto) -- [getFirstValueAsString](rifflisttag.md#getfirstvalueasstring) -- [getValueAsUint](rifflisttag.md#getvalueasuint) -- [getValues](rifflisttag.md#getvalues) -- [getValuesAsStrings](rifflisttag.md#getvaluesasstrings) -- [removeValue](rifflisttag.md#removevalue) -- [render](rifflisttag.md#render) -- [setInfoTag](rifflisttag.md#setinfotag) -- [setValueFromUint](rifflisttag.md#setvaluefromuint) -- [setValues](rifflisttag.md#setvalues) -- [setValuesFromStrings](rifflisttag.md#setvaluesfromstrings) -- [firstInGroup](rifflisttag.md#firstingroup) -- [isFalsyOrLikeEmpty](rifflisttag.md#isfalsyorlikeempty) -- [joinGroup](rifflisttag.md#joingroup) -- [tagTypeFlagsToArray](rifflisttag.md#tagtypeflagstoarray) +- [clear](RiffListTag.md#clear) +- [copyTo](RiffListTag.md#copyto) +- [getFirstValueAsString](RiffListTag.md#getfirstvalueasstring) +- [getValueAsUint](RiffListTag.md#getvalueasuint) +- [getValues](RiffListTag.md#getvalues) +- [getValuesAsStrings](RiffListTag.md#getvaluesasstrings) +- [removeValue](RiffListTag.md#removevalue) +- [render](RiffListTag.md#render) +- [setInfoTag](RiffListTag.md#setinfotag) +- [setValueFromUint](RiffListTag.md#setvaluefromuint) +- [setValues](RiffListTag.md#setvalues) +- [setValuesFromStrings](RiffListTag.md#setvaluesfromstrings) +- [firstInGroup](RiffListTag.md#firstingroup) +- [isFalsyOrLikeEmpty](RiffListTag.md#isfalsyorlikeempty) +- [joinGroup](RiffListTag.md#joingroup) +- [tagTypeFlagsToArray](RiffListTag.md#tagtypeflagstoarray) ## Constructors @@ -118,28 +119,28 @@ Abstract class that provides support for reading/writing tags in the RIFF list f | Name | Type | | :------ | :------ | -| `list` | [`RiffList`](rifflist.md) | +| `list` | [`RiffList`](RiffList.md) | #### Overrides -[Tag](tag.md).[constructor](tag.md#constructor) +[Tag](Tag.md).[constructor](Tag.md#constructor) ## Properties ### tagTypes -• `Abstract` **tagTypes**: [`TagTypes`](../enums/tagtypes.md) +• `Abstract` **tagTypes**: [`TagTypes`](../enums/TagTypes.md) -Gets the tag types contained in the current instance. A bit wise combined [TagTypes](../enums/tagtypes.md) +Gets the tag types contained in the current instance. A bit wise combined [TagTypes](../enums/TagTypes.md) containing the tag types contained in the current instance. **`remarks`** For a standard tag, the value should be intuitive. For example, Id3v2Tag objects have - a value of [TagTypes.Id3v2](../enums/tagtypes.md#id3v2). However, for CombinedTag type objects, they may + a value of [TagTypes.Id3v2](../enums/TagTypes.md#id3v2). However, for CombinedTag type objects, they may contain multiple or no types. #### Inherited from -[Tag](tag.md).[tagTypes](tag.md#tagtypes) +[Tag](Tag.md).[tagTypes](Tag.md#tagtypes) ## Accessors @@ -164,6 +165,10 @@ represents the collection the video belongs to. Album of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.album + • `set` **album**(`value`): `void` Sets the album of the media represented by the current instance. For video media, this @@ -189,6 +194,10 @@ represents the collection the video belongs to. Album of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.album + ___ ### albumArtists @@ -203,7 +212,7 @@ collection containing the media described by the current instance. will split up albums by the same artist. Having a single album artist for an entire album solves this problem. As this value is to be used as a sorting key, it should be used with less variation - than [performers](rifflisttag.md#performers). Where performers can be broken into multiple artists, it is + than [performers](RiffListTag.md#performers). Where performers can be broken into multiple artists, it is best to stick to a single name. Eg, "Super8 & Tab" #### Returns @@ -214,6 +223,10 @@ Band or artist credited with the creation of the entire album or collection containing the media described by the current instance or an empty array if no value is present +#### Inherited from + +Tag.albumArtists + • `set` **albumArtists**(`value`): `void` Sets the bands or artists who is credited credited in the creation of the entire album or @@ -224,7 +237,7 @@ collection containing the media described by the current instance. will split up albums by the same artist. Having a single album artist for an entire album solves this problem. As this value is to be used as a sorting key, it should be used with less variation - than [performers](rifflisttag.md#performers). Where performers can be broken into multiple artists, it is + than [performers](RiffListTag.md#performers). Where performers can be broken into multiple artists, it is best to stick to a single name. Eg, "Super8 & Tab" #### Parameters @@ -241,6 +254,10 @@ Band or artist credited with the creation of the entire album or collection containing the media described by the current instance or an empty array if no value is present +#### Inherited from + +Tag.albumArtists + ___ ### albumArtistsSort @@ -256,7 +273,7 @@ album or collection containing the media described by the current instance. skip articles or sort by last by last name. For example "Ben Folds" might be sorted as "Folds, Ben". As this value is to be used as a sorting key, it should be used with less variation than - [performers](rifflisttag.md#performers). Where [performers](rifflisttag.md#performers) can be broken into multiple performers, it is + [performers](RiffListTag.md#performers). Where [performers](RiffListTag.md#performers) can be broken into multiple performers, it is best to stick to a single album artist. Eg, "Van Buuren, Armin" #### Returns @@ -267,6 +284,10 @@ Sortable names for the bands/artists are credited with the creation of the entir album or collection containing the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +Tag.albumArtistsSort + • `set` **albumArtistsSort**(`value`): `void` Sets the sortable names of the bands/artists who are credited with creating the entire @@ -278,7 +299,7 @@ album or collection containing the media described by the current instance. skip articles or sort by last by last name. For example "Ben Folds" might be sorted as "Folds, Ben". As this value is to be used as a sorting key, it should be used with less variation than - [performers](rifflisttag.md#performers). Where [performers](rifflisttag.md#performers) can be broken into multiple performers, it is + [performers](RiffListTag.md#performers). Where [performers](RiffListTag.md#performers) can be broken into multiple performers, it is best to stick to a single album artist. Eg, "Van Buuren, Armin" #### Parameters @@ -295,6 +316,10 @@ Sortable names for the bands/artists are credited with the creation of the entir album or collection containing the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +Tag.albumArtistsSort + ___ ### albumSort @@ -315,6 +340,10 @@ Gets the sortable name of the album title of the media represented by the curren Sortable name for the album title of the media or `undefined` if the value is not present +#### Inherited from + +Tag.albumSort + • `set` **albumSort**(`value`): `void` Sets the sortable name of the album title of the media represented by the current instance. @@ -337,6 +366,10 @@ Sets the sortable name of the album title of the media represented by the curren Sortable name for the album title of the media or `undefined` if the value is not present +#### Inherited from + +Tag.albumSort + ___ ### amazonId @@ -355,6 +388,10 @@ Gets the Amazon ID of the media represented by the current instance. Amazon ID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.amazonId + • `set` **amazonId**(`value`): `void` Sets the Amazon ID of the media represented by the current instance. @@ -375,6 +412,10 @@ Sets the Amazon ID of the media represented by the current instance. Amazon ID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.amazonId + ___ ### beatsPerMinute @@ -394,6 +435,10 @@ instance. Beats per minute of the audio in the media represented by the current instance, or `0` if not specified +#### Inherited from + +Tag.beatsPerMinute + • `set` **beatsPerMinute**(`value`): `void` Sets the number of beats per minute in the audio of the media represented by the current @@ -415,6 +460,10 @@ instance. Beats per minute of the audio in the media represented by the current instance, or `0` if not specified +#### Inherited from + +Tag.beatsPerMinute + ___ ### comment @@ -436,6 +485,10 @@ Gets a user comment on the media represented by the current instance. User comments on the media represented by the current instance or `undefined` if the value is not present +#### Inherited from + +Tag.comment + • `set` **comment**(`value`): `void` Sets a user comment on the media represented by the current instance. @@ -459,6 +512,10 @@ Sets a user comment on the media represented by the current instance. User comments on the media represented by the current instance or `undefined` if the value is not present +#### Inherited from + +Tag.comment + ___ ### composers @@ -477,6 +534,10 @@ Gets the composers of the media represented by the current instance. Composers of the media represented by the current instance of an empty array if no value is present. +#### Inherited from + +Tag.composers + • `set` **composers**(`value`): `void` Sets the composers of the media represented by the current instance. @@ -497,6 +558,10 @@ Sets the composers of the media represented by the current instance. Composers of the media represented by the current instance of an empty array if no value is present. +#### Inherited from + +Tag.composers + ___ ### composersSort @@ -517,6 +582,10 @@ Gets the sortable names of the composers of the media represented by the current Sortable names for the composers of the media represented by the current instance or an empty array if no value is present. +#### Inherited from + +Tag.composersSort + • `set` **composersSort**(`value`): `void` Sets the sortable names of the composers of the media represented by the current instance. @@ -539,6 +608,10 @@ Sets the sortable names of the composers of the media represented by the current Sortable names for the composers of the media represented by the current instance or an empty array if no value is present. +#### Inherited from + +Tag.composersSort + ___ ### conductor @@ -556,6 +629,10 @@ Gets the conductor or director of the media represented by the current instance. Conductor or director of the media represented by the current instance or `undefined` if no value present. +#### Inherited from + +Tag.conductor + • `set` **conductor**(`value`): `void` Sets the conductor or director of the media represented by the current instance. @@ -575,6 +652,10 @@ Sets the conductor or director of the media represented by the current instance. Conductor or director of the media represented by the current instance or `undefined` if no value present. +#### Inherited from + +Tag.conductor + ___ ### copyright @@ -595,6 +676,10 @@ Gets the copyright information for the media represented by the current instance Copyright information for the media represented by the current instance or `undefined` if no value is present. +#### Inherited from + +Tag.copyright + • `set` **copyright**(`value`): `void` Sets the copyright information for the media represented by the current instance. @@ -617,6 +702,10 @@ Sets the copyright information for the media represented by the current instance Copyright information for the media represented by the current instance or `undefined` if no value is present. +#### Inherited from + +Tag.copyright + ___ ### dateTagged @@ -631,6 +720,10 @@ Gets the date and time at which the tag has been written. Date/time at which the tag has been written, or `undefined` if no value is present +#### Inherited from + +Tag.dateTagged + • `set` **dateTagged**(`value`): `void` Sets the date and time at which the tag has been written. @@ -647,6 +740,10 @@ Sets the date and time at which the tag has been written. Date/time at which the tag has been written, or `undefined` if no value is present +#### Inherited from + +Tag.dateTagged + ___ ### description @@ -668,6 +765,10 @@ generally no spoliers. This should give the impression of what to expect in the Description of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.description + • `set` **description**(`value`): `void` Sets a short description of the media. For music, this could be the comment that the artist @@ -691,6 +792,10 @@ generally no spoliers. This should give the impression of what to expect in the Description of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.description + ___ ### disc @@ -702,7 +807,7 @@ boxed set. For a series, this represents the season number. **`remarks`** This value should be the same as the number that appears on the disc. For example, if the disc is the first of three, the value should be `1`. It should be no more than - [discCount](rifflisttag.md#disccount) if [discCount](rifflisttag.md#disccount) is non-zero. + [discCount](RiffListTag.md#disccount) if [discCount](RiffListTag.md#disccount) is non-zero. #### Returns @@ -711,6 +816,10 @@ boxed set. For a series, this represents the season number. Number of the disc or season of the media represented by the current instance in a boxed set. +#### Inherited from + +Tag.disc + • `set` **disc**(`value`): `void` Sets the number of the disc containing the media represented by the current instance in the @@ -718,7 +827,7 @@ boxed set. For a series, this represents the season number. **`remarks`** This value should be the same as the number that appears on the disc. For example, if the disc is the first of three, the value should be `1`. It should be no more than - [discCount](rifflisttag.md#disccount) if [discCount](rifflisttag.md#disccount) is non-zero. + [discCount](RiffListTag.md#disccount) if [discCount](RiffListTag.md#disccount) is non-zero. #### Parameters @@ -733,6 +842,10 @@ boxed set. For a series, this represents the season number. Number of the disc or season of the media represented by the current instance in a boxed set. +#### Inherited from + +Tag.disc + ___ ### discCount @@ -742,7 +855,7 @@ ___ Gets the number of discs or seasons in the boxed set containing the media represented by the current instance. -**`remarks`** If non-zero, this should be at least equal to [disc](rifflisttag.md#disc). If [disc](rifflisttag.md#disc) is zero, +**`remarks`** If non-zero, this should be at least equal to [disc](RiffListTag.md#disc). If [disc](RiffListTag.md#disc) is zero, this value should also be zero. #### Returns @@ -752,12 +865,16 @@ current instance. Number of discs or seasons in the boxed set containing the media represented by the current instance or `0` if not specified. +#### Inherited from + +Tag.discCount + • `set` **discCount**(`value`): `void` Sets the number of discs or seasons in the boxed set containing the media represented by the current instance. -**`remarks`** If non-zero, this should be at least equal to [disc](rifflisttag.md#disc). If [disc](rifflisttag.md#disc) is zero, +**`remarks`** If non-zero, this should be at least equal to [disc](RiffListTag.md#disc). If [disc](RiffListTag.md#disc) is zero, this value should also be zero. #### Parameters @@ -773,90 +890,122 @@ current instance. Number of discs or seasons in the boxed set containing the media represented by the current instance or `0` if not specified. +#### Inherited from + +Tag.discCount + ___ ### firstAlbumArtist • `get` **firstAlbumArtist**(): `string` -Gets the the first value contained in [albumArtists](rifflisttag.md#albumartists). +Gets the first value contained in [albumArtists](RiffListTag.md#albumartists). #### Returns `string` +#### Inherited from + +Tag.firstAlbumArtist + ___ ### firstAlbumArtistSort • `get` **firstAlbumArtistSort**(): `string` -Gets the first value contained in [albumArtistsSort](rifflisttag.md#albumartistssort) +Gets the first value contained in [albumArtistsSort](RiffListTag.md#albumartistssort) #### Returns `string` +#### Inherited from + +Tag.firstAlbumArtistSort + ___ ### firstComposer • `get` **firstComposer**(): `string` -Gets the first value contained in [composers](rifflisttag.md#composers) +Gets the first value contained in [composers](RiffListTag.md#composers) #### Returns `string` +#### Inherited from + +Tag.firstComposer + ___ ### firstComposerSort • `get` **firstComposerSort**(): `string` -Gets the first value contained in [composersSort](rifflisttag.md#composerssort) +Gets the first value contained in [composersSort](RiffListTag.md#composerssort) #### Returns `string` +#### Inherited from + +Tag.firstComposerSort + ___ ### firstGenre • `get` **firstGenre**(): `string` -Gets the first value contained in [genres](rifflisttag.md#genres) +Gets the first value contained in [genres](RiffListTag.md#genres) #### Returns `string` +#### Inherited from + +Tag.firstGenre + ___ ### firstPerformer • `get` **firstPerformer**(): `string` -Gets the first value contained in [performers](rifflisttag.md#performers) +Gets the first value contained in [performers](RiffListTag.md#performers) #### Returns `string` +#### Inherited from + +Tag.firstPerformer + ___ ### firstPerformerSort • `get` **firstPerformerSort**(): `string` -Gets the first value contained in [performersSort](rifflisttag.md#performerssort) +Gets the first value contained in [performersSort](RiffListTag.md#performerssort) #### Returns `string` +#### Inherited from + +Tag.firstPerformerSort + ___ ### genres @@ -877,6 +1026,10 @@ Gets the genres of the media represented by the current instance. Genres of the media represented by the current instance or an empty array if no value is present. +#### Inherited from + +Tag.genres + • `set` **genres**(`value`): `void` Sets the genres of the media represented by the current instance. @@ -899,6 +1052,10 @@ Sets the genres of the media represented by the current instance. Genres of the media represented by the current instance or an empty array if no value is present. +#### Inherited from + +Tag.genres + ___ ### grouping @@ -918,6 +1075,10 @@ Gets the grouping on the album which the media in the current instance belongs t Grouping on the album which the media in the current instance belongs to or `undefined` if no value is present. +#### Inherited from + +Tag.grouping + • `set` **grouping**(`value`): `void` Sets the grouping on the album which the media in the current instance belongs to. @@ -939,6 +1100,10 @@ Sets the grouping on the album which the media in the current instance belongs t Grouping on the album which the media in the current instance belongs to or `undefined` if no value is present. +#### Inherited from + +Tag.grouping + ___ ### initialKey @@ -953,6 +1118,10 @@ Gets the initial key of the track. Initial key of the track or `undefined` if no value is set +#### Inherited from + +Tag.initialKey + • `set` **initialKey**(`value`): `void` Sets the initial key of the track. @@ -969,21 +1138,59 @@ Sets the initial key of the track. Initial key of the track or `undefined` if no value is set +#### Inherited from + +Tag.initialKey + +___ + +### isCompilation + +• `get` **isCompilation**(): `boolean` + +Gets whether or not the album described by the current instance is a compilation. + +#### Returns + +`boolean` + +#### Inherited from + +Tag.isCompilation + +• `set` **isCompilation**(`value`): `void` + +Gets whether or not the album described by the current instance is a compilation. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | `boolean` | Whether or not the album described by the current instance is a compilation | + +#### Returns + +`void` + +#### Inherited from + +Tag.isCompilation + ___ ### isEmpty • `get` **isEmpty**(): `boolean` -Gets whether or not the current instance is empty. - **`inheritdoc`** #### Returns `boolean` -`true` if the current instance does not contain any values. `false` otherwise +#### Overrides + +Tag.isEmpty ___ @@ -999,6 +1206,10 @@ Gets the ISRC (International Standard Recording Code) of the track. the ISRC of the track or `undefined` if no value is set +#### Inherited from + +Tag.isrc + • `set` **isrc**(`value`): `void` Sets the ISRC (International Standard Recording Code) of the track. @@ -1015,80 +1226,104 @@ Sets the ISRC (International Standard Recording Code) of the track. the ISRC of the track or `undefined` if no value is set +#### Inherited from + +Tag.isrc + ___ ### joinedAlbumArtists • `get` **joinedAlbumArtists**(): `string` -Gets a semicolon and space separated string containing the values in [albumArtists](rifflisttag.md#albumartists) +Gets a semicolon and space separated string containing the values in [albumArtists](RiffListTag.md#albumartists) #### Returns `string` +#### Inherited from + +Tag.joinedAlbumArtists + ___ ### joinedComposers • `get` **joinedComposers**(): `string` -Gets a semicolon and space separated string containing the values in [composers](rifflisttag.md#composers) +Gets a semicolon and space separated string containing the values in [composers](RiffListTag.md#composers) #### Returns `string` +#### Inherited from + +Tag.joinedComposers + ___ ### joinedGenres • `get` **joinedGenres**(): `string` -Gets a semicolon and space separated string containing the values in [genres](rifflisttag.md#genres) +Gets a semicolon and space separated string containing the values in [genres](RiffListTag.md#genres) #### Returns `string` +#### Inherited from + +Tag.joinedGenres + ___ ### joinedPerformers • `get` **joinedPerformers**(): `string` -Gets a semicolon and space separated string containing the values in [performers](rifflisttag.md#performers) +Gets a semicolon and space separated string containing the values in [performers](RiffListTag.md#performers) #### Returns `string` +#### Inherited from + +Tag.joinedPerformers + ___ ### joinedPerformersSort • `get` **joinedPerformersSort**(): `string` -Gets a semicolon and space separated string containing the values in [performersSort](rifflisttag.md#performerssort) +Gets a semicolon and space separated string containing the values in [performersSort](RiffListTag.md#performerssort) #### Returns `string` +#### Inherited from + +Tag.joinedPerformersSort + ___ ### list -• `get` **list**(): [`RiffList`](rifflist.md) +• `get` **list**(): [`RiffList`](RiffList.md) -Gets the [RiffList](rifflist.md) that backs the data for this tag. +Gets the [RiffList](RiffList.md) that backs the data for this tag. **`remarks`** Tags based on RiffLists are only supposed to support certain fields. Modify at your own risk. #### Returns -[`RiffList`](rifflist.md) +[`RiffList`](RiffList.md) ___ @@ -1110,6 +1345,10 @@ Gets the lyrics or script of the media represented by the current instance. Lyrics or script of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.lyrics + • `set` **lyrics**(`value`): `void` Sets the lyrics or script of the media represented by the current instance. @@ -1132,6 +1371,10 @@ Sets the lyrics or script of the media represented by the current instance. Lyrics or script of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.lyrics + ___ ### musicBrainzArtistId @@ -1150,6 +1393,10 @@ Gets the MusicBrainz artist ID of the media represented by the current instance. MusicBrainz ArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzArtistId + • `set` **musicBrainzArtistId**(`value`): `void` Sets the MusicBrainz artist ID of the media represented by the current instance. @@ -1170,6 +1417,10 @@ Sets the MusicBrainz artist ID of the media represented by the current instance. MusicBrainz ArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzArtistId + ___ ### musicBrainzDiscId @@ -1188,6 +1439,10 @@ Gets the MusicBrainz disc ID of the media represented by the current instance. MusicBrainz DiscID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzDiscId + • `set` **musicBrainzDiscId**(`value`): `void` Sets the MusicBrainz disc ID of the media represented by the current instance. @@ -1208,6 +1463,10 @@ Sets the MusicBrainz disc ID of the media represented by the current instance. MusicBrainz DiscID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzDiscId + ___ ### musicBrainzReleaseArtistId @@ -1226,6 +1485,10 @@ Gets the MusicBrainz release artist ID of the media represented by the current i MusicBrainz ReleaseArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseArtistId + • `set` **musicBrainzReleaseArtistId**(`value`): `void` Sets the MusicBrainz release artist ID of the media represented by the current instance. @@ -1246,6 +1509,10 @@ Sets the MusicBrainz release artist ID of the media represented by the current i MusicBrainz ReleaseArtistID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseArtistId + ___ ### musicBrainzReleaseCountry @@ -1267,6 +1534,10 @@ Gets the MusicBrainz release country of the media represented by the current ins MusicBrainz ReleaseCountry of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseCountry + • `set` **musicBrainzReleaseCountry**(`value`): `void` Sets the MusicBrainz release country of the media represented by the current instance. @@ -1290,6 +1561,10 @@ Sets the MusicBrainz release country of the media represented by the current ins MusicBrainz ReleaseCountry of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseCountry + ___ ### musicBrainzReleaseGroupId @@ -1308,6 +1583,10 @@ Gets the MusicBrainz release group ID of the media represented by the current in MusicBrainz ReleaseGroupID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseGroupId + • `set` **musicBrainzReleaseGroupId**(`value`): `void` Sets the MusicBrainz release group ID of the media represented by the current instance. @@ -1328,6 +1607,10 @@ Sets the MusicBrainz release group ID of the media represented by the current in MusicBrainz ReleaseGroupID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseGroupId + ___ ### musicBrainzReleaseId @@ -1346,6 +1629,10 @@ Gets the MusicBrainz release ID of the media represented by the current instance MusicBrainz ReleaseID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseId + • `set` **musicBrainzReleaseId**(`value`): `void` Sets the MusicBrainz release ID of the media represented by the current instance. @@ -1366,6 +1653,10 @@ Sets the MusicBrainz release ID of the media represented by the current instance MusicBrainz ReleaseID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseId + ___ ### musicBrainzReleaseStatus @@ -1384,6 +1675,10 @@ Gets the MusicBrainz release status of the media represented by the current inst MusicBrainz ReleaseStatus of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseStatus + • `set` **musicBrainzReleaseStatus**(`value`): `void` Sets the MusicBrainz release status of the media represented by the current instance. @@ -1404,6 +1699,10 @@ Sets the MusicBrainz release status of the media represented by the current inst MusicBrainz ReleaseStatus of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseStatus + ___ ### musicBrainzReleaseType @@ -1424,6 +1723,10 @@ Gets the MusicBrainz release type of the media represented by the current instan MusicBrainz ReleaseType of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseType + • `set` **musicBrainzReleaseType**(`value`): `void` Sets the MusicBrainz release type of the media represented by the current instance. @@ -1446,6 +1749,10 @@ Sets the MusicBrainz release type of the media represented by the current instan MusicBrainz ReleaseType of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzReleaseType + ___ ### musicBrainzTrackId @@ -1465,6 +1772,10 @@ current instance. MusicBrainz TrackID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzTrackId + • `set` **musicBrainzTrackId**(`value`): `void` Sets the MusicBrainz track ID of the media represented by the media represented by the @@ -1486,6 +1797,10 @@ current instance. MusicBrainz TrackID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicBrainzTrackId + ___ ### musicIpId @@ -1504,6 +1819,10 @@ Gets the MusicIP PUID of the media represented by the current instance. MusicIP PUID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicIpId + • `set` **musicIpId**(`value`): `void` Sets the MusicIP PUID of the media represented by the current instance. @@ -1524,6 +1843,10 @@ Sets the MusicIP PUID of the media represented by the current instance. MusicIP PUID of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.musicIpId + ___ ### performers @@ -1547,6 +1870,10 @@ Gets the performers or artists who performed in the media described by the curre Performers who performed in the media described by the current instance or an empty array if no value is present. +#### Inherited from + +Tag.performers + • `set` **performers**(`value`): `void` Sets the performers or artists who performed in the media described by the current instance. @@ -1572,6 +1899,10 @@ Sets the performers or artists who performed in the media described by the curre Performers who performed in the media described by the current instance or an empty array if no value is present. +#### Inherited from + +Tag.performers + ___ ### performersRole @@ -1579,12 +1910,12 @@ ___ • `get` **performersRole**(): `string`[] Gets the characters portrayed by an actor for a video or instruments played by a musician -for music. This must match the [performers](rifflisttag.md#performers) array (for each person, correspond one/more +for music. This must match the [performers](RiffListTag.md#performers) array (for each person, correspond one/more role). Several roles for the same artist/actor can be separated with semicolons. For example: "Bass; Backing Vocals; Vibraphone". **`remarks`** It is highly important to match each role to the performers. This means that an entry - in the [performersRole](rifflisttag.md#performersrole) array is `undefined` to maintain the relationship between + in the [performersRole](RiffListTag.md#performersrole) array is `undefined` to maintain the relationship between `performers[i]` and `performersRole[i]`. #### Returns @@ -1594,15 +1925,19 @@ example: "Bass; Backing Vocals; Vibraphone". Array containing the roles played by the performers in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +Tag.performersRole + • `set` **performersRole**(`value`): `void` Sets the characters portrayed by an actor for a video or instruments played by a musician -for music. This must match the [performers](rifflisttag.md#performers) array (for each person, correspond one/more +for music. This must match the [performers](RiffListTag.md#performers) array (for each person, correspond one/more role). Several roles for the same artist/actor can be separated with semicolons. For example: "Bass; Backing Vocals; Vibraphone". **`remarks`** It is highly important to match each role to the performers. This means that an entry - in the [performersRole](rifflisttag.md#performersrole) array is `undefined` to maintain the relationship between + in the [performersRole](RiffListTag.md#performersrole) array is `undefined` to maintain the relationship between `performers[i]` and `performersRole[i]`. #### Parameters @@ -1618,6 +1953,10 @@ example: "Bass; Backing Vocals; Vibraphone". Array containing the roles played by the performers in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +Tag.performersRole + ___ ### performersSort @@ -1640,6 +1979,10 @@ the current instance. Sortable names for the performers who performed in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +Tag.performersSort + • `set` **performersSort**(`value`): `void` Gets the sortable names of the performers or artists who performed in the media described by @@ -1664,11 +2007,15 @@ the current instance. Sortable names for the performers who performed in the media described by the current instance, or an empty array if no value is present. +#### Inherited from + +Tag.performersSort + ___ ### pictures -• `get` **pictures**(): [`IPicture`](../interfaces/ipicture.md)[] +• `get` **pictures**(): [`IPicture`](../interfaces/IPicture.md)[] Gets a collection of pictures associated with the media represented by the current instance. @@ -1678,11 +2025,15 @@ Gets a collection of pictures associated with the media represented by the curre #### Returns -[`IPicture`](../interfaces/ipicture.md)[] +[`IPicture`](../interfaces/IPicture.md)[] Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. +#### Inherited from + +Tag.pictures + • `set` **pictures**(`value`): `void` Sets a collection of pictures associated with the media represented by the current instance. @@ -1695,7 +2046,7 @@ Sets a collection of pictures associated with the media represented by the curre | Name | Type | Description | | :------ | :------ | :------ | -| `value` | [`IPicture`](../interfaces/ipicture.md)[] | Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. | +| `value` | [`IPicture`](../interfaces/IPicture.md)[] | Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. | #### Returns @@ -1704,6 +2055,10 @@ Sets a collection of pictures associated with the media represented by the curre Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. +#### Inherited from + +Tag.pictures + ___ ### publisher @@ -1718,6 +2073,10 @@ Gets the publisher of the track. Publisher of the track or `undefined` if no value is set +#### Inherited from + +Tag.publisher + • `set` **publisher**(`value`): `void` Sets the publisher of the track. @@ -1734,6 +2093,10 @@ Sets the publisher of the track. Publisher of the track or `undefined` if no value is set +#### Inherited from + +Tag.publisher + ___ ### remixedBy @@ -1748,6 +2111,10 @@ Gets the remixer of the track. Remixer of the track or `undefined` if no value is set +#### Inherited from + +Tag.remixedBy + • `set` **remixedBy**(`value`): `void` Sets the remixer of the track. @@ -1764,6 +2131,10 @@ Sets the remixer of the track. Remixer of the track or `undefined` if no value is set +#### Inherited from + +Tag.remixedBy + ___ ### replayGainAlbumGain @@ -1778,6 +2149,10 @@ Gets the ReplayGain album gain in dB. Album gain as per the ReplayGain specifications, in dB, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainAlbumGain + • `set` **replayGainAlbumGain**(`value`): `void` Sets the ReplayGain album gain in dB. @@ -1794,6 +2169,10 @@ Sets the ReplayGain album gain in dB. Album gain as per the ReplayGain specifications, in dB, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainAlbumGain + ___ ### replayGainAlbumPeak @@ -1808,6 +2187,10 @@ Gets the ReplayGain album peak sample. Album peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainAlbumPeak + • `set` **replayGainAlbumPeak**(`value`): `void` Sets the ReplayGain album peak sample. @@ -1824,6 +2207,10 @@ Sets the ReplayGain album peak sample. Album peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainAlbumPeak + ___ ### replayGainTrackGain @@ -1838,6 +2225,10 @@ Gets the ReplayGain track gain in dB. Track gain as per ReplayGain specifications, in dB, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainTrackGain + • `set` **replayGainTrackGain**(`value`): `void` Sets the ReplayGain track gain in dB. @@ -1854,6 +2245,10 @@ Sets the ReplayGain track gain in dB. Track gain as per ReplayGain specifications, in dB, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainTrackGain + ___ ### replayGainTrackPeak @@ -1868,6 +2263,10 @@ Gets the ReplayGain track peak sample. Track peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainTrackPeak + • `set` **replayGainTrackPeak**(`value`): `void` Sets the ReplayGain track peak sample. @@ -1884,31 +2283,37 @@ Sets the ReplayGain track peak sample. Track peak as per the ReplayGain specifications, or `NaN` if no value is set +#### Inherited from + +Tag.replayGainTrackPeak + ___ ### sizeOnDisk • `get` **sizeOnDisk**(): `number` -Gets the size of the tag in bytes on disk as it was read from disk. - **`inheritdoc`** #### Returns `number` +#### Overrides + +Tag.sizeOnDisk + ___ ### stringType -• `get` **stringType**(): [`StringType`](../enums/stringtype.md) +• `get` **stringType**(): [`StringType`](../enums/StringType.md) Gets the type of string used for parsing and rendering the contents of this tag. #### Returns -[`StringType`](../enums/stringtype.md) +[`StringType`](../enums/StringType.md) • `set` **stringType**(`value`): `void` @@ -1920,7 +2325,7 @@ Sets the type of string used for parsing and rendering the contents of this tag. | Name | Type | | :------ | :------ | -| `value` | [`StringType`](../enums/stringtype.md) | +| `value` | [`StringType`](../enums/StringType.md) | #### Returns @@ -1945,6 +2350,10 @@ Gets a description, one-line. It represents the tagline of the vide/music. Subtitle of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.subtitle + • `set` **subtitle**(`value`): `void` Sets a description, one-line. It represents the tagline of the vide/music. @@ -1966,6 +2375,10 @@ Sets a description, one-line. It represents the tagline of the vide/music. Subtitle of the media represented by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.subtitle + ___ ### title @@ -1985,6 +2398,10 @@ Gets the title for the media described by the current instance. Title of the media described by the current instance or `undefined` if no value is present. +#### Inherited from + +Tag.title + • `set` **title**(`value`): `void` Sets the title for the media described by the current instance. @@ -2006,6 +2423,10 @@ Sets the title for the media described by the current instance. Title of the media described by the current instance or `undefined` if no value is present. +#### Inherited from + +Tag.title + ___ ### titleSort @@ -2023,6 +2444,10 @@ Gets the sortable name for the title of the media described by the current insta Sortable name of the media described by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.titleSort + • `set` **titleSort**(`value`): `void` Sets the sortable name for the title of the media described by the current instance. @@ -2042,6 +2467,10 @@ Sets the sortable name for the title of the media described by the current insta Sortable name of the media described by the current instance or `undefined` if no value is present +#### Inherited from + +Tag.titleSort + ___ ### track @@ -2052,7 +2481,7 @@ Gets the position of the media represented by the current instance in its contai or season (for a series). **`remarks`** This value should be the same as is listed on the album cover and no more than - [trackCount](rifflisttag.md#trackcount), if [trackCount](rifflisttag.md#trackcount) is non-zero. + [trackCount](RiffListTag.md#trackcount), if [trackCount](RiffListTag.md#trackcount) is non-zero. Most tagging formats store this as a string. To help sorting, a two-digit zero-padded value is used in the resulting tag. For a series, this property represents the episodes in a season of the series. @@ -2064,13 +2493,17 @@ or season (for a series). Position of the media represented by the current instance in its containing album or `0` if not specified. +#### Inherited from + +Tag.track + • `set` **track**(`value`): `void` Sets the position of the media represented by the current instance in its containing album or season (for a series). **`remarks`** This value should be the same as is listed on the album cover and no more than - [trackCount](rifflisttag.md#trackcount), if [trackCount](rifflisttag.md#trackcount) is non-zero. + [trackCount](RiffListTag.md#trackcount), if [trackCount](RiffListTag.md#trackcount) is non-zero. Most tagging formats store this as a string. To help sorting, a two-digit zero-padded value is used in the resulting tag. For a series, this property represents the episodes in a season of the series. @@ -2088,6 +2521,10 @@ or season (for a series). Position of the media represented by the current instance in its containing album or `0` if not specified. +#### Inherited from + +Tag.track + ___ ### trackCount @@ -2097,8 +2534,8 @@ ___ Gets the number of tracks in the album or the number of episodes in a series of the media represented by the current instance. -**`remarks`** If non-zero, this value should be equal to or greater than [track](rifflisttag.md#track). If - [track](rifflisttag.md#track) is `0`, this value should also be `0`. +**`remarks`** If non-zero, this value should be equal to or greater than [track](RiffListTag.md#track). If + [track](RiffListTag.md#track) is `0`, this value should also be `0`. #### Returns @@ -2107,13 +2544,17 @@ represented by the current instance. Number of tracks in the album or number of episodes in a series of the media represented by the current instance or `0` if not specified. +#### Inherited from + +Tag.trackCount + • `set` **trackCount**(`value`): `void` Sets the number of tracks in the album or the number of episodes in a series of the media represented by the current instance. -**`remarks`** If non-zero, this value should be equal to or greater than [track](rifflisttag.md#track). If - [track](rifflisttag.md#track) is `0`, this value should also be `0`. +**`remarks`** If non-zero, this value should be equal to or greater than [track](RiffListTag.md#track). If + [track](RiffListTag.md#track) is `0`, this value should also be `0`. #### Parameters @@ -2128,6 +2569,10 @@ represented by the current instance. Number of tracks in the album or number of episodes in a series of the media represented by the current instance or `0` if not specified. +#### Inherited from + +Tag.trackCount + ___ ### year @@ -2148,6 +2593,10 @@ Gets the year that the media represented by the current instance was recorded. Year that the media represented by the current instance was created or `0` if no value is present. +#### Inherited from + +Tag.year + • `set` **year**(`value`): `void` Sets the year that the media represented by the current instance was recorded. @@ -2170,6 +2619,10 @@ Sets the year that the media represented by the current instance was recorded. Year that the media represented by the current instance was created or `0` if no value is present. +#### Inherited from + +Tag.year + ## Methods ### clear @@ -2186,7 +2639,7 @@ Clears all values stored in the current instance. #### Overrides -[Tag](tag.md).[clear](tag.md#clear) +[Tag](Tag.md).[clear](Tag.md#clear) ___ @@ -2194,19 +2647,19 @@ ___ ▸ **copyTo**(`target`, `overwrite`): `void` -Copies the values from the current instance to another [Tag](tag.md), optionally overwriting +Copies the values from the current instance to another [Tag](Tag.md), optionally overwriting existing values. **`remarks`** This method only copies the most basic values when copying between different tag formats. However, if `target` is of the same type as the current instance, more advanced copying may be done. For example if both `this` and `target` are - [Id3v2Tag](id3v2tag.md), all frames will be copied to the target. + [Id3v2Tag](Id3v2Tag.md), all frames will be copied to the target. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `target` | [`Tag`](tag.md) | Target tag to copy values to | +| `target` | [`Tag`](Tag.md) | Target tag to copy values to | | `overwrite` | `boolean` | Whether or not to copy values over existing ones | #### Returns @@ -2215,7 +2668,7 @@ Copies the values from the current instance to another [Tag](tag.md), optionally #### Inherited from -[Tag](tag.md).[copyTo](tag.md#copyto) +[Tag](Tag.md).[copyTo](Tag.md#copyto) ___ @@ -2258,7 +2711,7 @@ ___ ### getValues -▸ **getValues**(`id`): [`ByteVector`](bytevector.md)[] +▸ **getValues**(`id`): [`ByteVector`](ByteVector.md)[] Gets the values for a specified item in the current instance. @@ -2270,7 +2723,7 @@ Gets the values for a specified item in the current instance. #### Returns -[`ByteVector`](bytevector.md)[] +[`ByteVector`](ByteVector.md)[] ___ @@ -2312,14 +2765,14 @@ ___ ### render -▸ **render**(): [`ByteVector`](bytevector.md) +▸ **render**(): [`ByteVector`](ByteVector.md) Renders the current instance, including list header and padding bytes, ready to be written to a file. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ___ @@ -2337,7 +2790,7 @@ Set the tags that represent the tagger software (node-taglib-sharp) itself. #### Inherited from -[Tag](tag.md).[setInfoTag](tag.md#setinfotag) +[Tag](Tag.md).[setInfoTag](Tag.md#setinfotag) ___ @@ -2371,7 +2824,7 @@ Sets the value for a specified item in the current instance | Name | Type | Description | | :------ | :------ | :------ | | `id` | `string` | ID of the item to set | -| `values` | [`ByteVector`](bytevector.md)[] | Values to store in the specified item | +| `values` | [`ByteVector`](ByteVector.md)[] | Values to store in the specified item | #### Returns @@ -2419,7 +2872,7 @@ First string contained in `group` or `undefined` if the array is #### Inherited from -[Tag](tag.md).[firstInGroup](tag.md#firstingroup) +[Tag](Tag.md).[firstInGroup](Tag.md#firstingroup) ___ @@ -2445,7 +2898,7 @@ If `value` is a string, `true` is returned if the value is falsy or all #### Inherited from -[Tag](tag.md).[isFalsyOrLikeEmpty](tag.md#isfalsyorlikeempty) +[Tag](Tag.md).[isFalsyOrLikeEmpty](Tag.md#isfalsyorlikeempty) ___ @@ -2470,24 +2923,24 @@ A semicolon and space separated string containing the values from `group` #### Inherited from -[Tag](tag.md).[joinGroup](tag.md#joingroup) +[Tag](Tag.md).[joinGroup](Tag.md#joingroup) ___ ### tagTypeFlagsToArray -▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/tagtypes.md)[] +▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/TagTypes.md)[] #### Parameters | Name | Type | | :------ | :------ | -| `tagTypes` | [`TagTypes`](../enums/tagtypes.md) | +| `tagTypes` | [`TagTypes`](../enums/TagTypes.md) | #### Returns -[`TagTypes`](../enums/tagtypes.md)[] +[`TagTypes`](../enums/TagTypes.md)[] #### Inherited from -[Tag](tag.md).[tagTypeFlagsToArray](tag.md#tagtypeflagstoarray) +[Tag](Tag.md).[tagTypeFlagsToArray](Tag.md#tagtypeflagstoarray) diff --git a/docs/classes/riffwaveformatex.md b/docs/classes/RiffWaveFormatEx.md similarity index 63% rename from docs/classes/riffwaveformatex.md rename to docs/classes/RiffWaveFormatEx.md index 1147dc2c..29041089 100644 --- a/docs/classes/riffwaveformatex.md +++ b/docs/classes/RiffWaveFormatEx.md @@ -8,31 +8,31 @@ https://docs.microsoft.com/en-us/previous-versions/dd757713(v=vs.85) ## Implements -- [`ILosslessAudioCodec`](../interfaces/ilosslessaudiocodec.md) +- [`ILosslessAudioCodec`](../interfaces/ILosslessAudioCodec.md) ## Table of contents ### Constructors -- [constructor](riffwaveformatex.md#constructor) +- [constructor](RiffWaveFormatEx.md#constructor) ### Properties -- [CHUNK\_FOURCC](riffwaveformatex.md#chunk_fourcc) -- [WAVE\_FORMAT\_TAGS](riffwaveformatex.md#wave_format_tags) +- [CHUNK\_FOURCC](RiffWaveFormatEx.md#chunk_fourcc) +- [WAVE\_FORMAT\_TAGS](RiffWaveFormatEx.md#wave_format_tags) ### Accessors -- [audioBitrate](riffwaveformatex.md#audiobitrate) -- [audioChannels](riffwaveformatex.md#audiochannels) -- [audioSampleRate](riffwaveformatex.md#audiosamplerate) -- [averageBytesPerSecond](riffwaveformatex.md#averagebytespersecond) -- [bitsPerSample](riffwaveformatex.md#bitspersample) -- [blockAlign](riffwaveformatex.md#blockalign) -- [description](riffwaveformatex.md#description) -- [durationMilliseconds](riffwaveformatex.md#durationmilliseconds) -- [formatTag](riffwaveformatex.md#formattag) -- [mediaTypes](riffwaveformatex.md#mediatypes) +- [audioBitrate](RiffWaveFormatEx.md#audiobitrate) +- [audioChannels](RiffWaveFormatEx.md#audiochannels) +- [audioSampleRate](RiffWaveFormatEx.md#audiosamplerate) +- [averageBytesPerSecond](RiffWaveFormatEx.md#averagebytespersecond) +- [bitsPerSample](RiffWaveFormatEx.md#bitspersample) +- [blockAlign](RiffWaveFormatEx.md#blockalign) +- [description](RiffWaveFormatEx.md#description) +- [durationMilliseconds](RiffWaveFormatEx.md#durationmilliseconds) +- [formatTag](RiffWaveFormatEx.md#formattag) +- [mediaTypes](RiffWaveFormatEx.md#mediatypes) ## Constructors @@ -47,7 +47,7 @@ data. | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Byte vector that contains the raw header | +| `data` | [`ByteVector`](ByteVector.md) | Byte vector that contains the raw header | ## Properties @@ -59,11 +59,7 @@ ___ ### WAVE\_FORMAT\_TAGS -▪ `Static` `Readonly` **WAVE\_FORMAT\_TAGS**: `Object` - -#### Index signature - -▪ [key: `number`]: `string` +▪ `Static` `Readonly` **WAVE\_FORMAT\_TAGS**: `Map`<`number`, `string`\> ## Accessors @@ -79,7 +75,7 @@ Bitrate of the audio in kilobits per second represented by the current instance. #### Implementation of -[ILosslessAudioCodec](../interfaces/ilosslessaudiocodec.md).[audioBitrate](../interfaces/ilosslessaudiocodec.md#audiobitrate) +[ILosslessAudioCodec](../interfaces/ILosslessAudioCodec.md).[audioBitrate](../interfaces/ILosslessAudioCodec.md#audiobitrate) ___ @@ -95,7 +91,7 @@ Number of channels in the audio represented by the current instance. #### Implementation of -[ILosslessAudioCodec](../interfaces/ilosslessaudiocodec.md).[audioChannels](../interfaces/ilosslessaudiocodec.md#audiochannels) +[ILosslessAudioCodec](../interfaces/ILosslessAudioCodec.md).[audioChannels](../interfaces/ILosslessAudioCodec.md#audiochannels) ___ @@ -111,7 +107,7 @@ Sample rate of the audio represented by the current instance. #### Implementation of -[ILosslessAudioCodec](../interfaces/ilosslessaudiocodec.md).[audioSampleRate](../interfaces/ilosslessaudiocodec.md#audiosamplerate) +[ILosslessAudioCodec](../interfaces/ILosslessAudioCodec.md).[audioSampleRate](../interfaces/ILosslessAudioCodec.md#audiosamplerate) ___ @@ -143,7 +139,7 @@ Number of bits per sample in the audio represented by the current instance. #### Implementation of -[ILosslessAudioCodec](../interfaces/ilosslessaudiocodec.md).[bitsPerSample](../interfaces/ilosslessaudiocodec.md#bitspersample) +[ILosslessAudioCodec](../interfaces/ILosslessAudioCodec.md).[bitsPerSample](../interfaces/ILosslessAudioCodec.md#bitspersample) ___ @@ -172,7 +168,7 @@ Gets a text description of the media represented by the current instance. #### Implementation of -[ILosslessAudioCodec](../interfaces/ilosslessaudiocodec.md).[description](../interfaces/ilosslessaudiocodec.md#description) +[ILosslessAudioCodec](../interfaces/ILosslessAudioCodec.md).[description](../interfaces/ILosslessAudioCodec.md#description) ___ @@ -190,7 +186,7 @@ Duration of the media in milliseconds represented by the current instance. #### Implementation of -[ILosslessAudioCodec](../interfaces/ilosslessaudiocodec.md).[durationMilliseconds](../interfaces/ilosslessaudiocodec.md#durationmilliseconds) +[ILosslessAudioCodec](../interfaces/ILosslessAudioCodec.md).[durationMilliseconds](../interfaces/ILosslessAudioCodec.md#durationmilliseconds) ___ @@ -202,7 +198,7 @@ Gets the format tag of the audio described by the current instance. **`remarks`** Format tags indicate the codec of the audio contained in the file and are contained in a Microsoft registry. For a description of the format, use - [description](riffwaveformatex.md#description). The complete list can be found in the Win32 mmreg.h SDK header file + [description](RiffWaveFormatEx.md#description). The complete list can be found in the Win32 mmreg.h SDK header file #### Returns @@ -212,20 +208,20 @@ ___ ### mediaTypes -• `get` **mediaTypes**(): [`MediaTypes`](../enums/mediatypes.md) +• `get` **mediaTypes**(): [`MediaTypes`](../enums/MediaTypes.md) Types of media represented by the current instance, bitwise combined. **`remarks`** Technically any audio format can be encapsulated with a RIFF header since RIFF is simply a "Resource Interchange File Format". It is entirely possible to encapsulate a lossy format (and indeed, lossy WMA must be encapsulated) with a RIFF header. Therefore - this designation as lossless is somewhat misleading and checking [description](riffwaveformatex.md#description) is + this designation as lossless is somewhat misleading and checking [description](RiffWaveFormatEx.md#description) is necessary to verify the codec being used is lossless or not. #### Returns -[`MediaTypes`](../enums/mediatypes.md) +[`MediaTypes`](../enums/MediaTypes.md) #### Implementation of -[ILosslessAudioCodec](../interfaces/ilosslessaudiocodec.md).[mediaTypes](../interfaces/ilosslessaudiocodec.md#mediatypes) +[ILosslessAudioCodec](../interfaces/ILosslessAudioCodec.md).[mediaTypes](../interfaces/ILosslessAudioCodec.md#mediatypes) diff --git a/docs/classes/tag.md b/docs/classes/Tag.md similarity index 90% rename from docs/classes/tag.md rename to docs/classes/Tag.md index 76ccf13d..e712437d 100644 --- a/docs/classes/tag.md +++ b/docs/classes/Tag.md @@ -11,104 +11,105 @@ is stored by re-reading the property after it is set. - **`Tag`** - ↳ [`CombinedTag`](combinedtag.md) + ↳ [`CombinedTag`](CombinedTag.md) - ↳ [`ApeTag`](apetag.md) + ↳ [`ApeTag`](ApeTag.md) - ↳ [`AsfTag`](asftag.md) + ↳ [`AsfTag`](AsfTag.md) - ↳ [`Id3v1Tag`](id3v1tag.md) + ↳ [`Id3v1Tag`](Id3v1Tag.md) - ↳ [`Id3v2Tag`](id3v2tag.md) + ↳ [`Id3v2Tag`](Id3v2Tag.md) - ↳ [`DivxTag`](divxtag.md) + ↳ [`DivxTag`](DivxTag.md) - ↳ [`RiffListTag`](rifflisttag.md) + ↳ [`RiffListTag`](RiffListTag.md) - ↳ [`XiphComment`](xiphcomment.md) + ↳ [`XiphComment`](XiphComment.md) ## Table of contents ### Constructors -- [constructor](tag.md#constructor) +- [constructor](Tag.md#constructor) ### Properties -- [tagTypes](tag.md#tagtypes) +- [tagTypes](Tag.md#tagtypes) ### Accessors -- [album](tag.md#album) -- [albumArtists](tag.md#albumartists) -- [albumArtistsSort](tag.md#albumartistssort) -- [albumSort](tag.md#albumsort) -- [amazonId](tag.md#amazonid) -- [beatsPerMinute](tag.md#beatsperminute) -- [comment](tag.md#comment) -- [composers](tag.md#composers) -- [composersSort](tag.md#composerssort) -- [conductor](tag.md#conductor) -- [copyright](tag.md#copyright) -- [dateTagged](tag.md#datetagged) -- [description](tag.md#description) -- [disc](tag.md#disc) -- [discCount](tag.md#disccount) -- [firstAlbumArtist](tag.md#firstalbumartist) -- [firstAlbumArtistSort](tag.md#firstalbumartistsort) -- [firstComposer](tag.md#firstcomposer) -- [firstComposerSort](tag.md#firstcomposersort) -- [firstGenre](tag.md#firstgenre) -- [firstPerformer](tag.md#firstperformer) -- [firstPerformerSort](tag.md#firstperformersort) -- [genres](tag.md#genres) -- [grouping](tag.md#grouping) -- [initialKey](tag.md#initialkey) -- [isEmpty](tag.md#isempty) -- [isrc](tag.md#isrc) -- [joinedAlbumArtists](tag.md#joinedalbumartists) -- [joinedComposers](tag.md#joinedcomposers) -- [joinedGenres](tag.md#joinedgenres) -- [joinedPerformers](tag.md#joinedperformers) -- [joinedPerformersSort](tag.md#joinedperformerssort) -- [lyrics](tag.md#lyrics) -- [musicBrainzArtistId](tag.md#musicbrainzartistid) -- [musicBrainzDiscId](tag.md#musicbrainzdiscid) -- [musicBrainzReleaseArtistId](tag.md#musicbrainzreleaseartistid) -- [musicBrainzReleaseCountry](tag.md#musicbrainzreleasecountry) -- [musicBrainzReleaseGroupId](tag.md#musicbrainzreleasegroupid) -- [musicBrainzReleaseId](tag.md#musicbrainzreleaseid) -- [musicBrainzReleaseStatus](tag.md#musicbrainzreleasestatus) -- [musicBrainzReleaseType](tag.md#musicbrainzreleasetype) -- [musicBrainzTrackId](tag.md#musicbrainztrackid) -- [musicIpId](tag.md#musicipid) -- [performers](tag.md#performers) -- [performersRole](tag.md#performersrole) -- [performersSort](tag.md#performerssort) -- [pictures](tag.md#pictures) -- [publisher](tag.md#publisher) -- [remixedBy](tag.md#remixedby) -- [replayGainAlbumGain](tag.md#replaygainalbumgain) -- [replayGainAlbumPeak](tag.md#replaygainalbumpeak) -- [replayGainTrackGain](tag.md#replaygaintrackgain) -- [replayGainTrackPeak](tag.md#replaygaintrackpeak) -- [sizeOnDisk](tag.md#sizeondisk) -- [subtitle](tag.md#subtitle) -- [title](tag.md#title) -- [titleSort](tag.md#titlesort) -- [track](tag.md#track) -- [trackCount](tag.md#trackcount) -- [year](tag.md#year) +- [album](Tag.md#album) +- [albumArtists](Tag.md#albumartists) +- [albumArtistsSort](Tag.md#albumartistssort) +- [albumSort](Tag.md#albumsort) +- [amazonId](Tag.md#amazonid) +- [beatsPerMinute](Tag.md#beatsperminute) +- [comment](Tag.md#comment) +- [composers](Tag.md#composers) +- [composersSort](Tag.md#composerssort) +- [conductor](Tag.md#conductor) +- [copyright](Tag.md#copyright) +- [dateTagged](Tag.md#datetagged) +- [description](Tag.md#description) +- [disc](Tag.md#disc) +- [discCount](Tag.md#disccount) +- [firstAlbumArtist](Tag.md#firstalbumartist) +- [firstAlbumArtistSort](Tag.md#firstalbumartistsort) +- [firstComposer](Tag.md#firstcomposer) +- [firstComposerSort](Tag.md#firstcomposersort) +- [firstGenre](Tag.md#firstgenre) +- [firstPerformer](Tag.md#firstperformer) +- [firstPerformerSort](Tag.md#firstperformersort) +- [genres](Tag.md#genres) +- [grouping](Tag.md#grouping) +- [initialKey](Tag.md#initialkey) +- [isCompilation](Tag.md#iscompilation) +- [isEmpty](Tag.md#isempty) +- [isrc](Tag.md#isrc) +- [joinedAlbumArtists](Tag.md#joinedalbumartists) +- [joinedComposers](Tag.md#joinedcomposers) +- [joinedGenres](Tag.md#joinedgenres) +- [joinedPerformers](Tag.md#joinedperformers) +- [joinedPerformersSort](Tag.md#joinedperformerssort) +- [lyrics](Tag.md#lyrics) +- [musicBrainzArtistId](Tag.md#musicbrainzartistid) +- [musicBrainzDiscId](Tag.md#musicbrainzdiscid) +- [musicBrainzReleaseArtistId](Tag.md#musicbrainzreleaseartistid) +- [musicBrainzReleaseCountry](Tag.md#musicbrainzreleasecountry) +- [musicBrainzReleaseGroupId](Tag.md#musicbrainzreleasegroupid) +- [musicBrainzReleaseId](Tag.md#musicbrainzreleaseid) +- [musicBrainzReleaseStatus](Tag.md#musicbrainzreleasestatus) +- [musicBrainzReleaseType](Tag.md#musicbrainzreleasetype) +- [musicBrainzTrackId](Tag.md#musicbrainztrackid) +- [musicIpId](Tag.md#musicipid) +- [performers](Tag.md#performers) +- [performersRole](Tag.md#performersrole) +- [performersSort](Tag.md#performerssort) +- [pictures](Tag.md#pictures) +- [publisher](Tag.md#publisher) +- [remixedBy](Tag.md#remixedby) +- [replayGainAlbumGain](Tag.md#replaygainalbumgain) +- [replayGainAlbumPeak](Tag.md#replaygainalbumpeak) +- [replayGainTrackGain](Tag.md#replaygaintrackgain) +- [replayGainTrackPeak](Tag.md#replaygaintrackpeak) +- [sizeOnDisk](Tag.md#sizeondisk) +- [subtitle](Tag.md#subtitle) +- [title](Tag.md#title) +- [titleSort](Tag.md#titlesort) +- [track](Tag.md#track) +- [trackCount](Tag.md#trackcount) +- [year](Tag.md#year) ### Methods -- [clear](tag.md#clear) -- [copyTo](tag.md#copyto) -- [setInfoTag](tag.md#setinfotag) -- [firstInGroup](tag.md#firstingroup) -- [isFalsyOrLikeEmpty](tag.md#isfalsyorlikeempty) -- [joinGroup](tag.md#joingroup) -- [tagTypeFlagsToArray](tag.md#tagtypeflagstoarray) +- [clear](Tag.md#clear) +- [copyTo](Tag.md#copyto) +- [setInfoTag](Tag.md#setinfotag) +- [firstInGroup](Tag.md#firstingroup) +- [isFalsyOrLikeEmpty](Tag.md#isfalsyorlikeempty) +- [joinGroup](Tag.md#joingroup) +- [tagTypeFlagsToArray](Tag.md#tagtypeflagstoarray) ## Constructors @@ -120,13 +121,13 @@ is stored by re-reading the property after it is set. ### tagTypes -• `Abstract` **tagTypes**: [`TagTypes`](../enums/tagtypes.md) +• `Abstract` **tagTypes**: [`TagTypes`](../enums/TagTypes.md) -Gets the tag types contained in the current instance. A bit wise combined [TagTypes](../enums/tagtypes.md) +Gets the tag types contained in the current instance. A bit wise combined [TagTypes](../enums/TagTypes.md) containing the tag types contained in the current instance. **`remarks`** For a standard tag, the value should be intuitive. For example, Id3v2Tag objects have - a value of [TagTypes.Id3v2](../enums/tagtypes.md#id3v2). However, for CombinedTag type objects, they may + a value of [TagTypes.Id3v2](../enums/TagTypes.md#id3v2). However, for CombinedTag type objects, they may contain multiple or no types. ## Accessors @@ -191,7 +192,7 @@ collection containing the media described by the current instance. will split up albums by the same artist. Having a single album artist for an entire album solves this problem. As this value is to be used as a sorting key, it should be used with less variation - than [performers](tag.md#performers). Where performers can be broken into multiple artists, it is + than [performers](Tag.md#performers). Where performers can be broken into multiple artists, it is best to stick to a single name. Eg, "Super8 & Tab" #### Returns @@ -212,7 +213,7 @@ collection containing the media described by the current instance. will split up albums by the same artist. Having a single album artist for an entire album solves this problem. As this value is to be used as a sorting key, it should be used with less variation - than [performers](tag.md#performers). Where performers can be broken into multiple artists, it is + than [performers](Tag.md#performers). Where performers can be broken into multiple artists, it is best to stick to a single name. Eg, "Super8 & Tab" #### Parameters @@ -244,7 +245,7 @@ album or collection containing the media described by the current instance. skip articles or sort by last by last name. For example "Ben Folds" might be sorted as "Folds, Ben". As this value is to be used as a sorting key, it should be used with less variation than - [performers](tag.md#performers). Where [performers](tag.md#performers) can be broken into multiple performers, it is + [performers](Tag.md#performers). Where [performers](Tag.md#performers) can be broken into multiple performers, it is best to stick to a single album artist. Eg, "Van Buuren, Armin" #### Returns @@ -266,7 +267,7 @@ album or collection containing the media described by the current instance. skip articles or sort by last by last name. For example "Ben Folds" might be sorted as "Folds, Ben". As this value is to be used as a sorting key, it should be used with less variation than - [performers](tag.md#performers). Where [performers](tag.md#performers) can be broken into multiple performers, it is + [performers](Tag.md#performers). Where [performers](Tag.md#performers) can be broken into multiple performers, it is best to stick to a single album artist. Eg, "Van Buuren, Armin" #### Parameters @@ -690,7 +691,7 @@ boxed set. For a series, this represents the season number. **`remarks`** This value should be the same as the number that appears on the disc. For example, if the disc is the first of three, the value should be `1`. It should be no more than - [discCount](tag.md#disccount) if [discCount](tag.md#disccount) is non-zero. + [discCount](Tag.md#disccount) if [discCount](Tag.md#disccount) is non-zero. #### Returns @@ -706,7 +707,7 @@ boxed set. For a series, this represents the season number. **`remarks`** This value should be the same as the number that appears on the disc. For example, if the disc is the first of three, the value should be `1`. It should be no more than - [discCount](tag.md#disccount) if [discCount](tag.md#disccount) is non-zero. + [discCount](Tag.md#disccount) if [discCount](Tag.md#disccount) is non-zero. #### Parameters @@ -730,7 +731,7 @@ ___ Gets the number of discs or seasons in the boxed set containing the media represented by the current instance. -**`remarks`** If non-zero, this should be at least equal to [disc](tag.md#disc). If [disc](tag.md#disc) is zero, +**`remarks`** If non-zero, this should be at least equal to [disc](Tag.md#disc). If [disc](Tag.md#disc) is zero, this value should also be zero. #### Returns @@ -745,7 +746,7 @@ Number of discs or seasons in the boxed set containing the media represented by Sets the number of discs or seasons in the boxed set containing the media represented by the current instance. -**`remarks`** If non-zero, this should be at least equal to [disc](tag.md#disc). If [disc](tag.md#disc) is zero, +**`remarks`** If non-zero, this should be at least equal to [disc](Tag.md#disc). If [disc](Tag.md#disc) is zero, this value should also be zero. #### Parameters @@ -767,7 +768,7 @@ ___ • `get` **firstAlbumArtist**(): `string` -Gets the the first value contained in [albumArtists](tag.md#albumartists). +Gets the first value contained in [albumArtists](Tag.md#albumartists). #### Returns @@ -779,7 +780,7 @@ ___ • `get` **firstAlbumArtistSort**(): `string` -Gets the first value contained in [albumArtistsSort](tag.md#albumartistssort) +Gets the first value contained in [albumArtistsSort](Tag.md#albumartistssort) #### Returns @@ -791,7 +792,7 @@ ___ • `get` **firstComposer**(): `string` -Gets the first value contained in [composers](tag.md#composers) +Gets the first value contained in [composers](Tag.md#composers) #### Returns @@ -803,7 +804,7 @@ ___ • `get` **firstComposerSort**(): `string` -Gets the first value contained in [composersSort](tag.md#composerssort) +Gets the first value contained in [composersSort](Tag.md#composerssort) #### Returns @@ -815,7 +816,7 @@ ___ • `get` **firstGenre**(): `string` -Gets the first value contained in [genres](tag.md#genres) +Gets the first value contained in [genres](Tag.md#genres) #### Returns @@ -827,7 +828,7 @@ ___ • `get` **firstPerformer**(): `string` -Gets the first value contained in [performers](tag.md#performers) +Gets the first value contained in [performers](Tag.md#performers) #### Returns @@ -839,7 +840,7 @@ ___ • `get` **firstPerformerSort**(): `string` -Gets the first value contained in [performersSort](tag.md#performerssort) +Gets the first value contained in [performersSort](Tag.md#performerssort) #### Returns @@ -959,13 +960,39 @@ Initial key of the track or `undefined` if no value is set ___ +### isCompilation + +• `get` **isCompilation**(): `boolean` + +Gets whether or not the album described by the current instance is a compilation. + +#### Returns + +`boolean` + +• `set` **isCompilation**(`value`): `void` + +Gets whether or not the album described by the current instance is a compilation. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | `boolean` | Whether or not the album described by the current instance is a compilation | + +#### Returns + +`void` + +___ + ### isEmpty • `get` **isEmpty**(): `boolean` Gets whether or not the current instance is empty. -**`remarks`** In the default implementation, this checks the values supported by [Tag](tag.md), but it +**`remarks`** In the default implementation, this checks the values supported by [Tag](Tag.md), but it may be extended by child classes to support other values. #### Returns @@ -1010,7 +1037,7 @@ ___ • `get` **joinedAlbumArtists**(): `string` -Gets a semicolon and space separated string containing the values in [albumArtists](tag.md#albumartists) +Gets a semicolon and space separated string containing the values in [albumArtists](Tag.md#albumartists) #### Returns @@ -1022,7 +1049,7 @@ ___ • `get` **joinedComposers**(): `string` -Gets a semicolon and space separated string containing the values in [composers](tag.md#composers) +Gets a semicolon and space separated string containing the values in [composers](Tag.md#composers) #### Returns @@ -1034,7 +1061,7 @@ ___ • `get` **joinedGenres**(): `string` -Gets a semicolon and space separated string containing the values in [genres](tag.md#genres) +Gets a semicolon and space separated string containing the values in [genres](Tag.md#genres) #### Returns @@ -1046,7 +1073,7 @@ ___ • `get` **joinedPerformers**(): `string` -Gets a semicolon and space separated string containing the values in [performers](tag.md#performers) +Gets a semicolon and space separated string containing the values in [performers](Tag.md#performers) #### Returns @@ -1058,7 +1085,7 @@ ___ • `get` **joinedPerformersSort**(): `string` -Gets a semicolon and space separated string containing the values in [performersSort](tag.md#performerssort) +Gets a semicolon and space separated string containing the values in [performersSort](Tag.md#performerssort) #### Returns @@ -1553,12 +1580,12 @@ ___ • `get` **performersRole**(): `string`[] Gets the characters portrayed by an actor for a video or instruments played by a musician -for music. This must match the [performers](tag.md#performers) array (for each person, correspond one/more +for music. This must match the [performers](Tag.md#performers) array (for each person, correspond one/more role). Several roles for the same artist/actor can be separated with semicolons. For example: "Bass; Backing Vocals; Vibraphone". **`remarks`** It is highly important to match each role to the performers. This means that an entry - in the [performersRole](tag.md#performersrole) array is `undefined` to maintain the relationship between + in the [performersRole](Tag.md#performersrole) array is `undefined` to maintain the relationship between `performers[i]` and `performersRole[i]`. #### Returns @@ -1571,12 +1598,12 @@ Array containing the roles played by the performers in the media described by th • `set` **performersRole**(`value`): `void` Sets the characters portrayed by an actor for a video or instruments played by a musician -for music. This must match the [performers](tag.md#performers) array (for each person, correspond one/more +for music. This must match the [performers](Tag.md#performers) array (for each person, correspond one/more role). Several roles for the same artist/actor can be separated with semicolons. For example: "Bass; Backing Vocals; Vibraphone". **`remarks`** It is highly important to match each role to the performers. This means that an entry - in the [performersRole](tag.md#performersrole) array is `undefined` to maintain the relationship between + in the [performersRole](Tag.md#performersrole) array is `undefined` to maintain the relationship between `performers[i]` and `performersRole[i]`. #### Parameters @@ -1642,7 +1669,7 @@ ___ ### pictures -• `get` **pictures**(): [`IPicture`](../interfaces/ipicture.md)[] +• `get` **pictures**(): [`IPicture`](../interfaces/IPicture.md)[] Gets a collection of pictures associated with the media represented by the current instance. @@ -1652,7 +1679,7 @@ Gets a collection of pictures associated with the media represented by the curre #### Returns -[`IPicture`](../interfaces/ipicture.md)[] +[`IPicture`](../interfaces/IPicture.md)[] Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. @@ -1669,7 +1696,7 @@ Sets a collection of pictures associated with the media represented by the curre | Name | Type | Description | | :------ | :------ | :------ | -| `value` | [`IPicture`](../interfaces/ipicture.md)[] | Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. | +| `value` | [`IPicture`](../interfaces/IPicture.md)[] | Array containing a collection of pictures associated with the media represented by the current instance or an empty array if no pictures are present. | #### Returns @@ -1996,7 +2023,7 @@ Gets the position of the media represented by the current instance in its contai or season (for a series). **`remarks`** This value should be the same as is listed on the album cover and no more than - [trackCount](tag.md#trackcount), if [trackCount](tag.md#trackcount) is non-zero. + [trackCount](Tag.md#trackcount), if [trackCount](Tag.md#trackcount) is non-zero. Most tagging formats store this as a string. To help sorting, a two-digit zero-padded value is used in the resulting tag. For a series, this property represents the episodes in a season of the series. @@ -2014,7 +2041,7 @@ Sets the position of the media represented by the current instance in its contai or season (for a series). **`remarks`** This value should be the same as is listed on the album cover and no more than - [trackCount](tag.md#trackcount), if [trackCount](tag.md#trackcount) is non-zero. + [trackCount](Tag.md#trackcount), if [trackCount](Tag.md#trackcount) is non-zero. Most tagging formats store this as a string. To help sorting, a two-digit zero-padded value is used in the resulting tag. For a series, this property represents the episodes in a season of the series. @@ -2041,8 +2068,8 @@ ___ Gets the number of tracks in the album or the number of episodes in a series of the media represented by the current instance. -**`remarks`** If non-zero, this value should be equal to or greater than [track](tag.md#track). If - [track](tag.md#track) is `0`, this value should also be `0`. +**`remarks`** If non-zero, this value should be equal to or greater than [track](Tag.md#track). If + [track](Tag.md#track) is `0`, this value should also be `0`. #### Returns @@ -2056,8 +2083,8 @@ Number of tracks in the album or number of episodes in a series of the media Sets the number of tracks in the album or the number of episodes in a series of the media represented by the current instance. -**`remarks`** If non-zero, this value should be equal to or greater than [track](tag.md#track). If - [track](tag.md#track) is `0`, this value should also be `0`. +**`remarks`** If non-zero, this value should be equal to or greater than [track](Tag.md#track). If + [track](Tag.md#track) is `0`, this value should also be `0`. #### Parameters @@ -2134,19 +2161,19 @@ ___ ▸ **copyTo**(`target`, `overwrite`): `void` -Copies the values from the current instance to another [Tag](tag.md), optionally overwriting +Copies the values from the current instance to another [Tag](Tag.md), optionally overwriting existing values. **`remarks`** This method only copies the most basic values when copying between different tag formats. However, if `target` is of the same type as the current instance, more advanced copying may be done. For example if both `this` and `target` are - [Id3v2Tag](id3v2tag.md), all frames will be copied to the target. + [Id3v2Tag](Id3v2Tag.md), all frames will be copied to the target. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `target` | [`Tag`](tag.md) | Target tag to copy values to | +| `target` | [`Tag`](Tag.md) | Target tag to copy values to | | `overwrite` | `boolean` | Whether or not to copy values over existing ones | #### Returns @@ -2235,14 +2262,14 @@ ___ ### tagTypeFlagsToArray -▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/tagtypes.md)[] +▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/TagTypes.md)[] #### Parameters | Name | Type | | :------ | :------ | -| `tagTypes` | [`TagTypes`](../enums/tagtypes.md) | +| `tagTypes` | [`TagTypes`](../enums/TagTypes.md) | #### Returns -[`TagTypes`](../enums/tagtypes.md)[] +[`TagTypes`](../enums/TagTypes.md)[] diff --git a/docs/classes/XiphComment.md b/docs/classes/XiphComment.md new file mode 100644 index 00000000..71085481 --- /dev/null +++ b/docs/classes/XiphComment.md @@ -0,0 +1,2302 @@ +[node-taglib-sharp](../README.md) / [Exports](../modules.md) / XiphComment + +# Class: XiphComment + +Provides support for reading and writing Xiph comment-style tags. + +**`remarks`** Xiph comment tag properties are stored in "fields" of the form `KEY=value`, where `KEY` + is the "field name". The field name can be defined multiple times in the tag which means + each field can have multiple values. + +## Hierarchy + +- [`Tag`](Tag.md) + + ↳ **`XiphComment`** + +## Table of contents + +### Accessors + +- [album](XiphComment.md#album) +- [albumArtists](XiphComment.md#albumartists) +- [albumArtistsSort](XiphComment.md#albumartistssort) +- [albumSort](XiphComment.md#albumsort) +- [amazonId](XiphComment.md#amazonid) +- [beatsPerMinute](XiphComment.md#beatsperminute) +- [comment](XiphComment.md#comment) +- [composers](XiphComment.md#composers) +- [composersSort](XiphComment.md#composerssort) +- [conductor](XiphComment.md#conductor) +- [copyright](XiphComment.md#copyright) +- [dateTagged](XiphComment.md#datetagged) +- [description](XiphComment.md#description) +- [disc](XiphComment.md#disc) +- [discCount](XiphComment.md#disccount) +- [fieldNames](XiphComment.md#fieldnames) +- [fieldValueCount](XiphComment.md#fieldvaluecount) +- [firstAlbumArtist](XiphComment.md#firstalbumartist) +- [firstAlbumArtistSort](XiphComment.md#firstalbumartistsort) +- [firstComposer](XiphComment.md#firstcomposer) +- [firstComposerSort](XiphComment.md#firstcomposersort) +- [firstGenre](XiphComment.md#firstgenre) +- [firstPerformer](XiphComment.md#firstperformer) +- [firstPerformerSort](XiphComment.md#firstperformersort) +- [genres](XiphComment.md#genres) +- [grouping](XiphComment.md#grouping) +- [initialKey](XiphComment.md#initialkey) +- [isCompilation](XiphComment.md#iscompilation) +- [isEmpty](XiphComment.md#isempty) +- [isrc](XiphComment.md#isrc) +- [joinedAlbumArtists](XiphComment.md#joinedalbumartists) +- [joinedComposers](XiphComment.md#joinedcomposers) +- [joinedGenres](XiphComment.md#joinedgenres) +- [joinedPerformers](XiphComment.md#joinedperformers) +- [joinedPerformersSort](XiphComment.md#joinedperformerssort) +- [lyrics](XiphComment.md#lyrics) +- [musicBrainzArtistId](XiphComment.md#musicbrainzartistid) +- [musicBrainzDiscId](XiphComment.md#musicbrainzdiscid) +- [musicBrainzReleaseArtistId](XiphComment.md#musicbrainzreleaseartistid) +- [musicBrainzReleaseCountry](XiphComment.md#musicbrainzreleasecountry) +- [musicBrainzReleaseGroupId](XiphComment.md#musicbrainzreleasegroupid) +- [musicBrainzReleaseId](XiphComment.md#musicbrainzreleaseid) +- [musicBrainzReleaseStatus](XiphComment.md#musicbrainzreleasestatus) +- [musicBrainzReleaseType](XiphComment.md#musicbrainzreleasetype) +- [musicBrainzTrackId](XiphComment.md#musicbrainztrackid) +- [musicIpId](XiphComment.md#musicipid) +- [performers](XiphComment.md#performers) +- [performersRole](XiphComment.md#performersrole) +- [performersSort](XiphComment.md#performerssort) +- [pictures](XiphComment.md#pictures) +- [publisher](XiphComment.md#publisher) +- [remixedBy](XiphComment.md#remixedby) +- [replayGainAlbumGain](XiphComment.md#replaygainalbumgain) +- [replayGainAlbumPeak](XiphComment.md#replaygainalbumpeak) +- [replayGainTrackGain](XiphComment.md#replaygaintrackgain) +- [replayGainTrackPeak](XiphComment.md#replaygaintrackpeak) +- [sizeOnDisk](XiphComment.md#sizeondisk) +- [subtitle](XiphComment.md#subtitle) +- [tagTypes](XiphComment.md#tagtypes) +- [title](XiphComment.md#title) +- [titleSort](XiphComment.md#titlesort) +- [track](XiphComment.md#track) +- [trackCount](XiphComment.md#trackcount) +- [vendorId](XiphComment.md#vendorid) +- [year](XiphComment.md#year) + +### Methods + +- [clear](XiphComment.md#clear) +- [copyTo](XiphComment.md#copyto) +- [getField](XiphComment.md#getfield) +- [getFieldFirstValue](XiphComment.md#getfieldfirstvalue) +- [removeField](XiphComment.md#removefield) +- [render](XiphComment.md#render) +- [setFieldAsStrings](XiphComment.md#setfieldasstrings) +- [setFieldAsUint](XiphComment.md#setfieldasuint) +- [setInfoTag](XiphComment.md#setinfotag) +- [firstInGroup](XiphComment.md#firstingroup) +- [fromData](XiphComment.md#fromdata) +- [fromEmpty](XiphComment.md#fromempty) +- [isFalsyOrLikeEmpty](XiphComment.md#isfalsyorlikeempty) +- [joinGroup](XiphComment.md#joingroup) +- [tagTypeFlagsToArray](XiphComment.md#tagtypeflagstoarray) + +## Accessors + +### album + +• `get` **album**(): `string` + +**`inheritdoc`** `ALBUM` field + +#### Returns + +`string` + +#### Overrides + +Tag.album + +• `set` **album**(`value`): `void` + +**`inheritdoc`** `ALBUM` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.album + +___ + +### albumArtists + +• `get` **albumArtists**(): `string`[] + +**`inheritdoc`** `ALBUMARTIST` as per standard, though `ALBUM ARTIST` and `ENSEMBLE` will be + checked if `ALBUMARTIST` is not set. + +#### Returns + +`string`[] + +#### Overrides + +Tag.albumArtists + +• `set` **albumArtists**(`value`): `void` + +**`inheritdoc`** `ALBUMARTIST`, as per the standard + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string`[] | + +#### Returns + +`void` + +#### Overrides + +Tag.albumArtists + +___ + +### albumArtistsSort + +• `get` **albumArtistsSort**(): `string`[] + +**`inheritdoc`** `ALBUMARTISTSORT` field + +#### Returns + +`string`[] + +#### Overrides + +Tag.albumArtistsSort + +• `set` **albumArtistsSort**(`value`): `void` + +**`inheritdoc`** `ALBUMARTISTSORT` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string`[] | + +#### Returns + +`void` + +#### Overrides + +Tag.albumArtistsSort + +___ + +### albumSort + +• `get` **albumSort**(): `string` + +**`inheritdoc`** `ALBUMSORT` field + +#### Returns + +`string` + +#### Overrides + +Tag.albumSort + +• `set` **albumSort**(`value`): `void` + +**`inheritdoc`** `ALBUMSORT` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.albumSort + +___ + +### amazonId + +• `get` **amazonId**(): `string` + +**`inheritdoc`** `ASIN` field + +#### Returns + +`string` + +#### Overrides + +Tag.amazonId + +• `set` **amazonId**(`value`): `void` + +**`inheritdoc`** `ASIN` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.amazonId + +___ + +### beatsPerMinute + +• `get` **beatsPerMinute**(): `number` + +**`inheritdoc`** `TEMPO` field preferentially, BPM field is used as a fallback. + +**`remarks`** The field that stores the value will be used when setting a BPM in the future. This + behavior can be controlled via {@link XiphSettings.useTempoToStoreBpm}. + +#### Returns + +`number` + +#### Overrides + +Tag.beatsPerMinute + +• `set` **beatsPerMinute**(`value`): `void` + +**`inheritdoc`** + +**`remarks`** Value is stored via `TEMPO` field if {@link XiphSettings.useTempoToStoreBpm} is + `true`. Value is stored via `BPM` if {@link XiphSettings.useTempoToStoreBpm} is `false`. + The other field is removed when stored. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `number` | + +#### Returns + +`void` + +#### Overrides + +Tag.beatsPerMinute + +___ + +### comment + +• `get` **comment**(): `string` + +**`inheritdoc`** `COMMENT` field + +#### Returns + +`string` + +#### Overrides + +Tag.comment + +• `set` **comment**(`value`): `void` + +**`inheritdoc`** `COMMENT` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.comment + +___ + +### composers + +• `get` **composers**(): `string`[] + +**`inheritdoc`** `COMPOSER` field + +#### Returns + +`string`[] + +#### Overrides + +Tag.composers + +• `set` **composers**(`value`): `void` + +**`inheritdoc`** `COMPOSER` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string`[] | + +#### Returns + +`void` + +#### Overrides + +Tag.composers + +___ + +### composersSort + +• `get` **composersSort**(): `string`[] + +**`inheritdoc`** `COMPOSERSORT` field + +#### Returns + +`string`[] + +#### Overrides + +Tag.composersSort + +• `set` **composersSort**(`value`): `void` + +**`inheritdoc`** `COMPOSERSORT` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string`[] | + +#### Returns + +`void` + +#### Overrides + +Tag.composersSort + +___ + +### conductor + +• `get` **conductor**(): `string` + +**`inheritdoc`** `CONDUCTOR` field + +#### Returns + +`string` + +#### Overrides + +Tag.conductor + +• `set` **conductor**(`value`): `void` + +**`inheritdoc`** `CONDUCTOR` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.conductor + +___ + +### copyright + +• `get` **copyright**(): `string` + +**`inheritdoc`** `COPYRIGHT` field + +#### Returns + +`string` + +#### Overrides + +Tag.copyright + +• `set` **copyright**(`value`): `void` + +**`inheritdoc`** `GROUPING` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.copyright + +___ + +### dateTagged + +• `get` **dateTagged**(): `Date` + +**`inheritdoc`** `DATETAGGED` field + +#### Returns + +`Date` + +#### Overrides + +Tag.dateTagged + +• `set` **dateTagged**(`value`): `void` + +**`inheritdoc`** `DATETAGGED` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `Date` | + +#### Returns + +`void` + +#### Overrides + +Tag.dateTagged + +___ + +### description + +• `get` **description**(): `string` + +**`inheritdoc`** `DESCRIPTION` field + +#### Returns + +`string` + +#### Overrides + +Tag.description + +• `set` **description**(`value`): `void` + +**`inheritdoc`** `DESCRIPTION` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.description + +___ + +### disc + +• `get` **disc**(): `number` + +**`inheritdoc`** `DISCNUMBER` field + +#### Returns + +`number` + +#### Overrides + +Tag.disc + +• `set` **disc**(`value`): `void` + +**`inheritdoc`** `DISCNUMBER` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `number` | + +#### Returns + +`void` + +#### Overrides + +Tag.disc + +___ + +### discCount + +• `get` **discCount**(): `number` + +**`inheritdoc`** `DISCTOTAL` as per standard, but the denominator of `DISCNUMBER` is also + used if `DISCTOTAL` is not available. + +#### Returns + +`number` + +#### Overrides + +Tag.discCount + +• `set` **discCount**(`value`): `void` + +**`inheritdoc`** `DISCTOTAL` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `number` | + +#### Returns + +`void` + +#### Overrides + +Tag.discCount + +___ + +### fieldNames + +• `get` **fieldNames**(): `string`[] + +Gets the names of the fields currently stored in the list of fields, excluding the pictures. + +**`remarks`** This getter is useful for iterating over fields defined in this object in + conjunction with [getField](XiphComment.md#getfield). + +#### Returns + +`string`[] + +___ + +### fieldValueCount + +• `get` **fieldValueCount**(): `number` + +Gets the total number of values contained in the current instance, including the pictures. + +#### Returns + +`number` + +___ + +### firstAlbumArtist + +• `get` **firstAlbumArtist**(): `string` + +Gets the first value contained in [albumArtists](XiphComment.md#albumartists). + +#### Returns + +`string` + +#### Inherited from + +Tag.firstAlbumArtist + +___ + +### firstAlbumArtistSort + +• `get` **firstAlbumArtistSort**(): `string` + +Gets the first value contained in [albumArtistsSort](XiphComment.md#albumartistssort) + +#### Returns + +`string` + +#### Inherited from + +Tag.firstAlbumArtistSort + +___ + +### firstComposer + +• `get` **firstComposer**(): `string` + +Gets the first value contained in [composers](XiphComment.md#composers) + +#### Returns + +`string` + +#### Inherited from + +Tag.firstComposer + +___ + +### firstComposerSort + +• `get` **firstComposerSort**(): `string` + +Gets the first value contained in [composersSort](XiphComment.md#composerssort) + +#### Returns + +`string` + +#### Inherited from + +Tag.firstComposerSort + +___ + +### firstGenre + +• `get` **firstGenre**(): `string` + +Gets the first value contained in [genres](XiphComment.md#genres) + +#### Returns + +`string` + +#### Inherited from + +Tag.firstGenre + +___ + +### firstPerformer + +• `get` **firstPerformer**(): `string` + +Gets the first value contained in [performers](XiphComment.md#performers) + +#### Returns + +`string` + +#### Inherited from + +Tag.firstPerformer + +___ + +### firstPerformerSort + +• `get` **firstPerformerSort**(): `string` + +Gets the first value contained in [performersSort](XiphComment.md#performerssort) + +#### Returns + +`string` + +#### Inherited from + +Tag.firstPerformerSort + +___ + +### genres + +• `get` **genres**(): `string`[] + +**`inheritdoc`** `GENRE` field + +#### Returns + +`string`[] + +#### Overrides + +Tag.genres + +• `set` **genres**(`value`): `void` + +**`inheritdoc`** `GENRE` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string`[] | + +#### Returns + +`void` + +#### Overrides + +Tag.genres + +___ + +### grouping + +• `get` **grouping**(): `string` + +**`inheritdoc`** `GROUPING` field + +#### Returns + +`string` + +#### Overrides + +Tag.grouping + +• `set` **grouping**(`value`): `void` + +**`inheritdoc`** `GROUPING` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.grouping + +___ + +### initialKey + +• `get` **initialKey**(): `string` + +**`inheritdoc`** `INITIALKEY` field + +#### Returns + +`string` + +#### Overrides + +Tag.initialKey + +• `set` **initialKey**(`value`): `void` + +**`inheritdoc`** `INITIALKEY` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.initialKey + +___ + +### isCompilation + +• `get` **isCompilation**(): `boolean` + +**`inheritdoc`** `COMPILATION` field + +#### Returns + +`boolean` + +#### Overrides + +Tag.isCompilation + +• `set` **isCompilation**(`value`): `void` + +**`inheritdoc`** `COMPILATION` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `boolean` | + +#### Returns + +`void` + +#### Overrides + +Tag.isCompilation + +___ + +### isEmpty + +• `get` **isEmpty**(): `boolean` + +**`inheritdoc`** + +#### Returns + +`boolean` + +#### Overrides + +Tag.isEmpty + +___ + +### isrc + +• `get` **isrc**(): `string` + +**`inheritdoc`** `ISRC` field + +#### Returns + +`string` + +#### Overrides + +Tag.isrc + +• `set` **isrc**(`value`): `void` + +**`inheritdoc`** `ISRC` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.isrc + +___ + +### joinedAlbumArtists + +• `get` **joinedAlbumArtists**(): `string` + +Gets a semicolon and space separated string containing the values in [albumArtists](XiphComment.md#albumartists) + +#### Returns + +`string` + +#### Inherited from + +Tag.joinedAlbumArtists + +___ + +### joinedComposers + +• `get` **joinedComposers**(): `string` + +Gets a semicolon and space separated string containing the values in [composers](XiphComment.md#composers) + +#### Returns + +`string` + +#### Inherited from + +Tag.joinedComposers + +___ + +### joinedGenres + +• `get` **joinedGenres**(): `string` + +Gets a semicolon and space separated string containing the values in [genres](XiphComment.md#genres) + +#### Returns + +`string` + +#### Inherited from + +Tag.joinedGenres + +___ + +### joinedPerformers + +• `get` **joinedPerformers**(): `string` + +Gets a semicolon and space separated string containing the values in [performers](XiphComment.md#performers) + +#### Returns + +`string` + +#### Inherited from + +Tag.joinedPerformers + +___ + +### joinedPerformersSort + +• `get` **joinedPerformersSort**(): `string` + +Gets a semicolon and space separated string containing the values in [performersSort](XiphComment.md#performerssort) + +#### Returns + +`string` + +#### Inherited from + +Tag.joinedPerformersSort + +___ + +### lyrics + +• `get` **lyrics**(): `string` + +**`inheritdoc`** `LYRICS` field + +#### Returns + +`string` + +#### Overrides + +Tag.lyrics + +• `set` **lyrics**(`value`): `void` + +**`inheritdoc`** `LYRICS` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.lyrics + +___ + +### musicBrainzArtistId + +• `get` **musicBrainzArtistId**(): `string` + +**`inheritdoc`** `MUSICBRAINZ_ARTISTID` field + +#### Returns + +`string` + +#### Overrides + +Tag.musicBrainzArtistId + +• `set` **musicBrainzArtistId**(`value`): `void` + +**`inheritdoc`** `MUSICBRAINZ_ARTISTID` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.musicBrainzArtistId + +___ + +### musicBrainzDiscId + +• `get` **musicBrainzDiscId**(): `string` + +**`inheritdoc`** `MUSICBRAINZ_DISCID` field + +#### Returns + +`string` + +#### Overrides + +Tag.musicBrainzDiscId + +• `set` **musicBrainzDiscId**(`value`): `void` + +**`inheritdoc`** `MUSICBRAINZ_DISCID` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.musicBrainzDiscId + +___ + +### musicBrainzReleaseArtistId + +• `get` **musicBrainzReleaseArtistId**(): `string` + +**`inheritdoc`** `MUSICBRAINZ_ALBUMARTISTID` field + +#### Returns + +`string` + +#### Overrides + +Tag.musicBrainzReleaseArtistId + +• `set` **musicBrainzReleaseArtistId**(`value`): `void` + +**`inheritdoc`** `MUSICBRAINZ_ALBUMARTISTID` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.musicBrainzReleaseArtistId + +___ + +### musicBrainzReleaseCountry + +• `get` **musicBrainzReleaseCountry**(): `string` + +**`inheritdoc`** `RELEASECOUNTRY` field + +#### Returns + +`string` + +#### Overrides + +Tag.musicBrainzReleaseCountry + +• `set` **musicBrainzReleaseCountry**(`value`): `void` + +**`inheritdoc`** `RELEASECOUNTRY` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.musicBrainzReleaseCountry + +___ + +### musicBrainzReleaseGroupId + +• `get` **musicBrainzReleaseGroupId**(): `string` + +**`inheritdoc`** `MUSICBRAINZ_RELEASEGROUPID` field + +#### Returns + +`string` + +#### Overrides + +Tag.musicBrainzReleaseGroupId + +• `set` **musicBrainzReleaseGroupId**(`value`): `void` + +**`inheritdoc`** `MUSICBRAINZ_RELEASEGROUPID` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.musicBrainzReleaseGroupId + +___ + +### musicBrainzReleaseId + +• `get` **musicBrainzReleaseId**(): `string` + +**`inheritdoc`** `MUSICBRAINZ_ALBUMID` field + +#### Returns + +`string` + +#### Overrides + +Tag.musicBrainzReleaseId + +• `set` **musicBrainzReleaseId**(`value`): `void` + +**`inheritdoc`** `MUSICBRAINZ_ALBUMID` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.musicBrainzReleaseId + +___ + +### musicBrainzReleaseStatus + +• `get` **musicBrainzReleaseStatus**(): `string` + +**`inheritdoc`** `MUSICBRAINZ_ALBUMSTATUS` field + +#### Returns + +`string` + +#### Overrides + +Tag.musicBrainzReleaseStatus + +• `set` **musicBrainzReleaseStatus**(`value`): `void` + +**`inheritdoc`** `MUSICBRAINZ_ALBUMSTATUS` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.musicBrainzReleaseStatus + +___ + +### musicBrainzReleaseType + +• `get` **musicBrainzReleaseType**(): `string` + +**`inheritdoc`** `MUSICBRAINZ_ALBUMTYPE` field + +#### Returns + +`string` + +#### Overrides + +Tag.musicBrainzReleaseType + +• `set` **musicBrainzReleaseType**(`value`): `void` + +**`inheritdoc`** `MUSICBRAINZ_ALBUMTYPE` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.musicBrainzReleaseType + +___ + +### musicBrainzTrackId + +• `get` **musicBrainzTrackId**(): `string` + +**`inheritdoc`** `MUSICBRAINZ_TRACKID` field + +#### Returns + +`string` + +#### Overrides + +Tag.musicBrainzTrackId + +• `set` **musicBrainzTrackId**(`value`): `void` + +**`inheritdoc`** `MUSICBRAINZ_TRACKID` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.musicBrainzTrackId + +___ + +### musicIpId + +• `get` **musicIpId**(): `string` + +**`inheritdoc`** `MUSICIP_PUID` field + +#### Returns + +`string` + +#### Overrides + +Tag.musicIpId + +• `set` **musicIpId**(`value`): `void` + +**`inheritdoc`** `MUSICID_PUID` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.musicIpId + +___ + +### performers + +• `get` **performers**(): `string`[] + +**`inheritdoc`** `ARTIST` field + +#### Returns + +`string`[] + +#### Overrides + +Tag.performers + +• `set` **performers**(`value`): `void` + +**`inheritdoc`** `ARTIST` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string`[] | + +#### Returns + +`void` + +#### Overrides + +Tag.performers + +___ + +### performersRole + +• `get` **performersRole**(): `string`[] + +**`inheritdoc`** `ARTISTROLE` field + +#### Returns + +`string`[] + +#### Overrides + +Tag.performersRole + +• `set` **performersRole**(`value`): `void` + +**`inheritdoc`** `ARTISTROLE` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string`[] | + +#### Returns + +`void` + +#### Overrides + +Tag.performersRole + +___ + +### performersSort + +• `get` **performersSort**(): `string`[] + +**`inheritdoc`** `ARTISTSORT` field + +#### Returns + +`string`[] + +#### Overrides + +Tag.performersSort + +• `set` **performersSort**(`value`): `void` + +**`inheritdoc`** `ARTIST` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string`[] | + +#### Returns + +`void` + +#### Overrides + +Tag.performersSort + +___ + +### pictures + +• `get` **pictures**(): [`IPicture`](../interfaces/IPicture.md)[] + +**`inheritdoc`** + +#### Returns + +[`IPicture`](../interfaces/IPicture.md)[] + +#### Overrides + +Tag.pictures + +• `set` **pictures**(`value`): `void` + +**`inheritdoc`** + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | [`IPicture`](../interfaces/IPicture.md)[] | + +#### Returns + +`void` + +#### Overrides + +Tag.pictures + +___ + +### publisher + +• `get` **publisher**(): `string` + +**`inheritdoc`** `ORGANIZATION` field + +#### Returns + +`string` + +#### Overrides + +Tag.publisher + +• `set` **publisher**(`value`): `void` + +**`inheritdoc`** `ORGANIZATION` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.publisher + +___ + +### remixedBy + +• `get` **remixedBy**(): `string` + +**`inheritdoc`** `REMIXEDBY` field + +#### Returns + +`string` + +#### Overrides + +Tag.remixedBy + +• `set` **remixedBy**(`value`): `void` + +**`inheritdoc`** `REMIXEDBY` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.remixedBy + +___ + +### replayGainAlbumGain + +• `get` **replayGainAlbumGain**(): `number` + +**`inheritdoc`** `REPLAYGAIN_ALBUM_GAIN` field + +#### Returns + +`number` + +#### Overrides + +Tag.replayGainAlbumGain + +• `set` **replayGainAlbumGain**(`value`): `void` + +**`inheritdoc`** `REPLAYGAIN_ALBUM_GAIN` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `number` | + +#### Returns + +`void` + +#### Overrides + +Tag.replayGainAlbumGain + +___ + +### replayGainAlbumPeak + +• `get` **replayGainAlbumPeak**(): `number` + +**`inheritdoc`** `REPLAYGAIN_ALBUM_PEAK` field + +#### Returns + +`number` + +#### Overrides + +Tag.replayGainAlbumPeak + +• `set` **replayGainAlbumPeak**(`value`): `void` + +**`inheritdoc`** `REPLAYGAIN_TRACK_PEAK` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `number` | + +#### Returns + +`void` + +#### Overrides + +Tag.replayGainAlbumPeak + +___ + +### replayGainTrackGain + +• `get` **replayGainTrackGain**(): `number` + +**`inheritdoc`** `REPLAYGAIN_TRACK_GAIN` field + +#### Returns + +`number` + +#### Overrides + +Tag.replayGainTrackGain + +• `set` **replayGainTrackGain**(`value`): `void` + +**`inheritdoc`** `REPLAYGAIN_TRACK_GAIN` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `number` | + +#### Returns + +`void` + +#### Overrides + +Tag.replayGainTrackGain + +___ + +### replayGainTrackPeak + +• `get` **replayGainTrackPeak**(): `number` + +**`inheritdoc`** `REPLAYGAIN_TRACK_PEAK` field + +#### Returns + +`number` + +#### Overrides + +Tag.replayGainTrackPeak + +• `set` **replayGainTrackPeak**(`value`): `void` + +**`inheritdoc`** `REPLAYGAIN_TRACK_PEAK` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `number` | + +#### Returns + +`void` + +#### Overrides + +Tag.replayGainTrackPeak + +___ + +### sizeOnDisk + +• `get` **sizeOnDisk**(): `number` + +**`inheritdoc`** + +#### Returns + +`number` + +#### Overrides + +Tag.sizeOnDisk + +___ + +### subtitle + +• `get` **subtitle**(): `string` + +**`inheritdoc`** `SUBTITLE` field + +#### Returns + +`string` + +#### Overrides + +Tag.subtitle + +• `set` **subtitle**(`value`): `void` + +**`inheritdoc`** `SUBTITLE` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.subtitle + +___ + +### tagTypes + +• `get` **tagTypes**(): [`TagTypes`](../enums/TagTypes.md) + +Gets the tag types contained in the current instance. A bit wise combined [TagTypes](../enums/TagTypes.md) +containing the tag types contained in the current instance. + +**`inheritdoc`** returns [TagTypes.Xiph](../enums/TagTypes.md#xiph) + +#### Returns + +[`TagTypes`](../enums/TagTypes.md) + +#### Overrides + +Tag.tagTypes + +___ + +### title + +• `get` **title**(): `string` + +**`inheritdoc`** `TITLE` field + +#### Returns + +`string` + +#### Overrides + +Tag.title + +• `set` **title**(`value`): `void` + +**`inheritdoc`** `TITLE` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.title + +___ + +### titleSort + +• `get` **titleSort**(): `string` + +**`inheritdoc`** `TITLESORT` field + +#### Returns + +`string` + +#### Overrides + +Tag.titleSort + +• `set` **titleSort**(`value`): `void` + +**`inheritdoc`** `TITLESORT` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `string` | + +#### Returns + +`void` + +#### Overrides + +Tag.titleSort + +___ + +### track + +• `get` **track**(): `number` + +**`inheritdoc`** `TRACKNUMBER` field + +#### Returns + +`number` + +#### Overrides + +Tag.track + +• `set` **track**(`value`): `void` + +**`inheritdoc`** `TRACKNUMBER` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `number` | + +#### Returns + +`void` + +#### Overrides + +Tag.track + +___ + +### trackCount + +• `get` **trackCount**(): `number` + +**`inheritdoc`** `TRACKTOTAL` as per standard, but the denominator of `TRACKNUMBER` is also + used if `TRACKTOTAL` is not available. + +#### Returns + +`number` + +#### Overrides + +Tag.trackCount + +• `set` **trackCount**(`value`): `void` + +**`inheritdoc`** `TRACKNUMBER` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `number` | + +#### Returns + +`void` + +#### Overrides + +Tag.trackCount + +___ + +### vendorId + +• `get` **vendorId**(): `string` + +Gets the vendor ID for the current instance. + +#### Returns + +`string` + +___ + +### year + +• `get` **year**(): `number` + +**`inheritdoc`** `DATE` field + +#### Returns + +`number` + +#### Overrides + +Tag.year + +• `set` **year**(`value`): `void` + +**`inheritdoc`** `DATE` field + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `value` | `number` | + +#### Returns + +`void` + +#### Overrides + +Tag.year + +## Methods + +### clear + +▸ **clear**(): `void` + +Clears all values stored in the current instance. + +**`remarks`** The clearing procedure is format specific and should clear all values. + +#### Returns + +`void` + +#### Overrides + +[Tag](Tag.md).[clear](Tag.md#clear) + +___ + +### copyTo + +▸ **copyTo**(`target`, `overwrite`): `void` + +Copies the values from the current instance to another [Tag](Tag.md), optionally overwriting + existing values. + +**`remarks`** This method only copies the most basic values when copying between different tag + formats. However, if `target` is of the same type as the current instance, + more advanced copying may be done. For example if both `this` and `target` are + [Id3v2Tag](Id3v2Tag.md), all frames will be copied to the target. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `target` | [`Tag`](Tag.md) | Target tag to copy values to | +| `overwrite` | `boolean` | Whether or not to copy values over existing ones | + +#### Returns + +`void` + +#### Overrides + +[Tag](Tag.md).[copyTo](Tag.md#copyto) + +___ + +### getField + +▸ **getField**(`key`): `string`[] + +Gets the field data for a given field identifier. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `key` | `string` | Field identifier to look up | + +#### Returns + +`string`[] + +string[] Field data or undefined if the field cannot be found + +___ + +### getFieldFirstValue + +▸ **getFieldFirstValue**(`key`): `string` + +Gets the first value in a field for a given field identifier. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `key` | `string` | Field identifier to look up | + +#### Returns + +`string` + +string Field data or `undefined` if the field was notfound + +___ + +### removeField + +▸ **removeField**(`key`): `void` + +Removes a field and all its values from the current instance. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `key` | `string` | Field identifier to remove | + +#### Returns + +`void` + +___ + +### render + +▸ **render**(`addFramingBit`): [`ByteVector`](ByteVector.md) + +Renders the current instance as a raw Xiph comment, optionally adding a framing bit. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `addFramingBit` | `boolean` | Whether or not to add a framing bit to the end of the content. | + +#### Returns + +[`ByteVector`](ByteVector.md) + +___ + +### setFieldAsStrings + +▸ **setFieldAsStrings**(`key`, ...`values`): `void` + +Sets the contents of a specified field to the provided strings. All values are trimmed and +empty/undefined values are excluded. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `key` | `string` | Field identifier to set | +| `...values` | `string`[] | Values to store in the current instance | + +#### Returns + +`void` + +___ + +### setFieldAsUint + +▸ **setFieldAsUint**(`key`, `value`, `minPlaces?`): `void` + +Sets the contents of a specified field to the provided number. + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `key` | `string` | `undefined` | Field identifier to set | +| `value` | `number` | `undefined` | Value to store, must be a positive, 32-bit integer | +| `minPlaces` | `number` | `1` | Number of places to include at a minimum, if the number has fewer places than this, the value will be padded with zeroes. | + +#### Returns + +`void` + +___ + +### setInfoTag + +▸ **setInfoTag**(): `void` + +Set the tags that represent the tagger software (node-taglib-sharp) itself. + +**`remarks`** This is typically a method to call just before saving a tag. + +#### Returns + +`void` + +#### Inherited from + +[Tag](Tag.md).[setInfoTag](Tag.md#setinfotag) + +___ + +### firstInGroup + +▸ `Static` `Protected` **firstInGroup**(`group`): `string` + +Gets the first string in an array. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `group` | `string`[] | Array of strings to get the first string from. | + +#### Returns + +`string` + +First string contained in `group` or `undefined` if the array is + `undefined` or empty + +#### Inherited from + +[Tag](Tag.md).[firstInGroup](Tag.md#firstingroup) + +___ + +### fromData + +▸ `Static` **fromData**(`data`, `lazyLoadPictures`): [`XiphComment`](XiphComment.md) + +Constructs and initializes a new instance by reading the contents of a raw Xiph comment from +a [ByteVector](ByteVector.md) object. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `data` | [`ByteVector`](ByteVector.md) | Object containing a raw Xiph comment, cannot be falsey | +| `lazyLoadPictures` | `boolean` | Whether or not to load pictures lazily | + +#### Returns + +[`XiphComment`](XiphComment.md) + +___ + +### fromEmpty + +▸ `Static` **fromEmpty**(): [`XiphComment`](XiphComment.md) + +Constructs and initializes a new instance with no contents. + +#### Returns + +[`XiphComment`](XiphComment.md) + +___ + +### isFalsyOrLikeEmpty + +▸ `Static` `Protected` **isFalsyOrLikeEmpty**(`value`): `boolean` + +Checks if a value is falsy or empty. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | `string` \| `string`[] | Object to check | + +#### Returns + +`boolean` + +If `value` is a string, `true` is returned if the value is falsy or all + whitespace, `false` is returned otherwise. If `value` is an array of strings, + the array must be falsy or all elements must be falsy or whitespace to return `true`. + +#### Inherited from + +[Tag](Tag.md).[isFalsyOrLikeEmpty](Tag.md#isfalsyorlikeempty) + +___ + +### joinGroup + +▸ `Static` `Protected` **joinGroup**(`group`): `string` + +Joins an array of string into a single, semicolon and space separated string. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `group` | `string`[] | Array of string to join | + +#### Returns + +`string` + +A semicolon and space separated string containing the values from `group` + or undefined if the array is `undefined` or empty. + +#### Inherited from + +[Tag](Tag.md).[joinGroup](Tag.md#joingroup) + +___ + +### tagTypeFlagsToArray + +▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/TagTypes.md)[] + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `tagTypes` | [`TagTypes`](../enums/TagTypes.md) | + +#### Returns + +[`TagTypes`](../enums/TagTypes.md)[] + +#### Inherited from + +[Tag](Tag.md).[tagTypeFlagsToArray](Tag.md#tagtypeflagstoarray) diff --git a/docs/classes/xiphpicture.md b/docs/classes/XiphPicture.md similarity index 71% rename from docs/classes/xiphpicture.md rename to docs/classes/XiphPicture.md index 97899047..787e2a38 100644 --- a/docs/classes/xiphpicture.md +++ b/docs/classes/XiphPicture.md @@ -4,32 +4,32 @@ ## Implements -- [`IPicture`](../interfaces/ipicture.md) +- [`IPicture`](../interfaces/IPicture.md) - `ILazy` ## Table of contents ### Accessors -- [colorDepth](xiphpicture.md#colordepth) -- [data](xiphpicture.md#data) -- [description](xiphpicture.md#description) -- [filename](xiphpicture.md#filename) -- [height](xiphpicture.md#height) -- [indexedColors](xiphpicture.md#indexedcolors) -- [isLoaded](xiphpicture.md#isloaded) -- [mimeType](xiphpicture.md#mimetype) -- [type](xiphpicture.md#type) -- [width](xiphpicture.md#width) +- [colorDepth](XiphPicture.md#colordepth) +- [data](XiphPicture.md#data) +- [description](XiphPicture.md#description) +- [filename](XiphPicture.md#filename) +- [height](XiphPicture.md#height) +- [indexedColors](XiphPicture.md#indexedcolors) +- [isLoaded](XiphPicture.md#isloaded) +- [mimeType](XiphPicture.md#mimetype) +- [type](XiphPicture.md#type) +- [width](XiphPicture.md#width) ### Methods -- [load](xiphpicture.md#load) -- [renderForFlacBlock](xiphpicture.md#renderforflacblock) -- [renderForXiphComment](xiphpicture.md#renderforxiphcomment) -- [fromFlacBlock](xiphpicture.md#fromflacblock) -- [fromPicture](xiphpicture.md#frompicture) -- [fromXiphComment](xiphpicture.md#fromxiphcomment) +- [load](XiphPicture.md#load) +- [renderForFlacBlock](XiphPicture.md#renderforflacblock) +- [renderForXiphComment](XiphPicture.md#renderforxiphcomment) +- [fromFlacBlock](XiphPicture.md#fromflacblock) +- [fromPicture](XiphPicture.md#frompicture) +- [fromXiphComment](XiphPicture.md#fromxiphcomment) ## Accessors @@ -61,17 +61,17 @@ ___ ### data -• `get` **data**(): [`ByteVector`](bytevector.md) +• `get` **data**(): [`ByteVector`](ByteVector.md) Gets and sets the picture data stored in the current instance. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) #### Implementation of -[IPicture](../interfaces/ipicture.md).[data](../interfaces/ipicture.md#data) +[IPicture](../interfaces/IPicture.md).[data](../interfaces/IPicture.md#data) • `set` **data**(`value`): `void` @@ -81,7 +81,7 @@ Gets and sets the picture data stored in the current instance. | Name | Type | | :------ | :------ | -| `value` | [`ByteVector`](bytevector.md) | +| `value` | [`ByteVector`](ByteVector.md) | #### Returns @@ -89,7 +89,7 @@ Gets and sets the picture data stored in the current instance. #### Implementation of -[IPicture](../interfaces/ipicture.md).[data](../interfaces/ipicture.md#data) +[IPicture](../interfaces/IPicture.md).[data](../interfaces/IPicture.md#data) ___ @@ -105,7 +105,7 @@ Gets and sets a description of the picture stored in the current instance. Optio #### Implementation of -[IPicture](../interfaces/ipicture.md).[description](../interfaces/ipicture.md#description) +[IPicture](../interfaces/IPicture.md).[description](../interfaces/IPicture.md#description) • `set` **description**(`value`): `void` @@ -123,7 +123,7 @@ Gets and sets a description of the picture stored in the current instance. Optio #### Implementation of -[IPicture](../interfaces/ipicture.md).[description](../interfaces/ipicture.md#description) +[IPicture](../interfaces/IPicture.md).[description](../interfaces/IPicture.md#description) ___ @@ -142,7 +142,7 @@ Gets and sets a filename of the picture stored in the current instance. Optional #### Implementation of -[IPicture](../interfaces/ipicture.md).[filename](../interfaces/ipicture.md#filename) +[IPicture](../interfaces/IPicture.md).[filename](../interfaces/IPicture.md#filename) • `set` **filename**(`value`): `void` @@ -162,7 +162,7 @@ Gets and sets a filename of the picture stored in the current instance. Optional #### Implementation of -[IPicture](../interfaces/ipicture.md).[filename](../interfaces/ipicture.md#filename) +[IPicture](../interfaces/IPicture.md).[filename](../interfaces/IPicture.md#filename) ___ @@ -228,6 +228,10 @@ ___ `boolean` +#### Implementation of + +ILazy.isLoaded + ___ ### mimeType @@ -242,7 +246,7 @@ Gets and sets the mime-type of the picture data stored in the current instance. #### Implementation of -[IPicture](../interfaces/ipicture.md).[mimeType](../interfaces/ipicture.md#mimetype) +[IPicture](../interfaces/IPicture.md).[mimeType](../interfaces/IPicture.md#mimetype) • `set` **mimeType**(`value`): `void` @@ -260,23 +264,23 @@ Gets and sets the mime-type of the picture data stored in the current instance. #### Implementation of -[IPicture](../interfaces/ipicture.md).[mimeType](../interfaces/ipicture.md#mimetype) +[IPicture](../interfaces/IPicture.md).[mimeType](../interfaces/IPicture.md#mimetype) ___ ### type -• `get` **type**(): [`PictureType`](../enums/picturetype.md) +• `get` **type**(): [`PictureType`](../enums/PictureType.md) Gets and sets the type of the content visible in the picture stored in the current instance. #### Returns -[`PictureType`](../enums/picturetype.md) +[`PictureType`](../enums/PictureType.md) #### Implementation of -[IPicture](../interfaces/ipicture.md).[type](../interfaces/ipicture.md#type) +[IPicture](../interfaces/IPicture.md).[type](../interfaces/IPicture.md#type) • `set` **type**(`value`): `void` @@ -286,7 +290,7 @@ Gets and sets the type of the content visible in the picture stored in the curre | Name | Type | | :------ | :------ | -| `value` | [`PictureType`](../enums/picturetype.md) | +| `value` | [`PictureType`](../enums/PictureType.md) | #### Returns @@ -294,7 +298,7 @@ Gets and sets the type of the content visible in the picture stored in the curre #### Implementation of -[IPicture](../interfaces/ipicture.md).[type](../interfaces/ipicture.md#type) +[IPicture](../interfaces/IPicture.md).[type](../interfaces/IPicture.md#type) ___ @@ -342,13 +346,13 @@ ___ ### renderForFlacBlock -▸ **renderForFlacBlock**(): [`ByteVector`](bytevector.md) +▸ **renderForFlacBlock**(): [`ByteVector`](ByteVector.md) Renders the picture for use in a FLAC block. #### Returns -[`ByteVector`](bytevector.md) +[`ByteVector`](ByteVector.md) ___ @@ -367,49 +371,49 @@ ___ ### fromFlacBlock -▸ `Static` **fromFlacBlock**(`block`, `isLazy?`): [`XiphPicture`](xiphpicture.md) +▸ `Static` **fromFlacBlock**(`block`, `isLazy?`): [`XiphPicture`](XiphPicture.md) Constructs and initializes a new instance by reading the contents of the picture from a FLAC -block. Intended to be used by the [FlacTag](flactag.md) class. +block. Intended to be used by the [FlacTag](FlacTag.md) class. #### Parameters | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `block` | [`FlacBlock`](flacblock.md) | `undefined` | FLAC block containing the Xiph image. | +| `block` | [`FlacBlock`](FlacBlock.md) | `undefined` | FLAC block containing the Xiph image. | | `isLazy` | `boolean` | `false` | Whether or not to lazily load the data. For FLAC blocks, this will chain into the lazy loading capabilities of the block | #### Returns -[`XiphPicture`](xiphpicture.md) +[`XiphPicture`](XiphPicture.md) ___ ### fromPicture -▸ `Static` **fromPicture**(`picture`): [`XiphPicture`](xiphpicture.md) +▸ `Static` **fromPicture**(`picture`): [`XiphPicture`](XiphPicture.md) -Constructs and initializes a new instance by copying the properties of an [IPicture](../interfaces/ipicture.md) +Constructs and initializes a new instance by copying the properties of an [IPicture](../interfaces/IPicture.md) object. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `picture` | [`IPicture`](../interfaces/ipicture.md) | Object to copy properties from. | +| `picture` | [`IPicture`](../interfaces/IPicture.md) | Object to copy properties from. | #### Returns -[`XiphPicture`](xiphpicture.md) +[`XiphPicture`](XiphPicture.md) ___ ### fromXiphComment -▸ `Static` **fromXiphComment**(`data`, `isLazy?`): [`XiphPicture`](xiphpicture.md) +▸ `Static` **fromXiphComment**(`data`, `isLazy?`): [`XiphPicture`](XiphPicture.md) Constructs and initializes a new instance by decoding and reading the contents of a raw Xiph -image structure. Intended to be used by the [XiphComment](xiphcomment.md) class. +image structure. Intended to be used by the [XiphComment](XiphComment.md) class. #### Parameters @@ -420,4 +424,4 @@ image structure. Intended to be used by the [XiphComment](xiphcomment.md) class. #### Returns -[`XiphPicture`](xiphpicture.md) +[`XiphPicture`](XiphPicture.md) diff --git a/docs/classes/asfcontentdescriptor.md b/docs/classes/asfcontentdescriptor.md deleted file mode 100644 index 09d39740..00000000 --- a/docs/classes/asfcontentdescriptor.md +++ /dev/null @@ -1,369 +0,0 @@ -[node-taglib-sharp](../README.md) / [Exports](../modules.md) / AsfContentDescriptor - -# Class: AsfContentDescriptor - -This class provides a representation of an ASF content descriptor to be used in combination with -{@link ExtendedContentDescriptionObject}. - -**`remarks`** This class can store various types of information. Although [toString](asfcontentdescriptor.md#tostring) provides - a representation of all types of values, it is recommended to determine which of the `get*` - methods to use by accessing [type](asfcontentdescriptor.md#type) - -## Hierarchy - -- `DescriptorBase` - - ↳ **`AsfContentDescriptor`** - -## Table of contents - -### Constructors - -- [constructor](asfcontentdescriptor.md#constructor) - -### Properties - -- [\_boolValue](asfcontentdescriptor.md#_boolvalue) -- [\_byteValue](asfcontentdescriptor.md#_bytevalue) -- [\_dWordValue](asfcontentdescriptor.md#_dwordvalue) -- [\_guidValue](asfcontentdescriptor.md#_guidvalue) -- [\_name](asfcontentdescriptor.md#_name) -- [\_qWordValue](asfcontentdescriptor.md#_qwordvalue) -- [\_stringValue](asfcontentdescriptor.md#_stringvalue) -- [\_type](asfcontentdescriptor.md#_type) -- [\_wordValue](asfcontentdescriptor.md#_wordvalue) - -### Accessors - -- [name](asfcontentdescriptor.md#name) -- [type](asfcontentdescriptor.md#type) - -### Methods - -- [getBool](asfcontentdescriptor.md#getbool) -- [getBytes](asfcontentdescriptor.md#getbytes) -- [getGuid](asfcontentdescriptor.md#getguid) -- [getString](asfcontentdescriptor.md#getstring) -- [getUint](asfcontentdescriptor.md#getuint) -- [getUlong](asfcontentdescriptor.md#getulong) -- [getUshort](asfcontentdescriptor.md#getushort) -- [render](asfcontentdescriptor.md#render) -- [toString](asfcontentdescriptor.md#tostring) -- [fromFile](asfcontentdescriptor.md#fromfile) - -## Constructors - -### constructor - -• **new AsfContentDescriptor**(`name`, `type`, `value`) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `name` | `string` | -| `type` | [`AsfObjectDataType`](../enums/asfobjectdatatype.md) | -| `value` | `DescriptorValue` | - -#### Overrides - -DescriptorBase.constructor - -## Properties - -### \_boolValue - -• `Protected` `Readonly` **\_boolValue**: `boolean` - -#### Inherited from - -DescriptorBase.\_boolValue - -___ - -### \_byteValue - -• `Protected` `Readonly` **\_byteValue**: [`ByteVector`](bytevector.md) - -#### Inherited from - -DescriptorBase.\_byteValue - -___ - -### \_dWordValue - -• `Protected` `Readonly` **\_dWordValue**: `number` - -#### Inherited from - -DescriptorBase.\_dWordValue - -___ - -### \_guidValue - -• `Protected` `Readonly` **\_guidValue**: `default` - -#### Inherited from - -DescriptorBase.\_guidValue - -___ - -### \_name - -• `Protected` `Readonly` **\_name**: `string` - -#### Inherited from - -DescriptorBase.\_name - -___ - -### \_qWordValue - -• `Protected` `Readonly` **\_qWordValue**: `bigint` - -#### Inherited from - -DescriptorBase.\_qWordValue - -___ - -### \_stringValue - -• `Protected` `Readonly` **\_stringValue**: `string` - -#### Inherited from - -DescriptorBase.\_stringValue - -___ - -### \_type - -• `Protected` `Readonly` **\_type**: [`AsfObjectDataType`](../enums/asfobjectdatatype.md) - -#### Inherited from - -DescriptorBase.\_type - -___ - -### \_wordValue - -• `Protected` `Readonly` **\_wordValue**: `number` - -#### Inherited from - -DescriptorBase.\_wordValue - -## Accessors - -### name - -• `get` **name**(): `string` - -Gets the name of the current instance. - -#### Returns - -`string` - -___ - -### type - -• `get` **type**(): [`AsfObjectDataType`](../enums/asfobjectdatatype.md) - -Gets the type of data contained in the current instance. - -#### Returns - -[`AsfObjectDataType`](../enums/asfobjectdatatype.md) - -## Methods - -### getBool - -▸ **getBool**(): `boolean` - -Gets the boolean value of the current instance. - -#### Returns - -`boolean` - -boolean Boolean value of the current instance is returned if [type](asfcontentdescriptor.md#type) is - {@link DataType.Bool}. `undefined` is returned otherwise. - -#### Inherited from - -DescriptorBase.getBool - -___ - -### getBytes - -▸ **getBytes**(): [`ByteVector`](bytevector.md) - -Gets the binary contents of the current instance. - -#### Returns - -[`ByteVector`](bytevector.md) - -ByteVector Byte contents of the current instance, if [type](asfcontentdescriptor.md#type) is - {@link DataType.Bytes}. `undefined` is returned otherwise. - -#### Inherited from - -DescriptorBase.getBytes - -___ - -### getGuid - -▸ **getGuid**(): `default` - -Gets the guid contents of the current instance. - -#### Returns - -`default` - -UuidWrapper GUID contents of the current instance, if [type](asfcontentdescriptor.md#type) is - {@link DataType.Guid}. `undefined` is returned otherwise. - -#### Inherited from - -DescriptorBase.getGuid - -___ - -### getString - -▸ **getString**(): `string` - -Gets the string contents of the current instance. - -#### Returns - -`string` - -string String contents of the current instance if [type](asfcontentdescriptor.md#type) is - {@link DataType.Unicode}. `undefined` is returned otherwise. - -#### Inherited from - -DescriptorBase.getString - -___ - -### getUint - -▸ **getUint**(): `number` - -Gets the 32-bit double word contents of the current instance. - -#### Returns - -`number` - -number Double word contents of the current instance, if [type](asfcontentdescriptor.md#type) is - {@link DataType.DWord}. `undefined` is returned otherwise. - -#### Inherited from - -DescriptorBase.getUint - -___ - -### getUlong - -▸ **getUlong**(): `bigint` - -Gets the 64-bit quad word contents of the current instance. - -#### Returns - -`bigint` - -bigint Quad word contents of the current instance, if [type](asfcontentdescriptor.md#type) is - {@link DataType.QWord}. `undefined` is returned otherwise. - -#### Inherited from - -DescriptorBase.getUlong - -___ - -### getUshort - -▸ **getUshort**(): `number` - -Gets the 16-bit word contents of the current instance. - -#### Returns - -`number` - -number Word contents of the current instance, if [type](asfcontentdescriptor.md#type) is - {@link DataType.Word}. `undefined` is returned otherwise. - -#### Inherited from - -DescriptorBase.getUshort - -___ - -### render - -▸ **render**(): [`ByteVector`](bytevector.md) - -**`inheritdoc`** - -#### Returns - -[`ByteVector`](bytevector.md) - -#### Overrides - -DescriptorBase.render - -___ - -### toString - -▸ **toString**(): `string` - -**`inheritdoc`** - -#### Returns - -`string` - -#### Inherited from - -DescriptorBase.toString - -___ - -### fromFile - -▸ `Static` **fromFile**(`file`): [`AsfContentDescriptor`](asfcontentdescriptor.md) - -Instantiates a new instance by reading in the contents from a file. - -**`internal`** - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `file` | [`File`](file.md) | The file to read the raw ASF description record from | - -#### Returns - -[`AsfContentDescriptor`](asfcontentdescriptor.md) diff --git a/docs/classes/asfmetadatadescriptor.md b/docs/classes/asfmetadatadescriptor.md deleted file mode 100644 index 71d7fd23..00000000 --- a/docs/classes/asfmetadatadescriptor.md +++ /dev/null @@ -1,397 +0,0 @@ -[node-taglib-sharp](../README.md) / [Exports](../modules.md) / AsfMetadataDescriptor - -# Class: AsfMetadataDescriptor - -This class provides a representation of an ASF description record to be used inside a -MetadataLibraryObject. - -**`remarks`** This class can store various types of information. Although [toString](asfmetadatadescriptor.md#tostring) provides - a representation of all types of values, it is recommended to determine which of the `get*` - methods to use by accessing [type](asfmetadatadescriptor.md#type) - -## Hierarchy - -- `DescriptorBase` - - ↳ **`AsfMetadataDescriptor`** - -## Table of contents - -### Constructors - -- [constructor](asfmetadatadescriptor.md#constructor) - -### Properties - -- [\_boolValue](asfmetadatadescriptor.md#_boolvalue) -- [\_byteValue](asfmetadatadescriptor.md#_bytevalue) -- [\_dWordValue](asfmetadatadescriptor.md#_dwordvalue) -- [\_guidValue](asfmetadatadescriptor.md#_guidvalue) -- [\_name](asfmetadatadescriptor.md#_name) -- [\_qWordValue](asfmetadatadescriptor.md#_qwordvalue) -- [\_stringValue](asfmetadatadescriptor.md#_stringvalue) -- [\_type](asfmetadatadescriptor.md#_type) -- [\_wordValue](asfmetadatadescriptor.md#_wordvalue) - -### Accessors - -- [languageListIndex](asfmetadatadescriptor.md#languagelistindex) -- [name](asfmetadatadescriptor.md#name) -- [streamNumber](asfmetadatadescriptor.md#streamnumber) -- [type](asfmetadatadescriptor.md#type) - -### Methods - -- [getBool](asfmetadatadescriptor.md#getbool) -- [getBytes](asfmetadatadescriptor.md#getbytes) -- [getGuid](asfmetadatadescriptor.md#getguid) -- [getString](asfmetadatadescriptor.md#getstring) -- [getUint](asfmetadatadescriptor.md#getuint) -- [getUlong](asfmetadatadescriptor.md#getulong) -- [getUshort](asfmetadatadescriptor.md#getushort) -- [render](asfmetadatadescriptor.md#render) -- [toString](asfmetadatadescriptor.md#tostring) -- [fromFile](asfmetadatadescriptor.md#fromfile) - -## Constructors - -### constructor - -• **new AsfMetadataDescriptor**(`languageListIndex`, `streamNumber`, `name`, `type`, `value`) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `languageListIndex` | `number` | -| `streamNumber` | `number` | -| `name` | `string` | -| `type` | [`AsfObjectDataType`](../enums/asfobjectdatatype.md) | -| `value` | `DescriptorValue` | - -#### Overrides - -DescriptorBase.constructor - -## Properties - -### \_boolValue - -• `Protected` `Readonly` **\_boolValue**: `boolean` - -#### Inherited from - -DescriptorBase.\_boolValue - -___ - -### \_byteValue - -• `Protected` `Readonly` **\_byteValue**: [`ByteVector`](bytevector.md) - -#### Inherited from - -DescriptorBase.\_byteValue - -___ - -### \_dWordValue - -• `Protected` `Readonly` **\_dWordValue**: `number` - -#### Inherited from - -DescriptorBase.\_dWordValue - -___ - -### \_guidValue - -• `Protected` `Readonly` **\_guidValue**: `default` - -#### Inherited from - -DescriptorBase.\_guidValue - -___ - -### \_name - -• `Protected` `Readonly` **\_name**: `string` - -#### Inherited from - -DescriptorBase.\_name - -___ - -### \_qWordValue - -• `Protected` `Readonly` **\_qWordValue**: `bigint` - -#### Inherited from - -DescriptorBase.\_qWordValue - -___ - -### \_stringValue - -• `Protected` `Readonly` **\_stringValue**: `string` - -#### Inherited from - -DescriptorBase.\_stringValue - -___ - -### \_type - -• `Protected` `Readonly` **\_type**: [`AsfObjectDataType`](../enums/asfobjectdatatype.md) - -#### Inherited from - -DescriptorBase.\_type - -___ - -### \_wordValue - -• `Protected` `Readonly` **\_wordValue**: `number` - -#### Inherited from - -DescriptorBase.\_wordValue - -## Accessors - -### languageListIndex - -• `get` **languageListIndex**(): `number` - -Gets the index of the language associated with the current instance. - -#### Returns - -`number` - -___ - -### name - -• `get` **name**(): `string` - -Gets the name of the current instance. - -#### Returns - -`string` - -___ - -### streamNumber - -• `get` **streamNumber**(): `number` - -Gets the index of the stream associated with the current instance. - -#### Returns - -`number` - -___ - -### type - -• `get` **type**(): [`AsfObjectDataType`](../enums/asfobjectdatatype.md) - -Gets the type of data contained in the current instance. - -#### Returns - -[`AsfObjectDataType`](../enums/asfobjectdatatype.md) - -## Methods - -### getBool - -▸ **getBool**(): `boolean` - -Gets the boolean value of the current instance. - -#### Returns - -`boolean` - -boolean Boolean value of the current instance is returned if [type](asfmetadatadescriptor.md#type) is - {@link DataType.Bool}. `undefined` is returned otherwise. - -#### Inherited from - -DescriptorBase.getBool - -___ - -### getBytes - -▸ **getBytes**(): [`ByteVector`](bytevector.md) - -Gets the binary contents of the current instance. - -#### Returns - -[`ByteVector`](bytevector.md) - -ByteVector Byte contents of the current instance, if [type](asfmetadatadescriptor.md#type) is - {@link DataType.Bytes}. `undefined` is returned otherwise. - -#### Inherited from - -DescriptorBase.getBytes - -___ - -### getGuid - -▸ **getGuid**(): `default` - -Gets the guid contents of the current instance. - -#### Returns - -`default` - -UuidWrapper GUID contents of the current instance, if [type](asfmetadatadescriptor.md#type) is - {@link DataType.Guid}. `undefined` is returned otherwise. - -#### Inherited from - -DescriptorBase.getGuid - -___ - -### getString - -▸ **getString**(): `string` - -Gets the string contents of the current instance. - -#### Returns - -`string` - -string String contents of the current instance if [type](asfmetadatadescriptor.md#type) is - {@link DataType.Unicode}. `undefined` is returned otherwise. - -#### Inherited from - -DescriptorBase.getString - -___ - -### getUint - -▸ **getUint**(): `number` - -Gets the 32-bit double word contents of the current instance. - -#### Returns - -`number` - -number Double word contents of the current instance, if [type](asfmetadatadescriptor.md#type) is - {@link DataType.DWord}. `undefined` is returned otherwise. - -#### Inherited from - -DescriptorBase.getUint - -___ - -### getUlong - -▸ **getUlong**(): `bigint` - -Gets the 64-bit quad word contents of the current instance. - -#### Returns - -`bigint` - -bigint Quad word contents of the current instance, if [type](asfmetadatadescriptor.md#type) is - {@link DataType.QWord}. `undefined` is returned otherwise. - -#### Inherited from - -DescriptorBase.getUlong - -___ - -### getUshort - -▸ **getUshort**(): `number` - -Gets the 16-bit word contents of the current instance. - -#### Returns - -`number` - -number Word contents of the current instance, if [type](asfmetadatadescriptor.md#type) is - {@link DataType.Word}. `undefined` is returned otherwise. - -#### Inherited from - -DescriptorBase.getUshort - -___ - -### render - -▸ **render**(): [`ByteVector`](bytevector.md) - -**`inheritdoc`** - -#### Returns - -[`ByteVector`](bytevector.md) - -#### Overrides - -DescriptorBase.render - -___ - -### toString - -▸ **toString**(): `string` - -**`inheritdoc`** - -#### Returns - -`string` - -#### Inherited from - -DescriptorBase.toString - -___ - -### fromFile - -▸ `Static` **fromFile**(`file`): [`AsfMetadataDescriptor`](asfmetadatadescriptor.md) - -Instantiates a new instance by reading in the contents from a file. - -**`internal`** - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `file` | [`File`](file.md) | The file to read the raw ASF description record from | - -#### Returns - -[`AsfMetadataDescriptor`](asfmetadatadescriptor.md) diff --git a/docs/classes/bytevector.md b/docs/classes/bytevector.md deleted file mode 100644 index e8c8eb53..00000000 --- a/docs/classes/bytevector.md +++ /dev/null @@ -1,1315 +0,0 @@ -[node-taglib-sharp](../README.md) / [Exports](../modules.md) / ByteVector - -# Class: ByteVector - -## Table of contents - -### Accessors - -- [checksum](bytevector.md#checksum) -- [data](bytevector.md#data) -- [hashCode](bytevector.md#hashcode) -- [isEmpty](bytevector.md#isempty) -- [isReadOnly](bytevector.md#isreadonly) -- [length](bytevector.md#length) -- [lastUtf16Encoding](bytevector.md#lastutf16encoding) - -### Methods - -- [[iterator]](bytevector.md#[iterator]) -- [addByte](bytevector.md#addbyte) -- [addByteArray](bytevector.md#addbytearray) -- [addByteVector](bytevector.md#addbytevector) -- [clear](bytevector.md#clear) -- [compareTo](bytevector.md#compareto) -- [containsAt](bytevector.md#containsat) -- [endsWith](bytevector.md#endswith) -- [endsWithPartialMatch](bytevector.md#endswithpartialmatch) -- [find](bytevector.md#find) -- [get](bytevector.md#get) -- [indexOf](bytevector.md#indexof) -- [insertByte](bytevector.md#insertbyte) -- [insertByteArray](bytevector.md#insertbytearray) -- [insertByteVector](bytevector.md#insertbytevector) -- [mid](bytevector.md#mid) -- [rFind](bytevector.md#rfind) -- [removeAtIndex](bytevector.md#removeatindex) -- [removeRange](bytevector.md#removerange) -- [resize](bytevector.md#resize) -- [set](bytevector.md#set) -- [split](bytevector.md#split) -- [startsWith](bytevector.md#startswith) -- [toDouble](bytevector.md#todouble) -- [toFloat](bytevector.md#tofloat) -- [toInt](bytevector.md#toint) -- [toLong](bytevector.md#tolong) -- [toShort](bytevector.md#toshort) -- [toString](bytevector.md#tostring) -- [toStrings](bytevector.md#tostrings) -- [toUInt](bytevector.md#touint) -- [toULong](bytevector.md#toulong) -- [toUShort](bytevector.md#toushort) -- [add](bytevector.md#add) -- [concatenate](bytevector.md#concatenate) -- [empty](bytevector.md#empty) -- [equal](bytevector.md#equal) -- [fromByteArray](bytevector.md#frombytearray) -- [fromByteVector](bytevector.md#frombytevector) -- [fromFileAbstraction](bytevector.md#fromfileabstraction) -- [fromInt](bytevector.md#fromint) -- [fromInternalStream](bytevector.md#frominternalstream) -- [fromLong](bytevector.md#fromlong) -- [fromPath](bytevector.md#frompath) -- [fromShort](bytevector.md#fromshort) -- [fromSize](bytevector.md#fromsize) -- [fromStream](bytevector.md#fromstream) -- [fromString](bytevector.md#fromstring) -- [fromUInt](bytevector.md#fromuint) -- [fromULong](bytevector.md#fromulong) -- [fromUShort](bytevector.md#fromushort) -- [getTextDelimiter](bytevector.md#gettextdelimiter) -- [greaterThan](bytevector.md#greaterthan) -- [greaterThanEqual](bytevector.md#greaterthanequal) -- [lessThan](bytevector.md#lessthan) -- [lessThanEqual](bytevector.md#lessthanequal) -- [notEqual](bytevector.md#notequal) - -## Accessors - -### checksum - -• `get` **checksum**(): `number` - -#### Returns - -`number` - -___ - -### data - -• `get` **data**(): `Uint8Array` - -Array of bytes currently stored in the current instance - -#### Returns - -`Uint8Array` - -___ - -### hashCode - -• `get` **hashCode**(): `number` - -#### Returns - -`number` - -___ - -### isEmpty - -• `get` **isEmpty**(): `boolean` - -Whether or not the current instance has 0 bytes stored - -#### Returns - -`boolean` - -___ - -### isReadOnly - -• `get` **isReadOnly**(): `boolean` - -Whether or not the current instance is readonly. - -#### Returns - -`boolean` - -___ - -### length - -• `get` **length**(): `number` - -Number of bytes currently in this ByteVector - -#### Returns - -`number` - -___ - -### lastUtf16Encoding - -• `Static` `get` **lastUtf16Encoding**(): `string` - -#### Returns - -`string` - -• `Static` `set` **lastUtf16Encoding**(`encoding`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `encoding` | `string` | - -#### Returns - -`void` - -## Methods - -### [iterator] - -▸ **[iterator]**(): `Iterator`<`number`, `any`, `undefined`\> - -#### Returns - -`Iterator`<`number`, `any`, `undefined`\> - -___ - -### addByte - -▸ **addByte**(`byte`): `void` - -Adds a single byte to the end of the [ByteVector](bytevector.md) - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `byte` | `number` | Value to add to the end of the ByteVector. Must be positive 8-bit integer. | - -#### Returns - -`void` - -___ - -### addByteArray - -▸ **addByteArray**(`data`): `void` - -Adds an array of bytes to the end of the [ByteVector](bytevector.md) - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `data` | `Uint8Array` | Array of bytes to add to the end of the ByteVector | - -#### Returns - -`void` - -___ - -### addByteVector - -▸ **addByteVector**(`data`): `void` - -Adds a [ByteVector](bytevector.md) to the end of this ByteVector - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | ByteVector to add to the end of this ByteVector | - -#### Returns - -`void` - -___ - -### clear - -▸ **clear**(): `void` - -Removes all elements from this [ByteVector](bytevector.md) - -**`remarks`** NOTE: This method replaces the internal byte array with a new one. Any - existing references to [ByteVector.data](bytevector.md#data) will remain unchanged. - -#### Returns - -`void` - -___ - -### compareTo - -▸ **compareTo**(`other`): `number` - -Compares this byte vector to a different byte vector. Returns a numeric value - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `other` | [`ByteVector`](bytevector.md) | ByteVector to compare to this byte vector | - -#### Returns - -`number` - -___ - -### containsAt - -▸ **containsAt**(`pattern`, `offset?`, `patternOffset?`, `patternLength?`): `boolean` - -Determines if `pattern` exists at a certain `offset` in this byte vector. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | `undefined` | ByteVector to search for at in this byte vector | -| `offset` | `number` | `0` | Position in this byte vector to search for the pattern. If omitted, defaults to `0` | -| `patternOffset` | `number` | `0` | Position in `pattern` to begin matching. If omitted, defaults to `0` | -| `patternLength` | `number` | `undefined` | Bytes of `pattern` to match. If omitted, defaults to all bytes in the pattern minus the offset | - -#### Returns - -`boolean` - -___ - -### endsWith - -▸ **endsWith**(`pattern`): `boolean` - -Determines whether or not this byte vector ends with the provided `pattern`. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | ByteVector to look for at the end of this byte vector | - -#### Returns - -`boolean` - -___ - -### endsWithPartialMatch - -▸ **endsWithPartialMatch**(`pattern`): `number` - -Determines whether or not this byte vector ends with a part of the `pattern`. -NOTE: if this byte vector ends with `pattern` perfectly, it must end with n-1 or -less bytes - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | ByteVector to look for at the end of this byte vector | - -#### Returns - -`number` - -___ - -### find - -▸ **find**(`pattern`, `offset?`, `byteAlign?`): `number` - -Searches this instance for the `pattern`. Returns the index of the first instance -of the pattern, or `-1` if it was not found. Providing a `byteAlign` requires the -pattern to appear at an index that is a multiple of the byteAlign parameter. -Example: searching "abcd" for "ab" with byteAlign 1 will return 0. Searching "abcd" for -"ab" with byteAlign 2 will return 1. Searching "00ab" for "ab" with byteAlign 2 will return -2. Searching "0abc" with byteAlign 2 will return -1. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | `undefined` | Pattern of bytes to search this instance for | -| `offset` | `number` | `0` | Optional, offset into this instance to start searching | -| `byteAlign` | `number` | `1` | Optional, byte alignment the pattern much align to | - -#### Returns - -`number` - -___ - -### get - -▸ **get**(`index`): `number` - -Gets the byte at the given `index` - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `index` | `number` | Index into the byte vector to return | - -#### Returns - -`number` - -___ - -### indexOf - -▸ **indexOf**(`item`): `number` - -Gets the index of the first occurrence of the specified value. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `item` | `number` | A byte to find within the current instance. | - -#### Returns - -`number` - -An integer containing the first index at which the value was found, or -1 if it - was not found/ - -___ - -### insertByte - -▸ **insertByte**(`index`, `byte`): `void` - -Inserts a single byte at the given index of this [ByteVector](bytevector.md), increasing the length of -the ByteVector by one. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `index` | `number` | Index into this ByteVector at which the value will be inserted. | -| `byte` | `number` | Value to insert into the ByteVector. Must be a positive integer <=0xFF | - -#### Returns - -`void` - -___ - -### insertByteArray - -▸ **insertByteArray**(`index`, `other`): `void` - -Inserts an array of bytes into this [ByteVector](bytevector.md) at the given index, increasing the -length of this ByteVector by the length of the byte array. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `index` | `number` | Index into this ByteVector at which the bytes will be inserted. | -| `other` | `Uint8Array` | Array of bytes to insert into the ByteVector. | - -#### Returns - -`void` - -___ - -### insertByteVector - -▸ **insertByteVector**(`index`, `other`): `void` - -Inserts another ByteVector into this [ByteVector](bytevector.md) at the given index, increasing the -length of this ByteVector by the length of the ByteVector. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `index` | `number` | Index into this ByteVector at which the ByteVector will be inserted. | -| `other` | [`ByteVector`](bytevector.md) | ByteVector to insert into this ByteVector. | - -#### Returns - -`void` - -___ - -### mid - -▸ **mid**(`startIndex`, `length?`): [`ByteVector`](bytevector.md) - -Returns a subarray of the current instance. This operation returns a new instance and does -not alter the current instance. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `startIndex` | `number` | Index into the array to begin | -| `length` | `number` | Number of elements from the array to include. If omitted, defaults to the remainder of the array | - -#### Returns - -[`ByteVector`](bytevector.md) - -___ - -### rFind - -▸ **rFind**(`pattern`, `offset?`, `byteAlign?`): `number` - -Finds a byte vector by searching from the end of this instance and working towards the -beginning of this instance. Returns the index of the first instance of the pattern, or `-1` -if it was not found. Providing a `byteAlign` requires the pattern to appear at an -index that is a multiple of the byteAlign parameter. -Example: searching "abcd" for "ab" with byteAlign 1 will return 0. Searching "abcd" for -"ab" with byteAlign 2 will return 1. Searching "00ab" for "ab" with byteAlign 2 will return -2. Searching "0abc" with byteAlign 2 will return -1. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | `undefined` | Pattern of bytes to search this instance for | -| `offset` | `number` | `0` | Optional, offset into this instance to start searching | -| `byteAlign` | `number` | `1` | Optional, byte alignment the pattern much align to | - -#### Returns - -`number` - -___ - -### removeAtIndex - -▸ **removeAtIndex**(`index`): `void` - -Removes a single byte from this {@ByteVector} - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `index` | `number` | Index that will be removed from the ByteVector | - -#### Returns - -`void` - -___ - -### removeRange - -▸ **removeRange**(`index`, `count`): `void` - -Removes a range of bytes from this {@ByteVector} - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `index` | `number` | Index into this ByteVector where the range to remove begins | -| `count` | `number` | Number of bytes to remove from this ByteVector | - -#### Returns - -`void` - -___ - -### resize - -▸ **resize**(`size`, `padding?`): [`ByteVector`](bytevector.md) - -Resizes this instance to the length specified in `size`. If the desired size is -longer than the current length, it will be filled with the byte value in -`padding`. If the desired size is shorter than the current length, bytes will be -removed. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `size` | `number` | `undefined` | Length of the byte vector after resizing. Must be unsigned 32-bit integer | -| `padding` | `number` | `0x0` | Byte to fill any excess space created after resizing | - -#### Returns - -[`ByteVector`](bytevector.md) - -___ - -### set - -▸ **set**(`index`, `value`): `void` - -Sets the value at a specified index - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `index` | `number` | Index to set the value of | -| `value` | `number` | Value to set at the index. Must be a valid integer betweenInclusive 0x0 and 0xff | - -#### Returns - -`void` - -___ - -### split - -▸ **split**(`separator`, `byteAlign?`, `max?`): [`ByteVector`](bytevector.md)[] - -Splits this byte vector into a list of byte vectors using a separator - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `separator` | [`ByteVector`](bytevector.md) | `undefined` | Object to use to split this byte vector | -| `byteAlign` | `number` | `1` | Byte align to use when splitting. in order to split when a pattern is encountered, the index at which it is found must be divisible by this value. | -| `max` | `number` | `0` | Maximum number of objects to return or 0 to not limit the number. If that number is reached, the last value will contain the remainder of the file even if it contains more instances of `separator`. | - -#### Returns - -[`ByteVector`](bytevector.md)[] - -ByteVector[] The split contents of the current instance - -___ - -### startsWith - -▸ **startsWith**(`pattern`): `boolean` - -Checks whether or not a pattern appears at the beginning of the current instance. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `pattern` | [`ByteVector`](bytevector.md) | ByteVector containing the pattern to check for in the current instance. | - -#### Returns - -`boolean` - -`true` if the pattern was found at the beginning of the current instance, `false` - otherwise. - -___ - -### toDouble - -▸ **toDouble**(`mostSignificantByteFirst?`): `number` - -Converts the first eight bytes of the current instance to a double-precision floating-point -value. - -**`throws`** Error If there are less than eight bytes in the current instance. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `mostSignificantByteFirst` | `boolean` | `true` | If `true` the most significant byte appears first (big endian format). | - -#### Returns - -`number` - -A double value containing the value read from the current instance. - -___ - -### toFloat - -▸ **toFloat**(`mostSignificantByteFirst?`): `number` - -Converts the first four bytes of the current instance to a single-precision floating-point -value. - -**`throws`** Error If there are less than four bytes in the current instance - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `mostSignificantByteFirst` | `boolean` | `true` | If `true` the most significant byte appears first (big endian format). | - -#### Returns - -`number` - -A float value containing the value read from the current instance. - -___ - -### toInt - -▸ **toInt**(`mostSignificantByteFirst?`): `number` - -Converts the first four bytes of the current instance to a signed integer. If the current -instance is less than four bytes, the most significant bytes will be filled with 0x00. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `mostSignificantByteFirst` | `boolean` | `true` | If `true` the most significant byte appears first (big endian format) | - -#### Returns - -`number` - -A signed integer value containing the value read from the current instance - -___ - -### toLong - -▸ **toLong**(`mostSignificantByteFirst?`): `bigint` - -Converts the first eight bytes of the current instance to a signed long. If the current -instance is less than eight bytes, the most significant bytes will be filled with 0x00. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `mostSignificantByteFirst` | `boolean` | `true` | If `true` the most significant byte appears first (big endian format) | - -#### Returns - -`bigint` - -A signed long value containing the value read from the current instance, - represented as a BigInt due to JavaScript's 52-bit integer limitation. - -___ - -### toShort - -▸ **toShort**(`mostSignificantByteFirst?`): `number` - -Converts the first two bytes of the current instance to a signed short. If the current -instance is less than two bytes, the most significant bytes will be filled with 0x00. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `mostSignificantByteFirst` | `boolean` | `true` | If `true` the most significant byte appears first (big endian format) | - -#### Returns - -`number` - -A signed short value containing the value read from the current instance - -___ - -### toString - -▸ **toString**(`count?`, `type?`, `offset?`): `string` - -Converts a portion of the current instance to a string using a specified encoding - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `count` | `number` | `undefined` | Integer value specifying the number of *bytes* to convert. | -| `type` | [`StringType`](../enums/stringtype.md) | `undefined` | Value indicating the encoding to use when converting to a string. | -| `offset` | `number` | `0` | Value specifying the index into the current instance at which to start converting. | - -#### Returns - -`string` - -string String containing the converted bytes - -___ - -### toStrings - -▸ **toStrings**(`type`, `offset`, `count?`): `string`[] - -Converts the current instance into an array of strings starting at the specified offset and -using the specified encoding, assuming the values are `null` separated and limiting it to a -specified number of items. - -**`remarks`** I'm not actually sure if this works as defined, but it behaves the same as the - original .NET implementation, so that's good enough for now. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `type` | [`StringType`](../enums/stringtype.md) | A [StringType](../enums/stringtype.md) value indicating the encoding to use when converting | -| `offset` | `number` | Value specifying the index into the current instance at which to start converting. | -| `count` | `number` | Value specifying a limit to the number of strings to create. Once the limit has been reached, the last string will be filled by the remainder of the data | - -#### Returns - -`string`[] - -string[] Array of strings containing the converted text. - -___ - -### toUInt - -▸ **toUInt**(`mostSignificantByteFirst?`): `number` - -Converts the first four bytes of the current instance to an unsigned integer. If the current -instance is less than four bytes, the most significant bytes will be filled with 0x00. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `mostSignificantByteFirst` | `boolean` | `true` | If `true` the most significant byte appears first (big endian format) | - -#### Returns - -`number` - -An unsigned integer value containing the value read from the current instance - -___ - -### toULong - -▸ **toULong**(`mostSignificantByteFirst?`): `bigint` - -Converts the first eight bytes of the current instance to an unsigned long. If the current -instance is less than eight bytes, the most significant bytes will be filled with 0x00. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `mostSignificantByteFirst` | `boolean` | `true` | If `true` the most significant byte appears first (big endian format) | - -#### Returns - -`bigint` - -An unsigned short value containing the value read from the current instance, - represented as a BigInt due to JavaScript's 32-bit integer limitation - -___ - -### toUShort - -▸ **toUShort**(`mostSignificantByteFirst?`): `number` - -Converts the first two bytes of the current instance to an unsigned short. If the current -instance is less than two bytes, the most significant bytes will be filled with 0x00. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `mostSignificantByteFirst` | `boolean` | `true` | If `true` the most significant byte appears first (big endian format) | - -#### Returns - -`number` - -An unsigned short value containing the value read from the current instance - -___ - -### add - -▸ `Static` **add**(`first`, `second`): [`ByteVector`](bytevector.md) - -Creates a new [ByteVector](bytevector.md) that contains the contents of `first` concatenated -with `second`. This operation can be thought of as `first + second`. Note: Regardless -of the value of [ByteVector.isReadOnly](bytevector.md#isreadonly), the created ByteVector will always be -read/write. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `first` | [`ByteVector`](bytevector.md) | ByteVector to which `second` will be added | -| `second` | [`ByteVector`](bytevector.md) | ByteVector which will be added to `first` | - -#### Returns - -[`ByteVector`](bytevector.md) - -___ - -### concatenate - -▸ `Static` **concatenate**(...`vectors`): [`ByteVector`](bytevector.md) - -Creates a [ByteVector](bytevector.md) from a collection of bytes, byte arrays, and byte vectors. This -method is better to use when a known quantity of byte vectors will be concatenated together, -since doing multiple calls to [ByteVector.addByteVector](bytevector.md#addbytevector) results in the entire byte -vector being copied for each call. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `...vectors` | (`number` \| [`ByteVector`](bytevector.md) \| `Uint8Array`)[] | ByteVectors, byte arrays, or straight bytes to concatenate together into a new [ByteVector](bytevector.md) | - -#### Returns - -[`ByteVector`](bytevector.md) - -ByteVector Single byte vector with the contents of the byte vectors in - `vectors` concatenated together - -___ - -### empty - -▸ `Static` **empty**(): [`ByteVector`](bytevector.md) - -Creates an empty [ByteVector](bytevector.md) - -#### Returns - -[`ByteVector`](bytevector.md) - -___ - -### equal - -▸ `Static` **equal**(`first`, `second`): `boolean` - -Returns `true` if the contents of the two [ByteVector](bytevector.md)s are identical, returns `false` -otherwise - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `first` | [`ByteVector`](bytevector.md) | ByteVector to compare with `second` | -| `second` | [`ByteVector`](bytevector.md) | ByteVector to compare with `first` | - -#### Returns - -`boolean` - -___ - -### fromByteArray - -▸ `Static` **fromByteArray**(`data`, `length?`, `isReadOnly?`): [`ByteVector`](bytevector.md) - -Creates a [ByteVector](bytevector.md) from a `Uint8Array` or node `Buffer` - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `data` | `Uint8Array` \| `Buffer` | `undefined` | Uint8Array of the bytes to put in the ByteVector | -| `length` | `number` | `undefined` | Number of bytes to read | -| `isReadOnly` | `boolean` | `false` | If `true` then the ByteVector will be read only | - -#### Returns - -[`ByteVector`](bytevector.md) - -___ - -### fromByteVector - -▸ `Static` **fromByteVector**(`original`, `isReadOnly?`): [`ByteVector`](bytevector.md) - -Creates a [ByteVector](bytevector.md) as a copy of another ByteVector. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `original` | [`ByteVector`](bytevector.md) | `undefined` | Data from this ByteVector will be copied into the new one | -| `isReadOnly` | `boolean` | `false` | If `true` then the ByteVector will be read only | - -#### Returns - -[`ByteVector`](bytevector.md) - -___ - -### fromFileAbstraction - -▸ `Static` **fromFileAbstraction**(`abstraction`, `isReadOnly?`): [`ByteVector`](bytevector.md) - -Creates a new instance by reading in the contents of a specified file abstraction. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `abstraction` | `IFileAbstraction` | `undefined` | File abstraction to read | -| `isReadOnly` | `boolean` | `false` | Whether or not the resulting ByteVector is readonly | - -#### Returns - -[`ByteVector`](bytevector.md) - -___ - -### fromInt - -▸ `Static` **fromInt**(`value`, `mostSignificantByteFirst?`, `isReadOnly?`): [`ByteVector`](bytevector.md) - -Creates a 4 byte [ByteVector](bytevector.md) with a signed 32-bit integer as the data - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `value` | `number` | `undefined` | Signed 32-bit integer to use as the data. Must be a safe integer, storable in 4 bytes, cannot be a floating point number. | -| `mostSignificantByteFirst` | `boolean` | `true` | If `true`, `value` will be stored in big endian format. If `false`, `value` will be stored in little endian format | -| `isReadOnly` | `boolean` | `false` | If `true` then the ByteVector will be read only | - -#### Returns - -[`ByteVector`](bytevector.md) - -___ - -### fromInternalStream - -▸ `Static` **fromInternalStream**(`stream`, `isReadOnly?`): [`ByteVector`](bytevector.md) - -Creates a ByteVector using the contents of an TagLibSharp-node stream as the contents. This -method reads from the current offset of the stream, not the beginning of the stream - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `stream` | `IStream` | `undefined` | TagLibSharp-node internal stream object | -| `isReadOnly` | `boolean` | `false` | Whether or not the byte vector is readonly | - -#### Returns - -[`ByteVector`](bytevector.md) - -___ - -### fromLong - -▸ `Static` **fromLong**(`value`, `mostSignificantByteFirst?`, `isReadOnly?`): [`ByteVector`](bytevector.md) - -Creates an 8 byte [ByteVector](bytevector.md) with a signed 64-bit integer as the data - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `value` | `number` \| `bigint` | `undefined` | Signed 64-bit integer to use as the data. If using a `bigint`, it must fit within 8 bytes. If using a `number`, it must be a safe integer. | -| `mostSignificantByteFirst` | `boolean` | `true` | If `true`, `value` will be stored in big endian format. If `false`, `value` will be stored in little endian format | -| `isReadOnly` | `boolean` | `false` | If `true` then the ByteVector will be read only | - -#### Returns - -[`ByteVector`](bytevector.md) - -___ - -### fromPath - -▸ `Static` **fromPath**(`path`, `isReadOnly?`): [`ByteVector`](bytevector.md) - -Creates a [ByteVector](bytevector.md) using the contents of a file as the data - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `path` | `string` | `undefined` | Path to the file to store in the ByteVector | -| `isReadOnly` | `boolean` | `false` | If `true` then the ByteVector will be read only | - -#### Returns - -[`ByteVector`](bytevector.md) - -___ - -### fromShort - -▸ `Static` **fromShort**(`value`, `mostSignificantByteFirst?`, `isReadOnly?`): [`ByteVector`](bytevector.md) - -Creates a 2 byte [ByteVector](bytevector.md) with a signed 16-bit integer as the data - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `value` | `number` | `undefined` | Signed 16-bit integer to use as the data. Must be a safe integer, storable in 2 bytes, cannot be a floating point number. | -| `mostSignificantByteFirst` | `boolean` | `true` | If `true`, `value` will be stored in big endian format. If `false`, `value` will be stored in little endian format | -| `isReadOnly` | `boolean` | `false` | If `true` then the ByteVector will be read only | - -#### Returns - -[`ByteVector`](bytevector.md) - -___ - -### fromSize - -▸ `Static` **fromSize**(`size`, `fill?`, `isReadOnly?`): [`ByteVector`](bytevector.md) - -Creates a [ByteVector](bytevector.md) of a given length with a given value for all the elements - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `size` | `number` | `undefined` | Length of the ByteVector. Must be a positive safe integer, cannot be a float | -| `fill` | `number` | `0x0` | Byte value to initialize all elements to. Must be a positive 8-bit integer, cannot be floating point | -| `isReadOnly` | `boolean` | `false` | If `true` then the ByteVector will be read only | - -#### Returns - -[`ByteVector`](bytevector.md) - -___ - -### fromStream - -▸ `Static` **fromStream**(`readStream`, `isReadOnly?`): `Promise`<[`ByteVector`](bytevector.md)\> - -Creates [ByteVector](bytevector.md) with the contents of a stream as the data. The stream will be read -to the end before the ByteVector is returned. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `readStream` | `ReadableStream` | `undefined` | Readable stream that will be read in entirety. | -| `isReadOnly` | `boolean` | `false` | If `true` then the ByteVector will be read only | - -#### Returns - -`Promise`<[`ByteVector`](bytevector.md)\> - -___ - -### fromString - -▸ `Static` **fromString**(`text`, `type?`, `length?`, `isReadOnly?`): [`ByteVector`](bytevector.md) - -Creates [ByteVector](bytevector.md) with the byte representation of a string as the data. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `text` | `string` | `undefined` | String to store in the ByteVector | -| `type` | [`StringType`](../enums/stringtype.md) | `undefined` | StringType to use to encode the string. If [StringType.UTF16](../enums/stringtype.md#utf16) is used, the string will be encoded as UTF16-LE. | -| `length` | `number` | `undefined` | Number of characters from the string to store in the ByteVector. Must be a positive 32-bit integer. | -| `isReadOnly` | `boolean` | `false` | If `true` then the ByteVector will be read only | - -#### Returns - -[`ByteVector`](bytevector.md) - -___ - -### fromUInt - -▸ `Static` **fromUInt**(`value`, `mostSignificantByteFirst?`, `isReadOnly?`): [`ByteVector`](bytevector.md) - -Creates a 4 byte [ByteVector](bytevector.md) with a positive 32-bit integer as the data - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `value` | `number` | `undefined` | Positive 32-bit integer to use as the data. Must be a positive safe integer, storable in 4 bytes, cannot be a floating point number. | -| `mostSignificantByteFirst` | `boolean` | `true` | If `true`, `value` will be stored in big endian format. If `false`, `value` will be stored in little endian format | -| `isReadOnly` | `boolean` | `false` | If `true` then the ByteVector will be read only | - -#### Returns - -[`ByteVector`](bytevector.md) - -___ - -### fromULong - -▸ `Static` **fromULong**(`value`, `mostSignificantByteFirst?`, `isReadOnly?`): [`ByteVector`](bytevector.md) - -Creates an 8 byte [ByteVector](bytevector.md) with a positive 64-bit integer as the data - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `value` | `number` \| `bigint` | `undefined` | Positive 64-bit integer to use as the data. If using a `bigint` it must fit within 8 bytes. If using a `number` it must be a safe, positive integer. | -| `mostSignificantByteFirst` | `boolean` | `true` | If `true`, `value` will be stored in big endian format. If `false`, `value` will be stored in little endian format | -| `isReadOnly` | `boolean` | `false` | If `true` then the ByteVector will be read only | - -#### Returns - -[`ByteVector`](bytevector.md) - -___ - -### fromUShort - -▸ `Static` **fromUShort**(`value`, `mostSignificantByteFirst?`, `isReadOnly?`): [`ByteVector`](bytevector.md) - -Creates a 2 byte [ByteVector](bytevector.md) with a positive 32-bit integer as the data - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `value` | `number` | `undefined` | Positive 16-bit integer to use as the data. Must be a positive safe integer, storable in 2 bytes, cannot be a floating point number. | -| `mostSignificantByteFirst` | `boolean` | `true` | If `true`, `value` will be stored in big endian format. If `false`, `value` will be stored in little endian format | -| `isReadOnly` | `boolean` | `false` | If `true` then the ByteVector will be read only | - -#### Returns - -[`ByteVector`](bytevector.md) - -___ - -### getTextDelimiter - -▸ `Static` **getTextDelimiter**(`type`): [`ByteVector`](bytevector.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `type` | [`StringType`](../enums/stringtype.md) | - -#### Returns - -[`ByteVector`](bytevector.md) - -___ - -### greaterThan - -▸ `Static` **greaterThan**(`first`, `second`): `boolean` - -Returns `true` if `first` is greater than `second`. This is true if -`first` is longer than `second` or if the first element in `first` -that is different than the element at the same position in `second` is greater than. -Returns `false` if the two [ByteVector](bytevector.md)s are identical. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `first` | [`ByteVector`](bytevector.md) | ByteVector to compare with `second` | -| `second` | [`ByteVector`](bytevector.md) | ByteVector to compare with `first` | - -#### Returns - -`boolean` - -___ - -### greaterThanEqual - -▸ `Static` **greaterThanEqual**(`first`, `second`): `boolean` - -Returns `true` if `first` is greater than `second`. This is true if -`first` is longer than `second` or if the first element in `first` -that is different than the element at the same position in `second` is greater than. -Returns `true` if the two [ByteVector](bytevector.md)s are identical. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `first` | [`ByteVector`](bytevector.md) | ByteVector to compare with `second` | -| `second` | [`ByteVector`](bytevector.md) | ByteVector to compare with `first` | - -#### Returns - -`boolean` - -___ - -### lessThan - -▸ `Static` **lessThan**(`first`, `second`): `boolean` - -Returns `true` if `first` is less than `second`. This is true if -`first` is shorter than `second` or if the first element in `first` -that is different than the element at the same position in `second` is less than. -Returns `false` if the two [ByteVector](bytevector.md)s are identical. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `first` | [`ByteVector`](bytevector.md) | ByteVector to compare with `second` | -| `second` | [`ByteVector`](bytevector.md) | ByteVector to compare with `first` | - -#### Returns - -`boolean` - -___ - -### lessThanEqual - -▸ `Static` **lessThanEqual**(`first`, `second`): `boolean` - -Returns `true` if `first` is less than `second`. This is true if -`first` is shorter than `second` or if the first element in `first` -that is different than the element at the same position in `second` is less than. -Returns `true` if the two [ByteVector](bytevector.md)s are identical. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `first` | [`ByteVector`](bytevector.md) | ByteVector to compare with `second` | -| `second` | [`ByteVector`](bytevector.md) | ByteVector to compare with `first` | - -#### Returns - -`boolean` - -___ - -### notEqual - -▸ `Static` **notEqual**(`first`, `second`): `boolean` - -Returns `false` if the contents of the two [ByteVector](bytevector.md)s are identical, returns `true` -otherwise - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `first` | [`ByteVector`](bytevector.md) | ByteVector to compare with `second` | -| `second` | [`ByteVector`](bytevector.md) | ByteVector to compare with `first` | - -#### Returns - -`boolean` diff --git a/docs/classes/combinedtag.md b/docs/classes/combinedtag.md deleted file mode 100644 index 2720408f..00000000 --- a/docs/classes/combinedtag.md +++ /dev/null @@ -1,1916 +0,0 @@ -[node-taglib-sharp](../README.md) / [Exports](../modules.md) / CombinedTag - -# Class: CombinedTag - -This class provides a unified way of accessing tag data from multiple tag types. - -## Hierarchy - -- [`Tag`](tag.md) - - ↳ **`CombinedTag`** - - ↳↳ [`FlacTag`](flactag.md) - -## Table of contents - -### Constructors - -- [constructor](combinedtag.md#constructor) - -### Accessors - -- [album](combinedtag.md#album) -- [albumArtists](combinedtag.md#albumartists) -- [albumArtistsSort](combinedtag.md#albumartistssort) -- [albumSort](combinedtag.md#albumsort) -- [amazonId](combinedtag.md#amazonid) -- [beatsPerMinute](combinedtag.md#beatsperminute) -- [comment](combinedtag.md#comment) -- [composers](combinedtag.md#composers) -- [composersSort](combinedtag.md#composerssort) -- [conductor](combinedtag.md#conductor) -- [copyright](combinedtag.md#copyright) -- [dateTagged](combinedtag.md#datetagged) -- [description](combinedtag.md#description) -- [disc](combinedtag.md#disc) -- [discCount](combinedtag.md#disccount) -- [firstAlbumArtist](combinedtag.md#firstalbumartist) -- [firstAlbumArtistSort](combinedtag.md#firstalbumartistsort) -- [firstComposer](combinedtag.md#firstcomposer) -- [firstComposerSort](combinedtag.md#firstcomposersort) -- [firstGenre](combinedtag.md#firstgenre) -- [firstPerformer](combinedtag.md#firstperformer) -- [firstPerformerSort](combinedtag.md#firstperformersort) -- [genres](combinedtag.md#genres) -- [grouping](combinedtag.md#grouping) -- [initialKey](combinedtag.md#initialkey) -- [isEmpty](combinedtag.md#isempty) -- [isrc](combinedtag.md#isrc) -- [joinedAlbumArtists](combinedtag.md#joinedalbumartists) -- [joinedComposers](combinedtag.md#joinedcomposers) -- [joinedGenres](combinedtag.md#joinedgenres) -- [joinedPerformers](combinedtag.md#joinedperformers) -- [joinedPerformersSort](combinedtag.md#joinedperformerssort) -- [lyrics](combinedtag.md#lyrics) -- [musicBrainzArtistId](combinedtag.md#musicbrainzartistid) -- [musicBrainzDiscId](combinedtag.md#musicbrainzdiscid) -- [musicBrainzReleaseArtistId](combinedtag.md#musicbrainzreleaseartistid) -- [musicBrainzReleaseCountry](combinedtag.md#musicbrainzreleasecountry) -- [musicBrainzReleaseGroupId](combinedtag.md#musicbrainzreleasegroupid) -- [musicBrainzReleaseId](combinedtag.md#musicbrainzreleaseid) -- [musicBrainzReleaseStatus](combinedtag.md#musicbrainzreleasestatus) -- [musicBrainzReleaseType](combinedtag.md#musicbrainzreleasetype) -- [musicBrainzTrackId](combinedtag.md#musicbrainztrackid) -- [musicIpId](combinedtag.md#musicipid) -- [performers](combinedtag.md#performers) -- [performersRole](combinedtag.md#performersrole) -- [performersSort](combinedtag.md#performerssort) -- [pictures](combinedtag.md#pictures) -- [publisher](combinedtag.md#publisher) -- [remixedBy](combinedtag.md#remixedby) -- [replayGainAlbumGain](combinedtag.md#replaygainalbumgain) -- [replayGainAlbumPeak](combinedtag.md#replaygainalbumpeak) -- [replayGainTrackGain](combinedtag.md#replaygaintrackgain) -- [replayGainTrackPeak](combinedtag.md#replaygaintrackpeak) -- [sizeOnDisk](combinedtag.md#sizeondisk) -- [subtitle](combinedtag.md#subtitle) -- [supportedTagTypes](combinedtag.md#supportedtagtypes) -- [tagTypes](combinedtag.md#tagtypes) -- [tags](combinedtag.md#tags) -- [title](combinedtag.md#title) -- [titleSort](combinedtag.md#titlesort) -- [track](combinedtag.md#track) -- [trackCount](combinedtag.md#trackcount) -- [year](combinedtag.md#year) - -### Methods - -- [addTag](combinedtag.md#addtag) -- [clear](combinedtag.md#clear) -- [copyTo](combinedtag.md#copyto) -- [createTag](combinedtag.md#createtag) -- [getTag](combinedtag.md#gettag) -- [removeTags](combinedtag.md#removetags) -- [setInfoTag](combinedtag.md#setinfotag) -- [validateTagCreation](combinedtag.md#validatetagcreation) -- [firstInGroup](combinedtag.md#firstingroup) -- [isFalsyOrLikeEmpty](combinedtag.md#isfalsyorlikeempty) -- [joinGroup](combinedtag.md#joingroup) -- [tagTypeFlagsToArray](combinedtag.md#tagtypeflagstoarray) - -## Constructors - -### constructor - -• `Protected` **new CombinedTag**(`supportedTagTypes`, `tags?`) - -Constructs and initializes a new instance of [CombinedTag](combinedtag.md). - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `supportedTagTypes` | [`TagTypes`](../enums/tagtypes.md) | Types of tags that are supported by this instance of the combined | -| `tags?` | [`Tag`](tag.md)[] | Optionally, a list of tags to combine in the new instance. | - -#### Overrides - -[Tag](tag.md).[constructor](tag.md#constructor) - -## Accessors - -### album - -• `get` **album**(): `string` - -Gets the album title for the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **album**(`val`): `void` - -Sets the album title for the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### albumArtists - -• `get` **albumArtists**(): `string`[] - -Gets the band or artist is credited in the creation of the entire album or collection -containing the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string`[] - -• `set` **albumArtists**(`val`): `void` - -Sets the band or artist is credited in the creation of the entire album or collection -containing the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string`[] | - -#### Returns - -`void` - -___ - -### albumArtistsSort - -• `get` **albumArtistsSort**(): `string`[] - -Gets the band or artist is credited in the creation of the entire album or collection -containing the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string`[] - -• `set` **albumArtistsSort**(`val`): `void` - -Sets the band or artist is credited in the creation of the entire album or collection -containing the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string`[] | - -#### Returns - -`void` - -___ - -### albumSort - -• `get` **albumSort**(): `string` - -Gets the album title for sorting the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **albumSort**(`val`): `void` - -Sets the album title for sorting the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### amazonId - -• `get` **amazonId**(): `string` - -Gets the Amazon ID. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **amazonId**(`val`): `void` - -Sets the Amazon ID. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### beatsPerMinute - -• `get` **beatsPerMinute**(): `number` - -Gets the number of beats per minute of the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`number` - -• `set` **beatsPerMinute**(`val`): `void` - -Sets the number of beats per minute of the media represented by the current instance. Must -be a positive integer positive integer. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `number` | - -#### Returns - -`void` - -___ - -### comment - -• `get` **comment**(): `string` - -Gets a user comment for the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **comment**(`val`): `void` - -Sets a user comment for the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### composers - -• `get` **composers**(): `string`[] - -Gets the composers of the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string`[] - -• `set` **composers**(`val`): `void` - -Sets the composers of the media represented by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string`[] | - -#### Returns - -`void` - -___ - -### composersSort - -• `get` **composersSort**(): `string`[] - -Gets the composers of the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string`[] - -• `set` **composersSort**(`val`): `void` - -Sets the composers of the media represented by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string`[] | - -#### Returns - -`void` - -___ - -### conductor - -• `get` **conductor**(): `string` - -Gets the conductor or director of the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **conductor**(`val`): `void` - -Sets the conductor or director of the media represented by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### copyright - -• `get` **copyright**(): `string` - -Gets the copyright information of the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **copyright**(`val`): `void` - -Sets the copyright information of the media represented by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### dateTagged - -• `get` **dateTagged**(): `Date` - -Gets the date at which the tag has been written. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`Date` - -• `set` **dateTagged**(`val`): `void` - -Sets the date at which the tag has been written - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `Date` | - -#### Returns - -`void` - -___ - -### description - -• `get` **description**(): `string` - -Gets the description for the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -**`remarks`** This is especially relevant for a movie. For example, for "Back to the Future - 2", this could be "After visiting 2015, Marty McFly must repeat his visit to 1955 to - prevent disastrous changes to 1985...without interfering with his first trip". - -#### Returns - -`string` - -• `set` **description**(`val`): `void` - -Sets the description for the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### disc - -• `get` **disc**(): `number` - -Gets the number of the disc containing the media represented by the current instance in a -boxed set. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`number` - -• `set` **disc**(`val`): `void` - -Sets the number of the disc containing the media represented by the current instance in a -boxed set. Must be a positive integer positive integer. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `number` | - -#### Returns - -`void` - -___ - -### discCount - -• `get` **discCount**(): `number` - -Gets the number of the discs in the boxed set containing the media represented by the -current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`number` - -• `set` **discCount**(`val`): `void` - -Sets the number of the discs in the boxed set containing the media represented by the -current instance. Must be a positive integer positive integer. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `number` | - -#### Returns - -`void` - -___ - -### firstAlbumArtist - -• `get` **firstAlbumArtist**(): `string` - -Gets the the first value contained in [albumArtists](combinedtag.md#albumartists). - -#### Returns - -`string` - -___ - -### firstAlbumArtistSort - -• `get` **firstAlbumArtistSort**(): `string` - -Gets the first value contained in [albumArtistsSort](combinedtag.md#albumartistssort) - -#### Returns - -`string` - -___ - -### firstComposer - -• `get` **firstComposer**(): `string` - -Gets the first value contained in [composers](combinedtag.md#composers) - -#### Returns - -`string` - -___ - -### firstComposerSort - -• `get` **firstComposerSort**(): `string` - -Gets the first value contained in [composersSort](combinedtag.md#composerssort) - -#### Returns - -`string` - -___ - -### firstGenre - -• `get` **firstGenre**(): `string` - -Gets the first value contained in [genres](combinedtag.md#genres) - -#### Returns - -`string` - -___ - -### firstPerformer - -• `get` **firstPerformer**(): `string` - -Gets the first value contained in [performers](combinedtag.md#performers) - -#### Returns - -`string` - -___ - -### firstPerformerSort - -• `get` **firstPerformerSort**(): `string` - -Gets the first value contained in [performersSort](combinedtag.md#performerssort) - -#### Returns - -`string` - -___ - -### genres - -• `get` **genres**(): `string`[] - -Gets the album genres of the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string`[] - -• `set` **genres**(`val`): `void` - -Sets the album genres of the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string`[] | - -#### Returns - -`void` - -___ - -### grouping - -• `get` **grouping**(): `string` - -Gets the grouping on the album which the media in the current instance belongs to. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **grouping**(`val`): `void` - -Sets the grouping on the album which the media in the current instance belongs to. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### initialKey - -• `get` **initialKey**(): `string` - -Gets the initial key of the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **initialKey**(`val`): `void` - -Sets the initial key of the media represented by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### isEmpty - -• `get` **isEmpty**(): `boolean` - -Whether or not the current instance is empty. If all child tags are empty, `true` is -returned, `false` otherwise. - -#### Returns - -`boolean` - -___ - -### isrc - -• `get` **isrc**(): `string` - -Gets the ISRC (International Standard Recording Code) of the media represented by the -current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **isrc**(`val`): `void` - -Sets the ISRC (International Standard Recording Code) of the media represented by the -current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### joinedAlbumArtists - -• `get` **joinedAlbumArtists**(): `string` - -Gets a semicolon and space separated string containing the values in [albumArtists](combinedtag.md#albumartists) - -#### Returns - -`string` - -___ - -### joinedComposers - -• `get` **joinedComposers**(): `string` - -Gets a semicolon and space separated string containing the values in [composers](combinedtag.md#composers) - -#### Returns - -`string` - -___ - -### joinedGenres - -• `get` **joinedGenres**(): `string` - -Gets a semicolon and space separated string containing the values in [genres](combinedtag.md#genres) - -#### Returns - -`string` - -___ - -### joinedPerformers - -• `get` **joinedPerformers**(): `string` - -Gets a semicolon and space separated string containing the values in [performers](combinedtag.md#performers) - -#### Returns - -`string` - -___ - -### joinedPerformersSort - -• `get` **joinedPerformersSort**(): `string` - -Gets a semicolon and space separated string containing the values in [performersSort](combinedtag.md#performerssort) - -#### Returns - -`string` - -___ - -### lyrics - -• `get` **lyrics**(): `string` - -Gets the lyrics or script of the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **lyrics**(`val`): `void` - -Sets the lyrics or script of the media represented by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### musicBrainzArtistId - -• `get` **musicBrainzArtistId**(): `string` - -Gets the MusicBrainz artist ID. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **musicBrainzArtistId**(`val`): `void` - -Sets the MusicBrainz artist ID. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### musicBrainzDiscId - -• `get` **musicBrainzDiscId**(): `string` - -Gets the MusicBrainz disc ID. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **musicBrainzDiscId**(`val`): `void` - -Sets the MusicBrainz disc ID. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### musicBrainzReleaseArtistId - -• `get` **musicBrainzReleaseArtistId**(): `string` - -Gets the MusicBrainz release artist ID. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **musicBrainzReleaseArtistId**(`val`): `void` - -Sets the MusicBrainz release artist ID. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### musicBrainzReleaseCountry - -• `get` **musicBrainzReleaseCountry**(): `string` - -Gets the MusicBrainz release country. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **musicBrainzReleaseCountry**(`val`): `void` - -Sets the MusicBrainz release country. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### musicBrainzReleaseGroupId - -• `get` **musicBrainzReleaseGroupId**(): `string` - -Gets the MusicBrainz release group ID. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **musicBrainzReleaseGroupId**(`val`): `void` - -Sets the MusicBrainz release group ID. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### musicBrainzReleaseId - -• `get` **musicBrainzReleaseId**(): `string` - -Gets the MusicBrainz release ID. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **musicBrainzReleaseId**(`val`): `void` - -Sets the MusicBrainz release ID. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### musicBrainzReleaseStatus - -• `get` **musicBrainzReleaseStatus**(): `string` - -Gets the MusicBrainz release status. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **musicBrainzReleaseStatus**(`val`): `void` - -Sets the MusicBrainz release status. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### musicBrainzReleaseType - -• `get` **musicBrainzReleaseType**(): `string` - -Gets the MusicBrainz release type. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **musicBrainzReleaseType**(`val`): `void` - -Sets the MusicBrainz release type. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### musicBrainzTrackId - -• `get` **musicBrainzTrackId**(): `string` - -Gets the MusicBrainz track ID. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **musicBrainzTrackId**(`val`): `void` - -Sets the MusicBrainz track ID. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### musicIpId - -• `get` **musicIpId**(): `string` - -Gets the MusicIP PUID. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **musicIpId**(`val`): `void` - -Sets the MusicIP PUID. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### performers - -• `get` **performers**(): `string`[] - -Gets the performers or artists who performed in the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string`[] - -• `set` **performers**(`val`): `void` - -Sets the performers in the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string`[] | - -#### Returns - -`void` - -___ - -### performersRole - -• `get` **performersRole**(): `string`[] - -Gets the characters for a video media, or instruments played for music media. This should -match the [performers](combinedtag.md#performers) array (for each person correspond one/more role). Several roles -for the same artist/actor can be made up with semicolons. For example, "Marty McFly; Marty -McFly Jr.; Marlene McFly". -Returns the first non-null/non-undefined value from the child tags. - -**`remarks`** This is typically useful for movies, although the instrument played by each - artist in a music file may be of relevance. - It is highly important to match each role to the performers. This means that a role may - be `null\undefined` to keep a match betweenInclusive performers[i] and performersRole[i]. - -#### Returns - -`string`[] - -• `set` **performersRole**(`val`): `void` - -Sets the characters in a video media, or instruments played for music media. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string`[] | - -#### Returns - -`void` - -___ - -### performersSort - -• `get` **performersSort**(): `string`[] - -Gets the performers or artists who performed in the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string`[] - -• `set` **performersSort**(`val`): `void` - -Sets the performers in the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string`[] | - -#### Returns - -`void` - -___ - -### pictures - -• `get` **pictures**(): [`IPicture`](../interfaces/ipicture.md)[] - -Gets a collection of pictures associated with the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -[`IPicture`](../interfaces/ipicture.md)[] - -• `set` **pictures**(`val`): `void` - -Sets the collection of pictures associated with the current media. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | [`IPicture`](../interfaces/ipicture.md)[] | - -#### Returns - -`void` - -___ - -### publisher - -• `get` **publisher**(): `string` - -Gets the publisher of the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **publisher**(`val`): `void` - -Sets the publisher of the media represented by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### remixedBy - -• `get` **remixedBy**(): `string` - -Gets the remixer of the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **remixedBy**(`val`): `void` - -Sets the remixer of the media represented by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### replayGainAlbumGain - -• `get` **replayGainAlbumGain**(): `number` - -Gets the ReplayGain album gain in dB. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`number` - -• `set` **replayGainAlbumGain**(`val`): `void` - -Sets the ReplayGain album gain in dB. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `number` | - -#### Returns - -`void` - -___ - -### replayGainAlbumPeak - -• `get` **replayGainAlbumPeak**(): `number` - -Gets the ReplayGain album peak sample. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`number` - -• `set` **replayGainAlbumPeak**(`val`): `void` - -Sets the ReplayGain album peak sample. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `number` | - -#### Returns - -`void` - -___ - -### replayGainTrackGain - -• `get` **replayGainTrackGain**(): `number` - -Gets the ReplayGain track gain in dB. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`number` - -• `set` **replayGainTrackGain**(`val`): `void` - -Sets the ReplayGain track gain in dB. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `number` | - -#### Returns - -`void` - -___ - -### replayGainTrackPeak - -• `get` **replayGainTrackPeak**(): `number` - -Gets the ReplayGain track peak sample. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`number` - -• `set` **replayGainTrackPeak**(`val`): `void` - -Sets the ReplayGain track peak sample. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `number` | - -#### Returns - -`void` - -___ - -### sizeOnDisk - -• `get` **sizeOnDisk**(): `number` - -**`inheritdoc`** - -**`remarks`** Note that tags may not appear contiguously in a file. Access the [tags](combinedtag.md#tags) - contained in this object to see the size of each tag on the disk. - -#### Returns - -`number` - -___ - -### subtitle - -• `get` **subtitle**(): `string` - -Gets the subtitle for the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -**`remarks`** This field gives a nice short precision to the title, which is typically below - the title on the front cover of the media. Example: for "Back to the Future", this would - be "It's About Time". - -#### Returns - -`string` - -• `set` **subtitle**(`val`): `void` - -Sets the subtitle for the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### supportedTagTypes - -• `get` **supportedTagTypes**(): [`TagTypes`](../enums/tagtypes.md) - -Gets the types of tags that are supported by this instance of a combined tag. Only these tag -types can be added to the instance. - -#### Returns - -[`TagTypes`](../enums/tagtypes.md) - -___ - -### tagTypes - -• `get` **tagTypes**(): [`TagTypes`](../enums/tagtypes.md) - -Gets the tag types contained in the current instance. - -#### Returns - -[`TagTypes`](../enums/tagtypes.md) - -TagTypes Bitwise combined tag types contained in all child tags. - -___ - -### tags - -• `get` **tags**(): [`Tag`](tag.md)[] - -Gets all tags contained within the current instance. If the tags within this tag are also -[CombinedTag](combinedtag.md)s, the retrieval will recurse and return a flat list of nested tags. - -**`remarks`** Modifications of the returned array will not be retained. - -#### Returns - -[`Tag`](tag.md)[] - -___ - -### title - -• `get` **title**(): `string` - -Gets the title for the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **title**(`val`): `void` - -Sets the title for the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### titleSort - -• `get` **titleSort**(): `string` - -Gets the title used for sorting the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **titleSort**(`val`): `void` - -Sets the title used for sorting the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### track - -• `get` **track**(): `number` - -Gets the position of the media represented by the current instance in its containing album. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`number` - -• `set` **track**(`val`): `void` - -Sets the position of the media represented by the current instance in its containing album. -Must be a positive integer positive integer. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `number` | - -#### Returns - -`void` - -___ - -### trackCount - -• `get` **trackCount**(): `number` - -Gets the number of tracks in the album containing the media represented by the current -instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`number` - -• `set` **trackCount**(`val`): `void` - -Sets the number of tracks in the album containing the media represented by the current -instance. Must be a positive integer positive integer. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `number` | - -#### Returns - -`void` - -___ - -### year - -• `get` **year**(): `number` - -Gets the year that the media represented by the current instance was recorded. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`number` - -• `set` **year**(`val`): `void` - -Sets the year that the media represented by the current instance was recorded. Must be a -positive integer. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `number` | - -#### Returns - -`void` - -## Methods - -### addTag - -▸ `Protected` **addTag**(`tag`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `tag` | [`Tag`](tag.md) | - -#### Returns - -`void` - -___ - -### clear - -▸ **clear**(): `void` - -Clears all values stored in the current instance. - -**`remarks`** The clearing procedure is format specific and should clear all values. - -#### Returns - -`void` - -#### Overrides - -[Tag](tag.md).[clear](tag.md#clear) - -___ - -### copyTo - -▸ **copyTo**(`target`, `overwrite`): `void` - -Copies the values from the current instance to another [Tag](tag.md), optionally overwriting - existing values. - -**`remarks`** This method only copies the most basic values when copying between different tag - formats. However, if `target` is of the same type as the current instance, - more advanced copying may be done. For example if both `this` and `target` are - [Id3v2Tag](id3v2tag.md), all frames will be copied to the target. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `target` | [`Tag`](tag.md) | Target tag to copy values to | -| `overwrite` | `boolean` | Whether or not to copy values over existing ones | - -#### Returns - -`void` - -#### Inherited from - -[Tag](tag.md).[copyTo](tag.md#copyto) - -___ - -### createTag - -▸ `Abstract` **createTag**(`tagType`, `copy`): [`Tag`](tag.md) - -Creates a new instance of the desired tag type and adds it to the current instance. If the -tag type is unsupported in the current context or the tag type already exists, an error will -be thrown. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `tagType` | [`TagTypes`](../enums/tagtypes.md) | Type of tag to create | -| `copy` | `boolean` | Whether or not to copy the contents of the current instance to the newly created tag instance | - -#### Returns - -[`Tag`](tag.md) - -Tag The newly created tag - -___ - -### getTag - -▸ **getTag**<`TTag`\>(`tagType`): `TTag` - -Gets a tag of the specified tag type if a matching tag exists in the current instance. - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `TTag` | extends [`Tag`](tag.md)<`TTag`\> | - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `tagType` | [`TagTypes`](../enums/tagtypes.md) | Type of tag to retrieve | - -#### Returns - -`TTag` - -Tag Tag with specified type, if it exists. `undefined` otherwise. - -___ - -### removeTags - -▸ **removeTags**(`tagTypes`): `void` - -Remove all tags that match the specified tagTypes. This is performed recursively. Any nested -`CombinedTag` instances are left in place. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `tagTypes` | [`TagTypes`](../enums/tagtypes.md) | Types of tags to remove | - -#### Returns - -`void` - -___ - -### setInfoTag - -▸ **setInfoTag**(): `void` - -Set the tags that represent the tagger software (node-taglib-sharp) itself. - -**`remarks`** This is typically a method to call just before saving a tag. - -#### Returns - -`void` - -#### Inherited from - -[Tag](tag.md).[setInfoTag](tag.md#setinfotag) - -___ - -### validateTagCreation - -▸ `Protected` **validateTagCreation**(`tagType`): `void` - -Verifies if a tag can be added to the current instance. The criteria for validation are: -* A tag of the given tag type does not already exist -* The given tag type is supported by the current instance - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `tagType` | [`TagTypes`](../enums/tagtypes.md) | Tag type that the caller wants to create | - -#### Returns - -`void` - -___ - -### firstInGroup - -▸ `Static` `Protected` **firstInGroup**(`group`): `string` - -Gets the first string in an array. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `group` | `string`[] | Array of strings to get the first string from. | - -#### Returns - -`string` - -First string contained in `group` or `undefined` if the array is - `undefined` or empty - -#### Inherited from - -[Tag](tag.md).[firstInGroup](tag.md#firstingroup) - -___ - -### isFalsyOrLikeEmpty - -▸ `Static` `Protected` **isFalsyOrLikeEmpty**(`value`): `boolean` - -Checks if a value is falsy or empty. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `string`[] | Object to check | - -#### Returns - -`boolean` - -If `value` is a string, `true` is returned if the value is falsy or all - whitespace, `false` is returned otherwise. If `value` is an array of strings, - the array must be falsy or all elements must be falsy or whitespace to return `true`. - -#### Inherited from - -[Tag](tag.md).[isFalsyOrLikeEmpty](tag.md#isfalsyorlikeempty) - -___ - -### joinGroup - -▸ `Static` `Protected` **joinGroup**(`group`): `string` - -Joins an array of string into a single, semicolon and space separated string. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `group` | `string`[] | Array of string to join | - -#### Returns - -`string` - -A semicolon and space separated string containing the values from `group` - or undefined if the array is `undefined` or empty. - -#### Inherited from - -[Tag](tag.md).[joinGroup](tag.md#joingroup) - -___ - -### tagTypeFlagsToArray - -▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/tagtypes.md)[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `tagTypes` | [`TagTypes`](../enums/tagtypes.md) | - -#### Returns - -[`TagTypes`](../enums/tagtypes.md)[] - -#### Inherited from - -[Tag](tag.md).[tagTypeFlagsToArray](tag.md#tagtypeflagstoarray) diff --git a/docs/classes/flactag.md b/docs/classes/flactag.md deleted file mode 100644 index f06ef939..00000000 --- a/docs/classes/flactag.md +++ /dev/null @@ -1,1989 +0,0 @@ -[node-taglib-sharp](../README.md) / [Exports](../modules.md) / FlacTag - -# Class: FlacTag - -Collection of tags that can be stored in a FLAC file. - -**`remarks`** The FLAC file specification states that tagging should be done via a XIPH comment block - and any pictures should be stored in a FLAC picture block. However, tagging can be done via - ID3 and APE tags at the beginning or end of the file, same as MP3 and other files. This - class provides a unified access into all the tags a FLAC file may contain. - -## Hierarchy - -- [`CombinedTag`](combinedtag.md) - - ↳ **`FlacTag`** - -## Table of contents - -### Constructors - -- [constructor](flactag.md#constructor) - -### Accessors - -- [album](flactag.md#album) -- [albumArtists](flactag.md#albumartists) -- [albumArtistsSort](flactag.md#albumartistssort) -- [albumSort](flactag.md#albumsort) -- [amazonId](flactag.md#amazonid) -- [beatsPerMinute](flactag.md#beatsperminute) -- [comment](flactag.md#comment) -- [composers](flactag.md#composers) -- [composersSort](flactag.md#composerssort) -- [conductor](flactag.md#conductor) -- [copyright](flactag.md#copyright) -- [dateTagged](flactag.md#datetagged) -- [description](flactag.md#description) -- [disc](flactag.md#disc) -- [discCount](flactag.md#disccount) -- [endTag](flactag.md#endtag) -- [firstAlbumArtist](flactag.md#firstalbumartist) -- [firstAlbumArtistSort](flactag.md#firstalbumartistsort) -- [firstComposer](flactag.md#firstcomposer) -- [firstComposerSort](flactag.md#firstcomposersort) -- [firstGenre](flactag.md#firstgenre) -- [firstPerformer](flactag.md#firstperformer) -- [firstPerformerSort](flactag.md#firstperformersort) -- [genres](flactag.md#genres) -- [grouping](flactag.md#grouping) -- [initialKey](flactag.md#initialkey) -- [isEmpty](flactag.md#isempty) -- [isrc](flactag.md#isrc) -- [joinedAlbumArtists](flactag.md#joinedalbumartists) -- [joinedComposers](flactag.md#joinedcomposers) -- [joinedGenres](flactag.md#joinedgenres) -- [joinedPerformers](flactag.md#joinedperformers) -- [joinedPerformersSort](flactag.md#joinedperformerssort) -- [lyrics](flactag.md#lyrics) -- [musicBrainzArtistId](flactag.md#musicbrainzartistid) -- [musicBrainzDiscId](flactag.md#musicbrainzdiscid) -- [musicBrainzReleaseArtistId](flactag.md#musicbrainzreleaseartistid) -- [musicBrainzReleaseCountry](flactag.md#musicbrainzreleasecountry) -- [musicBrainzReleaseGroupId](flactag.md#musicbrainzreleasegroupid) -- [musicBrainzReleaseId](flactag.md#musicbrainzreleaseid) -- [musicBrainzReleaseStatus](flactag.md#musicbrainzreleasestatus) -- [musicBrainzReleaseType](flactag.md#musicbrainzreleasetype) -- [musicBrainzTrackId](flactag.md#musicbrainztrackid) -- [musicIpId](flactag.md#musicipid) -- [performers](flactag.md#performers) -- [performersRole](flactag.md#performersrole) -- [performersSort](flactag.md#performerssort) -- [pictures](flactag.md#pictures) -- [publisher](flactag.md#publisher) -- [remixedBy](flactag.md#remixedby) -- [replayGainAlbumGain](flactag.md#replaygainalbumgain) -- [replayGainAlbumPeak](flactag.md#replaygainalbumpeak) -- [replayGainTrackGain](flactag.md#replaygaintrackgain) -- [replayGainTrackPeak](flactag.md#replaygaintrackpeak) -- [sizeOnDisk](flactag.md#sizeondisk) -- [startTag](flactag.md#starttag) -- [subtitle](flactag.md#subtitle) -- [supportedTagTypes](flactag.md#supportedtagtypes) -- [tagTypes](flactag.md#tagtypes) -- [tags](flactag.md#tags) -- [title](flactag.md#title) -- [titleSort](flactag.md#titlesort) -- [track](flactag.md#track) -- [trackCount](flactag.md#trackcount) -- [xiphComment](flactag.md#xiphcomment) -- [year](flactag.md#year) - -### Methods - -- [addTag](flactag.md#addtag) -- [clear](flactag.md#clear) -- [copyTo](flactag.md#copyto) -- [createTag](flactag.md#createtag) -- [getTag](flactag.md#gettag) -- [removeTags](flactag.md#removetags) -- [setInfoTag](flactag.md#setinfotag) -- [validateTagCreation](flactag.md#validatetagcreation) -- [firstInGroup](flactag.md#firstingroup) -- [isFalsyOrLikeEmpty](flactag.md#isfalsyorlikeempty) -- [joinGroup](flactag.md#joingroup) -- [tagTypeFlagsToArray](flactag.md#tagtypeflagstoarray) - -## Constructors - -### constructor - -• **new FlacTag**(`startTag`, `endTag`, `xiphTag`, `flacPictures`) - -Constructs and initializes a new FLAC tag using the component tags provided. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `startTag` | `default` | Required, collection of tags at the start of the file | -| `endTag` | `default` | Required, collection of tags at the end of the file | -| `xiphTag` | [`XiphComment`](xiphcomment.md) | Optional, Xiph comment tag from the FLAC file | -| `flacPictures` | [`XiphPicture`](xiphpicture.md)[] | Optional, array of pictures found in the file | - -#### Overrides - -[CombinedTag](combinedtag.md).[constructor](combinedtag.md#constructor) - -## Accessors - -### album - -• `get` **album**(): `string` - -Gets the album title for the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **album**(`val`): `void` - -Sets the album title for the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### albumArtists - -• `get` **albumArtists**(): `string`[] - -Gets the band or artist is credited in the creation of the entire album or collection -containing the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string`[] - -• `set` **albumArtists**(`val`): `void` - -Sets the band or artist is credited in the creation of the entire album or collection -containing the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string`[] | - -#### Returns - -`void` - -___ - -### albumArtistsSort - -• `get` **albumArtistsSort**(): `string`[] - -Gets the band or artist is credited in the creation of the entire album or collection -containing the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string`[] - -• `set` **albumArtistsSort**(`val`): `void` - -Sets the band or artist is credited in the creation of the entire album or collection -containing the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string`[] | - -#### Returns - -`void` - -___ - -### albumSort - -• `get` **albumSort**(): `string` - -Gets the album title for sorting the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **albumSort**(`val`): `void` - -Sets the album title for sorting the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### amazonId - -• `get` **amazonId**(): `string` - -Gets the Amazon ID. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **amazonId**(`val`): `void` - -Sets the Amazon ID. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### beatsPerMinute - -• `get` **beatsPerMinute**(): `number` - -Gets the number of beats per minute of the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`number` - -• `set` **beatsPerMinute**(`val`): `void` - -Sets the number of beats per minute of the media represented by the current instance. Must -be a positive integer positive integer. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `number` | - -#### Returns - -`void` - -___ - -### comment - -• `get` **comment**(): `string` - -Gets a user comment for the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **comment**(`val`): `void` - -Sets a user comment for the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### composers - -• `get` **composers**(): `string`[] - -Gets the composers of the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string`[] - -• `set` **composers**(`val`): `void` - -Sets the composers of the media represented by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string`[] | - -#### Returns - -`void` - -___ - -### composersSort - -• `get` **composersSort**(): `string`[] - -Gets the composers of the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string`[] - -• `set` **composersSort**(`val`): `void` - -Sets the composers of the media represented by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string`[] | - -#### Returns - -`void` - -___ - -### conductor - -• `get` **conductor**(): `string` - -Gets the conductor or director of the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **conductor**(`val`): `void` - -Sets the conductor or director of the media represented by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### copyright - -• `get` **copyright**(): `string` - -Gets the copyright information of the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **copyright**(`val`): `void` - -Sets the copyright information of the media represented by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### dateTagged - -• `get` **dateTagged**(): `Date` - -Gets the date at which the tag has been written. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`Date` - -• `set` **dateTagged**(`val`): `void` - -Sets the date at which the tag has been written - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `Date` | - -#### Returns - -`void` - -___ - -### description - -• `get` **description**(): `string` - -Gets the description for the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -**`remarks`** This is especially relevant for a movie. For example, for "Back to the Future - 2", this could be "After visiting 2015, Marty McFly must repeat his visit to 1955 to - prevent disastrous changes to 1985...without interfering with his first trip". - -#### Returns - -`string` - -• `set` **description**(`val`): `void` - -Sets the description for the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### disc - -• `get` **disc**(): `number` - -Gets the number of the disc containing the media represented by the current instance in a -boxed set. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`number` - -• `set` **disc**(`val`): `void` - -Sets the number of the disc containing the media represented by the current instance in a -boxed set. Must be a positive integer positive integer. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `number` | - -#### Returns - -`void` - -___ - -### discCount - -• `get` **discCount**(): `number` - -Gets the number of the discs in the boxed set containing the media represented by the -current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`number` - -• `set` **discCount**(`val`): `void` - -Sets the number of the discs in the boxed set containing the media represented by the -current instance. Must be a positive integer positive integer. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `number` | - -#### Returns - -`void` - -___ - -### endTag - -• `get` **endTag**(): `default` - -Gets the collection of tags appearing at the end of the file. - -#### Returns - -`default` - -___ - -### firstAlbumArtist - -• `get` **firstAlbumArtist**(): `string` - -Gets the the first value contained in [albumArtists](flactag.md#albumartists). - -#### Returns - -`string` - -___ - -### firstAlbumArtistSort - -• `get` **firstAlbumArtistSort**(): `string` - -Gets the first value contained in [albumArtistsSort](flactag.md#albumartistssort) - -#### Returns - -`string` - -___ - -### firstComposer - -• `get` **firstComposer**(): `string` - -Gets the first value contained in [composers](flactag.md#composers) - -#### Returns - -`string` - -___ - -### firstComposerSort - -• `get` **firstComposerSort**(): `string` - -Gets the first value contained in [composersSort](flactag.md#composerssort) - -#### Returns - -`string` - -___ - -### firstGenre - -• `get` **firstGenre**(): `string` - -Gets the first value contained in [genres](flactag.md#genres) - -#### Returns - -`string` - -___ - -### firstPerformer - -• `get` **firstPerformer**(): `string` - -Gets the first value contained in [performers](flactag.md#performers) - -#### Returns - -`string` - -___ - -### firstPerformerSort - -• `get` **firstPerformerSort**(): `string` - -Gets the first value contained in [performersSort](flactag.md#performerssort) - -#### Returns - -`string` - -___ - -### genres - -• `get` **genres**(): `string`[] - -Gets the album genres of the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string`[] - -• `set` **genres**(`val`): `void` - -Sets the album genres of the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string`[] | - -#### Returns - -`void` - -___ - -### grouping - -• `get` **grouping**(): `string` - -Gets the grouping on the album which the media in the current instance belongs to. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **grouping**(`val`): `void` - -Sets the grouping on the album which the media in the current instance belongs to. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### initialKey - -• `get` **initialKey**(): `string` - -Gets the initial key of the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **initialKey**(`val`): `void` - -Sets the initial key of the media represented by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### isEmpty - -• `get` **isEmpty**(): `boolean` - -Whether or not the current instance is empty. If all child tags are empty, `true` is -returned, `false` otherwise. - -#### Returns - -`boolean` - -___ - -### isrc - -• `get` **isrc**(): `string` - -Gets the ISRC (International Standard Recording Code) of the media represented by the -current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **isrc**(`val`): `void` - -Sets the ISRC (International Standard Recording Code) of the media represented by the -current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### joinedAlbumArtists - -• `get` **joinedAlbumArtists**(): `string` - -Gets a semicolon and space separated string containing the values in [albumArtists](flactag.md#albumartists) - -#### Returns - -`string` - -___ - -### joinedComposers - -• `get` **joinedComposers**(): `string` - -Gets a semicolon and space separated string containing the values in [composers](flactag.md#composers) - -#### Returns - -`string` - -___ - -### joinedGenres - -• `get` **joinedGenres**(): `string` - -Gets a semicolon and space separated string containing the values in [genres](flactag.md#genres) - -#### Returns - -`string` - -___ - -### joinedPerformers - -• `get` **joinedPerformers**(): `string` - -Gets a semicolon and space separated string containing the values in [performers](flactag.md#performers) - -#### Returns - -`string` - -___ - -### joinedPerformersSort - -• `get` **joinedPerformersSort**(): `string` - -Gets a semicolon and space separated string containing the values in [performersSort](flactag.md#performerssort) - -#### Returns - -`string` - -___ - -### lyrics - -• `get` **lyrics**(): `string` - -Gets the lyrics or script of the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **lyrics**(`val`): `void` - -Sets the lyrics or script of the media represented by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### musicBrainzArtistId - -• `get` **musicBrainzArtistId**(): `string` - -Gets the MusicBrainz artist ID. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **musicBrainzArtistId**(`val`): `void` - -Sets the MusicBrainz artist ID. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### musicBrainzDiscId - -• `get` **musicBrainzDiscId**(): `string` - -Gets the MusicBrainz disc ID. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **musicBrainzDiscId**(`val`): `void` - -Sets the MusicBrainz disc ID. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### musicBrainzReleaseArtistId - -• `get` **musicBrainzReleaseArtistId**(): `string` - -Gets the MusicBrainz release artist ID. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **musicBrainzReleaseArtistId**(`val`): `void` - -Sets the MusicBrainz release artist ID. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### musicBrainzReleaseCountry - -• `get` **musicBrainzReleaseCountry**(): `string` - -Gets the MusicBrainz release country. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **musicBrainzReleaseCountry**(`val`): `void` - -Sets the MusicBrainz release country. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### musicBrainzReleaseGroupId - -• `get` **musicBrainzReleaseGroupId**(): `string` - -Gets the MusicBrainz release group ID. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **musicBrainzReleaseGroupId**(`val`): `void` - -Sets the MusicBrainz release group ID. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### musicBrainzReleaseId - -• `get` **musicBrainzReleaseId**(): `string` - -Gets the MusicBrainz release ID. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **musicBrainzReleaseId**(`val`): `void` - -Sets the MusicBrainz release ID. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### musicBrainzReleaseStatus - -• `get` **musicBrainzReleaseStatus**(): `string` - -Gets the MusicBrainz release status. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **musicBrainzReleaseStatus**(`val`): `void` - -Sets the MusicBrainz release status. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### musicBrainzReleaseType - -• `get` **musicBrainzReleaseType**(): `string` - -Gets the MusicBrainz release type. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **musicBrainzReleaseType**(`val`): `void` - -Sets the MusicBrainz release type. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### musicBrainzTrackId - -• `get` **musicBrainzTrackId**(): `string` - -Gets the MusicBrainz track ID. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **musicBrainzTrackId**(`val`): `void` - -Sets the MusicBrainz track ID. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### musicIpId - -• `get` **musicIpId**(): `string` - -Gets the MusicIP PUID. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **musicIpId**(`val`): `void` - -Sets the MusicIP PUID. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### performers - -• `get` **performers**(): `string`[] - -Gets the performers or artists who performed in the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string`[] - -• `set` **performers**(`val`): `void` - -Sets the performers in the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string`[] | - -#### Returns - -`void` - -___ - -### performersRole - -• `get` **performersRole**(): `string`[] - -Gets the characters for a video media, or instruments played for music media. This should -match the [performers](flactag.md#performers) array (for each person correspond one/more role). Several roles -for the same artist/actor can be made up with semicolons. For example, "Marty McFly; Marty -McFly Jr.; Marlene McFly". -Returns the first non-null/non-undefined value from the child tags. - -**`remarks`** This is typically useful for movies, although the instrument played by each - artist in a music file may be of relevance. - It is highly important to match each role to the performers. This means that a role may - be `null\undefined` to keep a match betweenInclusive performers[i] and performersRole[i]. - -#### Returns - -`string`[] - -• `set` **performersRole**(`val`): `void` - -Sets the characters in a video media, or instruments played for music media. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string`[] | - -#### Returns - -`void` - -___ - -### performersSort - -• `get` **performersSort**(): `string`[] - -Gets the performers or artists who performed in the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string`[] - -• `set` **performersSort**(`val`): `void` - -Sets the performers in the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string`[] | - -#### Returns - -`void` - -___ - -### pictures - -• `get` **pictures**(): [`IPicture`](../interfaces/ipicture.md)[] - -Gets a collection of pictures associated with the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -**`inheritdoc`** -For FLAC files, FLAC-style pictures are preferentially returned. If those don't exist the -pictures that are stored in the - -#### Returns - -[`IPicture`](../interfaces/ipicture.md)[] - -• `set` **pictures**(`value`): `void` - -Gets a collection of pictures associated with the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -**`inheritdoc`** -For FLAC files, pictures are preferentially stored in FLAC-style picture blocks. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | [`IPicture`](../interfaces/ipicture.md)[] | - -#### Returns - -`void` - -___ - -### publisher - -• `get` **publisher**(): `string` - -Gets the publisher of the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **publisher**(`val`): `void` - -Sets the publisher of the media represented by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### remixedBy - -• `get` **remixedBy**(): `string` - -Gets the remixer of the media represented by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **remixedBy**(`val`): `void` - -Sets the remixer of the media represented by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### replayGainAlbumGain - -• `get` **replayGainAlbumGain**(): `number` - -Gets the ReplayGain album gain in dB. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`number` - -• `set` **replayGainAlbumGain**(`val`): `void` - -Sets the ReplayGain album gain in dB. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `number` | - -#### Returns - -`void` - -___ - -### replayGainAlbumPeak - -• `get` **replayGainAlbumPeak**(): `number` - -Gets the ReplayGain album peak sample. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`number` - -• `set` **replayGainAlbumPeak**(`val`): `void` - -Sets the ReplayGain album peak sample. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `number` | - -#### Returns - -`void` - -___ - -### replayGainTrackGain - -• `get` **replayGainTrackGain**(): `number` - -Gets the ReplayGain track gain in dB. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`number` - -• `set` **replayGainTrackGain**(`val`): `void` - -Sets the ReplayGain track gain in dB. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `number` | - -#### Returns - -`void` - -___ - -### replayGainTrackPeak - -• `get` **replayGainTrackPeak**(): `number` - -Gets the ReplayGain track peak sample. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`number` - -• `set` **replayGainTrackPeak**(`val`): `void` - -Sets the ReplayGain track peak sample. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `number` | - -#### Returns - -`void` - -___ - -### sizeOnDisk - -• `get` **sizeOnDisk**(): `number` - -Gets the size of the tag in bytes on disk as it was read from disk. - -**`inheritdoc`** - -**`remarks`** Note that tags may not appear contiguously in a file. Access the [tags](flactag.md#tags) - contained in this object to see the size of each tag on the disk. - -#### Returns - -`number` - -___ - -### startTag - -• `get` **startTag**(): `default` - -Gets the collection of tags appearing at the start of the file. - -#### Returns - -`default` - -___ - -### subtitle - -• `get` **subtitle**(): `string` - -Gets the subtitle for the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -**`remarks`** This field gives a nice short precision to the title, which is typically below - the title on the front cover of the media. Example: for "Back to the Future", this would - be "It's About Time". - -#### Returns - -`string` - -• `set` **subtitle**(`val`): `void` - -Sets the subtitle for the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### supportedTagTypes - -• `get` **supportedTagTypes**(): [`TagTypes`](../enums/tagtypes.md) - -Gets the types of tags that are supported by this instance of a combined tag. Only these tag -types can be added to the instance. - -#### Returns - -[`TagTypes`](../enums/tagtypes.md) - -___ - -### tagTypes - -• `get` **tagTypes**(): [`TagTypes`](../enums/tagtypes.md) - -Gets the tag types contained in the current instance. - -#### Returns - -[`TagTypes`](../enums/tagtypes.md) - -TagTypes Bitwise combined tag types contained in all child tags. - -___ - -### tags - -• `get` **tags**(): [`Tag`](tag.md)[] - -Gets all tags contained within the current instance. If the tags within this tag are also -[CombinedTag](combinedtag.md)s, the retrieval will recurse and return a flat list of nested tags. - -**`remarks`** Modifications of the returned array will not be retained. - -#### Returns - -[`Tag`](tag.md)[] - -___ - -### title - -• `get` **title**(): `string` - -Gets the title for the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **title**(`val`): `void` - -Sets the title for the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### titleSort - -• `get` **titleSort**(): `string` - -Gets the title used for sorting the media described by the current instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`string` - -• `set` **titleSort**(`val`): `void` - -Sets the title used for sorting the media described by the current instance. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `string` | - -#### Returns - -`void` - -___ - -### track - -• `get` **track**(): `number` - -Gets the position of the media represented by the current instance in its containing album. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`number` - -• `set` **track**(`val`): `void` - -Sets the position of the media represented by the current instance in its containing album. -Must be a positive integer positive integer. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `number` | - -#### Returns - -`void` - -___ - -### trackCount - -• `get` **trackCount**(): `number` - -Gets the number of tracks in the album containing the media represented by the current -instance. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`number` - -• `set` **trackCount**(`val`): `void` - -Sets the number of tracks in the album containing the media represented by the current -instance. Must be a positive integer positive integer. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `number` | - -#### Returns - -`void` - -___ - -### xiphComment - -• `get` **xiphComment**(): [`XiphComment`](xiphcomment.md) - -Gets the Xiph comment that is stored in the current instance. - -#### Returns - -[`XiphComment`](xiphcomment.md) - -___ - -### year - -• `get` **year**(): `number` - -Gets the year that the media represented by the current instance was recorded. -Returns the first non-null/non-undefined value from the child tags. - -#### Returns - -`number` - -• `set` **year**(`val`): `void` - -Sets the year that the media represented by the current instance was recorded. Must be a -positive integer. -Sets the value on all child tags - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `val` | `number` | - -#### Returns - -`void` - -## Methods - -### addTag - -▸ `Protected` **addTag**(`tag`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `tag` | [`Tag`](tag.md) | - -#### Returns - -`void` - -#### Inherited from - -[CombinedTag](combinedtag.md).[addTag](combinedtag.md#addtag) - -___ - -### clear - -▸ **clear**(): `void` - -Clears all values stored in the current instance. - -**`remarks`** The clearing procedure is format specific and should clear all values. - -#### Returns - -`void` - -#### Overrides - -[CombinedTag](combinedtag.md).[clear](combinedtag.md#clear) - -___ - -### copyTo - -▸ **copyTo**(`target`, `overwrite`): `void` - -Copies the values from the current instance to another [Tag](tag.md), optionally overwriting - existing values. - -**`remarks`** This method only copies the most basic values when copying between different tag - formats. However, if `target` is of the same type as the current instance, - more advanced copying may be done. For example if both `this` and `target` are - [Id3v2Tag](id3v2tag.md), all frames will be copied to the target. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `target` | [`Tag`](tag.md) | Target tag to copy values to | -| `overwrite` | `boolean` | Whether or not to copy values over existing ones | - -#### Returns - -`void` - -#### Inherited from - -[CombinedTag](combinedtag.md).[copyTo](combinedtag.md#copyto) - -___ - -### createTag - -▸ **createTag**(`tagType`, `copy`): [`Tag`](tag.md) - -Creates a new instance of the desired tag type and adds it to the current instance. If the -tag type is unsupported in the current context or the tag type already exists, an error will -be thrown. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `tagType` | [`TagTypes`](../enums/tagtypes.md) | Type of tag to create | -| `copy` | `boolean` | Whether or not to copy the contents of the current instance to the newly created tag instance | - -#### Returns - -[`Tag`](tag.md) - -Tag The newly created tag - -#### Overrides - -[CombinedTag](combinedtag.md).[createTag](combinedtag.md#createtag) - -___ - -### getTag - -▸ **getTag**<`TTag`\>(`tagType`): `TTag` - -Gets a tag of the specified tag type if a matching tag exists in the current instance. - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `TTag` | extends [`Tag`](tag.md)<`TTag`\> | - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `tagType` | [`TagTypes`](../enums/tagtypes.md) | Type of tag to retrieve | - -#### Returns - -`TTag` - -Tag Tag with specified type, if it exists. `undefined` otherwise. - -#### Inherited from - -[CombinedTag](combinedtag.md).[getTag](combinedtag.md#gettag) - -___ - -### removeTags - -▸ **removeTags**(`tagTypes`): `void` - -Remove all tags that match the specified tagTypes. This is performed recursively. Any nested -`CombinedTag` instances are left in place. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `tagTypes` | [`TagTypes`](../enums/tagtypes.md) | Types of tags to remove | - -#### Returns - -`void` - -#### Overrides - -[CombinedTag](combinedtag.md).[removeTags](combinedtag.md#removetags) - -___ - -### setInfoTag - -▸ **setInfoTag**(): `void` - -Set the tags that represent the tagger software (node-taglib-sharp) itself. - -**`remarks`** This is typically a method to call just before saving a tag. - -#### Returns - -`void` - -#### Inherited from - -[CombinedTag](combinedtag.md).[setInfoTag](combinedtag.md#setinfotag) - -___ - -### validateTagCreation - -▸ `Protected` **validateTagCreation**(`tagType`): `void` - -Verifies if a tag can be added to the current instance. The criteria for validation are: -* A tag of the given tag type does not already exist -* The given tag type is supported by the current instance - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `tagType` | [`TagTypes`](../enums/tagtypes.md) | Tag type that the caller wants to create | - -#### Returns - -`void` - -#### Inherited from - -[CombinedTag](combinedtag.md).[validateTagCreation](combinedtag.md#validatetagcreation) - -___ - -### firstInGroup - -▸ `Static` `Protected` **firstInGroup**(`group`): `string` - -Gets the first string in an array. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `group` | `string`[] | Array of strings to get the first string from. | - -#### Returns - -`string` - -First string contained in `group` or `undefined` if the array is - `undefined` or empty - -#### Inherited from - -[CombinedTag](combinedtag.md).[firstInGroup](combinedtag.md#firstingroup) - -___ - -### isFalsyOrLikeEmpty - -▸ `Static` `Protected` **isFalsyOrLikeEmpty**(`value`): `boolean` - -Checks if a value is falsy or empty. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `string`[] | Object to check | - -#### Returns - -`boolean` - -If `value` is a string, `true` is returned if the value is falsy or all - whitespace, `false` is returned otherwise. If `value` is an array of strings, - the array must be falsy or all elements must be falsy or whitespace to return `true`. - -#### Inherited from - -[CombinedTag](combinedtag.md).[isFalsyOrLikeEmpty](combinedtag.md#isfalsyorlikeempty) - -___ - -### joinGroup - -▸ `Static` `Protected` **joinGroup**(`group`): `string` - -Joins an array of string into a single, semicolon and space separated string. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `group` | `string`[] | Array of string to join | - -#### Returns - -`string` - -A semicolon and space separated string containing the values from `group` - or undefined if the array is `undefined` or empty. - -#### Inherited from - -[CombinedTag](combinedtag.md).[joinGroup](combinedtag.md#joingroup) - -___ - -### tagTypeFlagsToArray - -▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/tagtypes.md)[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `tagTypes` | [`TagTypes`](../enums/tagtypes.md) | - -#### Returns - -[`TagTypes`](../enums/tagtypes.md)[] - -#### Inherited from - -[CombinedTag](combinedtag.md).[tagTypeFlagsToArray](combinedtag.md#tagtypeflagstoarray) diff --git a/docs/classes/xiphcomment.md b/docs/classes/xiphcomment.md deleted file mode 100644 index 69b201be..00000000 --- a/docs/classes/xiphcomment.md +++ /dev/null @@ -1,2347 +0,0 @@ -[node-taglib-sharp](../README.md) / [Exports](../modules.md) / XiphComment - -# Class: XiphComment - -Provides support for reading and writing Xiph comment-style tags. - -**`remarks`** Xiph comment tag properties are stored in "fields" of the form `KEY=value`, where `KEY` - is the "field name". The field name can be defined multiple times in the tag which means - each field can have multiple values. - -## Hierarchy - -- [`Tag`](tag.md) - - ↳ **`XiphComment`** - -## Table of contents - -### Accessors - -- [album](xiphcomment.md#album) -- [albumArtists](xiphcomment.md#albumartists) -- [albumArtistsSort](xiphcomment.md#albumartistssort) -- [albumSort](xiphcomment.md#albumsort) -- [amazonId](xiphcomment.md#amazonid) -- [beatsPerMinute](xiphcomment.md#beatsperminute) -- [comment](xiphcomment.md#comment) -- [composers](xiphcomment.md#composers) -- [composersSort](xiphcomment.md#composerssort) -- [conductor](xiphcomment.md#conductor) -- [copyright](xiphcomment.md#copyright) -- [dateTagged](xiphcomment.md#datetagged) -- [description](xiphcomment.md#description) -- [disc](xiphcomment.md#disc) -- [discCount](xiphcomment.md#disccount) -- [fieldNames](xiphcomment.md#fieldnames) -- [fieldValueCount](xiphcomment.md#fieldvaluecount) -- [firstAlbumArtist](xiphcomment.md#firstalbumartist) -- [firstAlbumArtistSort](xiphcomment.md#firstalbumartistsort) -- [firstComposer](xiphcomment.md#firstcomposer) -- [firstComposerSort](xiphcomment.md#firstcomposersort) -- [firstGenre](xiphcomment.md#firstgenre) -- [firstPerformer](xiphcomment.md#firstperformer) -- [firstPerformerSort](xiphcomment.md#firstperformersort) -- [genres](xiphcomment.md#genres) -- [grouping](xiphcomment.md#grouping) -- [initialKey](xiphcomment.md#initialkey) -- [isCompilation](xiphcomment.md#iscompilation) -- [isEmpty](xiphcomment.md#isempty) -- [isrc](xiphcomment.md#isrc) -- [joinedAlbumArtists](xiphcomment.md#joinedalbumartists) -- [joinedComposers](xiphcomment.md#joinedcomposers) -- [joinedGenres](xiphcomment.md#joinedgenres) -- [joinedPerformers](xiphcomment.md#joinedperformers) -- [joinedPerformersSort](xiphcomment.md#joinedperformerssort) -- [lyrics](xiphcomment.md#lyrics) -- [musicBrainzArtistId](xiphcomment.md#musicbrainzartistid) -- [musicBrainzDiscId](xiphcomment.md#musicbrainzdiscid) -- [musicBrainzReleaseArtistId](xiphcomment.md#musicbrainzreleaseartistid) -- [musicBrainzReleaseCountry](xiphcomment.md#musicbrainzreleasecountry) -- [musicBrainzReleaseGroupId](xiphcomment.md#musicbrainzreleasegroupid) -- [musicBrainzReleaseId](xiphcomment.md#musicbrainzreleaseid) -- [musicBrainzReleaseStatus](xiphcomment.md#musicbrainzreleasestatus) -- [musicBrainzReleaseType](xiphcomment.md#musicbrainzreleasetype) -- [musicBrainzTrackId](xiphcomment.md#musicbrainztrackid) -- [musicIpId](xiphcomment.md#musicipid) -- [performers](xiphcomment.md#performers) -- [performersRole](xiphcomment.md#performersrole) -- [performersSort](xiphcomment.md#performerssort) -- [pictures](xiphcomment.md#pictures) -- [publisher](xiphcomment.md#publisher) -- [remixedBy](xiphcomment.md#remixedby) -- [replayGainAlbumGain](xiphcomment.md#replaygainalbumgain) -- [replayGainAlbumPeak](xiphcomment.md#replaygainalbumpeak) -- [replayGainTrackGain](xiphcomment.md#replaygaintrackgain) -- [replayGainTrackPeak](xiphcomment.md#replaygaintrackpeak) -- [sizeOnDisk](xiphcomment.md#sizeondisk) -- [subtitle](xiphcomment.md#subtitle) -- [tagTypes](xiphcomment.md#tagtypes) -- [title](xiphcomment.md#title) -- [titleSort](xiphcomment.md#titlesort) -- [track](xiphcomment.md#track) -- [trackCount](xiphcomment.md#trackcount) -- [vendorId](xiphcomment.md#vendorid) -- [year](xiphcomment.md#year) - -### Methods - -- [clear](xiphcomment.md#clear) -- [copyTo](xiphcomment.md#copyto) -- [getField](xiphcomment.md#getfield) -- [getFieldFirstValue](xiphcomment.md#getfieldfirstvalue) -- [removeField](xiphcomment.md#removefield) -- [render](xiphcomment.md#render) -- [setFieldAsStrings](xiphcomment.md#setfieldasstrings) -- [setFieldAsUint](xiphcomment.md#setfieldasuint) -- [setInfoTag](xiphcomment.md#setinfotag) -- [firstInGroup](xiphcomment.md#firstingroup) -- [fromData](xiphcomment.md#fromdata) -- [fromEmpty](xiphcomment.md#fromempty) -- [isFalsyOrLikeEmpty](xiphcomment.md#isfalsyorlikeempty) -- [joinGroup](xiphcomment.md#joingroup) -- [tagTypeFlagsToArray](xiphcomment.md#tagtypeflagstoarray) - -## Accessors - -### album - -• `get` **album**(): `string` - -Gets the album of the media represented by the current instance. For video media, this -represents the collection the video belongs to. - -**`inheritdoc`** `ALBUM` field - -#### Returns - -`string` - -Album of the media represented by the current instance or `undefined` if no value - is present - -• `set` **album**(`value`): `void` - -Gets the album of the media represented by the current instance. For video media, this -represents the collection the video belongs to. - -**`inheritdoc`** `ALBUM` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -Album of the media represented by the current instance or `undefined` if no value - is present - -___ - -### albumArtists - -• `get` **albumArtists**(): `string`[] - -Gets the band or artist who is credited credited in the creation of the entire album or -collection containing the media described by the current instance. - -**`inheritdoc`** `ALBUMARTIST` as per standard, though `ALBUM ARTIST` and `ENSEMBLE` will be - checked if `ALBUMARTIST` is not set. - -#### Returns - -`string`[] - -Band or artist credited with the creation of the entire album or collection - containing the media described by the current instance or an empty array if no value is - present - -• `set` **albumArtists**(`value`): `void` - -Gets the band or artist who is credited credited in the creation of the entire album or -collection containing the media described by the current instance. - -**`inheritdoc`** `ALBUMARTIST`, as per the standard - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string`[] | - -#### Returns - -`void` - -Band or artist credited with the creation of the entire album or collection - containing the media described by the current instance or an empty array if no value is - present - -___ - -### albumArtistsSort - -• `get` **albumArtistsSort**(): `string`[] - -Gets the sortable names of the bands/artists who are credited with creating the entire -album or collection containing the media described by the current instance. - -**`inheritdoc`** `ALBUMARTISTSORT` field - -#### Returns - -`string`[] - -Sortable names for the bands/artists are credited with the creation of the entire - album or collection containing the media described by the current instance, or an empty - array if no value is present. - -• `set` **albumArtistsSort**(`value`): `void` - -Gets the sortable names of the bands/artists who are credited with creating the entire -album or collection containing the media described by the current instance. - -**`inheritdoc`** `ALBUMARTISTSORT` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string`[] | - -#### Returns - -`void` - -Sortable names for the bands/artists are credited with the creation of the entire - album or collection containing the media described by the current instance, or an empty - array if no value is present. - -___ - -### albumSort - -• `get` **albumSort**(): `string` - -Gets the sortable name of the album title of the media represented by the current instance. - -**`inheritdoc`** `ALBUMSORT` field - -#### Returns - -`string` - -Sortable name for the album title of the media or `undefined` if the value is not - present - -• `set` **albumSort**(`value`): `void` - -Gets the sortable name of the album title of the media represented by the current instance. - -**`inheritdoc`** `ALBUMSORT` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -Sortable name for the album title of the media or `undefined` if the value is not - present - -___ - -### amazonId - -• `get` **amazonId**(): `string` - -Gets the Amazon ID of the media represented by the current instance. - -**`inheritdoc`** `ASIN` field - -#### Returns - -`string` - -Amazon ID of the media represented by the current instance or `undefined` if no - value is present - -• `set` **amazonId**(`value`): `void` - -Gets the Amazon ID of the media represented by the current instance. - -**`inheritdoc`** `ASIN` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -Amazon ID of the media represented by the current instance or `undefined` if no - value is present - -___ - -### beatsPerMinute - -• `get` **beatsPerMinute**(): `number` - -Gets the number of beats per minute in the audio of the media represented by the current -instance. - -**`inheritdoc`** `TEMPO` field preferentially, BPM field is used as a fallback. - -**`remarks`** The field that stores the value will be used when setting a BPM in the future. This - behavior can be controlled via {@link XiphSettings.useTempoToStoreBpm}. - -#### Returns - -`number` - -Beats per minute of the audio in the media represented by the current instance, or - `0` if not specified - -• `set` **beatsPerMinute**(`value`): `void` - -Gets the number of beats per minute in the audio of the media represented by the current -instance. - -**`inheritdoc`** - -**`remarks`** Value is stored via `TEMPO` field if {@link XiphSettings.useTempoToStoreBpm} is - `true`. Value is stored via `BPM` if {@link XiphSettings.useTempoToStoreBpm} is `false`. - The other field is removed when stored. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `number` | - -#### Returns - -`void` - -Beats per minute of the audio in the media represented by the current instance, or - `0` if not specified - -___ - -### comment - -• `get` **comment**(): `string` - -Gets a user comment on the media represented by the current instance. - -**`inheritdoc`** `COMMENT` field - -#### Returns - -`string` - -User comments on the media represented by the current instance or `undefined` if - the value is not present - -• `set` **comment**(`value`): `void` - -Gets a user comment on the media represented by the current instance. - -**`inheritdoc`** `COMMENT` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -User comments on the media represented by the current instance or `undefined` if - the value is not present - -___ - -### composers - -• `get` **composers**(): `string`[] - -Gets the composers of the media represented by the current instance. - -**`inheritdoc`** `COMPOSER` field - -#### Returns - -`string`[] - -Composers of the media represented by the current instance of an empty array if no - value is present. - -• `set` **composers**(`value`): `void` - -Gets the composers of the media represented by the current instance. - -**`inheritdoc`** `COMPOSER` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string`[] | - -#### Returns - -`void` - -Composers of the media represented by the current instance of an empty array if no - value is present. - -___ - -### composersSort - -• `get` **composersSort**(): `string`[] - -Gets the sortable names of the composers of the media represented by the current instance. - -**`inheritdoc`** `COMPOSERSORT` field - -#### Returns - -`string`[] - -Sortable names for the composers of the media represented by the current instance - or an empty array if no value is present. - -• `set` **composersSort**(`value`): `void` - -Gets the sortable names of the composers of the media represented by the current instance. - -**`inheritdoc`** `COMPOSERSORT` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string`[] | - -#### Returns - -`void` - -Sortable names for the composers of the media represented by the current instance - or an empty array if no value is present. - -___ - -### conductor - -• `get` **conductor**(): `string` - -Gets the conductor or director of the media represented by the current instance. - -**`inheritdoc`** `CONDUCTOR` field - -#### Returns - -`string` - -Conductor or director of the media represented by the current instance or - `undefined` if no value present. - -• `set` **conductor**(`value`): `void` - -Gets the conductor or director of the media represented by the current instance. - -**`inheritdoc`** `CONDUCTOR` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -Conductor or director of the media represented by the current instance or - `undefined` if no value present. - -___ - -### copyright - -• `get` **copyright**(): `string` - -Gets the copyright information for the media represented by the current instance. - -**`inheritdoc`** `COPYRIGHT` field - -#### Returns - -`string` - -Copyright information for the media represented by the current instance or - `undefined` if no value is present. - -• `set` **copyright**(`value`): `void` - -Gets the copyright information for the media represented by the current instance. - -**`inheritdoc`** `GROUPING` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -Copyright information for the media represented by the current instance or - `undefined` if no value is present. - -___ - -### dateTagged - -• `get` **dateTagged**(): `Date` - -Gets the date and time at which the tag has been written. - -**`inheritdoc`** `DATETAGGED` field - -#### Returns - -`Date` - -Date/time at which the tag has been written, or `undefined` if no value is present - -• `set` **dateTagged**(`value`): `void` - -Gets the date and time at which the tag has been written. - -**`inheritdoc`** `DATETAGGED` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `Date` | - -#### Returns - -`void` - -Date/time at which the tag has been written, or `undefined` if no value is present - -___ - -### description - -• `get` **description**(): `string` - -Gets a short description of the media. For music, this could be the comment that the artist -made of his/her work. For a video, this should be a short summary of the story/plot, but -generally no spoliers. This should give the impression of what to expect in the media. - -**`inheritdoc`** `DESCRIPTION` field - -#### Returns - -`string` - -Description of the media represented by the current instance or `undefined` if no - value is present - -• `set` **description**(`value`): `void` - -Gets a short description of the media. For music, this could be the comment that the artist -made of his/her work. For a video, this should be a short summary of the story/plot, but -generally no spoliers. This should give the impression of what to expect in the media. - -**`inheritdoc`** `DESCRIPTION` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -Description of the media represented by the current instance or `undefined` if no - value is present - -___ - -### disc - -• `get` **disc**(): `number` - -Gets the number of the disc containing the media represented by the current instance in the -boxed set. For a series, this represents the season number. - -**`inheritdoc`** `DISCNUMBER` field - -#### Returns - -`number` - -Number of the disc or season of the media represented by the current instance in a - boxed set. - -• `set` **disc**(`value`): `void` - -Gets the number of the disc containing the media represented by the current instance in the -boxed set. For a series, this represents the season number. - -**`inheritdoc`** `DISCNUMBER` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `number` | - -#### Returns - -`void` - -Number of the disc or season of the media represented by the current instance in a - boxed set. - -___ - -### discCount - -• `get` **discCount**(): `number` - -Gets the number of discs or seasons in the boxed set containing the media represented by the -current instance. - -**`inheritdoc`** `DISCTOTAL` as per standard, but the denominator of `DISCNUMBER` is also - used if `DISCTOTAL` is not available. - -#### Returns - -`number` - -Number of discs or seasons in the boxed set containing the media represented by the - current instance or `0` if not specified. - -• `set` **discCount**(`value`): `void` - -Gets the number of discs or seasons in the boxed set containing the media represented by the -current instance. - -**`inheritdoc`** `DISCTOTAL` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `number` | - -#### Returns - -`void` - -Number of discs or seasons in the boxed set containing the media represented by the - current instance or `0` if not specified. - -___ - -### fieldNames - -• `get` **fieldNames**(): `string`[] - -Gets the names of the fields currently stored in the list of fields, excluding the pictures. - -**`remarks`** This getter is useful for iterating over fields defined in this object in - conjunction with [getField](xiphcomment.md#getfield). - -#### Returns - -`string`[] - -___ - -### fieldValueCount - -• `get` **fieldValueCount**(): `number` - -Gets the total number of values contained in the current instance, including the pictures. - -#### Returns - -`number` - -___ - -### firstAlbumArtist - -• `get` **firstAlbumArtist**(): `string` - -Gets the the first value contained in [albumArtists](xiphcomment.md#albumartists). - -#### Returns - -`string` - -___ - -### firstAlbumArtistSort - -• `get` **firstAlbumArtistSort**(): `string` - -Gets the first value contained in [albumArtistsSort](xiphcomment.md#albumartistssort) - -#### Returns - -`string` - -___ - -### firstComposer - -• `get` **firstComposer**(): `string` - -Gets the first value contained in [composers](xiphcomment.md#composers) - -#### Returns - -`string` - -___ - -### firstComposerSort - -• `get` **firstComposerSort**(): `string` - -Gets the first value contained in [composersSort](xiphcomment.md#composerssort) - -#### Returns - -`string` - -___ - -### firstGenre - -• `get` **firstGenre**(): `string` - -Gets the first value contained in [genres](xiphcomment.md#genres) - -#### Returns - -`string` - -___ - -### firstPerformer - -• `get` **firstPerformer**(): `string` - -Gets the first value contained in [performers](xiphcomment.md#performers) - -#### Returns - -`string` - -___ - -### firstPerformerSort - -• `get` **firstPerformerSort**(): `string` - -Gets the first value contained in [performersSort](xiphcomment.md#performerssort) - -#### Returns - -`string` - -___ - -### genres - -• `get` **genres**(): `string`[] - -Gets the genres of the media represented by the current instance. - -**`inheritdoc`** `GENRE` field - -#### Returns - -`string`[] - -Genres of the media represented by the current instance or an empty array if no - value is present. - -• `set` **genres**(`value`): `void` - -Gets the genres of the media represented by the current instance. - -**`inheritdoc`** `GENRE` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string`[] | - -#### Returns - -`void` - -Genres of the media represented by the current instance or an empty array if no - value is present. - -___ - -### grouping - -• `get` **grouping**(): `string` - -Gets the grouping on the album which the media in the current instance belongs to. - -**`inheritdoc`** `GROUPING` field - -#### Returns - -`string` - -Grouping on the album which the media in the current instance belongs to or - `undefined` if no value is present. - -• `set` **grouping**(`value`): `void` - -Gets the grouping on the album which the media in the current instance belongs to. - -**`inheritdoc`** `GROUPING` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -Grouping on the album which the media in the current instance belongs to or - `undefined` if no value is present. - -___ - -### initialKey - -• `get` **initialKey**(): `string` - -Gets the initial key of the track. - -**`inheritdoc`** `INITIALKEY` field - -#### Returns - -`string` - -Initial key of the track or `undefined` if no value is set - -• `set` **initialKey**(`value`): `void` - -Gets the initial key of the track. - -**`inheritdoc`** `INITIALKEY` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -Initial key of the track or `undefined` if no value is set - -___ - -### isCompilation - -• `get` **isCompilation**(): `boolean` - -**`inheritdoc`** `COMPILATION` field - -#### Returns - -`boolean` - -• `set` **isCompilation**(`value`): `void` - -**`inheritdoc`** `COMPILATION` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `boolean` | - -#### Returns - -`void` - -___ - -### isEmpty - -• `get` **isEmpty**(): `boolean` - -Gets whether or not the current instance is empty. - -**`inheritdoc`** - -#### Returns - -`boolean` - -`true` if the current instance does not contain any values. `false` otherwise - -___ - -### isrc - -• `get` **isrc**(): `string` - -Gets the ISRC (International Standard Recording Code) of the track. - -**`inheritdoc`** `ISRC` field - -#### Returns - -`string` - -the ISRC of the track or `undefined` if no value is set - -• `set` **isrc**(`value`): `void` - -Gets the ISRC (International Standard Recording Code) of the track. - -**`inheritdoc`** `ISRC` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -the ISRC of the track or `undefined` if no value is set - -___ - -### joinedAlbumArtists - -• `get` **joinedAlbumArtists**(): `string` - -Gets a semicolon and space separated string containing the values in [albumArtists](xiphcomment.md#albumartists) - -#### Returns - -`string` - -___ - -### joinedComposers - -• `get` **joinedComposers**(): `string` - -Gets a semicolon and space separated string containing the values in [composers](xiphcomment.md#composers) - -#### Returns - -`string` - -___ - -### joinedGenres - -• `get` **joinedGenres**(): `string` - -Gets a semicolon and space separated string containing the values in [genres](xiphcomment.md#genres) - -#### Returns - -`string` - -___ - -### joinedPerformers - -• `get` **joinedPerformers**(): `string` - -Gets a semicolon and space separated string containing the values in [performers](xiphcomment.md#performers) - -#### Returns - -`string` - -___ - -### joinedPerformersSort - -• `get` **joinedPerformersSort**(): `string` - -Gets a semicolon and space separated string containing the values in [performersSort](xiphcomment.md#performerssort) - -#### Returns - -`string` - -___ - -### lyrics - -• `get` **lyrics**(): `string` - -Gets the lyrics or script of the media represented by the current instance. - -**`inheritdoc`** `LYRICS` field - -#### Returns - -`string` - -Lyrics or script of the media represented by the current instance or `undefined` if - no value is present - -• `set` **lyrics**(`value`): `void` - -Gets the lyrics or script of the media represented by the current instance. - -**`inheritdoc`** `LYRICS` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -Lyrics or script of the media represented by the current instance or `undefined` if - no value is present - -___ - -### musicBrainzArtistId - -• `get` **musicBrainzArtistId**(): `string` - -Gets the MusicBrainz artist ID of the media represented by the current instance. - -**`inheritdoc`** `MUSICBRAINZ_ARTISTID` field - -#### Returns - -`string` - -MusicBrainz ArtistID of the media represented by the current instance or - `undefined` if no value is present - -• `set` **musicBrainzArtistId**(`value`): `void` - -Gets the MusicBrainz artist ID of the media represented by the current instance. - -**`inheritdoc`** `MUSICBRAINZ_ARTISTID` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -MusicBrainz ArtistID of the media represented by the current instance or - `undefined` if no value is present - -___ - -### musicBrainzDiscId - -• `get` **musicBrainzDiscId**(): `string` - -Gets the MusicBrainz disc ID of the media represented by the current instance. - -**`inheritdoc`** `MUSICBRAINZ_DISCID` field - -#### Returns - -`string` - -MusicBrainz DiscID of the media represented by the current instance or `undefined` - if no value is present - -• `set` **musicBrainzDiscId**(`value`): `void` - -Gets the MusicBrainz disc ID of the media represented by the current instance. - -**`inheritdoc`** `MUSICBRAINZ_DISCID` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -MusicBrainz DiscID of the media represented by the current instance or `undefined` - if no value is present - -___ - -### musicBrainzReleaseArtistId - -• `get` **musicBrainzReleaseArtistId**(): `string` - -Gets the MusicBrainz release artist ID of the media represented by the current instance. - -**`inheritdoc`** `MUSICBRAINZ_ALBUMARTISTID` field - -#### Returns - -`string` - -MusicBrainz ReleaseArtistID of the media represented by the current instance or - `undefined` if no value is present - -• `set` **musicBrainzReleaseArtistId**(`value`): `void` - -Gets the MusicBrainz release artist ID of the media represented by the current instance. - -**`inheritdoc`** `MUSICBRAINZ_ALBUMARTISTID` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -MusicBrainz ReleaseArtistID of the media represented by the current instance or - `undefined` if no value is present - -___ - -### musicBrainzReleaseCountry - -• `get` **musicBrainzReleaseCountry**(): `string` - -Gets the MusicBrainz release country of the media represented by the current instance. - -**`inheritdoc`** `RELEASECOUNTRY` field - -#### Returns - -`string` - -MusicBrainz ReleaseCountry of the media represented by the current instance or - `undefined` if no value is present - -• `set` **musicBrainzReleaseCountry**(`value`): `void` - -Gets the MusicBrainz release country of the media represented by the current instance. - -**`inheritdoc`** `RELEASECOUNTRY` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -MusicBrainz ReleaseCountry of the media represented by the current instance or - `undefined` if no value is present - -___ - -### musicBrainzReleaseGroupId - -• `get` **musicBrainzReleaseGroupId**(): `string` - -Gets the MusicBrainz release group ID of the media represented by the current instance. - -**`inheritdoc`** `MUSICBRAINZ_RELEASEGROUPID` field - -#### Returns - -`string` - -MusicBrainz ReleaseGroupID of the media represented by the current instance or - `undefined` if no value is present - -• `set` **musicBrainzReleaseGroupId**(`value`): `void` - -Gets the MusicBrainz release group ID of the media represented by the current instance. - -**`inheritdoc`** `MUSICBRAINZ_RELEASEGROUPID` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -MusicBrainz ReleaseGroupID of the media represented by the current instance or - `undefined` if no value is present - -___ - -### musicBrainzReleaseId - -• `get` **musicBrainzReleaseId**(): `string` - -Gets the MusicBrainz release ID of the media represented by the current instance. - -**`inheritdoc`** `MUSICBRAINZ_ALBUMID` field - -#### Returns - -`string` - -MusicBrainz ReleaseID of the media represented by the current instance or - `undefined` if no value is present - -• `set` **musicBrainzReleaseId**(`value`): `void` - -Gets the MusicBrainz release ID of the media represented by the current instance. - -**`inheritdoc`** `MUSICBRAINZ_ALBUMID` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -MusicBrainz ReleaseID of the media represented by the current instance or - `undefined` if no value is present - -___ - -### musicBrainzReleaseStatus - -• `get` **musicBrainzReleaseStatus**(): `string` - -Gets the MusicBrainz release status of the media represented by the current instance. - -**`inheritdoc`** `MUSICBRAINZ_ALBUMSTATUS` field - -#### Returns - -`string` - -MusicBrainz ReleaseStatus of the media represented by the current instance or - `undefined` if no value is present - -• `set` **musicBrainzReleaseStatus**(`value`): `void` - -Gets the MusicBrainz release status of the media represented by the current instance. - -**`inheritdoc`** `MUSICBRAINZ_ALBUMSTATUS` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -MusicBrainz ReleaseStatus of the media represented by the current instance or - `undefined` if no value is present - -___ - -### musicBrainzReleaseType - -• `get` **musicBrainzReleaseType**(): `string` - -Gets the MusicBrainz release type of the media represented by the current instance. - -**`inheritdoc`** `MUSICBRAINZ_ALBUMTYPE` field - -#### Returns - -`string` - -MusicBrainz ReleaseType of the media represented by the current instance or - `undefined` if no value is present - -• `set` **musicBrainzReleaseType**(`value`): `void` - -Gets the MusicBrainz release type of the media represented by the current instance. - -**`inheritdoc`** `MUSICBRAINZ_ALBUMTYPE` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -MusicBrainz ReleaseType of the media represented by the current instance or - `undefined` if no value is present - -___ - -### musicBrainzTrackId - -• `get` **musicBrainzTrackId**(): `string` - -Gets the MusicBrainz track ID of the media represented by the media represented by the -current instance. - -**`inheritdoc`** `MUSICBRAINZ_TRACKID` field - -#### Returns - -`string` - -MusicBrainz TrackID of the media represented by the current instance or `undefined` - if no value is present - -• `set` **musicBrainzTrackId**(`value`): `void` - -Gets the MusicBrainz track ID of the media represented by the media represented by the -current instance. - -**`inheritdoc`** `MUSICBRAINZ_TRACKID` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -MusicBrainz TrackID of the media represented by the current instance or `undefined` - if no value is present - -___ - -### musicIpId - -• `get` **musicIpId**(): `string` - -Gets the MusicIP PUID of the media represented by the current instance. - -**`inheritdoc`** `MUSICIP_PUID` field - -#### Returns - -`string` - -MusicIP PUID of the media represented by the current instance or `undefined` if no - value is present - -• `set` **musicIpId**(`value`): `void` - -Gets the MusicIP PUID of the media represented by the current instance. - -**`inheritdoc`** `MUSICID_PUID` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -MusicIP PUID of the media represented by the current instance or `undefined` if no - value is present - -___ - -### performers - -• `get` **performers**(): `string`[] - -Gets the performers or artists who performed in the media described by the current instance. - -**`inheritdoc`** `ARTIST` field - -#### Returns - -`string`[] - -Performers who performed in the media described by the current instance or an empty - array if no value is present. - -• `set` **performers**(`value`): `void` - -Gets the performers or artists who performed in the media described by the current instance. - -**`inheritdoc`** `ARTIST` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string`[] | - -#### Returns - -`void` - -Performers who performed in the media described by the current instance or an empty - array if no value is present. - -___ - -### performersRole - -• `get` **performersRole**(): `string`[] - -Gets the characters portrayed by an actor for a video or instruments played by a musician -for music. This must match the [performers](xiphcomment.md#performers) array (for each person, correspond one/more -role). Several roles for the same artist/actor can be separated with semicolons. For -example: "Bass; Backing Vocals; Vibraphone". - -**`inheritdoc`** `ARTISTROLE` field - -#### Returns - -`string`[] - -Array containing the roles played by the performers in the media described by the - current instance, or an empty array if no value is present. - -• `set` **performersRole**(`value`): `void` - -Gets the characters portrayed by an actor for a video or instruments played by a musician -for music. This must match the [performers](xiphcomment.md#performers) array (for each person, correspond one/more -role). Several roles for the same artist/actor can be separated with semicolons. For -example: "Bass; Backing Vocals; Vibraphone". - -**`inheritdoc`** `ARTISTROLE` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string`[] | - -#### Returns - -`void` - -Array containing the roles played by the performers in the media described by the - current instance, or an empty array if no value is present. - -___ - -### performersSort - -• `get` **performersSort**(): `string`[] - -Gets the sortable names of the performers or artists who performed in the media described by -the current instance. - -**`inheritdoc`** `ARTISTSORT` field - -#### Returns - -`string`[] - -Sortable names for the performers who performed in the media described by the - current instance, or an empty array if no value is present. - -• `set` **performersSort**(`value`): `void` - -Gets the sortable names of the performers or artists who performed in the media described by -the current instance. - -**`inheritdoc`** `ARTIST` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string`[] | - -#### Returns - -`void` - -Sortable names for the performers who performed in the media described by the - current instance, or an empty array if no value is present. - -___ - -### pictures - -• `get` **pictures**(): [`IPicture`](../interfaces/ipicture.md)[] - -Gets a collection of pictures associated with the media represented by the current instance. - -**`inheritdoc`** - -#### Returns - -[`IPicture`](../interfaces/ipicture.md)[] - -Array containing a collection of pictures associated with the media represented by - the current instance or an empty array if no pictures are present. - -• `set` **pictures**(`value`): `void` - -Gets a collection of pictures associated with the media represented by the current instance. - -**`inheritdoc`** - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | [`IPicture`](../interfaces/ipicture.md)[] | - -#### Returns - -`void` - -Array containing a collection of pictures associated with the media represented by - the current instance or an empty array if no pictures are present. - -___ - -### publisher - -• `get` **publisher**(): `string` - -Gets the publisher of the track. - -**`inheritdoc`** `ORGANIZATION` field - -#### Returns - -`string` - -Publisher of the track or `undefined` if no value is set - -• `set` **publisher**(`value`): `void` - -Gets the publisher of the track. - -**`inheritdoc`** `ORGANIZATION` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -Publisher of the track or `undefined` if no value is set - -___ - -### remixedBy - -• `get` **remixedBy**(): `string` - -Gets the remixer of the track. - -**`inheritdoc`** `REMIXEDBY` field - -#### Returns - -`string` - -Remixer of the track or `undefined` if no value is set - -• `set` **remixedBy**(`value`): `void` - -Gets the remixer of the track. - -**`inheritdoc`** `REMIXEDBY` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -Remixer of the track or `undefined` if no value is set - -___ - -### replayGainAlbumGain - -• `get` **replayGainAlbumGain**(): `number` - -Gets the ReplayGain album gain in dB. - -**`inheritdoc`** `REPLAYGAIN_ALBUM_GAIN` field - -#### Returns - -`number` - -Album gain as per the ReplayGain specifications, in dB, or `NaN` if no value is set - -• `set` **replayGainAlbumGain**(`value`): `void` - -Gets the ReplayGain album gain in dB. - -**`inheritdoc`** `REPLAYGAIN_ALBUM_GAIN` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `number` | - -#### Returns - -`void` - -Album gain as per the ReplayGain specifications, in dB, or `NaN` if no value is set - -___ - -### replayGainAlbumPeak - -• `get` **replayGainAlbumPeak**(): `number` - -Gets the ReplayGain album peak sample. - -**`inheritdoc`** `REPLAYGAIN_ALBUM_PEAK` field - -#### Returns - -`number` - -Album peak as per the ReplayGain specifications, or `NaN` if no value is set - -• `set` **replayGainAlbumPeak**(`value`): `void` - -Gets the ReplayGain album peak sample. - -**`inheritdoc`** `REPLAYGAIN_TRACK_PEAK` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `number` | - -#### Returns - -`void` - -Album peak as per the ReplayGain specifications, or `NaN` if no value is set - -___ - -### replayGainTrackGain - -• `get` **replayGainTrackGain**(): `number` - -Gets the ReplayGain track gain in dB. - -**`inheritdoc`** `REPLAYGAIN_TRACK_GAIN` field - -#### Returns - -`number` - -Track gain as per ReplayGain specifications, in dB, or `NaN` if no value is set - -• `set` **replayGainTrackGain**(`value`): `void` - -Gets the ReplayGain track gain in dB. - -**`inheritdoc`** `REPLAYGAIN_TRACK_GAIN` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `number` | - -#### Returns - -`void` - -Track gain as per ReplayGain specifications, in dB, or `NaN` if no value is set - -___ - -### replayGainTrackPeak - -• `get` **replayGainTrackPeak**(): `number` - -Gets the ReplayGain track peak sample. - -**`inheritdoc`** `REPLAYGAIN_TRACK_PEAK` field - -#### Returns - -`number` - -Track peak as per the ReplayGain specifications, or `NaN` if no value is set - -• `set` **replayGainTrackPeak**(`value`): `void` - -Gets the ReplayGain track peak sample. - -**`inheritdoc`** `REPLAYGAIN_TRACK_PEAK` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `number` | - -#### Returns - -`void` - -Track peak as per the ReplayGain specifications, or `NaN` if no value is set - -___ - -### sizeOnDisk - -• `get` **sizeOnDisk**(): `number` - -Gets the size of the tag in bytes on disk as it was read from disk. - -**`inheritdoc`** - -#### Returns - -`number` - -___ - -### subtitle - -• `get` **subtitle**(): `string` - -Gets a description, one-line. It represents the tagline of the vide/music. - -**`inheritdoc`** `SUBTITLE` field - -#### Returns - -`string` - -Subtitle of the media represented by the current instance or `undefined` if no - value is present - -• `set` **subtitle**(`value`): `void` - -Gets a description, one-line. It represents the tagline of the vide/music. - -**`inheritdoc`** `SUBTITLE` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -Subtitle of the media represented by the current instance or `undefined` if no - value is present - -___ - -### tagTypes - -• `get` **tagTypes**(): [`TagTypes`](../enums/tagtypes.md) - -Gets the tag types contained in the current instance. A bit wise combined [TagTypes](../enums/tagtypes.md) -containing the tag types contained in the current instance. - -**`inheritdoc`** returns [TagTypes.Xiph](../enums/tagtypes.md#xiph) - -#### Returns - -[`TagTypes`](../enums/tagtypes.md) - -___ - -### title - -• `get` **title**(): `string` - -Gets the title for the media described by the current instance. - -**`inheritdoc`** `TITLE` field - -#### Returns - -`string` - -Title of the media described by the current instance or `undefined` if no value is - present. - -• `set` **title**(`value`): `void` - -Gets the title for the media described by the current instance. - -**`inheritdoc`** `TITLE` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -Title of the media described by the current instance or `undefined` if no value is - present. - -___ - -### titleSort - -• `get` **titleSort**(): `string` - -Gets the sortable name for the title of the media described by the current instance. - -**`inheritdoc`** `TITLESORT` field - -#### Returns - -`string` - -Sortable name of the media described by the current instance or `undefined` if no - value is present - -• `set` **titleSort**(`value`): `void` - -Gets the sortable name for the title of the media described by the current instance. - -**`inheritdoc`** `TITLESORT` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `string` | - -#### Returns - -`void` - -Sortable name of the media described by the current instance or `undefined` if no - value is present - -___ - -### track - -• `get` **track**(): `number` - -Gets the position of the media represented by the current instance in its containing album -or season (for a series). - -**`inheritdoc`** `TRACKNUMBER` field - -#### Returns - -`number` - -Position of the media represented by the current instance in its containing album - or `0` if not specified. - -• `set` **track**(`value`): `void` - -Gets the position of the media represented by the current instance in its containing album -or season (for a series). - -**`inheritdoc`** `TRACKNUMBER` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `number` | - -#### Returns - -`void` - -Position of the media represented by the current instance in its containing album - or `0` if not specified. - -___ - -### trackCount - -• `get` **trackCount**(): `number` - -Gets the number of tracks in the album or the number of episodes in a series of the media -represented by the current instance. - -**`inheritdoc`** `TRACKTOTAL` as per standard, but the denominator of `TRACKNUMBER` is also - used if `TRACKTOTAL` is not available. - -#### Returns - -`number` - -Number of tracks in the album or number of episodes in a series of the media - represented by the current instance or `0` if not specified. - -• `set` **trackCount**(`value`): `void` - -Gets the number of tracks in the album or the number of episodes in a series of the media -represented by the current instance. - -**`inheritdoc`** `TRACKNUMBER` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `number` | - -#### Returns - -`void` - -Number of tracks in the album or number of episodes in a series of the media - represented by the current instance or `0` if not specified. - -___ - -### vendorId - -• `get` **vendorId**(): `string` - -Gets the vendor ID for the current instance. - -#### Returns - -`string` - -___ - -### year - -• `get` **year**(): `number` - -Gets the year that the media represented by the current instance was recorded. - -**`inheritdoc`** `DATE` field - -#### Returns - -`number` - -Year that the media represented by the current instance was created or `0` if no - value is present. - -• `set` **year**(`value`): `void` - -Gets the year that the media represented by the current instance was recorded. - -**`inheritdoc`** `DATE` field - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `number` | - -#### Returns - -`void` - -Year that the media represented by the current instance was created or `0` if no - value is present. - -## Methods - -### clear - -▸ **clear**(): `void` - -Clears all values stored in the current instance. - -**`remarks`** The clearing procedure is format specific and should clear all values. - -#### Returns - -`void` - -#### Overrides - -[Tag](tag.md).[clear](tag.md#clear) - -___ - -### copyTo - -▸ **copyTo**(`target`, `overwrite`): `void` - -Copies the values from the current instance to another [Tag](tag.md), optionally overwriting - existing values. - -**`remarks`** This method only copies the most basic values when copying between different tag - formats. However, if `target` is of the same type as the current instance, - more advanced copying may be done. For example if both `this` and `target` are - [Id3v2Tag](id3v2tag.md), all frames will be copied to the target. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `target` | [`Tag`](tag.md) | Target tag to copy values to | -| `overwrite` | `boolean` | Whether or not to copy values over existing ones | - -#### Returns - -`void` - -#### Overrides - -[Tag](tag.md).[copyTo](tag.md#copyto) - -___ - -### getField - -▸ **getField**(`key`): `string`[] - -Gets the field data for a given field identifier. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `key` | `string` | Field identifier to look up | - -#### Returns - -`string`[] - -string[] Field data or undefined if the field cannot be found - -___ - -### getFieldFirstValue - -▸ **getFieldFirstValue**(`key`): `string` - -Gets the first value in a field for a given field identifier. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `key` | `string` | Field identifier to look up | - -#### Returns - -`string` - -string Field data or `undefined` if the field was notfound - -___ - -### removeField - -▸ **removeField**(`key`): `void` - -Removes a field and all its values from the current instance. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `key` | `string` | Field identifier to remove | - -#### Returns - -`void` - -___ - -### render - -▸ **render**(`addFramingBit`): [`ByteVector`](bytevector.md) - -Renders the current instance as a raw Xiph comment, optionally adding a framing bit. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `addFramingBit` | `boolean` | Whether or not to add a framing bit to the end of the content. | - -#### Returns - -[`ByteVector`](bytevector.md) - -___ - -### setFieldAsStrings - -▸ **setFieldAsStrings**(`key`, ...`values`): `void` - -Sets the contents of a specified field to the provided strings. All values are trimmed and -empty/undefined values are excluded. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `key` | `string` | Field identifier to set | -| `...values` | `string`[] | Values to store in the current instance | - -#### Returns - -`void` - -___ - -### setFieldAsUint - -▸ **setFieldAsUint**(`key`, `value`, `minPlaces?`): `void` - -Sets the contents of a specified field to the provided number. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `key` | `string` | `undefined` | Field identifier to set | -| `value` | `number` | `undefined` | Value to store, must be a positive, 32-bit integer | -| `minPlaces` | `number` | `1` | Number of places to include at a minimum, if the number has fewer places than this, the value will be padded with zeroes. | - -#### Returns - -`void` - -___ - -### setInfoTag - -▸ **setInfoTag**(): `void` - -Set the tags that represent the tagger software (node-taglib-sharp) itself. - -**`remarks`** This is typically a method to call just before saving a tag. - -#### Returns - -`void` - -#### Inherited from - -[Tag](tag.md).[setInfoTag](tag.md#setinfotag) - -___ - -### firstInGroup - -▸ `Static` `Protected` **firstInGroup**(`group`): `string` - -Gets the first string in an array. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `group` | `string`[] | Array of strings to get the first string from. | - -#### Returns - -`string` - -First string contained in `group` or `undefined` if the array is - `undefined` or empty - -#### Inherited from - -[Tag](tag.md).[firstInGroup](tag.md#firstingroup) - -___ - -### fromData - -▸ `Static` **fromData**(`data`): [`XiphComment`](xiphcomment.md) - -Constructs and initializes a new instance by reading the contents of a raw Xiph comment from -a [ByteVector](bytevector.md) object. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `data` | [`ByteVector`](bytevector.md) | Object containing a raw Xiph comment, cannot be falsey | - -#### Returns - -[`XiphComment`](xiphcomment.md) - -___ - -### fromEmpty - -▸ `Static` **fromEmpty**(): [`XiphComment`](xiphcomment.md) - -Constructs and initializes a new instance with no contents. - -#### Returns - -[`XiphComment`](xiphcomment.md) - -___ - -### isFalsyOrLikeEmpty - -▸ `Static` `Protected` **isFalsyOrLikeEmpty**(`value`): `boolean` - -Checks if a value is falsy or empty. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `string`[] | Object to check | - -#### Returns - -`boolean` - -If `value` is a string, `true` is returned if the value is falsy or all - whitespace, `false` is returned otherwise. If `value` is an array of strings, - the array must be falsy or all elements must be falsy or whitespace to return `true`. - -#### Inherited from - -[Tag](tag.md).[isFalsyOrLikeEmpty](tag.md#isfalsyorlikeempty) - -___ - -### joinGroup - -▸ `Static` `Protected` **joinGroup**(`group`): `string` - -Joins an array of string into a single, semicolon and space separated string. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `group` | `string`[] | Array of string to join | - -#### Returns - -`string` - -A semicolon and space separated string containing the values from `group` - or undefined if the array is `undefined` or empty. - -#### Inherited from - -[Tag](tag.md).[joinGroup](tag.md#joingroup) - -___ - -### tagTypeFlagsToArray - -▸ `Static` **tagTypeFlagsToArray**(`tagTypes`): [`TagTypes`](../enums/tagtypes.md)[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `tagTypes` | [`TagTypes`](../enums/tagtypes.md) | - -#### Returns - -[`TagTypes`](../enums/tagtypes.md)[] - -#### Inherited from - -[Tag](tag.md).[tagTypeFlagsToArray](tag.md#tagtypeflagstoarray) diff --git a/docs/enums/asfobjectdatatype.md b/docs/enums/AsfObjectDataType.md similarity index 76% rename from docs/enums/asfobjectdatatype.md rename to docs/enums/AsfObjectDataType.md index 0cf6eb09..db3233f5 100644 --- a/docs/enums/asfobjectdatatype.md +++ b/docs/enums/AsfObjectDataType.md @@ -8,13 +8,13 @@ Indicates the type of data stored in a {@link ContentDescriptor} or {@link Metad ### Enumeration members -- [Bool](asfobjectdatatype.md#bool) -- [Bytes](asfobjectdatatype.md#bytes) -- [DWord](asfobjectdatatype.md#dword) -- [Guid](asfobjectdatatype.md#guid) -- [QWord](asfobjectdatatype.md#qword) -- [Unicode](asfobjectdatatype.md#unicode) -- [Word](asfobjectdatatype.md#word) +- [Bool](AsfObjectDataType.md#bool) +- [Bytes](AsfObjectDataType.md#bytes) +- [DWord](AsfObjectDataType.md#dword) +- [Guid](AsfObjectDataType.md#guid) +- [QWord](AsfObjectDataType.md#qword) +- [Unicode](AsfObjectDataType.md#unicode) +- [Word](AsfObjectDataType.md#word) ## Enumeration members diff --git a/docs/enums/AviStreamType.md b/docs/enums/AviStreamType.md new file mode 100644 index 00000000..942d7dcd --- /dev/null +++ b/docs/enums/AviStreamType.md @@ -0,0 +1,44 @@ +[node-taglib-sharp](../README.md) / [Exports](../modules.md) / AviStreamType + +# Enumeration: AviStreamType + +## Table of contents + +### Enumeration members + +- [AudioStream](AviStreamType.md#audiostream) +- [MidiStream](AviStreamType.md#midistream) +- [TextStream](AviStreamType.md#textstream) +- [VideoStream](AviStreamType.md#videostream) + +## Enumeration members + +### AudioStream + +• **AudioStream** = `1935963489` + +Audio Stream + +___ + +### MidiStream + +• **MidiStream** = `1919183213` + +MIDI Stream + +___ + +### TextStream + +• **TextStream** = `1937012852` + +Text stream + +___ + +### VideoStream + +• **VideoStream** = `1935960438` + +Video stream diff --git a/docs/enums/fileaccessmode.md b/docs/enums/FileAccessMode.md similarity index 76% rename from docs/enums/fileaccessmode.md rename to docs/enums/FileAccessMode.md index 277ee873..bb37f43a 100644 --- a/docs/enums/fileaccessmode.md +++ b/docs/enums/FileAccessMode.md @@ -2,15 +2,15 @@ # Enumeration: FileAccessMode -Specifies the type of file access operations currently permitted on an instance of [File](../classes/file.md) +Specifies the type of file access operations currently permitted on an instance of [File](../classes/File.md) ## Table of contents ### Enumeration members -- [Closed](fileaccessmode.md#closed) -- [Read](fileaccessmode.md#read) -- [Write](fileaccessmode.md#write) +- [Closed](FileAccessMode.md#closed) +- [Read](FileAccessMode.md#read) +- [Write](FileAccessMode.md#write) ## Enumeration members diff --git a/docs/enums/id3v2eventtype.md b/docs/enums/Id3v2EventType.md similarity index 63% rename from docs/enums/id3v2eventtype.md rename to docs/enums/Id3v2EventType.md index c33aa627..f913d960 100644 --- a/docs/enums/id3v2eventtype.md +++ b/docs/enums/Id3v2EventType.md @@ -6,31 +6,31 @@ ### Enumeration members -- [AudioEnd](id3v2eventtype.md#audioend) -- [AudioFileEnd](id3v2eventtype.md#audiofileend) -- [EndOfInitialSilence](id3v2eventtype.md#endofinitialsilence) -- [InterludeStart](id3v2eventtype.md#interludestart) -- [IntroEnd](id3v2eventtype.md#introend) -- [IntroStart](id3v2eventtype.md#introstart) -- [KeyChange](id3v2eventtype.md#keychange) -- [MainPartEnd](id3v2eventtype.md#mainpartend) -- [MainPartStart](id3v2eventtype.md#mainpartstart) -- [MomentaryUnwantedNoise](id3v2eventtype.md#momentaryunwantednoise) -- [OutroEnd](id3v2eventtype.md#outroend) -- [OutroStart](id3v2eventtype.md#outrostart) -- [Padding](id3v2eventtype.md#padding) -- [Profanity](id3v2eventtype.md#profanity) -- [ProfanityEnd](id3v2eventtype.md#profanityend) -- [RefrainEnd](id3v2eventtype.md#refrainend) -- [RefrainStart](id3v2eventtype.md#refrainstart) -- [SustainedNoise](id3v2eventtype.md#sustainednoise) -- [SustainedNoiseEnd](id3v2eventtype.md#sustainednoiseend) -- [ThemeEnd](id3v2eventtype.md#themeend) -- [ThemeStart](id3v2eventtype.md#themestart) -- [TimeChange](id3v2eventtype.md#timechange) -- [VariationStart](id3v2eventtype.md#variationstart) -- [VerseEnd](id3v2eventtype.md#verseend) -- [VerseStart](id3v2eventtype.md#versestart) +- [AudioEnd](Id3v2EventType.md#audioend) +- [AudioFileEnd](Id3v2EventType.md#audiofileend) +- [EndOfInitialSilence](Id3v2EventType.md#endofinitialsilence) +- [InterludeStart](Id3v2EventType.md#interludestart) +- [IntroEnd](Id3v2EventType.md#introend) +- [IntroStart](Id3v2EventType.md#introstart) +- [KeyChange](Id3v2EventType.md#keychange) +- [MainPartEnd](Id3v2EventType.md#mainpartend) +- [MainPartStart](Id3v2EventType.md#mainpartstart) +- [MomentaryUnwantedNoise](Id3v2EventType.md#momentaryunwantednoise) +- [OutroEnd](Id3v2EventType.md#outroend) +- [OutroStart](Id3v2EventType.md#outrostart) +- [Padding](Id3v2EventType.md#padding) +- [Profanity](Id3v2EventType.md#profanity) +- [ProfanityEnd](Id3v2EventType.md#profanityend) +- [RefrainEnd](Id3v2EventType.md#refrainend) +- [RefrainStart](Id3v2EventType.md#refrainstart) +- [SustainedNoise](Id3v2EventType.md#sustainednoise) +- [SustainedNoiseEnd](Id3v2EventType.md#sustainednoiseend) +- [ThemeEnd](Id3v2EventType.md#themeend) +- [ThemeStart](Id3v2EventType.md#themestart) +- [TimeChange](Id3v2EventType.md#timechange) +- [VariationStart](Id3v2EventType.md#variationstart) +- [VerseEnd](Id3v2EventType.md#verseend) +- [VerseStart](Id3v2EventType.md#versestart) ## Enumeration members diff --git a/docs/enums/id3v2frameclasstype.md b/docs/enums/Id3v2FrameClassType.md similarity index 56% rename from docs/enums/id3v2frameclasstype.md rename to docs/enums/Id3v2FrameClassType.md index dd37d28a..5229ddb9 100644 --- a/docs/enums/id3v2frameclasstype.md +++ b/docs/enums/Id3v2FrameClassType.md @@ -6,23 +6,23 @@ ### Enumeration members -- [AttachmentFrame](id3v2frameclasstype.md#attachmentframe) -- [CommentsFrame](id3v2frameclasstype.md#commentsframe) -- [EventTimeCodeFrame](id3v2frameclasstype.md#eventtimecodeframe) -- [MusicCdIdentifierFrame](id3v2frameclasstype.md#musiccdidentifierframe) -- [PlayCountFrame](id3v2frameclasstype.md#playcountframe) -- [PopularimeterFrame](id3v2frameclasstype.md#popularimeterframe) -- [PrivateFrame](id3v2frameclasstype.md#privateframe) -- [RelativeVolumeFrame](id3v2frameclasstype.md#relativevolumeframe) -- [SynchronizedLyricsFrame](id3v2frameclasstype.md#synchronizedlyricsframe) -- [TermsOfUseFrame](id3v2frameclasstype.md#termsofuseframe) -- [TextInformationFrame](id3v2frameclasstype.md#textinformationframe) -- [UniqueFileIdentifierFrame](id3v2frameclasstype.md#uniquefileidentifierframe) -- [UnknownFrame](id3v2frameclasstype.md#unknownframe) -- [UnsynchronizedLyricsFrame](id3v2frameclasstype.md#unsynchronizedlyricsframe) -- [UrlLinkFrame](id3v2frameclasstype.md#urllinkframe) -- [UserTextInformationFrame](id3v2frameclasstype.md#usertextinformationframe) -- [UserUrlLinkFrame](id3v2frameclasstype.md#userurllinkframe) +- [AttachmentFrame](Id3v2FrameClassType.md#attachmentframe) +- [CommentsFrame](Id3v2FrameClassType.md#commentsframe) +- [EventTimeCodeFrame](Id3v2FrameClassType.md#eventtimecodeframe) +- [MusicCdIdentifierFrame](Id3v2FrameClassType.md#musiccdidentifierframe) +- [PlayCountFrame](Id3v2FrameClassType.md#playcountframe) +- [PopularimeterFrame](Id3v2FrameClassType.md#popularimeterframe) +- [PrivateFrame](Id3v2FrameClassType.md#privateframe) +- [RelativeVolumeFrame](Id3v2FrameClassType.md#relativevolumeframe) +- [SynchronizedLyricsFrame](Id3v2FrameClassType.md#synchronizedlyricsframe) +- [TermsOfUseFrame](Id3v2FrameClassType.md#termsofuseframe) +- [TextInformationFrame](Id3v2FrameClassType.md#textinformationframe) +- [UniqueFileIdentifierFrame](Id3v2FrameClassType.md#uniquefileidentifierframe) +- [UnknownFrame](Id3v2FrameClassType.md#unknownframe) +- [UnsynchronizedLyricsFrame](Id3v2FrameClassType.md#unsynchronizedlyricsframe) +- [UrlLinkFrame](Id3v2FrameClassType.md#urllinkframe) +- [UserTextInformationFrame](Id3v2FrameClassType.md#usertextinformationframe) +- [UserUrlLinkFrame](Id3v2FrameClassType.md#userurllinkframe) ## Enumeration members diff --git a/docs/enums/id3v2frameflags.md b/docs/enums/Id3v2FrameFlags.md similarity index 60% rename from docs/enums/id3v2frameflags.md rename to docs/enums/Id3v2FrameFlags.md index de744349..91dbb4a0 100644 --- a/docs/enums/id3v2frameflags.md +++ b/docs/enums/Id3v2FrameFlags.md @@ -6,15 +6,15 @@ ### Enumeration members -- [Compression](id3v2frameflags.md#compression) -- [DataLengthIndicator](id3v2frameflags.md#datalengthindicator) -- [Desynchronized](id3v2frameflags.md#desynchronized) -- [Encryption](id3v2frameflags.md#encryption) -- [FileAlterPreservation](id3v2frameflags.md#filealterpreservation) -- [GroupingIdentity](id3v2frameflags.md#groupingidentity) -- [None](id3v2frameflags.md#none) -- [ReadOnly](id3v2frameflags.md#readonly) -- [TagAlterPreservation](id3v2frameflags.md#tagalterpreservation) +- [Compression](Id3v2FrameFlags.md#compression) +- [DataLengthIndicator](Id3v2FrameFlags.md#datalengthindicator) +- [Encryption](Id3v2FrameFlags.md#encryption) +- [FileAlterPreservation](Id3v2FrameFlags.md#filealterpreservation) +- [GroupingIdentity](Id3v2FrameFlags.md#groupingidentity) +- [None](Id3v2FrameFlags.md#none) +- [ReadOnly](Id3v2FrameFlags.md#readonly) +- [TagAlterPreservation](Id3v2FrameFlags.md#tagalterpreservation) +- [Unsynchronized](Id3v2FrameFlags.md#unsynchronized) ## Enumeration members @@ -34,14 +34,6 @@ Frame has a data length indicator. ___ -### Desynchronized - -• **Desynchronized** = `2` - -Frame data has been desynchronized. - -___ - ### Encryption • **Encryption** = `4` @@ -87,3 +79,11 @@ ___ • **TagAlterPreservation** = `16384` Frame is to be deleted if the tag is altered. + +___ + +### Unsynchronized + +• **Unsynchronized** = `2` + +Frame data has been unsynchronized using the ID3v2 unsynchronization scheme. diff --git a/docs/enums/id3v2relativevolumeframechanneltype.md b/docs/enums/Id3v2RelativeVolumeFrameChannelType.md similarity index 62% rename from docs/enums/id3v2relativevolumeframechanneltype.md rename to docs/enums/Id3v2RelativeVolumeFrameChannelType.md index 5470c584..6ff7ec3a 100644 --- a/docs/enums/id3v2relativevolumeframechanneltype.md +++ b/docs/enums/Id3v2RelativeVolumeFrameChannelType.md @@ -2,21 +2,21 @@ # Enumeration: Id3v2RelativeVolumeFrameChannelType -Type of channel data to get from or set to a [RelativeVolumeFrame](id3v2frameclasstype.md#relativevolumeframe) object +Type of channel data to get from or set to a [RelativeVolumeFrame](Id3v2FrameClassType.md#relativevolumeframe) object ## Table of contents ### Enumeration members -- [BackCenter](id3v2relativevolumeframechanneltype.md#backcenter) -- [BackLeft](id3v2relativevolumeframechanneltype.md#backleft) -- [BackRight](id3v2relativevolumeframechanneltype.md#backright) -- [FrontCentre](id3v2relativevolumeframechanneltype.md#frontcentre) -- [FrontLeft](id3v2relativevolumeframechanneltype.md#frontleft) -- [FrontRight](id3v2relativevolumeframechanneltype.md#frontright) -- [MasterVolume](id3v2relativevolumeframechanneltype.md#mastervolume) -- [Other](id3v2relativevolumeframechanneltype.md#other) -- [Subwoofer](id3v2relativevolumeframechanneltype.md#subwoofer) +- [BackCenter](Id3v2RelativeVolumeFrameChannelType.md#backcenter) +- [BackLeft](Id3v2RelativeVolumeFrameChannelType.md#backleft) +- [BackRight](Id3v2RelativeVolumeFrameChannelType.md#backright) +- [FrontCentre](Id3v2RelativeVolumeFrameChannelType.md#frontcentre) +- [FrontLeft](Id3v2RelativeVolumeFrameChannelType.md#frontleft) +- [FrontRight](Id3v2RelativeVolumeFrameChannelType.md#frontright) +- [MasterVolume](Id3v2RelativeVolumeFrameChannelType.md#mastervolume) +- [Other](Id3v2RelativeVolumeFrameChannelType.md#other) +- [Subwoofer](Id3v2RelativeVolumeFrameChannelType.md#subwoofer) ## Enumeration members diff --git a/docs/enums/id3v2synchronizedtexttype.md b/docs/enums/Id3v2SynchronizedTextType.md similarity index 68% rename from docs/enums/id3v2synchronizedtexttype.md rename to docs/enums/Id3v2SynchronizedTextType.md index d11b33fa..7e0f8d71 100644 --- a/docs/enums/id3v2synchronizedtexttype.md +++ b/docs/enums/Id3v2SynchronizedTextType.md @@ -8,15 +8,15 @@ Specifies the type of text contained in a synchronized lyrics frame ### Enumeration members -- [Chord](id3v2synchronizedtexttype.md#chord) -- [Events](id3v2synchronizedtexttype.md#events) -- [ImageUrls](id3v2synchronizedtexttype.md#imageurls) -- [Lyrics](id3v2synchronizedtexttype.md#lyrics) -- [Movement](id3v2synchronizedtexttype.md#movement) -- [Other](id3v2synchronizedtexttype.md#other) -- [TextTranscription](id3v2synchronizedtexttype.md#texttranscription) -- [Trivia](id3v2synchronizedtexttype.md#trivia) -- [WebpageUrls](id3v2synchronizedtexttype.md#webpageurls) +- [Chord](Id3v2SynchronizedTextType.md#chord) +- [Events](Id3v2SynchronizedTextType.md#events) +- [ImageUrls](Id3v2SynchronizedTextType.md#imageurls) +- [Lyrics](Id3v2SynchronizedTextType.md#lyrics) +- [Movement](Id3v2SynchronizedTextType.md#movement) +- [Other](Id3v2SynchronizedTextType.md#other) +- [TextTranscription](Id3v2SynchronizedTextType.md#texttranscription) +- [Trivia](Id3v2SynchronizedTextType.md#trivia) +- [WebpageUrls](Id3v2SynchronizedTextType.md#webpageurls) ## Enumeration members diff --git a/docs/enums/id3v2tagheaderflags.md b/docs/enums/Id3v2TagHeaderFlags.md similarity index 63% rename from docs/enums/id3v2tagheaderflags.md rename to docs/enums/Id3v2TagHeaderFlags.md index c25289ac..c5ac334d 100644 --- a/docs/enums/id3v2tagheaderflags.md +++ b/docs/enums/Id3v2TagHeaderFlags.md @@ -6,11 +6,11 @@ ### Enumeration members -- [ExperimentalIndicator](id3v2tagheaderflags.md#experimentalindicator) -- [ExtendedHeader](id3v2tagheaderflags.md#extendedheader) -- [FooterPresent](id3v2tagheaderflags.md#footerpresent) -- [None](id3v2tagheaderflags.md#none) -- [Unsynchronization](id3v2tagheaderflags.md#unsynchronization) +- [ExperimentalIndicator](Id3v2TagHeaderFlags.md#experimentalindicator) +- [ExtendedHeader](Id3v2TagHeaderFlags.md#extendedheader) +- [FooterPresent](Id3v2TagHeaderFlags.md#footerpresent) +- [None](Id3v2TagHeaderFlags.md#none) +- [Unsynchronization](Id3v2TagHeaderFlags.md#unsynchronization) ## Enumeration members @@ -50,4 +50,5 @@ ___ • **Unsynchronization** = `128` -The tag described by the header has been desynchronized. +The tag described by the header has been unsynchronized using the ID3v2 unsynchronization +scheme. diff --git a/docs/enums/id3v2timestampformat.md b/docs/enums/Id3v2TimestampFormat.md similarity index 78% rename from docs/enums/id3v2timestampformat.md rename to docs/enums/Id3v2TimestampFormat.md index 8d5d56a9..3dbe443b 100644 --- a/docs/enums/id3v2timestampformat.md +++ b/docs/enums/Id3v2TimestampFormat.md @@ -8,9 +8,9 @@ Specifies the timestamp format used by a few frame types. ### Enumeration members -- [AbsoluteMilliseconds](id3v2timestampformat.md#absolutemilliseconds) -- [AbsoluteMpegFrames](id3v2timestampformat.md#absolutempegframes) -- [Unknown](id3v2timestampformat.md#unknown) +- [AbsoluteMilliseconds](Id3v2TimestampFormat.md#absolutemilliseconds) +- [AbsoluteMpegFrames](Id3v2TimestampFormat.md#absolutempegframes) +- [Unknown](Id3v2TimestampFormat.md#unknown) ## Enumeration members diff --git a/docs/enums/mediatypes.md b/docs/enums/MediaTypes.md similarity index 72% rename from docs/enums/mediatypes.md rename to docs/enums/MediaTypes.md index 1430b6b8..d91524c2 100644 --- a/docs/enums/mediatypes.md +++ b/docs/enums/MediaTypes.md @@ -2,19 +2,19 @@ # Enumeration: MediaTypes -Indicates the types o media represented by a [ICodec](../interfaces/icodec.md) or [Properties](../classes/properties.md). These values +Indicates the types o media represented by a [ICodec](../interfaces/ICodec.md) or [Properties](../classes/Properties.md). These values can be combined to represent multiple media types. ## Table of contents ### Enumeration members -- [Audio](mediatypes.md#audio) -- [LosslessAudio](mediatypes.md#losslessaudio) -- [None](mediatypes.md#none) -- [Photo](mediatypes.md#photo) -- [Text](mediatypes.md#text) -- [Video](mediatypes.md#video) +- [Audio](MediaTypes.md#audio) +- [LosslessAudio](MediaTypes.md#losslessaudio) +- [None](MediaTypes.md#none) +- [Photo](MediaTypes.md#photo) +- [Text](MediaTypes.md#text) +- [Video](MediaTypes.md#video) ## Enumeration members diff --git a/docs/enums/mpegaudiochannelmode.md b/docs/enums/MpegAudioChannelMode.md similarity index 70% rename from docs/enums/mpegaudiochannelmode.md rename to docs/enums/MpegAudioChannelMode.md index ea67a0f7..cbf98b91 100644 --- a/docs/enums/mpegaudiochannelmode.md +++ b/docs/enums/MpegAudioChannelMode.md @@ -8,10 +8,10 @@ Indicates the MPEG audio channel mode of a file or stream. ### Enumeration members -- [DualChannel](mpegaudiochannelmode.md#dualchannel) -- [JointStereo](mpegaudiochannelmode.md#jointstereo) -- [SingleChannel](mpegaudiochannelmode.md#singlechannel) -- [Stereo](mpegaudiochannelmode.md#stereo) +- [DualChannel](MpegAudioChannelMode.md#dualchannel) +- [JointStereo](MpegAudioChannelMode.md#jointstereo) +- [SingleChannel](MpegAudioChannelMode.md#singlechannel) +- [Stereo](MpegAudioChannelMode.md#stereo) ## Enumeration members diff --git a/docs/enums/mpegversion.md b/docs/enums/MpegVersion.md similarity index 74% rename from docs/enums/mpegversion.md rename to docs/enums/MpegVersion.md index b45e3713..55f4ff56 100644 --- a/docs/enums/mpegversion.md +++ b/docs/enums/MpegVersion.md @@ -8,10 +8,10 @@ Indicates the MPEG version of a file or stream. ### Enumeration members -- [Unknown](mpegversion.md#unknown) -- [Version1](mpegversion.md#version1) -- [Version2](mpegversion.md#version2) -- [Version25](mpegversion.md#version25) +- [Unknown](MpegVersion.md#unknown) +- [Version1](MpegVersion.md#version1) +- [Version2](MpegVersion.md#version2) +- [Version25](MpegVersion.md#version25) ## Enumeration members diff --git a/docs/enums/picturetype.md b/docs/enums/PictureType.md similarity index 72% rename from docs/enums/picturetype.md rename to docs/enums/PictureType.md index 2dd3d1be..4e3c6971 100644 --- a/docs/enums/picturetype.md +++ b/docs/enums/PictureType.md @@ -2,34 +2,34 @@ # Enumeration: PictureType -The type of content appearing in an [IPicture](../interfaces/ipicture.md) instance. +The type of content appearing in an [IPicture](../interfaces/IPicture.md) instance. ## Table of contents ### Enumeration members -- [Artist](picturetype.md#artist) -- [BackCover](picturetype.md#backcover) -- [Band](picturetype.md#band) -- [BandLogo](picturetype.md#bandlogo) -- [ColoredFish](picturetype.md#coloredfish) -- [Composer](picturetype.md#composer) -- [Conductor](picturetype.md#conductor) -- [DuringPerformance](picturetype.md#duringperformance) -- [DuringRecording](picturetype.md#duringrecording) -- [FileIcon](picturetype.md#fileicon) -- [FrontCover](picturetype.md#frontcover) -- [Illustration](picturetype.md#illustration) -- [LeadArtist](picturetype.md#leadartist) -- [LeafletPage](picturetype.md#leafletpage) -- [Lyricist](picturetype.md#lyricist) -- [Media](picturetype.md#media) -- [MovieScreenCapture](picturetype.md#moviescreencapture) -- [NotAPicture](picturetype.md#notapicture) -- [Other](picturetype.md#other) -- [OtherFileIcon](picturetype.md#otherfileicon) -- [PublisherLogo](picturetype.md#publisherlogo) -- [RecordingLocation](picturetype.md#recordinglocation) +- [Artist](PictureType.md#artist) +- [BackCover](PictureType.md#backcover) +- [Band](PictureType.md#band) +- [BandLogo](PictureType.md#bandlogo) +- [ColoredFish](PictureType.md#coloredfish) +- [Composer](PictureType.md#composer) +- [Conductor](PictureType.md#conductor) +- [DuringPerformance](PictureType.md#duringperformance) +- [DuringRecording](PictureType.md#duringrecording) +- [FileIcon](PictureType.md#fileicon) +- [FrontCover](PictureType.md#frontcover) +- [Illustration](PictureType.md#illustration) +- [LeadArtist](PictureType.md#leadartist) +- [LeafletPage](PictureType.md#leafletpage) +- [Lyricist](PictureType.md#lyricist) +- [Media](PictureType.md#media) +- [MovieScreenCapture](PictureType.md#moviescreencapture) +- [NotAPicture](PictureType.md#notapicture) +- [Other](PictureType.md#other) +- [OtherFileIcon](PictureType.md#otherfileicon) +- [PublisherLogo](PictureType.md#publisherlogo) +- [RecordingLocation](PictureType.md#recordinglocation) ## Enumeration members @@ -189,7 +189,7 @@ ___ • **OtherFileIcon** = `2` -**`summary`** The picture is of an icon different from [FileIcon](picturetype.md#fileicon) +**`summary`** The picture is of an icon different from [FileIcon](PictureType.md#fileicon) ___ diff --git a/docs/enums/readstyle.md b/docs/enums/ReadStyle.md similarity index 71% rename from docs/enums/readstyle.md rename to docs/enums/ReadStyle.md index b1339e4d..7c65e602 100644 --- a/docs/enums/readstyle.md +++ b/docs/enums/ReadStyle.md @@ -8,9 +8,9 @@ Specifies the options to use when reading the media. Can be treated as flags. ### Enumeration members -- [Average](readstyle.md#average) -- [None](readstyle.md#none) -- [PictureLazy](readstyle.md#picturelazy) +- [Average](ReadStyle.md#average) +- [None](ReadStyle.md#none) +- [PictureLazy](ReadStyle.md#picturelazy) ## Enumeration members @@ -34,6 +34,6 @@ ___ • **PictureLazy** = `4` -Use the [PictureLazy](readstyle.md#picturelazy) class in the the property [Tag.pictures](../classes/tag.md#pictures). This will avoid +Use the [PictureLazy](ReadStyle.md#picturelazy) class in the the property [Tag.pictures](../classes/Tag.md#pictures). This will avoid loading picture content when reading the tag. Picture will be read lazily, when the picture content is accessed. diff --git a/docs/enums/stringtype.md b/docs/enums/StringType.md similarity index 71% rename from docs/enums/stringtype.md rename to docs/enums/StringType.md index 8ec4ad39..9ce394b6 100644 --- a/docs/enums/stringtype.md +++ b/docs/enums/StringType.md @@ -3,20 +3,20 @@ # Enumeration: StringType **`summary`** Specifies the text encoding used when converting betweenInclusive a string and a - [ByteVector](../classes/bytevector.md). + [ByteVector](../classes/ByteVector.md). -**`remarks`** This enumeration is used by [ByteVector.fromString](../classes/bytevector.md#fromstring) and - [ByteVector.toString](../classes/bytevector.md#tostring) +**`remarks`** This enumeration is used by [ByteVector.fromString](../classes/ByteVector.md#fromstring) and + [ByteVector.toString](../classes/ByteVector.md#tostring) ## Table of contents ### Enumeration members -- [Latin1](stringtype.md#latin1) -- [UTF16](stringtype.md#utf16) -- [UTF16BE](stringtype.md#utf16be) -- [UTF16LE](stringtype.md#utf16le) -- [UTF8](stringtype.md#utf8) +- [Latin1](StringType.md#latin1) +- [UTF16](StringType.md#utf16) +- [UTF16BE](StringType.md#utf16be) +- [UTF16LE](StringType.md#utf16le) +- [UTF8](StringType.md#utf8) ## Enumeration members diff --git a/docs/enums/tagtypes.md b/docs/enums/TagTypes.md similarity index 72% rename from docs/enums/tagtypes.md rename to docs/enums/TagTypes.md index d9c52138..bbf023bc 100644 --- a/docs/enums/tagtypes.md +++ b/docs/enums/TagTypes.md @@ -8,26 +8,26 @@ Indicates the tag types used by a file. ### Enumeration members -- [AllTags](tagtypes.md#alltags) -- [Ape](tagtypes.md#ape) -- [Apple](tagtypes.md#apple) -- [Asf](tagtypes.md#asf) -- [AudibleMetadata](tagtypes.md#audiblemetadata) -- [DivX](tagtypes.md#divx) -- [FlacPictures](tagtypes.md#flacpictures) -- [GifComment](tagtypes.md#gifcomment) -- [IPTCIIM](tagtypes.md#iptciim) -- [Id3v1](tagtypes.md#id3v1) -- [Id3v2](tagtypes.md#id3v2) -- [JpegComment](tagtypes.md#jpegcomment) -- [Matroska](tagtypes.md#matroska) -- [MovieId](tagtypes.md#movieid) -- [None](tagtypes.md#none) -- [Png](tagtypes.md#png) -- [RiffInfo](tagtypes.md#riffinfo) -- [TiffIFD](tagtypes.md#tiffifd) -- [XMP](tagtypes.md#xmp) -- [Xiph](tagtypes.md#xiph) +- [AllTags](TagTypes.md#alltags) +- [Ape](TagTypes.md#ape) +- [Apple](TagTypes.md#apple) +- [Asf](TagTypes.md#asf) +- [AudibleMetadata](TagTypes.md#audiblemetadata) +- [DivX](TagTypes.md#divx) +- [FlacPictures](TagTypes.md#flacpictures) +- [GifComment](TagTypes.md#gifcomment) +- [IPTCIIM](TagTypes.md#iptciim) +- [Id3v1](TagTypes.md#id3v1) +- [Id3v2](TagTypes.md#id3v2) +- [JpegComment](TagTypes.md#jpegcomment) +- [Matroska](TagTypes.md#matroska) +- [MovieId](TagTypes.md#movieid) +- [None](TagTypes.md#none) +- [Png](TagTypes.md#png) +- [RiffInfo](TagTypes.md#riffinfo) +- [TiffIFD](TagTypes.md#tiffifd) +- [XMP](TagTypes.md#xmp) +- [Xiph](TagTypes.md#xiph) ## Enumeration members diff --git a/docs/enums/avistreamtype.md b/docs/enums/avistreamtype.md deleted file mode 100644 index cc11b234..00000000 --- a/docs/enums/avistreamtype.md +++ /dev/null @@ -1,44 +0,0 @@ -[node-taglib-sharp](../README.md) / [Exports](../modules.md) / AviStreamType - -# Enumeration: AviStreamType - -## Table of contents - -### Enumeration members - -- [AUDIO\_STREAM](avistreamtype.md#audio_stream) -- [MIDI\_STREAM](avistreamtype.md#midi_stream) -- [TEXT\_STREAM](avistreamtype.md#text_stream) -- [VIDEO\_STREAM](avistreamtype.md#video_stream) - -## Enumeration members - -### AUDIO\_STREAM - -• **AUDIO\_STREAM** = `1935963489` - -Audio Stream - -___ - -### MIDI\_STREAM - -• **MIDI\_STREAM** = `1919183213` - -MIDI Stream - -___ - -### TEXT\_STREAM - -• **TEXT\_STREAM** = `1937012852` - -Text stream - -___ - -### VIDEO\_STREAM - -• **VIDEO\_STREAM** = `1935960438` - -Video stream diff --git a/docs/interfaces/iaudiocodec.md b/docs/interfaces/IAudioCodec.md similarity index 55% rename from docs/interfaces/iaudiocodec.md rename to docs/interfaces/IAudioCodec.md index d2536425..57d7d3e9 100644 --- a/docs/interfaces/iaudiocodec.md +++ b/docs/interfaces/IAudioCodec.md @@ -3,32 +3,34 @@ # Interface: IAudioCodec Interface that inherits the common codec information and adds audio-specific information. -When dealing with an [ICodec](icodec.md), if [ICodec.mediaTypes](icodec.md#mediatypes) contains -[MediaTypes.Audio](../enums/mediatypes.md#audio), it is safe to assume that the object also inherits [IAudioCodec](iaudiocodec.md) +When dealing with an [ICodec](ICodec.md), if [ICodec.mediaTypes](ICodec.md#mediatypes) contains +[MediaTypes.Audio](../enums/MediaTypes.md#audio), it is safe to assume that the object also inherits [IAudioCodec](IAudioCodec.md) and can be recast without issue. ## Hierarchy -- [`ICodec`](icodec.md) +- [`ICodec`](ICodec.md) ↳ **`IAudioCodec`** - ↳↳ [`ILosslessAudioCodec`](ilosslessaudiocodec.md) + ↳↳ [`ILosslessAudioCodec`](ILosslessAudioCodec.md) ## Implemented by -- [`MpegAudioHeader`](../classes/mpegaudioheader.md) +- [`MpegAudioHeader`](../classes/MpegAudioHeader.md) +- [`OggOpusCodec`](../classes/OggOpusCodec.md) +- [`OggVorbisCodec`](../classes/OggVorbisCodec.md) ## Table of contents ### Properties -- [audioBitrate](iaudiocodec.md#audiobitrate) -- [audioChannels](iaudiocodec.md#audiochannels) -- [audioSampleRate](iaudiocodec.md#audiosamplerate) -- [description](iaudiocodec.md#description) -- [durationMilliseconds](iaudiocodec.md#durationmilliseconds) -- [mediaTypes](iaudiocodec.md#mediatypes) +- [audioBitrate](IAudioCodec.md#audiobitrate) +- [audioChannels](IAudioCodec.md#audiochannels) +- [audioSampleRate](IAudioCodec.md#audiosamplerate) +- [description](IAudioCodec.md#description) +- [durationMilliseconds](IAudioCodec.md#durationmilliseconds) +- [mediaTypes](IAudioCodec.md#mediatypes) ## Properties @@ -64,7 +66,7 @@ Gets a text description of the media represented by the current instance. #### Inherited from -[ICodec](icodec.md).[description](icodec.md#description) +[ICodec](ICodec.md).[description](ICodec.md#description) ___ @@ -78,16 +80,16 @@ Duration of the media in milliseconds represented by the current instance. #### Inherited from -[ICodec](icodec.md).[durationMilliseconds](icodec.md#durationmilliseconds) +[ICodec](ICodec.md).[durationMilliseconds](ICodec.md#durationmilliseconds) ___ ### mediaTypes -• **mediaTypes**: [`MediaTypes`](../enums/mediatypes.md) +• **mediaTypes**: [`MediaTypes`](../enums/MediaTypes.md) Types of media represented by the current instance, bitwise combined. #### Inherited from -[ICodec](icodec.md).[mediaTypes](icodec.md#mediatypes) +[ICodec](ICodec.md).[mediaTypes](ICodec.md#mediatypes) diff --git a/docs/interfaces/icodec.md b/docs/interfaces/ICodec.md similarity index 69% rename from docs/interfaces/icodec.md rename to docs/interfaces/ICodec.md index 456eb1af..e7a06a5e 100644 --- a/docs/interfaces/icodec.md +++ b/docs/interfaces/ICodec.md @@ -8,19 +8,19 @@ Interface that provides basic information common to all media codecs - **`ICodec`** - ↳ [`IAudioCodec`](iaudiocodec.md) + ↳ [`IAudioCodec`](IAudioCodec.md) - ↳ [`IVideoCodec`](ivideocodec.md) + ↳ [`IVideoCodec`](IVideoCodec.md) - ↳ [`IPhotoCodec`](iphotocodec.md) + ↳ [`IPhotoCodec`](IPhotoCodec.md) ## Table of contents ### Properties -- [description](icodec.md#description) -- [durationMilliseconds](icodec.md#durationmilliseconds) -- [mediaTypes](icodec.md#mediatypes) +- [description](ICodec.md#description) +- [durationMilliseconds](ICodec.md#durationmilliseconds) +- [mediaTypes](ICodec.md#mediatypes) ## Properties @@ -44,6 +44,6 @@ ___ ### mediaTypes -• **mediaTypes**: [`MediaTypes`](../enums/mediatypes.md) +• **mediaTypes**: [`MediaTypes`](../enums/MediaTypes.md) Types of media represented by the current instance, bitwise combined. diff --git a/docs/interfaces/ilosslessaudiocodec.md b/docs/interfaces/ILosslessAudioCodec.md similarity index 56% rename from docs/interfaces/ilosslessaudiocodec.md rename to docs/interfaces/ILosslessAudioCodec.md index de327671..cf9c7169 100644 --- a/docs/interfaces/ilosslessaudiocodec.md +++ b/docs/interfaces/ILosslessAudioCodec.md @@ -3,32 +3,32 @@ # Interface: ILosslessAudioCodec This interface provides information specific to lossless audio codecs. -When dealing with an [ICodec](icodec.md), if [ICodec.mediaTypes](icodec.md#mediatypes) contains -[MediaTypes.LosslessAudio](../enums/mediatypes.md#losslessaudio), it is safe to assume that the object also inherits -[ILosslessAudioCodec](ilosslessaudiocodec.md) and can be recast without issue. +When dealing with an [ICodec](ICodec.md), if [ICodec.mediaTypes](ICodec.md#mediatypes) contains +[MediaTypes.LosslessAudio](../enums/MediaTypes.md#losslessaudio), it is safe to assume that the object also inherits +[ILosslessAudioCodec](ILosslessAudioCodec.md) and can be recast without issue. ## Hierarchy -- [`IAudioCodec`](iaudiocodec.md) +- [`IAudioCodec`](IAudioCodec.md) ↳ **`ILosslessAudioCodec`** ## Implemented by -- [`Properties`](../classes/properties.md) -- [`RiffWaveFormatEx`](../classes/riffwaveformatex.md) +- [`Properties`](../classes/Properties.md) +- [`RiffWaveFormatEx`](../classes/RiffWaveFormatEx.md) ## Table of contents ### Properties -- [audioBitrate](ilosslessaudiocodec.md#audiobitrate) -- [audioChannels](ilosslessaudiocodec.md#audiochannels) -- [audioSampleRate](ilosslessaudiocodec.md#audiosamplerate) -- [bitsPerSample](ilosslessaudiocodec.md#bitspersample) -- [description](ilosslessaudiocodec.md#description) -- [durationMilliseconds](ilosslessaudiocodec.md#durationmilliseconds) -- [mediaTypes](ilosslessaudiocodec.md#mediatypes) +- [audioBitrate](ILosslessAudioCodec.md#audiobitrate) +- [audioChannels](ILosslessAudioCodec.md#audiochannels) +- [audioSampleRate](ILosslessAudioCodec.md#audiosamplerate) +- [bitsPerSample](ILosslessAudioCodec.md#bitspersample) +- [description](ILosslessAudioCodec.md#description) +- [durationMilliseconds](ILosslessAudioCodec.md#durationmilliseconds) +- [mediaTypes](ILosslessAudioCodec.md#mediatypes) ## Properties @@ -40,7 +40,7 @@ Bitrate of the audio in kilobits per second represented by the current instance. #### Inherited from -[IAudioCodec](iaudiocodec.md).[audioBitrate](iaudiocodec.md#audiobitrate) +[IAudioCodec](IAudioCodec.md).[audioBitrate](IAudioCodec.md#audiobitrate) ___ @@ -52,7 +52,7 @@ Number of channels in the audio represented by the current instance. #### Inherited from -[IAudioCodec](iaudiocodec.md).[audioChannels](iaudiocodec.md#audiochannels) +[IAudioCodec](IAudioCodec.md).[audioChannels](IAudioCodec.md#audiochannels) ___ @@ -64,7 +64,7 @@ Sample rate of the audio represented by the current instance. #### Inherited from -[IAudioCodec](iaudiocodec.md).[audioSampleRate](iaudiocodec.md#audiosamplerate) +[IAudioCodec](IAudioCodec.md).[audioSampleRate](IAudioCodec.md#audiosamplerate) ___ @@ -84,7 +84,7 @@ Gets a text description of the media represented by the current instance. #### Inherited from -[IAudioCodec](iaudiocodec.md).[description](iaudiocodec.md#description) +[IAudioCodec](IAudioCodec.md).[description](IAudioCodec.md#description) ___ @@ -98,16 +98,16 @@ Duration of the media in milliseconds represented by the current instance. #### Inherited from -[IAudioCodec](iaudiocodec.md).[durationMilliseconds](iaudiocodec.md#durationmilliseconds) +[IAudioCodec](IAudioCodec.md).[durationMilliseconds](IAudioCodec.md#durationmilliseconds) ___ ### mediaTypes -• **mediaTypes**: [`MediaTypes`](../enums/mediatypes.md) +• **mediaTypes**: [`MediaTypes`](../enums/MediaTypes.md) Types of media represented by the current instance, bitwise combined. #### Inherited from -[IAudioCodec](iaudiocodec.md).[mediaTypes](iaudiocodec.md#mediatypes) +[IAudioCodec](IAudioCodec.md).[mediaTypes](IAudioCodec.md#mediatypes) diff --git a/docs/interfaces/iphotocodec.md b/docs/interfaces/IPhotoCodec.md similarity index 61% rename from docs/interfaces/iphotocodec.md rename to docs/interfaces/IPhotoCodec.md index 459890c5..b1879718 100644 --- a/docs/interfaces/iphotocodec.md +++ b/docs/interfaces/IPhotoCodec.md @@ -3,30 +3,30 @@ # Interface: IPhotoCodec Interface that inherits the common codec information and adds photo-specific information. -When dealing with an [ICodec](icodec.md), if [ICodec.mediaTypes](icodec.md#mediatypes) contains -[MediaTypes.Photo](../enums/mediatypes.md#photo), it is safe to assume that the object also inherits [IPhotoCodec](iphotocodec.md) +When dealing with an [ICodec](ICodec.md), if [ICodec.mediaTypes](ICodec.md#mediatypes) contains +[MediaTypes.Photo](../enums/MediaTypes.md#photo), it is safe to assume that the object also inherits [IPhotoCodec](IPhotoCodec.md) and can be recast without issue. ## Hierarchy -- [`ICodec`](icodec.md) +- [`ICodec`](ICodec.md) ↳ **`IPhotoCodec`** ## Implemented by -- [`Properties`](../classes/properties.md) +- [`Properties`](../classes/Properties.md) ## Table of contents ### Properties -- [description](iphotocodec.md#description) -- [durationMilliseconds](iphotocodec.md#durationmilliseconds) -- [mediaTypes](iphotocodec.md#mediatypes) -- [photoHeight](iphotocodec.md#photoheight) -- [photoQuality](iphotocodec.md#photoquality) -- [photoWidth](iphotocodec.md#photowidth) +- [description](IPhotoCodec.md#description) +- [durationMilliseconds](IPhotoCodec.md#durationmilliseconds) +- [mediaTypes](IPhotoCodec.md#mediatypes) +- [photoHeight](IPhotoCodec.md#photoheight) +- [photoQuality](IPhotoCodec.md#photoquality) +- [photoWidth](IPhotoCodec.md#photowidth) ## Properties @@ -38,7 +38,7 @@ Gets a text description of the media represented by the current instance. #### Inherited from -[ICodec](icodec.md).[description](icodec.md#description) +[ICodec](ICodec.md).[description](ICodec.md#description) ___ @@ -52,19 +52,19 @@ Duration of the media in milliseconds represented by the current instance. #### Inherited from -[ICodec](icodec.md).[durationMilliseconds](icodec.md#durationmilliseconds) +[ICodec](ICodec.md).[durationMilliseconds](ICodec.md#durationmilliseconds) ___ ### mediaTypes -• **mediaTypes**: [`MediaTypes`](../enums/mediatypes.md) +• **mediaTypes**: [`MediaTypes`](../enums/MediaTypes.md) Types of media represented by the current instance, bitwise combined. #### Inherited from -[ICodec](icodec.md).[mediaTypes](icodec.md#mediatypes) +[ICodec](ICodec.md).[mediaTypes](ICodec.md#mediatypes) ___ diff --git a/docs/interfaces/ipicture.md b/docs/interfaces/IPicture.md similarity index 65% rename from docs/interfaces/ipicture.md rename to docs/interfaces/IPicture.md index 210bc5f8..4a6a289c 100644 --- a/docs/interfaces/ipicture.md +++ b/docs/interfaces/IPicture.md @@ -7,26 +7,26 @@ various formats. ## Implemented by -- [`Id3v2AttachmentFrame`](../classes/id3v2attachmentframe.md) -- [`Picture`](../classes/picture.md) -- [`PictureLazy`](../classes/picturelazy.md) -- [`XiphPicture`](../classes/xiphpicture.md) +- [`Id3v2AttachmentFrame`](../classes/Id3v2AttachmentFrame.md) +- [`Picture`](../classes/Picture.md) +- [`PictureLazy`](../classes/PictureLazy.md) +- [`XiphPicture`](../classes/XiphPicture.md) ## Table of contents ### Properties -- [data](ipicture.md#data) -- [description](ipicture.md#description) -- [filename](ipicture.md#filename) -- [mimeType](ipicture.md#mimetype) -- [type](ipicture.md#type) +- [data](IPicture.md#data) +- [description](IPicture.md#description) +- [filename](IPicture.md#filename) +- [mimeType](IPicture.md#mimetype) +- [type](IPicture.md#type) ## Properties ### data -• **data**: [`ByteVector`](../classes/bytevector.md) +• **data**: [`ByteVector`](../classes/ByteVector.md) Gets and sets the picture data stored in the current instance. @@ -58,6 +58,6 @@ ___ ### type -• **type**: [`PictureType`](../enums/picturetype.md) +• **type**: [`PictureType`](../enums/PictureType.md) Gets and sets the type of the content visible in the picture stored in the current instance. diff --git a/docs/interfaces/ivideocodec.md b/docs/interfaces/IVideoCodec.md similarity index 54% rename from docs/interfaces/ivideocodec.md rename to docs/interfaces/IVideoCodec.md index 276b7708..50dcac4a 100644 --- a/docs/interfaces/ivideocodec.md +++ b/docs/interfaces/IVideoCodec.md @@ -3,31 +3,32 @@ # Interface: IVideoCodec Interface that inherits the common codec information and adds video-specific information. -When dealing with an [ICodec](icodec.md), if [ICodec.mediaTypes](icodec.md#mediatypes) contains -[MediaTypes.Video](../enums/mediatypes.md#video), it is safe to assume that the object also inherits [IVideoCodec](ivideocodec.md) +When dealing with an [ICodec](ICodec.md), if [ICodec.mediaTypes](ICodec.md#mediatypes) contains +[MediaTypes.Video](../enums/MediaTypes.md#video), it is safe to assume that the object also inherits [IVideoCodec](IVideoCodec.md) and can be recast without issue. ## Hierarchy -- [`ICodec`](icodec.md) +- [`ICodec`](ICodec.md) ↳ **`IVideoCodec`** ## Implemented by -- [`MpegVideoHeader`](../classes/mpegvideoheader.md) -- [`Properties`](../classes/properties.md) -- [`RiffBitmapInfoHeader`](../classes/riffbitmapinfoheader.md) +- [`MpegVideoHeader`](../classes/MpegVideoHeader.md) +- [`OggTheoraCodec`](../classes/OggTheoraCodec.md) +- [`Properties`](../classes/Properties.md) +- [`RiffBitmapInfoHeader`](../classes/RiffBitmapInfoHeader.md) ## Table of contents ### Properties -- [description](ivideocodec.md#description) -- [durationMilliseconds](ivideocodec.md#durationmilliseconds) -- [mediaTypes](ivideocodec.md#mediatypes) -- [videoHeight](ivideocodec.md#videoheight) -- [videoWidth](ivideocodec.md#videowidth) +- [description](IVideoCodec.md#description) +- [durationMilliseconds](IVideoCodec.md#durationmilliseconds) +- [mediaTypes](IVideoCodec.md#mediatypes) +- [videoHeight](IVideoCodec.md#videoheight) +- [videoWidth](IVideoCodec.md#videowidth) ## Properties @@ -39,7 +40,7 @@ Gets a text description of the media represented by the current instance. #### Inherited from -[ICodec](icodec.md).[description](icodec.md#description) +[ICodec](ICodec.md).[description](ICodec.md#description) ___ @@ -53,19 +54,19 @@ Duration of the media in milliseconds represented by the current instance. #### Inherited from -[ICodec](icodec.md).[durationMilliseconds](icodec.md#durationmilliseconds) +[ICodec](ICodec.md).[durationMilliseconds](ICodec.md#durationmilliseconds) ___ ### mediaTypes -• **mediaTypes**: [`MediaTypes`](../enums/mediatypes.md) +• **mediaTypes**: [`MediaTypes`](../enums/MediaTypes.md) Types of media represented by the current instance, bitwise combined. #### Inherited from -[ICodec](icodec.md).[mediaTypes](icodec.md#mediatypes) +[ICodec](ICodec.md).[mediaTypes](ICodec.md#mediatypes) ___ diff --git a/docs/modules.md b/docs/modules.md index 633f142d..3c4d9c5a 100644 --- a/docs/modules.md +++ b/docs/modules.md @@ -6,114 +6,121 @@ ### Enumerations -- [AsfObjectDataType](enums/asfobjectdatatype.md) -- [AviStreamType](enums/avistreamtype.md) -- [FileAccessMode](enums/fileaccessmode.md) -- [Id3v2EventType](enums/id3v2eventtype.md) -- [Id3v2FrameClassType](enums/id3v2frameclasstype.md) -- [Id3v2FrameFlags](enums/id3v2frameflags.md) -- [Id3v2RelativeVolumeFrameChannelType](enums/id3v2relativevolumeframechanneltype.md) -- [Id3v2SynchronizedTextType](enums/id3v2synchronizedtexttype.md) -- [Id3v2TagHeaderFlags](enums/id3v2tagheaderflags.md) -- [Id3v2TimestampFormat](enums/id3v2timestampformat.md) -- [MediaTypes](enums/mediatypes.md) -- [MpegAudioChannelMode](enums/mpegaudiochannelmode.md) -- [MpegVersion](enums/mpegversion.md) -- [PictureType](enums/picturetype.md) -- [ReadStyle](enums/readstyle.md) -- [StringType](enums/stringtype.md) -- [TagTypes](enums/tagtypes.md) +- [AsfObjectDataType](enums/AsfObjectDataType.md) +- [AviStreamType](enums/AviStreamType.md) +- [FileAccessMode](enums/FileAccessMode.md) +- [Id3v2EventType](enums/Id3v2EventType.md) +- [Id3v2FrameClassType](enums/Id3v2FrameClassType.md) +- [Id3v2FrameFlags](enums/Id3v2FrameFlags.md) +- [Id3v2RelativeVolumeFrameChannelType](enums/Id3v2RelativeVolumeFrameChannelType.md) +- [Id3v2SynchronizedTextType](enums/Id3v2SynchronizedTextType.md) +- [Id3v2TagHeaderFlags](enums/Id3v2TagHeaderFlags.md) +- [Id3v2TimestampFormat](enums/Id3v2TimestampFormat.md) +- [MediaTypes](enums/MediaTypes.md) +- [MpegAudioChannelMode](enums/MpegAudioChannelMode.md) +- [MpegVersion](enums/MpegVersion.md) +- [PictureType](enums/PictureType.md) +- [ReadStyle](enums/ReadStyle.md) +- [StringType](enums/StringType.md) +- [TagTypes](enums/TagTypes.md) ### Classes -- [AacFile](classes/aacfile.md) -- [AacFileSettings](classes/aacfilesettings.md) -- [AiffFile](classes/aifffile.md) -- [ApeFile](classes/apefile.md) -- [ApeFileSettings](classes/apefilesettings.md) -- [ApeTag](classes/apetag.md) -- [AsfContentDescriptionObject](classes/asfcontentdescriptionobject.md) -- [AsfContentDescriptor](classes/asfcontentdescriptor.md) -- [AsfExtendedContentDescriptionObject](classes/asfextendedcontentdescriptionobject.md) -- [AsfFile](classes/asffile.md) -- [AsfFilePropertiesObject](classes/asffilepropertiesobject.md) -- [AsfHeaderExtensionObject](classes/asfheaderextensionobject.md) -- [AsfHeaderObject](classes/asfheaderobject.md) -- [AsfMetadataDescriptor](classes/asfmetadatadescriptor.md) -- [AsfMetadataLibraryObject](classes/asfmetadatalibraryobject.md) -- [AsfPaddingObject](classes/asfpaddingobject.md) -- [AsfStreamPropertiesObject](classes/asfstreampropertiesobject.md) -- [AsfTag](classes/asftag.md) -- [AsfUnknownObject](classes/asfunknownobject.md) -- [AviStream](classes/avistream.md) -- [ByteVector](classes/bytevector.md) -- [CombinedTag](classes/combinedtag.md) -- [CorruptFileError](classes/corruptfileerror.md) -- [DivxTag](classes/divxtag.md) -- [File](classes/file.md) -- [FlacBlock](classes/flacblock.md) -- [FlacFile](classes/flacfile.md) -- [FlacFileSettings](classes/flacfilesettings.md) -- [FlacTag](classes/flactag.md) -- [Id3v1Tag](classes/id3v1tag.md) -- [Id3v2AttachmentFrame](classes/id3v2attachmentframe.md) -- [Id3v2CommentsFrame](classes/id3v2commentsframe.md) -- [Id3v2EventTimeCode](classes/id3v2eventtimecode.md) -- [Id3v2EventTimeCodeFrame](classes/id3v2eventtimecodeframe.md) -- [Id3v2ExtendedHeader](classes/id3v2extendedheader.md) -- [Id3v2Frame](classes/id3v2frame.md) -- [Id3v2FrameHeader](classes/id3v2frameheader.md) -- [Id3v2FrameIdentifier](classes/id3v2frameidentifier.md) -- [Id3v2MusicCdIdentifierFrame](classes/id3v2musiccdidentifierframe.md) -- [Id3v2PlayCountFrame](classes/id3v2playcountframe.md) -- [Id3v2PopularimeterFrame](classes/id3v2popularimeterframe.md) -- [Id3v2PrivateFrame](classes/id3v2privateframe.md) -- [Id3v2RelativeVolumeFrame](classes/id3v2relativevolumeframe.md) -- [Id3v2RelativeVolumeFrameChannelData](classes/id3v2relativevolumeframechanneldata.md) -- [Id3v2Settings](classes/id3v2settings.md) -- [Id3v2Synchronized](classes/id3v2synchronized.md) -- [Id3v2SynchronizedLyricsFrame](classes/id3v2synchronizedlyricsframe.md) -- [Id3v2Tag](classes/id3v2tag.md) -- [Id3v2TagFooter](classes/id3v2tagfooter.md) -- [Id3v2TagHeader](classes/id3v2tagheader.md) -- [Id3v2TermsOfUseFrame](classes/id3v2termsofuseframe.md) -- [Id3v2TextInformationFrame](classes/id3v2textinformationframe.md) -- [Id3v2UniqueFileIdentifierFrame](classes/id3v2uniquefileidentifierframe.md) -- [Id3v2UnknownFrame](classes/id3v2unknownframe.md) -- [Id3v2UnsynchronizedFrame](classes/id3v2unsynchronizedframe.md) -- [Id3v2UrlLinkFrame](classes/id3v2urllinkframe.md) -- [Id3v2UserTextInformationFrame](classes/id3v2usertextinformationframe.md) -- [Id3v2UserUrlLinkFrame](classes/id3v2userurllinkframe.md) -- [InfoTag](classes/infotag.md) -- [LocalFileAbstraction](classes/localfileabstraction.md) -- [MovieIdTag](classes/movieidtag.md) -- [MpegAudioFile](classes/mpegaudiofile.md) -- [MpegAudioHeader](classes/mpegaudioheader.md) -- [MpegContainerFile](classes/mpegcontainerfile.md) -- [MpegVbriHeader](classes/mpegvbriheader.md) -- [MpegVideoHeader](classes/mpegvideoheader.md) -- [MpegXingHeader](classes/mpegxingheader.md) -- [NotImplementedError](classes/notimplementederror.md) -- [Picture](classes/picture.md) -- [PictureLazy](classes/picturelazy.md) -- [Properties](classes/properties.md) -- [RiffBitmapInfoHeader](classes/riffbitmapinfoheader.md) -- [RiffFile](classes/rifffile.md) -- [RiffList](classes/rifflist.md) -- [RiffListTag](classes/rifflisttag.md) -- [RiffWaveFormatEx](classes/riffwaveformatex.md) -- [Tag](classes/tag.md) -- [XiphComment](classes/xiphcomment.md) -- [XiphPicture](classes/xiphpicture.md) +- [AacFile](classes/AacFile.md) +- [AacFileSettings](classes/AacFileSettings.md) +- [AiffFile](classes/AiffFile.md) +- [ApeFile](classes/ApeFile.md) +- [ApeFileSettings](classes/ApeFileSettings.md) +- [ApeTag](classes/ApeTag.md) +- [AsfContentDescriptionObject](classes/AsfContentDescriptionObject.md) +- [AsfContentDescriptor](classes/AsfContentDescriptor.md) +- [AsfExtendedContentDescriptionObject](classes/AsfExtendedContentDescriptionObject.md) +- [AsfFile](classes/AsfFile.md) +- [AsfFilePropertiesObject](classes/AsfFilePropertiesObject.md) +- [AsfHeaderExtensionObject](classes/AsfHeaderExtensionObject.md) +- [AsfHeaderObject](classes/AsfHeaderObject.md) +- [AsfMetadataDescriptor](classes/AsfMetadataDescriptor.md) +- [AsfMetadataLibraryObject](classes/AsfMetadataLibraryObject.md) +- [AsfPaddingObject](classes/AsfPaddingObject.md) +- [AsfStreamPropertiesObject](classes/AsfStreamPropertiesObject.md) +- [AsfTag](classes/AsfTag.md) +- [AsfUnknownObject](classes/AsfUnknownObject.md) +- [AviStream](classes/AviStream.md) +- [ByteVector](classes/ByteVector.md) +- [CombinedTag](classes/CombinedTag.md) +- [CorruptFileError](classes/CorruptFileError.md) +- [DivxTag](classes/DivxTag.md) +- [File](classes/File.md) +- [FlacBlock](classes/FlacBlock.md) +- [FlacFile](classes/FlacFile.md) +- [FlacFileSettings](classes/FlacFileSettings.md) +- [FlacTag](classes/FlacTag.md) +- [Id3v1Tag](classes/Id3v1Tag.md) +- [Id3v2AttachmentFrame](classes/Id3v2AttachmentFrame.md) +- [Id3v2CommentsFrame](classes/Id3v2CommentsFrame.md) +- [Id3v2EventTimeCode](classes/Id3v2EventTimeCode.md) +- [Id3v2EventTimeCodeFrame](classes/Id3v2EventTimeCodeFrame.md) +- [Id3v2ExtendedHeader](classes/Id3v2ExtendedHeader.md) +- [Id3v2Frame](classes/Id3v2Frame.md) +- [Id3v2FrameHeader](classes/Id3v2FrameHeader.md) +- [Id3v2FrameIdentifier](classes/Id3v2FrameIdentifier.md) +- [Id3v2MusicCdIdentifierFrame](classes/Id3v2MusicCdIdentifierFrame.md) +- [Id3v2PlayCountFrame](classes/Id3v2PlayCountFrame.md) +- [Id3v2PopularimeterFrame](classes/Id3v2PopularimeterFrame.md) +- [Id3v2PrivateFrame](classes/Id3v2PrivateFrame.md) +- [Id3v2RelativeVolumeFrame](classes/Id3v2RelativeVolumeFrame.md) +- [Id3v2RelativeVolumeFrameChannelData](classes/Id3v2RelativeVolumeFrameChannelData.md) +- [Id3v2Settings](classes/Id3v2Settings.md) +- [Id3v2Synchronized](classes/Id3v2Synchronized.md) +- [Id3v2SynchronizedLyricsFrame](classes/Id3v2SynchronizedLyricsFrame.md) +- [Id3v2Tag](classes/Id3v2Tag.md) +- [Id3v2TagFooter](classes/Id3v2TagFooter.md) +- [Id3v2TagHeader](classes/Id3v2TagHeader.md) +- [Id3v2TermsOfUseFrame](classes/Id3v2TermsOfUseFrame.md) +- [Id3v2TextInformationFrame](classes/Id3v2TextInformationFrame.md) +- [Id3v2UniqueFileIdentifierFrame](classes/Id3v2UniqueFileIdentifierFrame.md) +- [Id3v2UnknownFrame](classes/Id3v2UnknownFrame.md) +- [Id3v2UnsynchronizedFrame](classes/Id3v2UnsynchronizedFrame.md) +- [Id3v2UrlLinkFrame](classes/Id3v2UrlLinkFrame.md) +- [Id3v2UserTextInformationFrame](classes/Id3v2UserTextInformationFrame.md) +- [Id3v2UserUrlLinkFrame](classes/Id3v2UserUrlLinkFrame.md) +- [InfoTag](classes/InfoTag.md) +- [LocalFileAbstraction](classes/LocalFileAbstraction.md) +- [MovieIdTag](classes/MovieIdTag.md) +- [MpegAudioFile](classes/MpegAudioFile.md) +- [MpegAudioHeader](classes/MpegAudioHeader.md) +- [MpegContainerFile](classes/MpegContainerFile.md) +- [MpegVbriHeader](classes/MpegVbriHeader.md) +- [MpegVideoHeader](classes/MpegVideoHeader.md) +- [MpegXingHeader](classes/MpegXingHeader.md) +- [NotImplementedError](classes/NotImplementedError.md) +- [OggCodecFactory](classes/OggCodecFactory.md) +- [OggFile](classes/OggFile.md) +- [OggFileSettings](classes/OggFileSettings.md) +- [OggOpusCodec](classes/OggOpusCodec.md) +- [OggTag](classes/OggTag.md) +- [OggTheoraCodec](classes/OggTheoraCodec.md) +- [OggVorbisCodec](classes/OggVorbisCodec.md) +- [Picture](classes/Picture.md) +- [PictureLazy](classes/PictureLazy.md) +- [Properties](classes/Properties.md) +- [RiffBitmapInfoHeader](classes/RiffBitmapInfoHeader.md) +- [RiffFile](classes/RiffFile.md) +- [RiffList](classes/RiffList.md) +- [RiffListTag](classes/RiffListTag.md) +- [RiffWaveFormatEx](classes/RiffWaveFormatEx.md) +- [Tag](classes/Tag.md) +- [XiphComment](classes/XiphComment.md) +- [XiphPicture](classes/XiphPicture.md) ### Interfaces -- [IAudioCodec](interfaces/iaudiocodec.md) -- [ICodec](interfaces/icodec.md) -- [ILosslessAudioCodec](interfaces/ilosslessaudiocodec.md) -- [IPhotoCodec](interfaces/iphotocodec.md) -- [IPicture](interfaces/ipicture.md) -- [IVideoCodec](interfaces/ivideocodec.md) +- [IAudioCodec](interfaces/IAudioCodec.md) +- [ICodec](interfaces/ICodec.md) +- [ILosslessAudioCodec](interfaces/ILosslessAudioCodec.md) +- [IPhotoCodec](interfaces/IPhotoCodec.md) +- [IPicture](interfaces/IPicture.md) +- [IVideoCodec](interfaces/IVideoCodec.md) ### Type aliases @@ -133,7 +140,7 @@ ### FileTypeConstructor -Ƭ **FileTypeConstructor**: (`abstraction`: `IFileAbstraction`, `style`: [`ReadStyle`](enums/readstyle.md)) => [`File`](classes/file.md) +Ƭ **FileTypeConstructor**: (`abstraction`: `IFileAbstraction`, `style`: [`ReadStyle`](enums/ReadStyle.md)) => [`File`](classes/File.md) #### Type declaration @@ -144,34 +151,43 @@ | Name | Type | | :------ | :------ | | `abstraction` | `IFileAbstraction` | -| `style` | [`ReadStyle`](enums/readstyle.md) | +| `style` | [`ReadStyle`](enums/ReadStyle.md) | ___ ### FileTypeResolver -Ƭ **FileTypeResolver**: (`abstraction`: `IFileAbstraction`, `mimetype`: `string`, `style`: [`ReadStyle`](enums/readstyle.md)) => [`File`](classes/file.md) +Ƭ **FileTypeResolver**: (`abstraction`: `IFileAbstraction`, `mimetype`: `string`, `style`: [`ReadStyle`](enums/ReadStyle.md)) => [`File`](classes/File.md) #### Type declaration -▸ (`abstraction`, `mimetype`, `style`): [`File`](classes/file.md) +▸ (`abstraction`, `mimetype`, `style`): [`File`](classes/File.md) -Delegate is used for intervening in [File.createFromPath](classes/file.md#createfrompath) by resolving the filetype before +Delegate is used for intervening in [File.createFromPath](classes/File.md#createfrompath) by resolving the filetype before any standard resolution operations. +**`remarks`** A FileTypeResolver is one way of altering the behavior of + [File.createFromPath](classes/File.md#createfrompath) When [File.createFromPath](classes/File.md#createfrompath) is called, the registered + resolvers are invoked in reverse order in which they were registered. The resolver may then + perform any operations necessary, including other type-finding methods. If the resolver + returns a new [File](classes/File.md) it will instantly be returned, by [File.createFromPath](classes/File.md#createfrompath). If + it returns `undefined`, [File.createFromPath](classes/File.md#createfrompath) will continue to process. If the resolver + throws an exception, it will be uncaught. To register a resolver, use + [File.addFileTypeResolver](classes/File.md#addfiletyperesolver). + ##### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `abstraction` | `IFileAbstraction` | File to be read. | | `mimetype` | `string` | - | -| `style` | [`ReadStyle`](enums/readstyle.md) | How to read media properties from the file | +| `style` | [`ReadStyle`](enums/ReadStyle.md) | How to read media properties from the file | ##### Returns -[`File`](classes/file.md) +[`File`](classes/File.md) -New instance of [File](classes/file.md) or `undefined` if the resolver could not be matched +New instance of [File](classes/File.md) or `undefined` if the resolver could not be matched ## Properties @@ -200,7 +216,7 @@ ___ | :------ | :------ | | `addFrameCreator` | (`creator`: `FrameCreator`) => `void` | | `clearFrameCreators` | () => `void` | -| `createFrame` | (`data`: [`ByteVector`](classes/bytevector.md), `file`: [`File`](classes/file.md), `offset`: `number`, `version`: `number`, `alreadyUnsynced`: `boolean`) => { `frame`: [`Id3v2Frame`](classes/id3v2frame.md) ; `offset`: `number` } | +| `createFrame` | (`data`: [`ByteVector`](classes/ByteVector.md), `file`: [`File`](classes/File.md), `offset`: `number`, `version`: `number`, `alreadyUnsynced`: `boolean`) => { `frame`: [`Id3v2Frame`](classes/Id3v2Frame.md) ; `offset`: `number` } | ## Variables @@ -210,4 +226,4 @@ ___ #### Index signature -▪ [key: `string`]: [`Id3v2FrameIdentifier`](classes/id3v2frameidentifier.md) +▪ [key: `string`]: [`Id3v2FrameIdentifier`](classes/Id3v2FrameIdentifier.md) diff --git a/package-lock.json b/package-lock.json index 2453b68d..6aee07f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,41 +1,45 @@ { "name": "node-taglib-sharp", - "version": "3.4.0", + "version": "5.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "node-taglib-sharp", - "version": "3.4.0", + "version": "5.0.0", "license": "LGPL-2.1-or-later", "dependencies": { "dateformat": "^3.0.3", - "iconv-lite": "^0.4.24", + "iconv-lite": "^0.6.3", + "itiriri": "^2.0.1", "os-locale": "^4.0.0", "uuid": "^8.3.2" }, "devDependencies": { - "@istanbuljs/nyc-config-typescript": "^1.0.1", - "@testdeck/mocha": "^0.1.2", - "@types/chai": "^4.1.7", + "@istanbuljs/nyc-config-typescript": "^1.0.2", + "@testdeck/mocha": "^0.2.0", + "@types/chai": "^4.3.0", "@types/chai-as-promised": "^7.1.0", "@types/dateformat": "^3.0.0", "@types/stream-buffers": "^3.0.2", - "@types/uuid": "^8.3.0", - "chai": "^4.2.0", + "@types/uuid": "^8.3.4", + "@typescript-eslint/eslint-plugin": "^5.15.0", + "@typescript-eslint/parser": "^5.15.0", + "chai": "^4.3.6", "chai-as-promised": "^7.1.1", - "coveralls": "^3.0.9", + "coveralls": "^3.1.1", + "eslint-plugin-import": "^2.25.4", + "eslint-plugin-jsdoc": "^38.0.4", + "eslint-plugin-prefer-arrow": "^1.2.3", "madge": "^4.0.1", - "mocha": "^7.0.0-esm1", + "mocha": "^9.2.2", "nyc": "^15.1.0", "source-map-support": "^0.5.16", "stream-buffers": "^3.0.2", - "ts-node": "^8.5.4", - "tslint": "^5.13.1", - "typedoc": "^0.21.2", - "typedoc-plugin-markdown": "^3.10.2", + "ts-node": "^10.7.0", + "typedoc": "^0.23.6", + "typedoc-plugin-markdown": "^3.13.3", "typemoq": "^2.1.0", - "typescript": "^4.1.6" + "typescript": "^4.5.5" }, "engines": { "node": ">=12.16.1" @@ -459,6 +463,146 @@ "node": ">=6.9.0" } }, + "node_modules/@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "dev": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-consumer": "0.8.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@es-joy/jsdoccomment": { + "version": "0.21.2", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.21.2.tgz", + "integrity": "sha512-k8NwNnnYgUR/hyC/JdAbKvaIzTgnT5XJeCeVFo5tpT/4Fu5WiXmhdi6M/c4diqXSDf3ZENyrCtgzCUhIbfT8Zg==", + "dev": true, + "dependencies": { + "comment-parser": "1.3.0", + "esquery": "^1.4.0", + "jsdoc-type-pratt-parser": "~2.2.4" + }, + "engines": { + "node": "^12 || ^14 || ^16 || ^17" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.1.tgz", + "integrity": "sha512-bxvbYnBPN1Gibwyp6NrpnFzA3YtRL3BBAyEAFVIpNTm2Rn4Vy87GA5M4aSn3InRrlsbX5N0GW7XIx+U4SAEKdQ==", + "dev": true, + "peer": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.3.1", + "globals": "^13.9.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "peer": true + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "13.13.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.13.0.tgz", + "integrity": "sha512-EQ7Q18AJlPwp3vUDL4mKA0KXrXyNIQyWon6T6XQiBQF0XHvRsiCSrWmmeATpUzdJN2HhWZU6Pdl0a9zdep5p6A==", + "dev": true, + "peer": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/eslintrc/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "peer": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@eslint/eslintrc/node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/eslintrc/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.9.5", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", + "integrity": "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==", + "dev": true, + "peer": true, + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true, + "peer": true + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -522,9 +666,9 @@ } }, "node_modules/@istanbuljs/nyc-config-typescript": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@istanbuljs/nyc-config-typescript/-/nyc-config-typescript-1.0.1.tgz", - "integrity": "sha512-/gz6LgVpky205LuoOfwEZmnUtaSmdk0QIMcNFj9OvxhiMhPpKftMgZmGN7jNj7jR+lr8IB1Yks3QSSSNSxfoaQ==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@istanbuljs/nyc-config-typescript/-/nyc-config-typescript-1.0.2.tgz", + "integrity": "sha512-iKGIyMoyJuFnJRSVTZ78POIRvNnwZaWIf8vG4ZS3rQq58MMDrqEX2nnzx0R28V2X8JvmKYiqY9FP2hlJsm8A0w==", "dev": true, "dependencies": { "@istanbuljs/schema": "^0.1.2" @@ -533,9 +677,7 @@ "node": ">=8" }, "peerDependencies": { - "nyc": ">=15", - "source-map-support": "*", - "ts-node": "*" + "nyc": ">=15" } }, "node_modules/@istanbuljs/schema": { @@ -583,27 +725,51 @@ } }, "node_modules/@testdeck/core": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/@testdeck/core/-/core-0.1.2.tgz", - "integrity": "sha512-rggcFQqSejqtkqK1JcwZE/utD4oNsM1JMHwrYxH1PKYx0uL2cMs0Q4zMVLKw0oacIASCfkIUSdXx7rDNdCDlvA==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@testdeck/core/-/core-0.2.0.tgz", + "integrity": "sha512-2BAzKS18I+nFUb9kH2zK7Bs1CBD0WqaYikaLm+gRaOiQKYa8flvVzqlUGwjyOMmD16JFksgxYml4/7xm4tfEYA==", "dev": true }, "node_modules/@testdeck/mocha": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/@testdeck/mocha/-/mocha-0.1.2.tgz", - "integrity": "sha512-yn3OkFUlO9EkdBkDV08bPV0r26U2FC/8KvU9FdiS0ligOsjB5Ry4sp3eUQJAFxjrGJBpih0t7rZ/GzdsgCv/EQ==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@testdeck/mocha/-/mocha-0.2.0.tgz", + "integrity": "sha512-xudmoPiytaV3flmPZnRO02TPsH31IJuLkGGIX9ftOmditOgA57RK9tYDHNpanA9HxC6kQLP97Tut0RfILENn7w==", "dev": true, "dependencies": { - "@testdeck/core": "^0.1.2" + "@testdeck/core": "^0.2.0" }, "bin": { "testdeck-watch": "bin/watch" } }, + "node_modules/@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "dev": true + }, "node_modules/@types/chai": { - "version": "4.2.19", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.19.tgz", - "integrity": "sha512-jRJgpRBuY+7izT7/WNXP/LsMO9YonsstuL+xuvycDyESpoDoIAsMd7suwpB4h9oEWB+ZlPTqJJ8EHomzNhwTPQ==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.1.tgz", + "integrity": "sha512-/zPMqDkzSZ8t3VtxOa4KPq7uzzW978M9Tvh+j7GHKuo6k6GTLxPJ4J5gE5cjfJ26pnXst0N5Hax8Sr0T2Mi9zQ==", "dev": true }, "node_modules/@types/chai-as-promised": { @@ -621,6 +787,18 @@ "integrity": "sha512-KlPPdikagvL6ELjWsljbyDIPzNCeliYkqRpI+zea99vBBbCIA5JNshZAwQKTON139c87y9qvTFVgkFd14rtS4g==", "dev": true }, + "node_modules/@types/json-schema": { + "version": "7.0.10", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.10.tgz", + "integrity": "sha512-BLO9bBq59vW3fxCpD4o0N4U+DXsvwvIcl+jofw0frQo/GrBFC+/jRZj1E7kgp6dvTyNmA4y6JCV5Id/r3mNP5A==", + "dev": true + }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "dev": true + }, "node_modules/@types/node": { "version": "16.0.0", "resolved": "https://registry.npmjs.org/@types/node/-/node-16.0.0.tgz", @@ -637,1236 +815,2157 @@ } }, "node_modules/@types/uuid": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.1.tgz", - "integrity": "sha512-Y2mHTRAbqfFkpjldbkHGY8JIzRN6XqYRliG8/24FcHm2D2PwW24fl5xMRTVGdrb7iMrwCaIEbLWerGIkXuFWVg==", + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz", + "integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==", "dev": true }, - "node_modules/@typescript-eslint/types": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.28.1.tgz", - "integrity": "sha512-4z+knEihcyX7blAGi7O3Fm3O6YRCP+r56NJFMNGsmtdw+NCdpG5SgNz427LS9nQkRVTswZLhz484hakQwB8RRg==", + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.15.0.tgz", + "integrity": "sha512-u6Db5JfF0Esn3tiAKELvoU5TpXVSkOpZ78cEGn/wXtT2RVqs2vkt4ge6N8cRCyw7YVKhmmLDbwI2pg92mlv7cA==", "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.15.0", + "@typescript-eslint/type-utils": "5.15.0", + "@typescript-eslint/utils": "5.15.0", + "debug": "^4.3.2", + "functional-red-black-tree": "^1.0.1", + "ignore": "^5.1.8", + "regexpp": "^3.2.0", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + }, "engines": { - "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.28.1.tgz", - "integrity": "sha512-GhKxmC4sHXxHGJv8e8egAZeTZ6HI4mLU6S7FUzvFOtsk7ZIDN1ksA9r9DyOgNqowA9yAtZXV0Uiap61bIO81FQ==", + "node_modules/@typescript-eslint/parser": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.15.0.tgz", + "integrity": "sha512-NGAYP/+RDM2sVfmKiKOCgJYPstAO40vPAgACoWPO/+yoYKSgAXIFaBKsV8P0Cc7fwKgvj27SjRNX4L7f4/jCKQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "4.28.1", - "@typescript-eslint/visitor-keys": "4.28.1", - "debug": "^4.3.1", - "globby": "^11.0.3", - "is-glob": "^4.0.1", - "semver": "^7.3.5", - "tsutils": "^3.21.0" + "@typescript-eslint/scope-manager": "5.15.0", + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/typescript-estree": "5.15.0", + "debug": "^4.3.2" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, "peerDependenciesMeta": { "typescript": { "optional": true } } }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.28.1.tgz", - "integrity": "sha512-K4HMrdFqr9PFquPu178SaSb92CaWe2yErXyPumc8cYWxFmhgJsNY9eSePmO05j0JhBvf2Cdhptd6E6Yv9HVHcg==", + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.15.0.tgz", + "integrity": "sha512-yEiTN4MDy23vvsIksrShjNwQl2vl6kJeG9YkVJXjXZnkJElzVK8nfPsWKYxcsGWG8GhurYXP4/KGj3aZAxbeOA==", "dev": true, - "dependencies": { - "@typescript-eslint/types": "4.28.1", - "eslint-visitor-keys": "^2.0.0" - }, "engines": { - "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/aggregate-error": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", - "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.15.0.tgz", + "integrity": "sha512-Hb0e3dGc35b75xLzixM3cSbG1sSbrTBQDfIScqdyvrfJZVEi4XWAT+UL/HMxEdrJNB8Yk28SKxPLtAhfCbBInA==", "dev": true, "dependencies": { - "clean-stack": "^2.0.0", - "indent-string": "^4.0.0" + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/visitor-keys": "5.15.0", + "debug": "^4.3.2", + "globby": "^11.0.4", + "is-glob": "^4.0.3", + "semver": "^7.3.5", + "tsutils": "^3.21.0" }, "engines": { - "node": ">=8" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, - "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.15.0.tgz", + "integrity": "sha512-+vX5FKtgvyHbmIJdxMJ2jKm9z2BIlXJiuewI8dsDYMp5LzPUcuTT78Ya5iwvQg3VqSVdmxyM8Anj1Jeq7733ZQ==", "dev": true, "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" + "@typescript-eslint/types": "5.15.0", + "eslint-visitor-keys": "^3.0.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/ansi-colors": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", - "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==", + "node_modules/@typescript-eslint/parser/node_modules/eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", "dev": true, "engines": { - "node": ">=6" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "node_modules/@typescript-eslint/scope-manager": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.15.0.tgz", + "integrity": "sha512-EFiZcSKrHh4kWk0pZaa+YNJosvKE50EnmN4IfgjkA3bTHElPtYcd2U37QQkNTqwMCS7LXeDeZzEqnsOH8chjSg==", "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/visitor-keys": "5.15.0" + }, "engines": { - "node": ">=8" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/@typescript-eslint/scope-manager/node_modules/@typescript-eslint/types": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.15.0.tgz", + "integrity": "sha512-yEiTN4MDy23vvsIksrShjNwQl2vl6kJeG9YkVJXjXZnkJElzVK8nfPsWKYxcsGWG8GhurYXP4/KGj3aZAxbeOA==", "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, "engines": { - "node": ">=8" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "node_modules/@typescript-eslint/scope-manager/node_modules/@typescript-eslint/visitor-keys": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.15.0.tgz", + "integrity": "sha512-+vX5FKtgvyHbmIJdxMJ2jKm9z2BIlXJiuewI8dsDYMp5LzPUcuTT78Ya5iwvQg3VqSVdmxyM8Anj1Jeq7733ZQ==", "dev": true, "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" + "@typescript-eslint/types": "5.15.0", + "eslint-visitor-keys": "^3.0.0" }, "engines": { - "node": ">= 8" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/app-module-path": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/app-module-path/-/app-module-path-2.2.0.tgz", - "integrity": "sha1-ZBqlXft9am8KgUHEucCqULbCTdU=", - "dev": true - }, - "node_modules/append-transform": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-2.0.0.tgz", - "integrity": "sha512-7yeyCEurROLQJFv5Xj4lEGTy0borxepjFv1g22oAdqFu//SrAlDl1O1Nxx15SH1RoliUml6p8dwJW9jvZughhg==", + "node_modules/@typescript-eslint/scope-manager/node_modules/eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", "dev": true, - "dependencies": { - "default-require-extensions": "^3.0.0" - }, "engines": { - "node": ">=8" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/archy": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", - "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", - "dev": true - }, - "node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true - }, - "node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "node_modules/@typescript-eslint/type-utils": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.15.0.tgz", + "integrity": "sha512-KGeDoEQ7gHieLydujGEFLyLofipe9PIzfvA/41urz4hv+xVxPEbmMQonKSynZ0Ks2xDhJQ4VYjB3DnRiywvKDA==", "dev": true, "dependencies": { - "sprintf-js": "~1.0.2" + "@typescript-eslint/utils": "5.15.0", + "debug": "^4.3.2", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "*" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "node_modules/@typescript-eslint/types": { + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.28.1.tgz", + "integrity": "sha512-4z+knEihcyX7blAGi7O3Fm3O6YRCP+r56NJFMNGsmtdw+NCdpG5SgNz427LS9nQkRVTswZLhz484hakQwB8RRg==", "dev": true, "engines": { - "node": ">=8" - } + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.28.1.tgz", + "integrity": "sha512-GhKxmC4sHXxHGJv8e8egAZeTZ6HI4mLU6S7FUzvFOtsk7ZIDN1ksA9r9DyOgNqowA9yAtZXV0Uiap61bIO81FQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "4.28.1", + "@typescript-eslint/visitor-keys": "4.28.1", + "debug": "^4.3.1", + "globby": "^11.0.3", + "is-glob": "^4.0.1", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.15.0.tgz", + "integrity": "sha512-081rWu2IPKOgTOhHUk/QfxuFog8m4wxW43sXNOMSCdh578tGJ1PAaWPsj42LOa7pguh173tNlMigsbrHvh/mtA==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "@typescript-eslint/scope-manager": "5.15.0", + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/typescript-estree": "5.15.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.15.0.tgz", + "integrity": "sha512-yEiTN4MDy23vvsIksrShjNwQl2vl6kJeG9YkVJXjXZnkJElzVK8nfPsWKYxcsGWG8GhurYXP4/KGj3aZAxbeOA==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.15.0.tgz", + "integrity": "sha512-Hb0e3dGc35b75xLzixM3cSbG1sSbrTBQDfIScqdyvrfJZVEi4XWAT+UL/HMxEdrJNB8Yk28SKxPLtAhfCbBInA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/visitor-keys": "5.15.0", + "debug": "^4.3.2", + "globby": "^11.0.4", + "is-glob": "^4.0.3", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.15.0.tgz", + "integrity": "sha512-+vX5FKtgvyHbmIJdxMJ2jKm9z2BIlXJiuewI8dsDYMp5LzPUcuTT78Ya5iwvQg3VqSVdmxyM8Anj1Jeq7733ZQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.15.0", + "eslint-visitor-keys": "^3.0.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.28.1.tgz", + "integrity": "sha512-K4HMrdFqr9PFquPu178SaSb92CaWe2yErXyPumc8cYWxFmhgJsNY9eSePmO05j0JhBvf2Cdhptd6E6Yv9HVHcg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "4.28.1", + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "dev": true + }, + "node_modules/acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peer": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/app-module-path": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/app-module-path/-/app-module-path-2.2.0.tgz", + "integrity": "sha1-ZBqlXft9am8KgUHEucCqULbCTdU=", + "dev": true + }, + "node_modules/append-transform": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-2.0.0.tgz", + "integrity": "sha512-7yeyCEurROLQJFv5Xj4lEGTy0borxepjFv1g22oAdqFu//SrAlDl1O1Nxx15SH1RoliUml6p8dwJW9jvZughhg==", + "dev": true, + "dependencies": { + "default-require-extensions": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/archy": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", + "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", + "dev": true + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/array-includes": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.4.tgz", + "integrity": "sha512-ZTNSQkmWumEbiHO2GF4GmWxYVTiQyJy2XOTa15sdQSrvKn7l+180egQMqlrMOUMCyLMD7pmyQe4mMDUT6Behrw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.1", + "get-intrinsic": "^1.1.1", + "is-string": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/array.prototype.flat": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.5.tgz", + "integrity": "sha512-KaYU+S+ndVqyUnignHftkwc58o3uVU1jzczILJ1tN2YaIZpFIKBiP/x/j97E5MVPsaCloPbqWLB/8qCTVvT2qg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dev": true, + "dependencies": { + "safer-buffer": "~2.1.0" + } + }, + "node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/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, + "engines": { + "node": "*" + } + }, + "node_modules/ast-module-types": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/ast-module-types/-/ast-module-types-2.7.1.tgz", + "integrity": "sha512-Rnnx/4Dus6fn7fTqdeLEAn5vUll5w7/vts0RN608yFa6si/rDOUonlIIiwugHBFWjylHjxm9owoSZn71KwG4gw==", + "dev": true + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "node_modules/aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/aws4": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", + "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", + "dev": true + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, + "dependencies": { + "tweetnacl": "^0.14.3" + } + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/bl/node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/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, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/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 + }, + "node_modules/browserslist": { + "version": "4.16.6", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.6.tgz", + "integrity": "sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ==", + "dev": true, + "dependencies": { + "caniuse-lite": "^1.0.30001219", + "colorette": "^1.2.2", + "electron-to-chromium": "^1.3.723", + "escalade": "^3.1.1", + "node-releases": "^1.1.71" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + } + }, + "node_modules/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 + }, + "node_modules/caching-transform": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz", + "integrity": "sha512-kpqOvwXnjjN44D89K5ccQC+RUrsy7jB/XLlRrx0D7/2HNcTPqzsb6XgYoErwko6QsV184CA2YgS1fxDiiDZMWA==", + "dev": true, + "dependencies": { + "hasha": "^5.0.0", + "make-dir": "^3.0.0", + "package-hash": "^4.0.0", + "write-file-atomic": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001316", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001316.tgz", + "integrity": "sha512-JgUdNoZKxPZFzbzJwy4hDSyGuH/gXz2rN51QmoR8cBQsVo58llD3A0vlRKKRt8FGf5u69P9eQyIH8/z9vN/S0Q==", + "dev": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + } + }, + "node_modules/caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true + }, + "node_modules/chai": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.6.tgz", + "integrity": "sha512-bbcp3YfHCUzMOvKqsztczerVgBKSsEijCySNlHHbX3VG1nskvqjz5Rfso1gGwD6w6oOV3eI60pKuMOV5MV7p3Q==", + "dev": true, + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "loupe": "^2.3.1", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chai-as-promised": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.1.tgz", + "integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==", + "dev": true, + "dependencies": { + "check-error": "^1.0.2" + }, + "peerDependencies": { + "chai": ">= 2.1.2 < 5" + } + }, + "node_modules/chalk": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", + "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/circular-json": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", + "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", + "deprecated": "CircularJSON is in maintenance only, flatted is its successor.", + "dev": true + }, + "node_modules/clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "dependencies": { + "restore-cursor": "^3.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-spinners": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.0.tgz", + "integrity": "sha512-t+4/y50K/+4xcCRosKkA7W4gTr1MySvLV0q+PxmG7FJ5g+66ChKurYjxBCjHggHH3HA5Hh9cy+lcUGWDqVH+4Q==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "node_modules/asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "dev": true, "dependencies": { - "safer-buffer": "~2.1.0" + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" } }, - "node_modules/assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "node_modules/clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", "dev": true, "engines": { "node": ">=0.8" } }, - "node_modules/assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, "engines": { - "node": "*" + "node": ">=7.0.0" } }, - "node_modules/ast-module-types": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/ast-module-types/-/ast-module-types-2.7.1.tgz", - "integrity": "sha512-Rnnx/4Dus6fn7fTqdeLEAn5vUll5w7/vts0RN608yFa6si/rDOUonlIIiwugHBFWjylHjxm9owoSZn71KwG4gw==", + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "node_modules/colorette": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", + "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==", "dev": true }, - "node_modules/aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dev": true, + "dependencies": { + "delayed-stream": "~1.0.0" + }, "engines": { - "node": "*" + "node": ">= 0.8" } }, - "node_modules/aws4": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", - "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", + "node_modules/commander": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/comment-parser": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.3.0.tgz", + "integrity": "sha512-hRpmWIKgzd81vn0ydoWoyPoALEOnF4wt8yKD35Ib1D6XC2siLiYaiqfGkYrunuKdsXGwpBpHU3+9r+RVw2NZfA==", + "dev": true, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", "dev": true }, - "node_modules/balanced-match": { + "node_modules/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 + }, + "node_modules/convert-source-map": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", + "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.1" + } + }, + "node_modules/core-util-is": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "node_modules/coveralls": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.1.1.tgz", + "integrity": "sha512-+dxnG2NHncSD1NrqbSM3dn/lE57O6Qf/koe9+I7c+wzkqRmEvcp0kgJdxKInzYzkICKkFMZsX3Vct3++tsF9ww==", "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" + "dependencies": { + "js-yaml": "^3.13.1", + "lcov-parse": "^1.0.0", + "log-driver": "^1.2.7", + "minimist": "^1.2.5", + "request": "^2.88.2" + }, + "bin": { + "coveralls": "bin/coveralls.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "node_modules/cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dependencies": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "engines": { + "node": ">=4.8" + } + }, + "node_modules/cross-spawn/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "dependencies": { + "assert-plus": "^1.0.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/dateformat": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", + "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", + "engines": { + "node": "*" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true } - ] + } }, - "node_modules/bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decomment": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/decomment/-/decomment-0.9.4.tgz", + "integrity": "sha512-8eNlhyI5cSU4UbBlrtagWpR03dqXcE5IR9zpe7PnO6UzReXDskucsD8usgrzUmQ6qJ3N82aws/p/mu/jqbURWw==", "dev": true, "dependencies": { - "tweetnacl": "^0.14.3" + "esprima": "4.0.1" + }, + "engines": { + "node": ">=6.4", + "npm": ">=2.15" } }, - "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "node_modules/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, + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", "dev": true, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "node_modules/default-require-extensions": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.0.tgz", + "integrity": "sha512-ek6DpXq/SCpvjhpFsLFRVtIxJCRw6fUR42lYMVZuUMK7n8eMz4Uh5clckdBjEpLhn/gEBZo7hDJnJcwdKLKQjg==", + "dev": true, + "dependencies": { + "strip-bom": "^4.0.0" + }, "engines": { "node": ">=8" } }, - "node_modules/bl": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", - "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "node_modules/defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", "dev": true, "dependencies": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" + "clone": "^1.0.2" } }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "node_modules/define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", "dev": true, "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "object-keys": "^1.0.12" + }, + "engines": { + "node": ">= 0.4" } }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", "dev": true, - "dependencies": { - "fill-range": "^7.0.1" - }, "engines": { - "node": ">=8" + "node": ">=0.4.0" } }, - "node_modules/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 - }, - "node_modules/browserslist": { - "version": "4.16.6", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.6.tgz", - "integrity": "sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ==", + "node_modules/dependency-tree": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/dependency-tree/-/dependency-tree-8.1.1.tgz", + "integrity": "sha512-bl5U16VQpaYxD0xvcnCH/dTctCiWnsVWymh9dNjbm4T00Hm21flu1VLnNueKCj7+3uusbcJhKKKtiWrpU0I+Nw==", "dev": true, "dependencies": { - "caniuse-lite": "^1.0.30001219", - "colorette": "^1.2.2", - "electron-to-chromium": "^1.3.723", - "escalade": "^3.1.1", - "node-releases": "^1.1.71" + "commander": "^2.20.3", + "debug": "^4.3.1", + "filing-cabinet": "^3.0.0", + "precinct": "^8.0.0", + "typescript": "^3.9.7" }, "bin": { - "browserslist": "cli.js" + "dependency-tree": "bin/cli.js" }, "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" + "node": "^10.13 || ^12 || >=14" } }, - "node_modules/buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "node_modules/dependency-tree/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "node_modules/dependency-tree/node_modules/precinct": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/precinct/-/precinct-8.1.0.tgz", + "integrity": "sha512-oeZBR9IdER42Ef6Rz11z1oOUqicsI5J1Qffj6tYghKLhxN2UnHy7uE1axxNr0VZRevPK2HWkROk36uXrbJwHFA==", "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" + "commander": "^2.20.3", + "debug": "^4.3.1", + "detective-amd": "^3.0.1", + "detective-cjs": "^3.1.1", + "detective-es6": "^2.2.0", + "detective-less": "^1.0.2", + "detective-postcss": "^4.0.0", + "detective-sass": "^3.0.1", + "detective-scss": "^2.0.1", + "detective-stylus": "^1.0.0", + "detective-typescript": "^7.0.0", + "module-definition": "^3.3.1", + "node-source-walk": "^4.2.0" + }, + "bin": { + "precinct": "bin/cli.js" + }, + "engines": { + "node": "^10.13 || ^12 || >=14" } }, - "node_modules/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 - }, - "node_modules/builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "node_modules/dependency-tree/node_modules/typescript": { + "version": "3.9.10", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", + "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, "engines": { - "node": ">=0.10.0" + "node": ">=4.2.0" } }, - "node_modules/caching-transform": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz", - "integrity": "sha512-kpqOvwXnjjN44D89K5ccQC+RUrsy7jB/XLlRrx0D7/2HNcTPqzsb6XgYoErwko6QsV184CA2YgS1fxDiiDZMWA==", + "node_modules/detective-amd": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detective-amd/-/detective-amd-3.1.0.tgz", + "integrity": "sha512-G7wGWT6f0VErjUkE2utCm7IUshT7nBh7aBBH2VBOiY9Dqy2DMens5iiOvYCuhstoIxRKLrnOvVAz4/EyPIAjnw==", "dev": true, "dependencies": { - "hasha": "^5.0.0", - "make-dir": "^3.0.0", - "package-hash": "^4.0.0", - "write-file-atomic": "^3.0.0" + "ast-module-types": "^2.7.0", + "escodegen": "^2.0.0", + "get-amd-module-type": "^3.0.0", + "node-source-walk": "^4.0.0" + }, + "bin": { + "detective-amd": "bin/detective-amd.js" }, "engines": { - "node": ">=8" + "node": ">= 6.0" } }, - "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "node_modules/detective-cjs": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/detective-cjs/-/detective-cjs-3.1.1.tgz", + "integrity": "sha512-JQtNTBgFY6h8uT6pgph5QpV3IyxDv+z3qPk/FZRDT9TlFfm5dnRtpH39WtQEr1khqsUxVqXzKjZHpdoQvQbllg==", "dev": true, "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "ast-module-types": "^2.4.0", + "node-source-walk": "^4.0.0" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "engines": { + "node": ">= 6.0" } }, - "node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "node_modules/detective-es6": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/detective-es6/-/detective-es6-2.2.0.tgz", + "integrity": "sha512-fSpNY0SLER7/sVgQZ1NxJPwmc9uCTzNgdkQDhAaj8NPYwr7Qji9QBcmbNvtMCnuuOGMuKn3O7jv0An+/WRWJZQ==", "dev": true, + "dependencies": { + "node-source-walk": "^4.0.0" + }, "engines": { - "node": ">=6" + "node": ">= 6.0" } }, - "node_modules/caniuse-lite": { - "version": "1.0.30001242", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001242.tgz", - "integrity": "sha512-KvNuZ/duufelMB3w2xtf9gEWCSxJwUgoxOx5b6ScLXC4kPc9xsczUVCPrQU26j5kOsHM4pSUL54tAZt5THQKug==", + "node_modules/detective-less": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/detective-less/-/detective-less-1.0.2.tgz", + "integrity": "sha512-Rps1xDkEEBSq3kLdsdnHZL1x2S4NGDcbrjmd4q+PykK5aJwDdP5MBgrJw1Xo+kyUHuv3JEzPqxr+Dj9ryeDRTA==", "dev": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" + "dependencies": { + "debug": "^4.0.0", + "gonzales-pe": "^4.2.3", + "node-source-walk": "^4.0.0" + }, + "engines": { + "node": ">= 6.0" } }, - "node_modules/caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", - "dev": true - }, - "node_modules/chai": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.4.tgz", - "integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==", + "node_modules/detective-postcss": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/detective-postcss/-/detective-postcss-4.0.0.tgz", + "integrity": "sha512-Fwc/g9VcrowODIAeKRWZfVA/EufxYL7XfuqJQFroBKGikKX83d2G7NFw6kDlSYGG3LNQIyVa+eWv1mqre+v4+A==", "dev": true, "dependencies": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^3.0.1", - "get-func-name": "^2.0.0", - "pathval": "^1.1.1", - "type-detect": "^4.0.5" + "debug": "^4.1.1", + "is-url": "^1.2.4", + "postcss": "^8.1.7", + "postcss-values-parser": "^2.0.1" }, "engines": { - "node": ">=4" + "node": "^10 || ^12 || >=14" } }, - "node_modules/chai-as-promised": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.1.tgz", - "integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==", + "node_modules/detective-sass": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/detective-sass/-/detective-sass-3.0.1.tgz", + "integrity": "sha512-oSbrBozRjJ+QFF4WJFbjPQKeakoaY1GiR380NPqwdbWYd5wfl5cLWv0l6LsJVqrgWfFN1bjFqSeo32Nxza8Lbw==", "dev": true, "dependencies": { - "check-error": "^1.0.2" + "debug": "^4.1.1", + "gonzales-pe": "^4.2.3", + "node-source-walk": "^4.0.0" }, - "peerDependencies": { - "chai": ">= 2.1.2 < 5" + "engines": { + "node": ">= 6.0" } }, - "node_modules/chalk": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", - "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", + "node_modules/detective-scss": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/detective-scss/-/detective-scss-2.0.1.tgz", + "integrity": "sha512-VveyXW4WQE04s05KlJ8K0bG34jtHQVgTc9InspqoQxvnelj/rdgSAy7i2DXAazyQNFKlWSWbS+Ro2DWKFOKTPQ==", "dev": true, "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "debug": "^4.1.1", + "gonzales-pe": "^4.2.3", + "node-source-walk": "^4.0.0" }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "node": ">= 6.0" } }, - "node_modules/check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "node_modules/detective-stylus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/detective-stylus/-/detective-stylus-1.0.0.tgz", + "integrity": "sha1-UK7n24uruZA4HwEMY/q7pbWOVM0=", + "dev": true + }, + "node_modules/detective-typescript": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/detective-typescript/-/detective-typescript-7.0.0.tgz", + "integrity": "sha512-y/Ev98AleGvl43YKTNcA2Q+lyFmsmCfTTNWy4cjEJxoLkbobcXtRS0Kvx06daCgr2GdtlwLfNzL553BkktfJoA==", "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "^4.8.2", + "ast-module-types": "^2.7.1", + "node-source-walk": "^4.2.0", + "typescript": "^3.9.7" + }, "engines": { - "node": "*" + "node": "^10.13 || >=12.0.0" } }, - "node_modules/chokidar": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.0.tgz", - "integrity": "sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A==", + "node_modules/detective-typescript/node_modules/typescript": { + "version": "3.9.10", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", + "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", "dev": true, - "dependencies": { - "anymatch": "~3.1.1", - "braces": "~3.0.2", - "glob-parent": "~5.1.0", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.2.0" + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" }, "engines": { - "node": ">= 8.10.0" - }, - "optionalDependencies": { - "fsevents": "~2.1.1" + "node": ">=4.2.0" } }, - "node_modules/circular-json": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", - "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", - "deprecated": "CircularJSON is in maintenance only, flatted is its successor.", - "dev": true - }, - "node_modules/clean-stack": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", - "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "node_modules/diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", "dev": true, "engines": { - "node": ">=6" + "node": ">=0.3.1" } }, - "node_modules/cli-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", - "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", "dev": true, "dependencies": { - "restore-cursor": "^3.1.0" + "path-type": "^4.0.0" }, "engines": { "node": ">=8" } }, - "node_modules/cli-spinners": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.0.tgz", - "integrity": "sha512-t+4/y50K/+4xcCRosKkA7W4gTr1MySvLV0q+PxmG7FJ5g+66ChKurYjxBCjHggHH3HA5Hh9cy+lcUGWDqVH+4Q==", + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", "dev": true, - "engines": { - "node": ">=6" + "peer": true, + "dependencies": { + "esutils": "^2.0.2" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "engines": { + "node": ">=6.0.0" } }, - "node_modules/cliui": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "node_modules/ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", "dev": true, "dependencies": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" } }, - "node_modules/cliui/node_modules/ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true, - "engines": { - "node": ">=6" + "node_modules/electron-to-chromium": { + "version": "1.3.766", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.766.tgz", + "integrity": "sha512-u2quJ862q9reRKh/je3GXis3w38+RoXH1J9N3XjtsS6NzmUAosNsyZgUVFZPN/ZlJ3v6T0rTyZR3q/J5c6Sy5w==", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dependencies": { + "once": "^1.4.0" } }, - "node_modules/cliui/node_modules/string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "node_modules/enhanced-resolve": { + "version": "5.8.2", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.8.2.tgz", + "integrity": "sha512-F27oB3WuHDzvR2DOGNTaYy0D5o0cnrv8TeI482VM4kYgQd/FT9lUQwuNsJ0oOHtBUq7eiW5ytqzp7nBFknL+GA==", "dev": true, "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" }, "engines": { - "node": ">=6" + "node": ">=10.13.0" } }, - "node_modules/cliui/node_modules/strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "node_modules/es-abstract": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz", + "integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==", "dev": true, "dependencies": { - "ansi-regex": "^4.1.0" + "call-bind": "^1.0.2", + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "get-intrinsic": "^1.1.1", + "get-symbol-description": "^1.0.0", + "has": "^1.0.3", + "has-symbols": "^1.0.2", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.4", + "is-negative-zero": "^2.0.1", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.1", + "is-string": "^1.0.7", + "is-weakref": "^1.0.1", + "object-inspect": "^1.11.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.2", + "string.prototype.trimend": "^1.0.4", + "string.prototype.trimstart": "^1.0.4", + "unbox-primitive": "^1.0.1" }, "engines": { - "node": ">=6" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/clone": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", - "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", + "node_modules/es-abstract/node_modules/object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + }, "engines": { - "node": ">=0.8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", "dev": true, "dependencies": { - "color-name": "~1.1.4" + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" }, "engines": { - "node": ">=7.0.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/colorette": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", - "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==", + "node_modules/es6-error": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", + "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", "dev": true }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", "dev": true, - "dependencies": { - "delayed-stream": "~1.0.0" - }, "engines": { - "node": ">= 0.8" + "node": ">=6" } }, - "node_modules/commander": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", - "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", + "node_modules/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, "engines": { - "node": ">= 6" - } - }, - "node_modules/commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", - "dev": true - }, - "node_modules/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 - }, - "node_modules/convert-source-map": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", - "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", - "dev": true, - "dependencies": { - "safe-buffer": "~5.1.1" + "node": ">=0.8.0" } }, - "node_modules/core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "node_modules/coveralls": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.1.1.tgz", - "integrity": "sha512-+dxnG2NHncSD1NrqbSM3dn/lE57O6Qf/koe9+I7c+wzkqRmEvcp0kgJdxKInzYzkICKkFMZsX3Vct3++tsF9ww==", + "node_modules/escodegen": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz", + "integrity": "sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==", "dev": true, "dependencies": { - "js-yaml": "^3.13.1", - "lcov-parse": "^1.0.0", - "log-driver": "^1.2.7", - "minimist": "^1.2.5", - "request": "^2.88.2" + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1" }, "bin": { - "coveralls": "bin/coveralls.js" + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" }, "engines": { - "node": ">=6" + "node": ">=6.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" } }, - "node_modules/cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dependencies": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" + "node_modules/eslint": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.11.0.tgz", + "integrity": "sha512-/KRpd9mIRg2raGxHRGwW9ZywYNAClZrHjdueHcrVDuO3a6bj83eoTirCCk0M0yPwOjWYKHwRVRid+xK4F/GHgA==", + "dev": true, + "peer": true, + "dependencies": { + "@eslint/eslintrc": "^1.2.1", + "@humanwhocodes/config-array": "^0.9.2", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.1", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.3.1", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^6.0.1", + "globals": "^13.6.0", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "bin": { + "eslint": "bin/eslint.js" }, "engines": { - "node": ">=4.8" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/cross-spawn/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "bin": { - "semver": "bin/semver" + "node_modules/eslint-import-resolver-node": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", + "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==", + "dev": true, + "dependencies": { + "debug": "^3.2.7", + "resolve": "^1.20.0" } }, - "node_modules/dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, "dependencies": { - "assert-plus": "^1.0.0" + "ms": "^2.1.1" + } + }, + "node_modules/eslint-module-utils": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz", + "integrity": "sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==", + "dev": true, + "dependencies": { + "debug": "^3.2.7", + "find-up": "^2.1.0" }, "engines": { - "node": ">=0.10" + "node": ">=4" } }, - "node_modules/dateformat": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", - "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", - "engines": { - "node": "*" + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" } }, - "node_modules/debug": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", - "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "node_modules/eslint-module-utils/node_modules/find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true, "dependencies": { - "ms": "2.1.2" + "locate-path": "^2.0.0" }, "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } + "node": ">=4" } }, - "node_modules/decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "node_modules/eslint-module-utils/node_modules/locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", "dev": true, + "dependencies": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, "engines": { - "node": ">=0.10.0" + "node": ">=4" } }, - "node_modules/decomment": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/decomment/-/decomment-0.9.4.tgz", - "integrity": "sha512-8eNlhyI5cSU4UbBlrtagWpR03dqXcE5IR9zpe7PnO6UzReXDskucsD8usgrzUmQ6qJ3N82aws/p/mu/jqbURWw==", + "node_modules/eslint-module-utils/node_modules/p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", "dev": true, "dependencies": { - "esprima": "4.0.1" + "p-try": "^1.0.0" }, "engines": { - "node": ">=6.4", - "npm": ">=2.15" + "node": ">=4" } }, - "node_modules/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==", + "node_modules/eslint-module-utils/node_modules/p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", "dev": true, "dependencies": { - "type-detect": "^4.0.0" + "p-limit": "^1.1.0" }, "engines": { - "node": ">=0.12" + "node": ">=4" } }, - "node_modules/deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "node_modules/eslint-module-utils/node_modules/p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", "dev": true, "engines": { - "node": ">=4.0.0" + "node": ">=4" } }, - "node_modules/deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", - "dev": true - }, - "node_modules/default-require-extensions": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.0.tgz", - "integrity": "sha512-ek6DpXq/SCpvjhpFsLFRVtIxJCRw6fUR42lYMVZuUMK7n8eMz4Uh5clckdBjEpLhn/gEBZo7hDJnJcwdKLKQjg==", + "node_modules/eslint-plugin-import": { + "version": "2.25.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.25.4.tgz", + "integrity": "sha512-/KJBASVFxpu0xg1kIBn9AUa8hQVnszpwgE7Ld0lKAlx7Ie87yzEzCgSkekt+le/YVhiaosO4Y14GDAOc41nfxA==", "dev": true, "dependencies": { - "strip-bom": "^4.0.0" + "array-includes": "^3.1.4", + "array.prototype.flat": "^1.2.5", + "debug": "^2.6.9", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.6", + "eslint-module-utils": "^2.7.2", + "has": "^1.0.3", + "is-core-module": "^2.8.0", + "is-glob": "^4.0.3", + "minimatch": "^3.0.4", + "object.values": "^1.1.5", + "resolve": "^1.20.0", + "tsconfig-paths": "^3.12.0" }, "engines": { - "node": ">=8" + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" } }, - "node_modules/defaults": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", - "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", + "node_modules/eslint-plugin-import/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, "dependencies": { - "clone": "^1.0.2" + "ms": "2.0.0" } }, - "node_modules/define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "node_modules/eslint-plugin-import/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, "dependencies": { - "object-keys": "^1.0.12" + "esutils": "^2.0.2" }, "engines": { - "node": ">= 0.4" + "node": ">=0.10.0" } }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true, - "engines": { - "node": ">=0.4.0" - } + "node_modules/eslint-plugin-import/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true }, - "node_modules/dependency-tree": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/dependency-tree/-/dependency-tree-8.1.1.tgz", - "integrity": "sha512-bl5U16VQpaYxD0xvcnCH/dTctCiWnsVWymh9dNjbm4T00Hm21flu1VLnNueKCj7+3uusbcJhKKKtiWrpU0I+Nw==", + "node_modules/eslint-plugin-jsdoc": { + "version": "38.0.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-38.0.4.tgz", + "integrity": "sha512-/McOYm7BEmiwNd5niCea2iHuFRtTrqeZN6IKJPJoC2PO8hfQn3FFRgYoGs17hoo6PaIWQLxo6hvCJsu+/KSRfg==", "dev": true, "dependencies": { - "commander": "^2.20.3", - "debug": "^4.3.1", - "filing-cabinet": "^3.0.0", - "precinct": "^8.0.0", - "typescript": "^3.9.7" + "@es-joy/jsdoccomment": "~0.21.2", + "comment-parser": "1.3.0", + "debug": "^4.3.3", + "escape-string-regexp": "^4.0.0", + "esquery": "^1.4.0", + "regextras": "^0.8.0", + "semver": "^7.3.5", + "spdx-expression-parse": "^3.0.1" }, - "bin": { - "dependency-tree": "bin/cli.js" + "engines": { + "node": "^12 || ^14 || ^16 || ^17" }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + } + }, + "node_modules/eslint-plugin-jsdoc/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, "engines": { - "node": "^10.13 || ^12 || >=14" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/dependency-tree/node_modules/commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true + "node_modules/eslint-plugin-prefer-arrow": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-prefer-arrow/-/eslint-plugin-prefer-arrow-1.2.3.tgz", + "integrity": "sha512-J9I5PKCOJretVuiZRGvPQxCbllxGAV/viI20JO3LYblAodofBxyMnZAJ+WGeClHgANnSJberTNoFWWjrWKBuXQ==", + "dev": true, + "peerDependencies": { + "eslint": ">=2.0.0" + } }, - "node_modules/dependency-tree/node_modules/precinct": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/precinct/-/precinct-8.1.0.tgz", - "integrity": "sha512-oeZBR9IdER42Ef6Rz11z1oOUqicsI5J1Qffj6tYghKLhxN2UnHy7uE1axxNr0VZRevPK2HWkROk36uXrbJwHFA==", + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", "dev": true, "dependencies": { - "commander": "^2.20.3", - "debug": "^4.3.1", - "detective-amd": "^3.0.1", - "detective-cjs": "^3.1.1", - "detective-es6": "^2.2.0", - "detective-less": "^1.0.2", - "detective-postcss": "^4.0.0", - "detective-sass": "^3.0.1", - "detective-scss": "^2.0.1", - "detective-stylus": "^1.0.0", - "detective-typescript": "^7.0.0", - "module-definition": "^3.3.1", - "node-source-walk": "^4.2.0" - }, - "bin": { - "precinct": "bin/cli.js" + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" }, "engines": { - "node": "^10.13 || ^12 || >=14" + "node": ">=8.0.0" } }, - "node_modules/dependency-tree/node_modules/typescript": { - "version": "3.9.10", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", - "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", + "node_modules/eslint-scope/node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, "engines": { - "node": ">=4.2.0" + "node": ">=4.0" } }, - "node_modules/detective-amd": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/detective-amd/-/detective-amd-3.1.0.tgz", - "integrity": "sha512-G7wGWT6f0VErjUkE2utCm7IUshT7nBh7aBBH2VBOiY9Dqy2DMens5iiOvYCuhstoIxRKLrnOvVAz4/EyPIAjnw==", + "node_modules/eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", "dev": true, "dependencies": { - "ast-module-types": "^2.7.0", - "escodegen": "^2.0.0", - "get-amd-module-type": "^3.0.0", - "node-source-walk": "^4.0.0" + "eslint-visitor-keys": "^2.0.0" }, - "bin": { - "detective-amd": "bin/detective-amd.js" + "engines": { + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" }, + "peerDependencies": { + "eslint": ">=5" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true, "engines": { - "node": ">= 6.0" + "node": ">=10" } }, - "node_modules/detective-cjs": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/detective-cjs/-/detective-cjs-3.1.1.tgz", - "integrity": "sha512-JQtNTBgFY6h8uT6pgph5QpV3IyxDv+z3qPk/FZRDT9TlFfm5dnRtpH39WtQEr1khqsUxVqXzKjZHpdoQvQbllg==", + "node_modules/eslint/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "peer": true + }, + "node_modules/eslint/node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", "dev": true, + "peer": true, "dependencies": { - "ast-module-types": "^2.4.0", - "node-source-walk": "^4.0.0" + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" }, "engines": { - "node": ">= 6.0" + "node": ">= 8" } }, - "node_modules/detective-es6": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/detective-es6/-/detective-es6-2.2.0.tgz", - "integrity": "sha512-fSpNY0SLER7/sVgQZ1NxJPwmc9uCTzNgdkQDhAaj8NPYwr7Qji9QBcmbNvtMCnuuOGMuKn3O7jv0An+/WRWJZQ==", + "node_modules/eslint/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, - "dependencies": { - "node-source-walk": "^4.0.0" - }, + "peer": true, "engines": { - "node": ">= 6.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/detective-less": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/detective-less/-/detective-less-1.0.2.tgz", - "integrity": "sha512-Rps1xDkEEBSq3kLdsdnHZL1x2S4NGDcbrjmd4q+PykK5aJwDdP5MBgrJw1Xo+kyUHuv3JEzPqxr+Dj9ryeDRTA==", + "node_modules/eslint/node_modules/eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", "dev": true, + "peer": true, "dependencies": { - "debug": "^4.0.0", - "gonzales-pe": "^4.2.3", - "node-source-walk": "^4.0.0" + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" }, "engines": { - "node": ">= 6.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/detective-postcss": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/detective-postcss/-/detective-postcss-4.0.0.tgz", - "integrity": "sha512-Fwc/g9VcrowODIAeKRWZfVA/EufxYL7XfuqJQFroBKGikKX83d2G7NFw6kDlSYGG3LNQIyVa+eWv1mqre+v4+A==", + "node_modules/eslint/node_modules/eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", "dev": true, - "dependencies": { - "debug": "^4.1.1", - "is-url": "^1.2.4", - "postcss": "^8.1.7", - "postcss-values-parser": "^2.0.1" - }, + "peer": true, "engines": { - "node": "^10 || ^12 || >=14" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/detective-sass": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/detective-sass/-/detective-sass-3.0.1.tgz", - "integrity": "sha512-oSbrBozRjJ+QFF4WJFbjPQKeakoaY1GiR380NPqwdbWYd5wfl5cLWv0l6LsJVqrgWfFN1bjFqSeo32Nxza8Lbw==", + "node_modules/eslint/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, + "peer": true, "dependencies": { - "debug": "^4.1.1", - "gonzales-pe": "^4.2.3", - "node-source-walk": "^4.0.0" + "is-glob": "^4.0.3" }, "engines": { - "node": ">= 6.0" + "node": ">=10.13.0" } }, - "node_modules/detective-scss": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/detective-scss/-/detective-scss-2.0.1.tgz", - "integrity": "sha512-VveyXW4WQE04s05KlJ8K0bG34jtHQVgTc9InspqoQxvnelj/rdgSAy7i2DXAazyQNFKlWSWbS+Ro2DWKFOKTPQ==", + "node_modules/eslint/node_modules/globals": { + "version": "13.13.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.13.0.tgz", + "integrity": "sha512-EQ7Q18AJlPwp3vUDL4mKA0KXrXyNIQyWon6T6XQiBQF0XHvRsiCSrWmmeATpUzdJN2HhWZU6Pdl0a9zdep5p6A==", "dev": true, + "peer": true, "dependencies": { - "debug": "^4.1.1", - "gonzales-pe": "^4.2.3", - "node-source-walk": "^4.0.0" + "type-fest": "^0.20.2" }, "engines": { - "node": ">= 6.0" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/detective-stylus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/detective-stylus/-/detective-stylus-1.0.0.tgz", - "integrity": "sha1-UK7n24uruZA4HwEMY/q7pbWOVM0=", - "dev": true - }, - "node_modules/detective-typescript": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/detective-typescript/-/detective-typescript-7.0.0.tgz", - "integrity": "sha512-y/Ev98AleGvl43YKTNcA2Q+lyFmsmCfTTNWy4cjEJxoLkbobcXtRS0Kvx06daCgr2GdtlwLfNzL553BkktfJoA==", + "node_modules/eslint/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, + "peer": true, "dependencies": { - "@typescript-eslint/typescript-estree": "^4.8.2", - "ast-module-types": "^2.7.1", - "node-source-walk": "^4.2.0", - "typescript": "^3.9.7" + "argparse": "^2.0.1" }, - "engines": { - "node": "^10.13 || >=12.0.0" + "bin": { + "js-yaml": "bin/js-yaml.js" } }, - "node_modules/detective-typescript/node_modules/typescript": { - "version": "3.9.10", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", - "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", + "node_modules/eslint/node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" + "peer": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" }, "engines": { - "node": ">=4.2.0" + "node": ">= 0.8.0" } }, - "node_modules/diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "node_modules/eslint/node_modules/optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", "dev": true, + "peer": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + }, "engines": { - "node": ">=0.3.1" + "node": ">= 0.8.0" } }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "node_modules/eslint/node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true, - "dependencies": { - "path-type": "^4.0.0" - }, + "peer": true, "engines": { "node": ">=8" } }, - "node_modules/ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "node_modules/eslint/node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true, - "dependencies": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "node_modules/electron-to-chromium": { - "version": "1.3.766", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.766.tgz", - "integrity": "sha512-u2quJ862q9reRKh/je3GXis3w38+RoXH1J9N3XjtsS6NzmUAosNsyZgUVFZPN/ZlJ3v6T0rTyZR3q/J5c6Sy5w==", - "dev": true - }, - "node_modules/emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dependencies": { - "once": "^1.4.0" + "peer": true, + "engines": { + "node": ">= 0.8.0" } }, - "node_modules/enhanced-resolve": { - "version": "5.8.2", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.8.2.tgz", - "integrity": "sha512-F27oB3WuHDzvR2DOGNTaYy0D5o0cnrv8TeI482VM4kYgQd/FT9lUQwuNsJ0oOHtBUq7eiW5ytqzp7nBFknL+GA==", + "node_modules/eslint/node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", "dev": true, + "peer": true, "dependencies": { - "graceful-fs": "^4.2.4", - "tapable": "^2.2.0" + "shebang-regex": "^3.0.0" }, "engines": { - "node": ">=10.13.0" + "node": ">=8" } }, - "node_modules/es-abstract": { - "version": "1.18.3", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.3.tgz", - "integrity": "sha512-nQIr12dxV7SSxE6r6f1l3DtAeEYdsGpps13dR0TwJg1S8gyp4ZPgy3FZcHBgbiQqnoqSTb+oC+kO4UQ0C/J8vw==", + "node_modules/eslint/node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "get-intrinsic": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.2", - "is-callable": "^1.2.3", - "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.3", - "is-string": "^1.0.6", - "object-inspect": "^1.10.3", - "object-keys": "^1.1.1", - "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.1" - }, + "peer": true, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=8" } }, - "node_modules/es-abstract/node_modules/object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "node_modules/eslint/node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true, - "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", - "object-keys": "^1.1.1" - }, + "peer": true, "engines": { - "node": ">= 0.4" + "node": ">=8" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "node_modules/eslint/node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", "dev": true, + "peer": true, "dependencies": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" + "prelude-ls": "^1.2.1" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">= 0.8.0" } }, - "node_modules/es6-error": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", - "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", - "dev": true - }, - "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "node_modules/eslint/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, + "peer": true, "engines": { - "node": ">=6" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/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=", + "node_modules/eslint/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, + "peer": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, "engines": { - "node": ">=0.8.0" + "node": ">= 8" } }, - "node_modules/escodegen": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz", - "integrity": "sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==", + "node_modules/espree": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.1.tgz", + "integrity": "sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ==", "dev": true, + "peer": true, "dependencies": { - "esprima": "^4.0.1", - "estraverse": "^5.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1" - }, - "bin": { - "escodegen": "bin/escodegen.js", - "esgenerate": "bin/esgenerate.js" + "acorn": "^8.7.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^3.3.0" }, "engines": { - "node": ">=6.0" - }, - "optionalDependencies": { - "source-map": "~0.6.1" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", "dev": true, + "peer": true, "engines": { - "node": ">=10" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, "node_modules/esprima": { @@ -1882,6 +2981,30 @@ "node": ">=4" } }, + "node_modules/esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, "node_modules/estraverse": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", @@ -1980,7 +3103,20 @@ "integrity": "sha512-HOnr8Mc60eNYl1gzwp6r5RoUyAn5/glBolUzP/Ez6IFVPMPirxn/9phgL6zhOtaTy7ISwPvQ+wT+hfcRZh/bzw==", "dev": true, "dependencies": { - "reusify": "^1.0.4" + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "peer": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" } }, "node_modules/filing-cabinet": { @@ -2059,33 +3195,65 @@ } }, "node_modules/find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, "dependencies": { - "locate-path": "^3.0.0" + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" }, "engines": { - "node": ">=6" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-up/node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" } }, "node_modules/flat": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.1.tgz", - "integrity": "sha512-FmTtBsHskrU6FJ2VxCnsDb84wu9zhmO3cUX2kGFb5tuwhfXxGciiT0oRY+cck35QmG+NmGh5eLz6lLCpWTqwpA==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", "dev": true, - "dependencies": { - "is-buffer": "~2.0.3" - }, "bin": { "flat": "cli.js" } }, + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "peer": true, + "dependencies": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", + "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", + "dev": true, + "peer": true + }, "node_modules/flatten": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.3.tgz", "integrity": "sha512-dVsPA/UwQ8+2uoFe5GHtiBMu48dWLTdsuEd7CKGlZlD78r1TTWBvDuFaFGKCo/ZfEr95Uk56vZoX86OsHkUeIg==", + "deprecated": "flatten is deprecated in favor of utility frameworks such as lodash.", "dev": true }, "node_modules/foreground-child": { @@ -2210,10 +3378,9 @@ "dev": true }, "node_modules/fsevents": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", - "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", - "deprecated": "\"Please update to latest v2.3 or v2.2\"", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "dev": true, "hasInstallScript": true, "optional": true, @@ -2230,6 +3397,12 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "node_modules/functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -2310,6 +3483,22 @@ "node": ">=6" } }, + "node_modules/get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", @@ -2320,9 +3509,9 @@ } }, "node_modules/glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", @@ -2334,6 +3523,9 @@ }, "engines": { "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/glob-parent": { @@ -2505,6 +3697,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/hasha": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.2.tgz", @@ -2552,11 +3759,11 @@ } }, "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" + "safer-buffer": ">= 2.1.2 < 3.0.0" }, "engines": { "node": ">=0.10.0" @@ -2583,14 +3790,41 @@ ] }, "node_modules/ignore": { - "version": "5.1.8", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", - "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true, "engines": { "node": ">= 4" } }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "peer": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "peer": true, + "engines": { + "node": ">=4" + } + }, "node_modules/imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -2637,6 +3871,20 @@ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, + "node_modules/internal-slot": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", + "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/invert-kv": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-3.0.1.tgz", @@ -2684,33 +3932,10 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-buffer": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", - "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "engines": { - "node": ">=4" - } - }, "node_modules/is-callable": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.3.tgz", - "integrity": "sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", + "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", "dev": true, "engines": { "node": ">= 0.4" @@ -2720,9 +3945,9 @@ } }, "node_modules/is-core-module": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", - "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", + "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", "dev": true, "dependencies": { "has": "^1.0.3" @@ -2753,18 +3978,18 @@ } }, "node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, "engines": { - "node": ">=4" + "node": ">=8" } }, "node_modules/is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "dependencies": { "is-extglob": "^2.1.1" @@ -2824,14 +4049,23 @@ "node": ">=0.10.0" } }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-regex": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.3.tgz", - "integrity": "sha512-qSVXFz28HM7y+IWX6vLCsexdlvzT1PJNFSBuaQLQ5o0IEw8UDYW6/2+eCMVyIsbM8CNLX2a/QWmSpyxYEHY7CQ==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "has-symbols": "^1.0.2" + "has-tostringtag": "^1.0.0" }, "engines": { "node": ">= 0.4" @@ -2855,6 +4089,15 @@ "integrity": "sha1-CRtGoNZ8HtD+hfH4z93gBrslHUY=", "dev": true }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", + "integrity": "sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", @@ -2865,10 +4108,13 @@ } }, "node_modules/is-string": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.6.tgz", - "integrity": "sha512-2gdzbKUuqtQ3lYNrUTQYoClPhm7oQu4UdpSZMp1/DGgkHBT8E2Z1l0yMdb6D4zNAxwDiMv8MdulKROJGNl0Q0w==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, "engines": { "node": ">= 0.4" }, @@ -2915,6 +4161,18 @@ "integrity": "sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==", "dev": true }, + "node_modules/is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -3108,6 +4366,11 @@ "node": ">=8" } }, + "node_modules/itiriri": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/itiriri/-/itiriri-2.0.1.tgz", + "integrity": "sha512-XutdsL9Nm9ejgRlFwOBdWW78Txvs9ehhMFeGCp3GjGIWSeQNgOzOfo+PjuQSmaFgE1ol6Pr2g5Jg7W4BYIploQ==" + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -3133,6 +4396,15 @@ "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", "dev": true }, + "node_modules/jsdoc-type-pratt-parser": { + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-2.2.5.tgz", + "integrity": "sha512-2a6eRxSxp1BW040hFvaJxhsCMI9lT8QB8t14t+NY5tC5rckIR0U9cr2tjOeaFirmEOy6MHvmJnY7zTBHq431Lw==", + "dev": true, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -3146,9 +4418,9 @@ } }, "node_modules/json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", "dev": true }, "node_modules/json-schema-traverse": { @@ -3157,6 +4429,13 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true, + "peer": true + }, "node_modules/json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -3178,19 +4457,25 @@ "node": ">=6" } }, + "node_modules/jsonc-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz", + "integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==", + "dev": true + }, "node_modules/jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", + "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", "dev": true, - "engines": [ - "node >=0.6.0" - ], "dependencies": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", - "json-schema": "0.2.3", + "json-schema": "0.4.0", "verror": "1.10.0" + }, + "engines": { + "node": ">=0.6.0" } }, "node_modules/lcid": { @@ -3227,16 +4512,18 @@ } }, "node_modules/locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, "dependencies": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" + "p-locate": "^5.0.0" }, "engines": { - "node": ">=6" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/lodash": { @@ -3251,6 +4538,13 @@ "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", "dev": true }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, + "peer": true + }, "node_modules/log-driver": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz", @@ -3261,77 +4555,28 @@ } }, "node_modules/log-symbols": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", - "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", - "dev": true, - "dependencies": { - "chalk": "^2.4.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/log-symbols/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", "dev": true, "dependencies": { - "color-convert": "^1.9.0" + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" }, "engines": { - "node": ">=4" - } - }, - "node_modules/log-symbols/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "node": ">=10" }, - "engines": { - "node": ">=4" - } - }, - "node_modules/log-symbols/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/log-symbols/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "node_modules/log-symbols/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true, - "engines": { - "node": ">=4" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/log-symbols/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "node_modules/loupe": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.4.tgz", + "integrity": "sha512-OvKfgCC2Ndby6aSTREl5aCCPTNIzlDfQZvZxNUrBrihDhL3xcrYegTblhmEiCrg2kKQz4XsFIaemE5BF4ybSaQ==", "dev": true, "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" + "get-func-name": "^2.0.0" } }, "node_modules/lru-cache": { @@ -3447,15 +4692,15 @@ } }, "node_modules/marked": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/marked/-/marked-2.1.3.tgz", - "integrity": "sha512-/Q+7MGzaETqifOMWYEA7HVMaZb4XbcRfaOzcSsHZEith83KGlvaSG33u0SKu89Mj5h+T8V2hM+8O45Qc5XTgwA==", + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.17.tgz", + "integrity": "sha512-Wfk0ATOK5iPxM4ptrORkFemqroz0ZDxp5MWfYA7H/F+wO17NRWV5Ypxi6p3g2Xmw2bKeiYOl6oVnLHKxBA0VhA==", "dev": true, "bin": { - "marked": "bin/marked" + "marked": "bin/marked.js" }, "engines": { - "node": ">= 10" + "node": ">= 12" } }, "node_modules/mem": { @@ -3528,121 +4773,172 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "dev": true - }, - "node_modules/mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "dev": true, - "dependencies": { - "minimist": "^1.2.5" + "brace-expansion": "^1.1.7" }, - "bin": { - "mkdirp": "bin/cmd.js" + "engines": { + "node": "*" } }, + "node_modules/minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "dev": true + }, "node_modules/mocha": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.2.0.tgz", - "integrity": "sha512-O9CIypScywTVpNaRrCAgoUnJgozpIofjKUYmJhiCIJMiuYnLI6otcb1/kpW9/n/tJODHGZ7i8aLQoDVsMtOKQQ==", + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.2.2.tgz", + "integrity": "sha512-L6XC3EdwT6YrIk0yXpavvLkn8h+EU+Y5UcCHKECyMbdUIxyMuZj4bX4U9e1nvnvUUvQVsV2VHQr5zLdcUkhW/g==", "dev": true, "dependencies": { - "ansi-colors": "3.2.3", + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", "browser-stdout": "1.3.1", - "chokidar": "3.3.0", - "debug": "3.2.6", - "diff": "3.5.0", - "escape-string-regexp": "1.0.5", - "find-up": "3.0.0", - "glob": "7.1.3", + "chokidar": "3.5.3", + "debug": "4.3.3", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.2.0", "growl": "1.10.5", "he": "1.2.0", - "js-yaml": "3.13.1", - "log-symbols": "3.0.0", - "minimatch": "3.0.4", - "mkdirp": "0.5.5", - "ms": "2.1.1", - "node-environment-flags": "1.0.6", - "object.assign": "4.1.0", - "strip-json-comments": "2.0.1", - "supports-color": "6.0.0", - "which": "1.3.1", - "wide-align": "1.1.3", - "yargs": "13.3.2", - "yargs-parser": "13.1.2", - "yargs-unparser": "1.6.0" + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "4.2.1", + "ms": "2.1.3", + "nanoid": "3.3.1", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "workerpool": "6.2.0", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" }, "bin": { "_mocha": "bin/_mocha", "mocha": "bin/mocha" }, "engines": { - "node": ">= 8.10.0" + "node": ">= 12.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/mochajs" } }, + "node_modules/mocha/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, "node_modules/mocha/node_modules/debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "deprecated": "Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)", + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", "dev": true, "dependencies": { - "ms": "^2.1.1" + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, - "node_modules/mocha/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "node_modules/mocha/node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/mocha/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, "engines": { - "node": ">=4" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/mocha/node_modules/js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, + "node_modules/mocha/node_modules/minimatch": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-4.2.1.tgz", + "integrity": "sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/mocha/node_modules/ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, + "node_modules/mocha/node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/mocha/node_modules/supports-color": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", - "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, "dependencies": { - "has-flag": "^3.0.0" + "has-flag": "^4.0.0" }, "engines": { - "node": ">=6" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/mocha/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" } }, "node_modules/module-definition": { @@ -3686,26 +4982,6 @@ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, - "node_modules/module-lookup-amd/node_modules/glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", - "dev": true, - "dependencies": { - "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" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -3713,9 +4989,9 @@ "dev": true }, "node_modules/nanoid": { - "version": "3.1.23", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.23.tgz", - "integrity": "sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz", + "integrity": "sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==", "dev": true, "bin": { "nanoid": "bin/nanoid.cjs" @@ -3724,6 +5000,13 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true, + "peer": true + }, "node_modules/neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", @@ -3735,25 +5018,6 @@ "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" }, - "node_modules/node-environment-flags": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz", - "integrity": "sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw==", - "dev": true, - "dependencies": { - "object.getownpropertydescriptors": "^2.0.3", - "semver": "^5.7.0" - } - }, - "node_modules/node-environment-flags/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true, - "bin": { - "semver": "bin/semver" - } - }, "node_modules/node-preload": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", @@ -3856,12 +5120,6 @@ "wrap-ansi": "^6.2.0" } }, - "node_modules/nyc/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, "node_modules/nyc/node_modules/find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", @@ -3875,35 +5133,6 @@ "node": ">=8" } }, - "node_modules/nyc/node_modules/glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", - "dev": true, - "dependencies": { - "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" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/nyc/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/nyc/node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -3937,20 +5166,6 @@ "node": ">=8" } }, - "node_modules/nyc/node_modules/string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/nyc/node_modules/wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", @@ -4010,9 +5225,9 @@ } }, "node_modules/object-inspect": { - "version": "1.10.3", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.10.3.tgz", - "integrity": "sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", + "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -4027,33 +5242,18 @@ "node": ">= 0.4" } }, - "node_modules/object.assign": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", - "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", - "dev": true, - "dependencies": { - "define-properties": "^1.1.2", - "function-bind": "^1.1.1", - "has-symbols": "^1.0.0", - "object-keys": "^1.0.11" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/object.getownpropertydescriptors": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.2.tgz", - "integrity": "sha512-WtxeKSzfBjlzL+F9b7M7hewDzMwy+C8NRssHd1YrNlzHzIDrXcXiNOMrezdAEM4UXixgV+vvnyBeN7Rygl2ttQ==", + "node_modules/object.values": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", + "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.2" + "es-abstract": "^1.19.1" }, "engines": { - "node": ">= 0.8" + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -4082,30 +5282,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/onigasm": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/onigasm/-/onigasm-2.2.5.tgz", - "integrity": "sha512-F+th54mPc0l1lp1ZcFMyL/jTs2Tlq4SqIHKIXGZOR/VkHkF9A7Fr5rRr5+ZG/lWeRsyrClLYRq7s/yFQ/XhWCA==", - "dev": true, - "dependencies": { - "lru-cache": "^5.1.1" - } - }, - "node_modules/onigasm/node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "dependencies": { - "yallist": "^3.0.2" - } - }, - "node_modules/onigasm/node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true - }, "node_modules/optionator": { "version": "0.8.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", @@ -4146,22 +5322,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/ora/node_modules/log-symbols": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", - "dev": true, - "dependencies": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/os-locale": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-4.0.0.tgz", @@ -4215,15 +5375,33 @@ } }, "node_modules/p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, "dependencies": { - "p-limit": "^2.0.0" + "p-limit": "^3.0.2" }, "engines": { - "node": ">=6" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-map": { @@ -4262,6 +5440,19 @@ "node": ">=8" } }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "peer": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/parse-ms": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-2.1.0.tgz", @@ -4545,15 +5736,6 @@ "node": ">=8" } }, - "node_modules/progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", @@ -4607,6 +5789,15 @@ } ] }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, "node_modules/rc": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", @@ -4637,15 +5828,36 @@ } }, "node_modules/readdirp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz", - "integrity": "sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", "dev": true, "dependencies": { - "picomatch": "^2.0.4" + "picomatch": "^2.2.1" }, "engines": { - "node": ">= 8" + "node": ">=8.10.0" + } + }, + "node_modules/regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/regextras": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/regextras/-/regextras-0.8.0.tgz", + "integrity": "sha512-k519uI04Z3SaY0fLX843MRXnDeG2+vHOFsyhiPZvNLe7r8rD2YNRjq4BQLZZ0oAr2NrtvZlICsXysGNFPGa3CQ==", + "dev": true, + "engines": { + "node": ">=0.1.14" } }, "node_modules/release-zalgo": { @@ -4882,6 +6094,15 @@ "node": ">=10" } }, + "node_modules/serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, "node_modules/set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", @@ -4907,15 +6128,29 @@ "node": ">=0.10.0" } }, - "node_modules/shiki": { - "version": "0.9.5", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.5.tgz", - "integrity": "sha512-XFn+rl3wIowDjzdr5DlHoHgQphXefgUTs2bNp/bZu4WF9gTrTLnKwio3f28VjiFG6Jpip7yQn/p4mMj6OrjrtQ==", + "node_modules/shiki": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.10.1.tgz", + "integrity": "sha512-VsY7QJVzU51j5o1+DguUd+6vmCmZ5v/6gYu4vyYAhzjuNQU6P/vmSy4uQaOhvje031qQMiW0d2BwgMH52vqMng==", + "dev": true, + "dependencies": { + "jsonc-parser": "^3.0.0", + "vscode-oniguruma": "^1.6.1", + "vscode-textmate": "5.2.0" + } + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", "dev": true, "dependencies": { - "json5": "^2.2.0", - "onigasm": "^2.2.5", - "vscode-textmate": "5.2.0" + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/signal-exit": { @@ -4992,6 +6227,28 @@ "node": ">= 8" } }, + "node_modules/spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.11", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.11.tgz", + "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==", + "dev": true + }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -5062,37 +6319,17 @@ ] }, "node_modules/string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "dependencies": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/string-width/node_modules/ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/string-width/node_modules/strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, "dependencies": { - "ansi-regex": "^3.0.0" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" }, "engines": { - "node": ">=4" + "node": ">=8" } }, "node_modules/string.prototype.trimend": { @@ -5136,12 +6373,12 @@ } }, "node_modules/strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "dependencies": { - "ansi-regex": "^5.0.0" + "ansi-regex": "^5.0.1" }, "engines": { "node": ">=8" @@ -5239,25 +6476,12 @@ "node": ">=8" } }, - "node_modules/test-exclude/node_modules/glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true, - "dependencies": { - "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" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } + "peer": true }, "node_modules/to-fast-properties": { "version": "2.0.0", @@ -5294,28 +6518,46 @@ } }, "node_modules/ts-node": { - "version": "8.10.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz", - "integrity": "sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==", - "dev": true, - "dependencies": { + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", + "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", "arg": "^4.1.0", + "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", - "source-map-support": "^0.5.17", + "v8-compile-cache-lib": "^3.0.0", "yn": "3.1.1" }, "bin": { "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", "ts-node-script": "dist/bin-script.js", "ts-node-transpile-only": "dist/bin-transpile.js", "ts-script": "dist/bin-script-deprecated.js" }, - "engines": { - "node": ">=6.0.0" - }, "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } } }, "node_modules/ts-node/node_modules/diff": { @@ -5327,139 +6569,44 @@ "node": ">=0.3.1" } }, - "node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "node_modules/tslint": { - "version": "5.20.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", - "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.0.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^4.0.1", - "glob": "^7.1.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.8.0", - "tsutils": "^2.29.0" - }, - "bin": { - "tslint": "bin/tslint" - }, - "engines": { - "node": ">=4.8.0" - }, - "peerDependencies": { - "typescript": ">=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev" - } - }, - "node_modules/tslint/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "node_modules/tsconfig-paths": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.0.tgz", + "integrity": "sha512-cg/1jAZoL57R39+wiw4u/SCC6Ic9Q5NqjBOb+9xISedOYurfog9ZNmKJSxAnb2m/5Bq4lE9lhUcau33Ml8DM0g==", "dev": true, "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.0", + "strip-bom": "^3.0.0" } }, - "node_modules/tslint/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "node_modules/tsconfig-paths/node_modules/json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", "dev": true, "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "minimist": "^1.2.0" }, - "engines": { - "node": ">=4" - } - }, - "node_modules/tslint/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/tslint/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "node_modules/tslint/node_modules/commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - }, - "node_modules/tslint/node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/tslint/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/tslint/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true, "bin": { - "semver": "bin/semver" + "json5": "lib/cli.js" } }, - "node_modules/tslint/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "node_modules/tsconfig-paths/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, "engines": { "node": ">=4" } }, - "node_modules/tslint/node_modules/tsutils": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", - "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", - "dev": true, - "dependencies": { - "tslib": "^1.8.1" - }, - "peerDependencies": { - "typescript": ">=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev || >= 3.1.0-dev" - } + "node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true }, "node_modules/tsutils": { "version": "3.21.0", @@ -5534,73 +6681,57 @@ } }, "node_modules/typedoc": { - "version": "0.21.2", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.21.2.tgz", - "integrity": "sha512-SR1ByJB3USg+jxoxwzMRP07g/0f/cQUE5t7gOh1iTUyjTPyJohu9YSKRlK+MSXXqlhIq+m0jkEHEG5HoY7/Adg==", + "version": "0.23.6", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.23.6.tgz", + "integrity": "sha512-YkL7zq6Tjnze7tlPcXQd527VPpcz30cvvzVTar6jJtiHt1DPWgH8c64x2s2xsGQ+SafQpAc90jYyrB6+rXLW1g==", "dev": true, "dependencies": { - "glob": "^7.1.7", - "handlebars": "^4.7.7", - "lodash": "^4.17.21", "lunr": "^2.3.9", - "marked": "^2.1.1", - "minimatch": "^3.0.0", - "progress": "^2.0.3", - "shiki": "^0.9.3", - "typedoc-default-themes": "^0.12.10" + "marked": "^4.0.16", + "minimatch": "^5.1.0", + "shiki": "^0.10.1" }, "bin": { "typedoc": "bin/typedoc" }, "engines": { - "node": ">= 12.20.0" + "node": ">= 14.14" }, "peerDependencies": { - "typescript": "4.0.x || 4.1.x || 4.2.x || 4.3.x" - } - }, - "node_modules/typedoc-default-themes": { - "version": "0.12.10", - "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz", - "integrity": "sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA==", - "dev": true, - "engines": { - "node": ">= 8" + "typescript": "4.6.x || 4.7.x" } }, "node_modules/typedoc-plugin-markdown": { - "version": "3.10.2", - "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.10.2.tgz", - "integrity": "sha512-eAV7fuCymdbUIk2P3jjehUWG0VE3YSr/qGGYAHUEBTrRZMuFxS/rYrooF0PPabBUdbprL4BKV8HaP7oed12T2Q==", + "version": "3.13.3", + "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.13.3.tgz", + "integrity": "sha512-KKvFkQphRcH26NoBCKjjZ7a3rkPBQAOuWg1F4s+snDSWXfTyGWO5isgoe19VUbG87W8X/0x3uc/O0Nj7Qle3TQ==", "dev": true, "dependencies": { "handlebars": "^4.7.7" }, - "engines": { - "node": ">= 12.20.0" - }, "peerDependencies": { - "typedoc": ">=0.21.0" + "typedoc": ">=0.23.0" } }, - "node_modules/typedoc/node_modules/glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "node_modules/typedoc/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, "dependencies": { - "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" + "balanced-match": "^1.0.0" + } + }, + "node_modules/typedoc/node_modules/minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" }, "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "node": ">=10" } }, "node_modules/typemoq": { @@ -5619,9 +6750,9 @@ } }, "node_modules/typescript": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz", - "integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==", + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz", + "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -5688,6 +6819,19 @@ "uuid": "dist/bin/uuid" } }, + "node_modules/v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", + "dev": true, + "peer": true + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", + "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", + "dev": true + }, "node_modules/verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", @@ -5702,6 +6846,12 @@ "extsprintf": "^1.2.0" } }, + "node_modules/vscode-oniguruma": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.6.2.tgz", + "integrity": "sha512-KH8+KKov5eS/9WhofZR8M8dMHWN2gTxjMsG4jd04YhpbPR91fUj7rYQ2/XjeHCJWbg7X++ApRIU9NUwM2vTvLA==", + "dev": true + }, "node_modules/vscode-textmate": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-5.2.0.tgz", @@ -5753,110 +6903,48 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "node_modules/wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "dev": true, - "dependencies": { - "string-width": "^1.0.2 || 2" - } - }, - "node_modules/word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true - }, - "node_modules/wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/wrap-ansi/node_modules/ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/wrap-ansi/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/wrap-ansi/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/wrap-ansi/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "node_modules/which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, - "node_modules/wrap-ansi/node_modules/string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "node_modules/word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", "dev": true, - "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, "engines": { - "node": ">=6" + "node": ">=0.10.0" } }, - "node_modules/wrap-ansi/node_modules/strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + }, + "node_modules/workerpool": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz", + "integrity": "sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==", + "dev": true + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, "dependencies": { - "ansi-regex": "^4.1.0" + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" }, "engines": { - "node": ">=6" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, "node_modules/wrappy": { @@ -5889,80 +6977,78 @@ "dev": true }, "node_modules/yargs": { - "version": "13.3.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", - "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", "dev": true, "dependencies": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" } }, "node_modules/yargs-parser": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", - "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", "dev": true, - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" + "engines": { + "node": ">=10" } }, "node_modules/yargs-unparser": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", - "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", "dev": true, "dependencies": { - "flat": "^4.1.0", - "lodash": "^4.17.15", - "yargs": "^13.3.0" + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" }, "engines": { - "node": ">=6" + "node": ">=10" } }, - "node_modules/yargs/node_modules/ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "node_modules/yargs-unparser/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", "dev": true, "engines": { - "node": ">=6" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/yargs/node_modules/string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "node_modules/yargs-unparser/node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", "dev": true, - "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, "engines": { - "node": ">=6" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/yargs/node_modules/strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "node_modules/yargs/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "dev": true, - "dependencies": { - "ansi-regex": "^4.1.0" - }, "engines": { - "node": ">=6" + "node": ">=10" } }, "node_modules/yn": { @@ -5973,6 +7059,18 @@ "engines": { "node": ">=6" } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } } }, "dependencies": { @@ -6299,6 +7397,112 @@ "to-fast-properties": "^2.0.0" } }, + "@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "dev": true + }, + "@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "dev": true, + "requires": { + "@cspotcode/source-map-consumer": "0.8.0" + } + }, + "@es-joy/jsdoccomment": { + "version": "0.21.2", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.21.2.tgz", + "integrity": "sha512-k8NwNnnYgUR/hyC/JdAbKvaIzTgnT5XJeCeVFo5tpT/4Fu5WiXmhdi6M/c4diqXSDf3ZENyrCtgzCUhIbfT8Zg==", + "dev": true, + "requires": { + "comment-parser": "1.3.0", + "esquery": "^1.4.0", + "jsdoc-type-pratt-parser": "~2.2.4" + } + }, + "@eslint/eslintrc": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.1.tgz", + "integrity": "sha512-bxvbYnBPN1Gibwyp6NrpnFzA3YtRL3BBAyEAFVIpNTm2Rn4Vy87GA5M4aSn3InRrlsbX5N0GW7XIx+U4SAEKdQ==", + "dev": true, + "peer": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.3.1", + "globals": "^13.9.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "peer": true + }, + "globals": { + "version": "13.13.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.13.0.tgz", + "integrity": "sha512-EQ7Q18AJlPwp3vUDL4mKA0KXrXyNIQyWon6T6XQiBQF0XHvRsiCSrWmmeATpUzdJN2HhWZU6Pdl0a9zdep5p6A==", + "dev": true, + "peer": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "peer": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "peer": true + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "peer": true + } + } + }, + "@humanwhocodes/config-array": { + "version": "0.9.5", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", + "integrity": "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==", + "dev": true, + "peer": true, + "requires": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + } + }, + "@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true, + "peer": true + }, "@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -6349,9 +7553,9 @@ } }, "@istanbuljs/nyc-config-typescript": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@istanbuljs/nyc-config-typescript/-/nyc-config-typescript-1.0.1.tgz", - "integrity": "sha512-/gz6LgVpky205LuoOfwEZmnUtaSmdk0QIMcNFj9OvxhiMhPpKftMgZmGN7jNj7jR+lr8IB1Yks3QSSSNSxfoaQ==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@istanbuljs/nyc-config-typescript/-/nyc-config-typescript-1.0.2.tgz", + "integrity": "sha512-iKGIyMoyJuFnJRSVTZ78POIRvNnwZaWIf8vG4ZS3rQq58MMDrqEX2nnzx0R28V2X8JvmKYiqY9FP2hlJsm8A0w==", "dev": true, "requires": { "@istanbuljs/schema": "^0.1.2" @@ -6390,24 +7594,48 @@ } }, "@testdeck/core": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/@testdeck/core/-/core-0.1.2.tgz", - "integrity": "sha512-rggcFQqSejqtkqK1JcwZE/utD4oNsM1JMHwrYxH1PKYx0uL2cMs0Q4zMVLKw0oacIASCfkIUSdXx7rDNdCDlvA==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@testdeck/core/-/core-0.2.0.tgz", + "integrity": "sha512-2BAzKS18I+nFUb9kH2zK7Bs1CBD0WqaYikaLm+gRaOiQKYa8flvVzqlUGwjyOMmD16JFksgxYml4/7xm4tfEYA==", "dev": true }, "@testdeck/mocha": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/@testdeck/mocha/-/mocha-0.1.2.tgz", - "integrity": "sha512-yn3OkFUlO9EkdBkDV08bPV0r26U2FC/8KvU9FdiS0ligOsjB5Ry4sp3eUQJAFxjrGJBpih0t7rZ/GzdsgCv/EQ==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@testdeck/mocha/-/mocha-0.2.0.tgz", + "integrity": "sha512-xudmoPiytaV3flmPZnRO02TPsH31IJuLkGGIX9ftOmditOgA57RK9tYDHNpanA9HxC6kQLP97Tut0RfILENn7w==", "dev": true, "requires": { - "@testdeck/core": "^0.1.2" + "@testdeck/core": "^0.2.0" } }, + "@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "dev": true + }, + "@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "dev": true + }, + "@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "dev": true + }, + "@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "dev": true + }, "@types/chai": { - "version": "4.2.19", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.19.tgz", - "integrity": "sha512-jRJgpRBuY+7izT7/WNXP/LsMO9YonsstuL+xuvycDyESpoDoIAsMd7suwpB4h9oEWB+ZlPTqJJ8EHomzNhwTPQ==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.1.tgz", + "integrity": "sha512-/zPMqDkzSZ8t3VtxOa4KPq7uzzW978M9Tvh+j7GHKuo6k6GTLxPJ4J5gE5cjfJ26pnXst0N5Hax8Sr0T2Mi9zQ==", "dev": true }, "@types/chai-as-promised": { @@ -6425,6 +7653,18 @@ "integrity": "sha512-KlPPdikagvL6ELjWsljbyDIPzNCeliYkqRpI+zea99vBBbCIA5JNshZAwQKTON139c87y9qvTFVgkFd14rtS4g==", "dev": true }, + "@types/json-schema": { + "version": "7.0.10", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.10.tgz", + "integrity": "sha512-BLO9bBq59vW3fxCpD4o0N4U+DXsvwvIcl+jofw0frQo/GrBFC+/jRZj1E7kgp6dvTyNmA4y6JCV5Id/r3mNP5A==", + "dev": true + }, + "@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "dev": true + }, "@types/node": { "version": "16.0.0", "resolved": "https://registry.npmjs.org/@types/node/-/node-16.0.0.tgz", @@ -6441,11 +7681,124 @@ } }, "@types/uuid": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.1.tgz", - "integrity": "sha512-Y2mHTRAbqfFkpjldbkHGY8JIzRN6XqYRliG8/24FcHm2D2PwW24fl5xMRTVGdrb7iMrwCaIEbLWerGIkXuFWVg==", + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz", + "integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==", "dev": true }, + "@typescript-eslint/eslint-plugin": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.15.0.tgz", + "integrity": "sha512-u6Db5JfF0Esn3tiAKELvoU5TpXVSkOpZ78cEGn/wXtT2RVqs2vkt4ge6N8cRCyw7YVKhmmLDbwI2pg92mlv7cA==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "5.15.0", + "@typescript-eslint/type-utils": "5.15.0", + "@typescript-eslint/utils": "5.15.0", + "debug": "^4.3.2", + "functional-red-black-tree": "^1.0.1", + "ignore": "^5.1.8", + "regexpp": "^3.2.0", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/parser": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.15.0.tgz", + "integrity": "sha512-NGAYP/+RDM2sVfmKiKOCgJYPstAO40vPAgACoWPO/+yoYKSgAXIFaBKsV8P0Cc7fwKgvj27SjRNX4L7f4/jCKQ==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "5.15.0", + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/typescript-estree": "5.15.0", + "debug": "^4.3.2" + }, + "dependencies": { + "@typescript-eslint/types": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.15.0.tgz", + "integrity": "sha512-yEiTN4MDy23vvsIksrShjNwQl2vl6kJeG9YkVJXjXZnkJElzVK8nfPsWKYxcsGWG8GhurYXP4/KGj3aZAxbeOA==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.15.0.tgz", + "integrity": "sha512-Hb0e3dGc35b75xLzixM3cSbG1sSbrTBQDfIScqdyvrfJZVEi4XWAT+UL/HMxEdrJNB8Yk28SKxPLtAhfCbBInA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/visitor-keys": "5.15.0", + "debug": "^4.3.2", + "globby": "^11.0.4", + "is-glob": "^4.0.3", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.15.0.tgz", + "integrity": "sha512-+vX5FKtgvyHbmIJdxMJ2jKm9z2BIlXJiuewI8dsDYMp5LzPUcuTT78Ya5iwvQg3VqSVdmxyM8Anj1Jeq7733ZQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.15.0", + "eslint-visitor-keys": "^3.0.0" + } + }, + "eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "dev": true + } + } + }, + "@typescript-eslint/scope-manager": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.15.0.tgz", + "integrity": "sha512-EFiZcSKrHh4kWk0pZaa+YNJosvKE50EnmN4IfgjkA3bTHElPtYcd2U37QQkNTqwMCS7LXeDeZzEqnsOH8chjSg==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/visitor-keys": "5.15.0" + }, + "dependencies": { + "@typescript-eslint/types": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.15.0.tgz", + "integrity": "sha512-yEiTN4MDy23vvsIksrShjNwQl2vl6kJeG9YkVJXjXZnkJElzVK8nfPsWKYxcsGWG8GhurYXP4/KGj3aZAxbeOA==", + "dev": true + }, + "@typescript-eslint/visitor-keys": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.15.0.tgz", + "integrity": "sha512-+vX5FKtgvyHbmIJdxMJ2jKm9z2BIlXJiuewI8dsDYMp5LzPUcuTT78Ya5iwvQg3VqSVdmxyM8Anj1Jeq7733ZQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.15.0", + "eslint-visitor-keys": "^3.0.0" + } + }, + "eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "dev": true + } + } + }, + "@typescript-eslint/type-utils": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.15.0.tgz", + "integrity": "sha512-KGeDoEQ7gHieLydujGEFLyLofipe9PIzfvA/41urz4hv+xVxPEbmMQonKSynZ0Ks2xDhJQ4VYjB3DnRiywvKDA==", + "dev": true, + "requires": { + "@typescript-eslint/utils": "5.15.0", + "debug": "^4.3.2", + "tsutils": "^3.21.0" + } + }, "@typescript-eslint/types": { "version": "4.28.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.28.1.tgz", @@ -6467,6 +7820,59 @@ "tsutils": "^3.21.0" } }, + "@typescript-eslint/utils": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.15.0.tgz", + "integrity": "sha512-081rWu2IPKOgTOhHUk/QfxuFog8m4wxW43sXNOMSCdh578tGJ1PAaWPsj42LOa7pguh173tNlMigsbrHvh/mtA==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "@typescript-eslint/scope-manager": "5.15.0", + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/typescript-estree": "5.15.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" + }, + "dependencies": { + "@typescript-eslint/types": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.15.0.tgz", + "integrity": "sha512-yEiTN4MDy23vvsIksrShjNwQl2vl6kJeG9YkVJXjXZnkJElzVK8nfPsWKYxcsGWG8GhurYXP4/KGj3aZAxbeOA==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.15.0.tgz", + "integrity": "sha512-Hb0e3dGc35b75xLzixM3cSbG1sSbrTBQDfIScqdyvrfJZVEi4XWAT+UL/HMxEdrJNB8Yk28SKxPLtAhfCbBInA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/visitor-keys": "5.15.0", + "debug": "^4.3.2", + "globby": "^11.0.4", + "is-glob": "^4.0.3", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.15.0.tgz", + "integrity": "sha512-+vX5FKtgvyHbmIJdxMJ2jKm9z2BIlXJiuewI8dsDYMp5LzPUcuTT78Ya5iwvQg3VqSVdmxyM8Anj1Jeq7733ZQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.15.0", + "eslint-visitor-keys": "^3.0.0" + } + }, + "eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "dev": true + } + } + }, "@typescript-eslint/visitor-keys": { "version": "4.28.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.28.1.tgz", @@ -6477,6 +7883,32 @@ "eslint-visitor-keys": "^2.0.0" } }, + "@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "dev": true + }, + "acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "dev": true + }, + "acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peer": true, + "requires": {} + }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true + }, "aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -6500,15 +7932,15 @@ } }, "ansi-colors": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", - "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", "dev": true }, "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true }, "ansi-styles": { @@ -6566,12 +7998,36 @@ "sprintf-js": "~1.0.2" } }, + "array-includes": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.4.tgz", + "integrity": "sha512-ZTNSQkmWumEbiHO2GF4GmWxYVTiQyJy2XOTa15sdQSrvKn7l+180egQMqlrMOUMCyLMD7pmyQe4mMDUT6Behrw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.1", + "get-intrinsic": "^1.1.1", + "is-string": "^1.0.7" + } + }, "array-union": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "dev": true }, + "array.prototype.flat": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.5.tgz", + "integrity": "sha512-KaYU+S+ndVqyUnignHftkwc58o3uVU1jzczILJ1tN2YaIZpFIKBiP/x/j97E5MVPsaCloPbqWLB/8qCTVvT2qg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0" + } + }, "asn1": { "version": "0.2.4", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", @@ -6653,6 +8109,18 @@ "buffer": "^5.5.0", "inherits": "^2.0.4", "readable-stream": "^3.4.0" + }, + "dependencies": { + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + } } }, "brace-expansion": { @@ -6693,28 +8161,12 @@ "node-releases": "^1.1.71" } }, - "buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "dev": true, - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, "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 }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, "caching-transform": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz", @@ -6737,6 +8189,13 @@ "get-intrinsic": "^1.0.2" } }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "peer": true + }, "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", @@ -6744,9 +8203,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001242", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001242.tgz", - "integrity": "sha512-KvNuZ/duufelMB3w2xtf9gEWCSxJwUgoxOx5b6ScLXC4kPc9xsczUVCPrQU26j5kOsHM4pSUL54tAZt5THQKug==", + "version": "1.0.30001316", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001316.tgz", + "integrity": "sha512-JgUdNoZKxPZFzbzJwy4hDSyGuH/gXz2rN51QmoR8cBQsVo58llD3A0vlRKKRt8FGf5u69P9eQyIH8/z9vN/S0Q==", "dev": true }, "caseless": { @@ -6756,15 +8215,16 @@ "dev": true }, "chai": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.4.tgz", - "integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==", + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.6.tgz", + "integrity": "sha512-bbcp3YfHCUzMOvKqsztczerVgBKSsEijCySNlHHbX3VG1nskvqjz5Rfso1gGwD6w6oOV3eI60pKuMOV5MV7p3Q==", "dev": true, "requires": { "assertion-error": "^1.1.0", "check-error": "^1.0.2", "deep-eql": "^3.0.1", "get-func-name": "^2.0.0", + "loupe": "^2.3.1", "pathval": "^1.1.1", "type-detect": "^4.0.5" } @@ -6795,19 +8255,19 @@ "dev": true }, "chokidar": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.0.tgz", - "integrity": "sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A==", + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", "dev": true, "requires": { - "anymatch": "~3.1.1", + "anymatch": "~3.1.2", "braces": "~3.0.2", - "fsevents": "~2.1.1", - "glob-parent": "~5.1.0", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", - "readdirp": "~3.2.0" + "readdirp": "~3.6.0" } }, "circular-json": { @@ -6838,42 +8298,14 @@ "dev": true }, "cliui": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "dev": true, "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" } }, "clone": { @@ -6918,6 +8350,12 @@ "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", "dev": true }, + "comment-parser": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.3.0.tgz", + "integrity": "sha512-hRpmWIKgzd81vn0ydoWoyPoALEOnF4wt8yKD35Ib1D6XC2siLiYaiqfGkYrunuKdsXGwpBpHU3+9r+RVw2NZfA==", + "dev": true + }, "commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -6958,6 +8396,12 @@ "request": "^2.88.2" } }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, "cross-spawn": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", @@ -6992,9 +8436,9 @@ "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==" }, "debug": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", - "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "requires": { "ms": "2.1.2" @@ -7220,9 +8664,9 @@ } }, "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", "dev": true }, "dir-glob": { @@ -7234,6 +8678,16 @@ "path-type": "^4.0.0" } }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "peer": true, + "requires": { + "esutils": "^2.0.2" + } + }, "ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", @@ -7251,9 +8705,9 @@ "dev": true }, "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, "end-of-stream": { @@ -7275,22 +8729,26 @@ } }, "es-abstract": { - "version": "1.18.3", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.3.tgz", - "integrity": "sha512-nQIr12dxV7SSxE6r6f1l3DtAeEYdsGpps13dR0TwJg1S8gyp4ZPgy3FZcHBgbiQqnoqSTb+oC+kO4UQ0C/J8vw==", + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz", + "integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==", "dev": true, "requires": { "call-bind": "^1.0.2", "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "get-intrinsic": "^1.1.1", + "get-symbol-description": "^1.0.0", "has": "^1.0.3", "has-symbols": "^1.0.2", - "is-callable": "^1.2.3", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.4", "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.3", - "is-string": "^1.0.6", - "object-inspect": "^1.10.3", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.1", + "is-string": "^1.0.7", + "is-weakref": "^1.0.1", + "object-inspect": "^1.11.0", "object-keys": "^1.1.1", "object.assign": "^4.1.2", "string.prototype.trimend": "^1.0.4", @@ -7354,18 +8812,458 @@ "source-map": "~0.6.1" } }, + "eslint": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.11.0.tgz", + "integrity": "sha512-/KRpd9mIRg2raGxHRGwW9ZywYNAClZrHjdueHcrVDuO3a6bj83eoTirCCk0M0yPwOjWYKHwRVRid+xK4F/GHgA==", + "dev": true, + "peer": true, + "requires": { + "@eslint/eslintrc": "^1.2.1", + "@humanwhocodes/config-array": "^0.9.2", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.1", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.3.1", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^6.0.1", + "globals": "^13.6.0", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "peer": true + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "peer": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "peer": true + }, + "eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "dev": true, + "peer": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "dev": true, + "peer": true + }, + "glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "peer": true, + "requires": { + "is-glob": "^4.0.3" + } + }, + "globals": { + "version": "13.13.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.13.0.tgz", + "integrity": "sha512-EQ7Q18AJlPwp3vUDL4mKA0KXrXyNIQyWon6T6XQiBQF0XHvRsiCSrWmmeATpUzdJN2HhWZU6Pdl0a9zdep5p6A==", + "dev": true, + "peer": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "peer": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "peer": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "peer": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "peer": true + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "peer": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "peer": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "peer": true + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "peer": true + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "peer": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "peer": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "peer": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "eslint-import-resolver-node": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", + "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==", + "dev": true, + "requires": { + "debug": "^3.2.7", + "resolve": "^1.20.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "eslint-module-utils": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz", + "integrity": "sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==", + "dev": true, + "requires": { + "debug": "^3.2.7", + "find-up": "^2.1.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + } + } + }, + "eslint-plugin-import": { + "version": "2.25.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.25.4.tgz", + "integrity": "sha512-/KJBASVFxpu0xg1kIBn9AUa8hQVnszpwgE7Ld0lKAlx7Ie87yzEzCgSkekt+le/YVhiaosO4Y14GDAOc41nfxA==", + "dev": true, + "requires": { + "array-includes": "^3.1.4", + "array.prototype.flat": "^1.2.5", + "debug": "^2.6.9", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.6", + "eslint-module-utils": "^2.7.2", + "has": "^1.0.3", + "is-core-module": "^2.8.0", + "is-glob": "^4.0.3", + "minimatch": "^3.0.4", + "object.values": "^1.1.5", + "resolve": "^1.20.0", + "tsconfig-paths": "^3.12.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "eslint-plugin-jsdoc": { + "version": "38.0.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-38.0.4.tgz", + "integrity": "sha512-/McOYm7BEmiwNd5niCea2iHuFRtTrqeZN6IKJPJoC2PO8hfQn3FFRgYoGs17hoo6PaIWQLxo6hvCJsu+/KSRfg==", + "dev": true, + "requires": { + "@es-joy/jsdoccomment": "~0.21.2", + "comment-parser": "1.3.0", + "debug": "^4.3.3", + "escape-string-regexp": "^4.0.0", + "esquery": "^1.4.0", + "regextras": "^0.8.0", + "semver": "^7.3.5", + "spdx-expression-parse": "^3.0.1" + }, + "dependencies": { + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + } + } + }, + "eslint-plugin-prefer-arrow": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-prefer-arrow/-/eslint-plugin-prefer-arrow-1.2.3.tgz", + "integrity": "sha512-J9I5PKCOJretVuiZRGvPQxCbllxGAV/viI20JO3LYblAodofBxyMnZAJ+WGeClHgANnSJberTNoFWWjrWKBuXQ==", + "dev": true, + "requires": {} + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "dependencies": { + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + } + } + }, + "eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^2.0.0" + } + }, "eslint-visitor-keys": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", "dev": true }, + "espree": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.1.tgz", + "integrity": "sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ==", + "dev": true, + "peer": true, + "requires": { + "acorn": "^8.7.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^3.3.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "dev": true, + "peer": true + } + } + }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, + "esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + } + }, "estraverse": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", @@ -7451,6 +9349,16 @@ "reusify": "^1.0.4" } }, + "file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "peer": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, "filing-cabinet": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/filing-cabinet/-/filing-cabinet-3.0.0.tgz", @@ -7506,23 +9414,47 @@ "pkg-dir": "^4.1.0" } }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "dependencies": { + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + } + } + }, + "flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true + }, + "flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", "dev": true, + "peer": true, "requires": { - "locate-path": "^3.0.0" + "flatted": "^3.1.0", + "rimraf": "^3.0.2" } }, - "flat": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.1.tgz", - "integrity": "sha512-FmTtBsHskrU6FJ2VxCnsDb84wu9zhmO3cUX2kGFb5tuwhfXxGciiT0oRY+cck35QmG+NmGh5eLz6lLCpWTqwpA==", + "flatted": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", + "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", "dev": true, - "requires": { - "is-buffer": "~2.0.3" - } + "peer": true }, "flatten": { "version": "1.0.3", @@ -7613,9 +9545,9 @@ "dev": true }, "fsevents": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", - "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "dev": true, "optional": true }, @@ -7625,6 +9557,12 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, "gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -7684,6 +9622,16 @@ "pump": "^3.0.0" } }, + "get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, "getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", @@ -7694,9 +9642,9 @@ } }, "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "dev": true, "requires": { "fs.realpath": "^1.0.0", @@ -7822,6 +9770,15 @@ "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", "dev": true }, + "has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dev": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, "hasha": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.2.tgz", @@ -7856,11 +9813,11 @@ } }, "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", "requires": { - "safer-buffer": ">= 2.1.2 < 3" + "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "ieee754": { @@ -7870,11 +9827,31 @@ "dev": true }, "ignore": { - "version": "5.1.8", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", - "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "peer": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "peer": true + } + } + }, "imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -7915,6 +9892,17 @@ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, + "internal-slot": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", + "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "dev": true, + "requires": { + "get-intrinsic": "^1.1.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + } + }, "invert-kv": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-3.0.1.tgz", @@ -7944,22 +9932,16 @@ "call-bind": "^1.0.2" } }, - "is-buffer": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", - "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", - "dev": true - }, "is-callable": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.3.tgz", - "integrity": "sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", + "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", "dev": true }, "is-core-module": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", - "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", + "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", "dev": true, "requires": { "has": "^1.0.3" @@ -7978,15 +9960,15 @@ "dev": true }, "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true }, "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "requires": { "is-extglob": "^2.1.1" @@ -8022,14 +10004,20 @@ "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", "dev": true }, + "is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true + }, "is-regex": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.3.tgz", - "integrity": "sha512-qSVXFz28HM7y+IWX6vLCsexdlvzT1PJNFSBuaQLQ5o0IEw8UDYW6/2+eCMVyIsbM8CNLX2a/QWmSpyxYEHY7CQ==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", "dev": true, "requires": { "call-bind": "^1.0.2", - "has-symbols": "^1.0.2" + "has-tostringtag": "^1.0.0" } }, "is-regexp": { @@ -8044,6 +10032,12 @@ "integrity": "sha1-CRtGoNZ8HtD+hfH4z93gBrslHUY=", "dev": true }, + "is-shared-array-buffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", + "integrity": "sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==", + "dev": true + }, "is-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", @@ -8051,10 +10045,13 @@ "dev": true }, "is-string": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.6.tgz", - "integrity": "sha512-2gdzbKUuqtQ3lYNrUTQYoClPhm7oQu4UdpSZMp1/DGgkHBT8E2Z1l0yMdb6D4zNAxwDiMv8MdulKROJGNl0Q0w==", - "dev": true + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } }, "is-symbol": { "version": "1.0.4", @@ -8083,6 +10080,15 @@ "integrity": "sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==", "dev": true }, + "is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2" + } + }, "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -8231,6 +10237,11 @@ "istanbul-lib-report": "^3.0.0" } }, + "itiriri": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/itiriri/-/itiriri-2.0.1.tgz", + "integrity": "sha512-XutdsL9Nm9ejgRlFwOBdWW78Txvs9ehhMFeGCp3GjGIWSeQNgOzOfo+PjuQSmaFgE1ol6Pr2g5Jg7W4BYIploQ==" + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -8253,6 +10264,12 @@ "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", "dev": true }, + "jsdoc-type-pratt-parser": { + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-2.2.5.tgz", + "integrity": "sha512-2a6eRxSxp1BW040hFvaJxhsCMI9lT8QB8t14t+NY5tC5rckIR0U9cr2tjOeaFirmEOy6MHvmJnY7zTBHq431Lw==", + "dev": true + }, "jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -8260,9 +10277,9 @@ "dev": true }, "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", "dev": true }, "json-schema-traverse": { @@ -8271,6 +10288,13 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true, + "peer": true + }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -8286,15 +10310,21 @@ "minimist": "^1.2.5" } }, + "jsonc-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz", + "integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==", + "dev": true + }, "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", + "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", "dev": true, "requires": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", - "json-schema": "0.2.3", + "json-schema": "0.4.0", "verror": "1.10.0" } }, @@ -8323,13 +10353,12 @@ } }, "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" + "p-locate": "^5.0.0" } }, "lodash": { @@ -8344,6 +10373,13 @@ "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", "dev": true }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, + "peer": true + }, "log-driver": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz", @@ -8351,64 +10387,22 @@ "dev": true }, "log-symbols": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", - "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", "dev": true, "requires": { - "chalk": "^2.4.2" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "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 - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + } + }, + "loupe": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.4.tgz", + "integrity": "sha512-OvKfgCC2Ndby6aSTREl5aCCPTNIzlDfQZvZxNUrBrihDhL3xcrYegTblhmEiCrg2kKQz4XsFIaemE5BF4ybSaQ==", + "dev": true, + "requires": { + "get-func-name": "^2.0.0" } }, "lru-cache": { @@ -8496,9 +10490,9 @@ } }, "marked": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/marked/-/marked-2.1.3.tgz", - "integrity": "sha512-/Q+7MGzaETqifOMWYEA7HVMaZb4XbcRfaOzcSsHZEith83KGlvaSG33u0SKu89Mj5h+T8V2hM+8O45Qc5XTgwA==", + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.17.tgz", + "integrity": "sha512-Wfk0ATOK5iPxM4ptrORkFemqroz0ZDxp5MWfYA7H/F+wO17NRWV5Ypxi6p3g2Xmw2bKeiYOl6oVnLHKxBA0VhA==", "dev": true }, "mem": { @@ -8557,90 +10551,118 @@ } }, "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, - "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, "mocha": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.2.0.tgz", - "integrity": "sha512-O9CIypScywTVpNaRrCAgoUnJgozpIofjKUYmJhiCIJMiuYnLI6otcb1/kpW9/n/tJODHGZ7i8aLQoDVsMtOKQQ==", + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.2.2.tgz", + "integrity": "sha512-L6XC3EdwT6YrIk0yXpavvLkn8h+EU+Y5UcCHKECyMbdUIxyMuZj4bX4U9e1nvnvUUvQVsV2VHQr5zLdcUkhW/g==", "dev": true, "requires": { - "ansi-colors": "3.2.3", + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", "browser-stdout": "1.3.1", - "chokidar": "3.3.0", - "debug": "3.2.6", - "diff": "3.5.0", - "escape-string-regexp": "1.0.5", - "find-up": "3.0.0", - "glob": "7.1.3", + "chokidar": "3.5.3", + "debug": "4.3.3", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.2.0", "growl": "1.10.5", "he": "1.2.0", - "js-yaml": "3.13.1", - "log-symbols": "3.0.0", - "minimatch": "3.0.4", - "mkdirp": "0.5.5", - "ms": "2.1.1", - "node-environment-flags": "1.0.6", - "object.assign": "4.1.0", - "strip-json-comments": "2.0.1", - "supports-color": "6.0.0", - "which": "1.3.1", - "wide-align": "1.1.3", - "yargs": "13.3.2", - "yargs-parser": "13.1.2", - "yargs-unparser": "1.6.0" - }, - "dependencies": { + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "4.2.1", + "ms": "2.1.3", + "nanoid": "3.3.1", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "workerpool": "6.2.0", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "dependencies": { + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", "dev": true, "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" + }, + "dependencies": { + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true }, "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "minimatch": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-4.2.1.tgz", + "integrity": "sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==", "dev": true, "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "brace-expansion": "^1.1.7" } }, "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true }, "supports-color": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", - "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, "requires": { - "has-flag": "^3.0.0" + "has-flag": "^4.0.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" } } } @@ -8673,20 +10695,6 @@ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true - }, - "glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", - "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" - } } } }, @@ -8697,11 +10705,18 @@ "dev": true }, "nanoid": { - "version": "3.1.23", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.23.tgz", - "integrity": "sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz", + "integrity": "sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==", "dev": true }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true, + "peer": true + }, "neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", @@ -8713,24 +10728,6 @@ "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" }, - "node-environment-flags": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz", - "integrity": "sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw==", - "dev": true, - "requires": { - "object.getownpropertydescriptors": "^2.0.3", - "semver": "^5.7.0" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, "node-preload": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", @@ -8815,12 +10812,6 @@ "wrap-ansi": "^6.2.0" } }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, "find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", @@ -8831,26 +10822,6 @@ "path-exists": "^4.0.0" } }, - "glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", - "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" - } - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, "locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -8875,17 +10846,6 @@ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true }, - "string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - } - }, "wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", @@ -8935,9 +10895,9 @@ "dev": true }, "object-inspect": { - "version": "1.10.3", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.10.3.tgz", - "integrity": "sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", + "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", "dev": true }, "object-keys": { @@ -8946,27 +10906,15 @@ "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", "dev": true }, - "object.assign": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", - "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "function-bind": "^1.1.1", - "has-symbols": "^1.0.0", - "object-keys": "^1.0.11" - } - }, - "object.getownpropertydescriptors": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.2.tgz", - "integrity": "sha512-WtxeKSzfBjlzL+F9b7M7hewDzMwy+C8NRssHd1YrNlzHzIDrXcXiNOMrezdAEM4UXixgV+vvnyBeN7Rygl2ttQ==", + "object.values": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", + "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", "dev": true, "requires": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.2" + "es-abstract": "^1.19.1" } }, "once": { @@ -8986,32 +10934,6 @@ "mimic-fn": "^2.1.0" } }, - "onigasm": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/onigasm/-/onigasm-2.2.5.tgz", - "integrity": "sha512-F+th54mPc0l1lp1ZcFMyL/jTs2Tlq4SqIHKIXGZOR/VkHkF9A7Fr5rRr5+ZG/lWeRsyrClLYRq7s/yFQ/XhWCA==", - "dev": true, - "requires": { - "lru-cache": "^5.1.1" - }, - "dependencies": { - "lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "requires": { - "yallist": "^3.0.2" - } - }, - "yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true - } - } - }, "optionator": { "version": "0.8.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", @@ -9041,18 +10963,6 @@ "log-symbols": "^4.1.0", "strip-ansi": "^6.0.0", "wcwidth": "^1.0.1" - }, - "dependencies": { - "log-symbols": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", - "dev": true, - "requires": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - } - } } }, "os-locale": { @@ -9090,12 +11000,23 @@ } }, "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, "requires": { - "p-limit": "^2.0.0" + "p-limit": "^3.0.2" + }, + "dependencies": { + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + } } }, "p-map": { @@ -9125,6 +11046,16 @@ "release-zalgo": "^1.0.0" } }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "peer": true, + "requires": { + "callsites": "^3.0.0" + } + }, "parse-ms": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-2.1.0.tgz", @@ -9328,12 +11259,6 @@ "fromentries": "^1.2.0" } }, - "progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true - }, "psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", @@ -9367,6 +11292,15 @@ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, "rc": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", @@ -9391,14 +11325,26 @@ } }, "readdirp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz", - "integrity": "sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", "dev": true, "requires": { - "picomatch": "^2.0.4" + "picomatch": "^2.2.1" } }, + "regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true + }, + "regextras": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/regextras/-/regextras-0.8.0.tgz", + "integrity": "sha512-k519uI04Z3SaY0fLX843MRXnDeG2+vHOFsyhiPZvNLe7r8rD2YNRjq4BQLZZ0oAr2NrtvZlICsXysGNFPGa3CQ==", + "dev": true + }, "release-zalgo": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz", @@ -9565,6 +11511,15 @@ "lru-cache": "^6.0.0" } }, + "serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", @@ -9585,16 +11540,27 @@ "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" }, "shiki": { - "version": "0.9.5", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.5.tgz", - "integrity": "sha512-XFn+rl3wIowDjzdr5DlHoHgQphXefgUTs2bNp/bZu4WF9gTrTLnKwio3f28VjiFG6Jpip7yQn/p4mMj6OrjrtQ==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.10.1.tgz", + "integrity": "sha512-VsY7QJVzU51j5o1+DguUd+6vmCmZ5v/6gYu4vyYAhzjuNQU6P/vmSy4uQaOhvje031qQMiW0d2BwgMH52vqMng==", "dev": true, "requires": { - "json5": "^2.2.0", - "onigasm": "^2.2.5", + "jsonc-parser": "^3.0.0", + "vscode-oniguruma": "^1.6.1", "vscode-textmate": "5.2.0" } }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, "signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", @@ -9653,6 +11619,28 @@ } } }, + "spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.11", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.11.tgz", + "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==", + "dev": true + }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -9700,30 +11688,14 @@ } }, "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" } }, "string.prototype.trimend": { @@ -9758,12 +11730,12 @@ } }, "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "requires": { - "ansi-regex": "^5.0.0" + "ansi-regex": "^5.0.1" } }, "strip-bom": { @@ -9831,24 +11803,15 @@ "@istanbuljs/schema": "^0.1.2", "glob": "^7.1.4", "minimatch": "^3.0.4" - }, - "dependencies": { - "glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", - "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" - } - } } }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true, + "peer": true + }, "to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -9875,15 +11838,23 @@ } }, "ts-node": { - "version": "8.10.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz", - "integrity": "sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==", - "dev": true, - "requires": { + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", + "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "dev": true, + "requires": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", "arg": "^4.1.0", + "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", - "source-map-support": "^0.5.17", + "v8-compile-cache-lib": "^3.0.0", "yn": "3.1.1" }, "dependencies": { @@ -9895,112 +11866,41 @@ } } }, - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "tslint": { - "version": "5.20.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", - "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", + "tsconfig-paths": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.0.tgz", + "integrity": "sha512-cg/1jAZoL57R39+wiw4u/SCC6Ic9Q5NqjBOb+9xISedOYurfog9ZNmKJSxAnb2m/5Bq4lE9lhUcau33Ml8DM0g==", "dev": true, "requires": { - "@babel/code-frame": "^7.0.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^4.0.1", - "glob": "^7.1.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.8.0", - "tsutils": "^2.29.0" + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.0", + "strip-bom": "^3.0.0" }, "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", "dev": true, "requires": { - "color-name": "1.1.3" + "minimist": "^1.2.0" } }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - }, - "diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true - }, - "has-flag": { + "strip-bom": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "tsutils": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", - "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } } } }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, "tsutils": { "version": "3.21.0", "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", @@ -10056,48 +11956,41 @@ } }, "typedoc": { - "version": "0.21.2", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.21.2.tgz", - "integrity": "sha512-SR1ByJB3USg+jxoxwzMRP07g/0f/cQUE5t7gOh1iTUyjTPyJohu9YSKRlK+MSXXqlhIq+m0jkEHEG5HoY7/Adg==", + "version": "0.23.6", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.23.6.tgz", + "integrity": "sha512-YkL7zq6Tjnze7tlPcXQd527VPpcz30cvvzVTar6jJtiHt1DPWgH8c64x2s2xsGQ+SafQpAc90jYyrB6+rXLW1g==", "dev": true, "requires": { - "glob": "^7.1.7", - "handlebars": "^4.7.7", - "lodash": "^4.17.21", "lunr": "^2.3.9", - "marked": "^2.1.1", - "minimatch": "^3.0.0", - "progress": "^2.0.3", - "shiki": "^0.9.3", - "typedoc-default-themes": "^0.12.10" + "marked": "^4.0.16", + "minimatch": "^5.1.0", + "shiki": "^0.10.1" }, "dependencies": { - "glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", "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" + "brace-expansion": "^2.0.1" } } } }, - "typedoc-default-themes": { - "version": "0.12.10", - "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz", - "integrity": "sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA==", - "dev": true - }, "typedoc-plugin-markdown": { - "version": "3.10.2", - "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.10.2.tgz", - "integrity": "sha512-eAV7fuCymdbUIk2P3jjehUWG0VE3YSr/qGGYAHUEBTrRZMuFxS/rYrooF0PPabBUdbprL4BKV8HaP7oed12T2Q==", + "version": "3.13.3", + "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.13.3.tgz", + "integrity": "sha512-KKvFkQphRcH26NoBCKjjZ7a3rkPBQAOuWg1F4s+snDSWXfTyGWO5isgoe19VUbG87W8X/0x3uc/O0Nj7Qle3TQ==", "dev": true, "requires": { "handlebars": "^4.7.7" @@ -10115,9 +12008,9 @@ } }, "typescript": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz", - "integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==", + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz", + "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==", "dev": true }, "uglify-js": { @@ -10165,6 +12058,19 @@ "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" }, + "v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", + "dev": true, + "peer": true + }, + "v8-compile-cache-lib": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", + "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", + "dev": true + }, "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", @@ -10176,6 +12082,12 @@ "extsprintf": "^1.2.0" } }, + "vscode-oniguruma": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.6.2.tgz", + "integrity": "sha512-KH8+KKov5eS/9WhofZR8M8dMHWN2gTxjMsG4jd04YhpbPR91fUj7rYQ2/XjeHCJWbg7X++ApRIU9NUwM2vTvLA==", + "dev": true + }, "vscode-textmate": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-5.2.0.tgz", @@ -10224,15 +12136,6 @@ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, - "wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "dev": true, - "requires": { - "string-width": "^1.0.2 || 2" - } - }, "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", @@ -10245,67 +12148,21 @@ "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", "dev": true }, + "workerpool": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz", + "integrity": "sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==", + "dev": true + }, "wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" } }, "wrappy": { @@ -10338,70 +12195,58 @@ "dev": true }, "yargs": { - "version": "13.3.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", - "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", "dev": true, "requires": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" }, "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } } } }, "yargs-parser": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", - "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "dev": true }, "yargs-unparser": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", - "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", "dev": true, "requires": { - "flat": "^4.1.0", - "lodash": "^4.17.15", - "yargs": "^13.3.0" + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "dependencies": { + "camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true + }, + "decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true + } } }, "yn": { @@ -10409,6 +12254,12 @@ "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", "dev": true + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true } } } diff --git a/package.json b/package.json index 743e49b4..d4f1b36d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "node-taglib-sharp", "description": "Read and write audio/video/picture tags using a similar interface to TagLib#", - "version": "4.0.2", + "version": "5.0.0", "license": "LGPL-2.1-or-later", "author": "Ben Russell (https://github.com/benrr101)", "repository": "github:benrr101/node-taglib-sharp", @@ -11,6 +11,7 @@ "scripts": { "build": "tsc -p ./", "generate-docs": "typedoc --tsconfig tsconfig.json", + "lint": "eslint -c .eslintrc.js --ext .ts ./src", "madge": "node node_modules/madge/bin/cli.js --warning --circular --extensions ts ./", "publish-coverage": "nyc report --reporter=text-lcov | coveralls", "test-unit": "mocha test-unit --ui bdd", @@ -21,31 +22,36 @@ }, "dependencies": { "dateformat": "^3.0.3", - "iconv-lite": "^0.4.24", + "iconv-lite": "^0.6.3", + "itiriri": "^2.0.1", "os-locale": "^4.0.0", "uuid": "^8.3.2" }, "devDependencies": { - "@istanbuljs/nyc-config-typescript": "^1.0.1", - "@testdeck/mocha": "^0.1.2", - "@types/chai": "^4.1.7", + "@istanbuljs/nyc-config-typescript": "^1.0.2", + "@testdeck/mocha": "^0.2.0", + "@types/chai": "^4.3.0", "@types/chai-as-promised": "^7.1.0", "@types/dateformat": "^3.0.0", "@types/stream-buffers": "^3.0.2", - "@types/uuid": "^8.3.0", - "chai": "^4.2.0", + "@types/uuid": "^8.3.4", + "@typescript-eslint/eslint-plugin": "^5.15.0", + "@typescript-eslint/parser": "^5.15.0", + "chai": "^4.3.6", "chai-as-promised": "^7.1.1", - "coveralls": "^3.0.9", + "coveralls": "^3.1.1", + "eslint-plugin-import": "^2.25.4", + "eslint-plugin-jsdoc": "^38.0.4", + "eslint-plugin-prefer-arrow": "^1.2.3", "madge": "^4.0.1", - "mocha": "^7.0.0-esm1", + "mocha": "^9.2.2", "nyc": "^15.1.0", "source-map-support": "^0.5.16", "stream-buffers": "^3.0.2", - "ts-node": "^8.5.4", - "tslint": "^5.13.1", - "typedoc": "^0.21.2", - "typedoc-plugin-markdown": "^3.10.2", + "ts-node": "^10.7.0", + "typedoc": "^0.23.6", + "typedoc-plugin-markdown": "^3.13.3", "typemoq": "^2.1.0", - "typescript": "^4.1.6" + "typescript": "^4.5.5" } } diff --git a/src/aac/aacAudioHeader.ts b/src/aac/aacAudioHeader.ts index 027f1e58..dcb1edb8 100644 --- a/src/aac/aacAudioHeader.ts +++ b/src/aac/aacAudioHeader.ts @@ -1,15 +1,15 @@ import Mpeg4AudioTypes from "../mpeg4/mpeg4AudioTypes"; import {ByteVector} from "../byteVector"; import {File} from "../file"; -import {IAudioCodec, MediaTypes} from "../iCodec"; -import {Guards} from "../utils"; +import {IAudioCodec, MediaTypes} from "../properties"; +import {Guards, NumberUtils} from "../utils"; /** * This structure implements {@link IAudioCodec} and provides information about an ADTS AAC audio * stream. NOTE: This header type should not be used for MPEG-4 encapsulated audio files. */ export default class AacAudioHeader implements IAudioCodec { - private static readonly sampleRates = [ + private static readonly SAMPLE_RATES = [ 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350 ]; @@ -17,7 +17,7 @@ export default class AacAudioHeader implements IAudioCodec { /** * An empty an unset header */ - public static readonly unknown = new AacAudioHeader(0, 0, 0, 0); + public static readonly UNKNOWN = new AacAudioHeader(0, 0, 0, 0); private readonly _audioBitrate: number; private readonly _audioChannels: number; @@ -129,38 +129,43 @@ export default class AacAudioHeader implements IAudioCodec { // Sync word found, continue processing // NOTE: For details of the header format, see https://wiki.multimedia.cx/index.php/ADTS - const bytes = buffer.mid(i, 7); + const bytes = buffer.subarray(i, 7); // Sample rate const sampleRateByte = bytes.get(2); - const sampleRateIndex = (sampleRateByte & 0x3C) >>> 2; - if (sampleRateIndex >= this.sampleRates.length) { + const sampleRateIndex = NumberUtils.uintRShift(NumberUtils.uintAnd(sampleRateByte, 0x3C), 2); + if (sampleRateIndex >= this.SAMPLE_RATES.length) { return undefined; } - const sampleRate = this.sampleRates[sampleRateIndex]; + const sampleRate = this.SAMPLE_RATES[sampleRateIndex]; // MPEG-4 Audio Type - const mpeg4AudioType = ((sampleRateByte & 0xC0) >>> 6) + 1; + const mpeg4AudioType = NumberUtils.uintRShift(NumberUtils.uintAnd(sampleRateByte, 0xC0), 6) + 1; // Channel configuration const channelsByte1 = sampleRateByte; const channelsByte2 = bytes.get(3); - const channelCount = ((channelsByte1 & 0x1) << 2) - | (channelsByte2 & 0xC0) >>> 6; + const channelCount = NumberUtils.uintOr( + NumberUtils.uintLShift(NumberUtils.uintAnd(channelsByte1, 0x01), 2), + NumberUtils.uintRShift(NumberUtils.uintAnd(channelsByte2, 0xC0), 6) + ); // Frame length const frameLengthByte1 = channelsByte2; const frameLengthByte2 = bytes.get(4); const frameLengthByte3 = bytes.get(5); - const frameLength = ((frameLengthByte1 & 0x03) << 11) - | (frameLengthByte2 << 3) - | ((frameLengthByte3 & 0xE0) >>> 5); + const frameLength = NumberUtils.uintOr( + NumberUtils.uintLShift(NumberUtils.uintAnd(frameLengthByte1, 0x03), 11), + NumberUtils.uintLShift(frameLengthByte2, 3), + NumberUtils.uintRShift(NumberUtils.uintAnd(frameLengthByte3, 0xE0), 5) + ); if (frameLength < 7) { return undefined; } // Number of frames in ADTS frame minus 1 - const numberOfFrames = ((bytes.get(6) & 0x03) >>> 0) + 1; + const framesByte = bytes.get(6); + const numberOfFrames = NumberUtils.uintAnd(framesByte, 0x03) + 1; // Calculate number of samples and bitrate const numberOfSamples = numberOfFrames * 1024; diff --git a/src/aac/aacFile.ts b/src/aac/aacFile.ts index 87196c01..e6bca06a 100644 --- a/src/aac/aacFile.ts +++ b/src/aac/aacFile.ts @@ -1,11 +1,12 @@ import AacAudioHeader from "./aacAudioHeader"; import AacFileSettings from "./aacFileSettings"; import SandwichFile from "../sandwich/sandwichFile"; -import Properties from "../properties"; import {CorruptFileError} from "../errors"; import {File, ReadStyle} from "../file"; import {IFileAbstraction} from "../fileAbstraction"; +import {Properties} from "../properties"; import {TagTypes} from "../tag"; +import {NumberUtils} from "../utils"; /** * This class extends {@link File} to provide tagging and properties for ADTS AAC audio files. @@ -15,7 +16,7 @@ import {TagTypes} from "../tag"; * `file.removeTags(file.tagTypes & ~file.tagTypesOnDisk);` */ export default class AacFile extends SandwichFile { - private static readonly _defaultTagLocationMapping = new Map boolean>([ + private static readonly DEFAULT_TAG_LOCATION_MAPPING = new Map boolean>([ [TagTypes.Ape, () => AacFileSettings.preferApeTagAtFileEnd], [TagTypes.Id3v1, () => true], [TagTypes.Id3v2, () => AacFileSettings.preferId3v2TagAtFileEnd] @@ -23,12 +24,12 @@ export default class AacFile extends SandwichFile { /** @inheritDoc */ public constructor(file: IFileAbstraction|string, propertiesStyle: ReadStyle) { - super(file, propertiesStyle, AacFile._defaultTagLocationMapping, AacFileSettings.defaultTagTypes); + super(file, propertiesStyle, AacFile.DEFAULT_TAG_LOCATION_MAPPING, AacFileSettings.defaultTagTypes); } protected readProperties(readStyle: ReadStyle): Properties { // Skip if we're not reading the properties - if ((readStyle & ReadStyle.Average) === 0) { + if (!NumberUtils.hasFlag(readStyle, ReadStyle.Average)) { return undefined; } @@ -43,7 +44,7 @@ export default class AacFile extends SandwichFile { } } -//////////////////////////////////////////////////////////////////////////// +// ///////////////////////////////////////////////////////////////////////// // Register the file type [ "taglib/aac", diff --git a/src/aac/aacFileSettings.ts b/src/aac/aacFileSettings.ts index 5b5769a6..ef5adb80 100644 --- a/src/aac/aacFileSettings.ts +++ b/src/aac/aacFileSettings.ts @@ -6,7 +6,7 @@ import {NumberUtils} from "../utils"; * in order for changes to take effect. */ export default class AacFileSettings { - public static readonly supportedTagTypes = TagTypes.Id3v1 | TagTypes.Id3v2 | TagTypes.Ape; + public static readonly SUPPORTED_TAG_TYPES = TagTypes.Id3v1 | TagTypes.Id3v2 | TagTypes.Ape; private static _defaultTagTypes = TagTypes.Id3v1 | TagTypes.Id3v2; private static _preferApeTagAtFileEnd = true; @@ -19,13 +19,15 @@ export default class AacFileSettings { public static get defaultTagTypes(): TagTypes { return this._defaultTagTypes; } /** * Sets the default types of tags for an AAC file. When opening a file, if these tag types do - * not exist on the file, they will be created. See {@link supportedTagTypes} for a list of tag + * not exist on the file, they will be created. See {@link SUPPORTED_TAG_TYPES} for a list of tag * types that are supported by node-taglib-sharp for AAC files. */ public static set defaultTagTypes(value: TagTypes) { - const unsupportedTagTypes = NumberUtils.uintAnd(value, ~this.supportedTagTypes); + const unsupportedTagTypes = NumberUtils.uintAnd(value, ~this.SUPPORTED_TAG_TYPES); if (unsupportedTagTypes !== 0) { - throw new Error(`Argument error: node-taglib-sharp does not support tag types ${unsupportedTagTypes} for AAC files`); + throw new Error( + `Argument error: node-taglib-sharp does not support tag types ${unsupportedTagTypes} for AAC files` + ); } this._defaultTagTypes = value; diff --git a/src/aiff/aiffFile.ts b/src/aiff/aiffFile.ts index 2ab37a3f..49c8e07a 100644 --- a/src/aiff/aiffFile.ts +++ b/src/aiff/aiffFile.ts @@ -1,12 +1,14 @@ +import AiffFileSettings from "./aiffFileSettings"; +import AiffStreamHeader from "./aiffStreamHeader"; import Id3v2Tag from "../id3v2/id3v2Tag"; -import Properties from "../properties"; -import {ByteVector} from "../byteVector"; +import {ByteVector, StringType} from "../byteVector"; +import {CorruptFileError} from "../errors"; import {File, FileAccessMode, ReadStyle} from "../file"; import {IFileAbstraction} from "../fileAbstraction"; +import {Properties} from "../properties"; import {Tag, TagTypes} from "../tag"; import {SeekOrigin} from "../stream"; -import {CorruptFileError} from "../errors"; -import AiffStreamHeader from "./aiffStreamHeader"; +import {NumberUtils} from "../utils"; export default class AiffFile extends File { @@ -16,27 +18,27 @@ export default class AiffFile extends File { * Identifier used to recognize an AIFF form type. */ // @TODO: Add support for AIFF-C files - it's pretty much the same - public static readonly aiffFormType = ByteVector.fromString("AIFF", undefined, undefined, true); + public static readonly AIFF_FORM_TYPE = ByteVector.fromString("AIFF", StringType.UTF8).makeReadOnly(); /** * Identifier used to recognize an AIFF common chunk. */ - public static readonly commIdentifier = ByteVector.fromString("COMM", undefined, undefined, true); + public static readonly COMM_IDENTIFIER = ByteVector.fromString("COMM", StringType.UTF8).makeReadOnly(); /** * Identifier used to recognize an AIFF file. */ - public static readonly fileIdentifier = ByteVector.fromString("FORM", undefined, undefined, true); + public static readonly FILE_IDENTIFIER = ByteVector.fromString("FORM", StringType.UTF8).makeReadOnly(); /** * Identifier used to recognize an AIFF ID3 chunk. */ - public static readonly id3Identifier = ByteVector.fromString("ID3 ", undefined, undefined, true); + public static readonly ID3_IDENTIFIER = ByteVector.fromString("ID3 ", StringType.UTF8).makeReadOnly(); /** * Identifier used to recognize an AIFF sound data chunk. */ - public static readonly soundIdentifier = ByteVector.fromString("SSND", undefined, undefined, true); + public static readonly SOUND_IDENTIFIER = ByteVector.fromString("SSND", StringType.UTF8).makeReadOnly(); // #endregion @@ -62,9 +64,11 @@ export default class AiffFile extends File { this.mode = FileAccessMode.Closed; } - // Retrieve the tag - this._tagTypesOnDisk = this.tagTypes; - this.getTag(TagTypes.Id3v2, true); + // Create default tags if desired + this.tagTypesOnDisk = this.tagTypes; + if (NumberUtils.hasFlag(AiffFileSettings.defaultTagTypes, TagTypes.Id3v2)) { + this.getTag(TagTypes.Id3v2, true); + } } // #region Properties @@ -99,7 +103,7 @@ export default class AiffFile extends File { /** @inheritDoc */ public removeTags(types: TagTypes): void { - if ((types & TagTypes.Id3v2) > 0) { + if (NumberUtils.hasFlag(types, TagTypes.Id3v2)) { this._tag = undefined; } } @@ -112,7 +116,7 @@ export default class AiffFile extends File { try { // Add the ID3 chunk and ID3v2 tag to the vector const id3Chunk = ByteVector.empty(); - if (!!this._tag) { + if (this._tag) { const tagData = this._tag.render(); if (tagData.length > 10) { // Add padding if tag data length is odd @@ -120,8 +124,8 @@ export default class AiffFile extends File { tagData.addByte(0); } - id3Chunk.addByteVector(AiffFile.id3Identifier); - id3Chunk.addByteVector(ByteVector.fromUInt(tagData.length, true)); + id3Chunk.addByteVector(AiffFile.ID3_IDENTIFIER); + id3Chunk.addByteVector(ByteVector.fromUint(tagData.length, true)); id3Chunk.addByteVector(tagData); } } @@ -139,10 +143,10 @@ export default class AiffFile extends File { // Update the AIFF size const aiffSize = this.length - 8; - this.insert(ByteVector.fromUInt(aiffSize, true), 4, 4); + this.insert(ByteVector.fromUint(aiffSize, true), 4, 4); // Update the tag types - this._tagTypesOnDisk = this.tagTypes; + this.tagTypesOnDisk = this.tagTypes; } finally { this.mode = FileAccessMode.Closed; } @@ -161,14 +165,13 @@ export default class AiffFile extends File { // While we're not at the end of the file while (this.position < this.length) { // Read 4-byte chunk name - const chunkHeader = this.readBlock(4); - if (ByteVector.equal(chunkHeader, chunkName)) { + if (this.readBlock(4).equals(chunkName)) { // We found a matching chunk, return the position of the header start return this.position - 4; } else { // This chunk is not the one we are looking for // Continue the search, seeking over the chunk - const chunkSize = this.readBlock(4).toUInt(); + const chunkSize = this.readBlock(4).toUint(); this.seek(chunkSize, SeekOrigin.Current); } } @@ -183,43 +186,43 @@ export default class AiffFile extends File { private read(readTags: boolean, style: ReadStyle): {fileSize: number, tagEnd: number, tagStart: number} { this.seek(0); - if (!ByteVector.equal(this.readBlock(4), AiffFile.fileIdentifier)) { + if (!this.readBlock(4).equals(AiffFile.FILE_IDENTIFIER)) { throw new CorruptFileError("File does not begin with AIFF identifier"); } - const aiffSize = this.readBlock(4).toUInt(true); + const aiffSize = this.readBlock(4).toUint(true); let tagStart = -1; let tagEnd = -1; // Check form type - if (!ByteVector.equal(this.readBlock(4), AiffFile.aiffFormType)) { + if (!this.readBlock(4).equals(AiffFile.AIFF_FORM_TYPE)) { throw new CorruptFileError("File form type is not AIFF"); } // Read the properties of the file if (!this._headerBlock && style !== ReadStyle.None) { - const commonChunkPos = this.findChunk(AiffFile.commIdentifier, this.position); + const commonChunkPos = this.findChunk(AiffFile.COMM_IDENTIFIER, this.position); if (commonChunkPos === -1) { throw new CorruptFileError("No common chunk available in this AIFF file"); } this.seek(commonChunkPos); - this._headerBlock = this.readBlock(AiffStreamHeader.size); + this._headerBlock = this.readBlock(AiffStreamHeader.SIZE); const header = new AiffStreamHeader(this._headerBlock, aiffSize); this._properties = new Properties(0, [header]); } // Search for the sound chunk - const soundChunkPos = this.findChunk(AiffFile.soundIdentifier, this.position); + const soundChunkPos = this.findChunk(AiffFile.SOUND_IDENTIFIER, this.position); if (soundChunkPos === -1) { throw new CorruptFileError("No sound chunk available in this AIFF file"); } this.seek(this.position + 4); - const soundChunkLength = this.readBlock(4).toUInt(); + const soundChunkLength = this.readBlock(4).toUint(); // Search for the ID3 chunk - const id3ChunkPos = this.findChunk(AiffFile.id3Identifier, this.position + soundChunkLength); + const id3ChunkPos = this.findChunk(AiffFile.ID3_IDENTIFIER, this.position + soundChunkLength); if (id3ChunkPos >= 0) { if (readTags && !this._tag) { this._tag = Id3v2Tag.fromFileStart(this, id3ChunkPos + 8, style); @@ -227,7 +230,7 @@ export default class AiffFile extends File { // Get the length of the tag from the ID3 chunk this.seek(id3ChunkPos + 4); - const tagSize = this.readBlock(4).toUInt(true) + 8; + const tagSize = this.readBlock(4).toUint(true) + 8; tagStart = id3ChunkPos; tagEnd = tagStart + tagSize; @@ -243,7 +246,7 @@ export default class AiffFile extends File { // #endregion } -//////////////////////////////////////////////////////////////////////////// +// ///////////////////////////////////////////////////////////////////////// // Register the file type [ "taglib/aif", diff --git a/src/aiff/aiffFileSettings.ts b/src/aiff/aiffFileSettings.ts new file mode 100644 index 00000000..dc81f1f3 --- /dev/null +++ b/src/aiff/aiffFileSettings.ts @@ -0,0 +1,33 @@ +import {TagTypes} from "../tag"; +import {NumberUtils} from "../utils"; + +/** + * This class contains settings related to AIFF file operations. Open files will need to be re-read + * in order for changes to take effect. + */ +export default class AiffFileSettings { + public static readonly SUPPORTED_TAG_TYPES = TagTypes.Id3v2; + + private static _defaultTagTypes = TagTypes.Id3v2; + + /** + * Gets the default types of tags for an AIFF file. When opening a file, if these tag types do + * not exist on the file, they will be created. + */ + public static get defaultTagTypes(): TagTypes { return this._defaultTagTypes; } + /** + * Sets the default types of tags for an AIFF file. When opening a file, if these tag types do + * not exist on the file, they will be created. See {@link SUPPORTED_TAG_TYPES} for a list of tag + * types that are supported by node-taglib-sharp for AIFF files. + */ + public static set defaultTagTypes(value: TagTypes) { + const unsupportedTagTypes = NumberUtils.uintAnd(value, ~this.SUPPORTED_TAG_TYPES); + if (unsupportedTagTypes !== 0) { + throw new Error( + `Argument error: node-taglib-sharp does not support tag types ${unsupportedTagTypes} for AIFF files` + ); + } + + this._defaultTagTypes = value; + } +} diff --git a/src/aiff/aiffStreamHeader.ts b/src/aiff/aiffStreamHeader.ts index 1077c00f..c3ed2888 100644 --- a/src/aiff/aiffStreamHeader.ts +++ b/src/aiff/aiffStreamHeader.ts @@ -1,5 +1,5 @@ -import {ByteVector} from "../byteVector"; -import {ILosslessAudioCodec, MediaTypes} from "../iCodec"; +import {ByteVector, StringType} from "../byteVector"; +import {ILosslessAudioCodec, MediaTypes} from "../properties"; import {Guards, NumberUtils} from "../utils"; import {CorruptFileError} from "../errors"; @@ -12,12 +12,12 @@ export default class AiffStreamHeader implements ILosslessAudioCodec { * Identifier used to recognize an AIFF file. Although an AIFF file starts with "FORM2", we're * interested in the common chunk only, which contains the properties we need. */ - public static readonly fileIdentifier = ByteVector.fromString("COMM", undefined, undefined, true); + public static readonly FILE_IDENTIFIER = ByteVector.fromString("COMM", StringType.UTF8).makeReadOnly(); /** * Size of an AIFF common chunk in bytes */ - public static readonly size = 26; + public static readonly SIZE = 26; // #region Private members @@ -38,7 +38,7 @@ export default class AiffStreamHeader implements ILosslessAudioCodec { public constructor(data: ByteVector, streamLength: number) { Guards.truthy(data, "data"); Guards.uint(streamLength, "streamLength"); - if (!data.startsWith(AiffStreamHeader.fileIdentifier)) { + if (!data.startsWith(AiffStreamHeader.FILE_IDENTIFIER)) { throw new CorruptFileError("Data does not begin with identifier"); } @@ -46,10 +46,10 @@ export default class AiffStreamHeader implements ILosslessAudioCodec { // The first 8 bytes contain the common chunk identifier "COMM" and the size of the common // chunk, which is always 18 - this._channels = data.mid(8, 2).toUShort(true); - this._totalFrames = data.mid(10, 4).toUInt(true); - this._bitsPerSample = data.mid(14, 2).toUShort(true); - this._sampleRate = NumberUtils.convertFromIeeeExtended(data.mid(16, 10)); + this._channels = data.subarray(8, 2).toUshort(true); + this._totalFrames = data.subarray(10, 4).toUint(true); + this._bitsPerSample = data.subarray(14, 2).toUshort(true); + this._sampleRate = NumberUtils.convertFromIeeeExtended(data.subarray(16, 10)); } // #region Properties @@ -85,7 +85,5 @@ export default class AiffStreamHeader implements ILosslessAudioCodec { /** @inheritDoc */ public get mediaTypes(): MediaTypes { return MediaTypes.Audio; } - - // #endregion } diff --git a/src/ape/apeFile.ts b/src/ape/apeFile.ts index 06d4b26d..7422f197 100644 --- a/src/ape/apeFile.ts +++ b/src/ape/apeFile.ts @@ -1,10 +1,11 @@ import ApeFileSettings from "./apeFileSettings"; import SandwichFile from "../sandwich/sandwichFile"; -import Properties from "../properties"; import {ApeStreamHeader} from "./apeStreamHeader"; import {File, ReadStyle} from "../file"; import {IFileAbstraction} from "../fileAbstraction"; +import {Properties} from "../properties"; import {TagTypes} from "../tag"; +import {NumberUtils} from "../utils"; /** * Provides tagging and properties support for Monkey's Audio APE files. @@ -13,7 +14,7 @@ import {TagTypes} from "../tag"; * using the following method: `file.removeTags(file.tagTypes & ~file.tagTypesOnDisk);` */ export default class ApeFile extends SandwichFile { - private static readonly _defaultTagLocationMapping = new Map boolean>([ + private static readonly DEFAULT_TAG_LOCATION_MAPPING = new Map boolean>([ [TagTypes.Ape, () => ApeFileSettings.preferApeTagAtFileEnd], [TagTypes.Id3v1, () => true], [TagTypes.Id3v2, () => ApeFileSettings.preferId3v2TagAtFileEnd] @@ -21,30 +22,25 @@ export default class ApeFile extends SandwichFile { /** @inheritDoc */ public constructor(file: IFileAbstraction|string, propertiesStyle: ReadStyle) { - super(file, propertiesStyle, ApeFile._defaultTagLocationMapping, ApeFileSettings.defaultTagTypes); - } - - /** @inheritDoc */ - protected readEnd(_end: number, _propertiesStyle: ReadStyle): void { - this.getTag(TagTypes.Ape, true); + super(file, propertiesStyle, ApeFile.DEFAULT_TAG_LOCATION_MAPPING, ApeFileSettings.defaultTagTypes); } /** @inheritDoc */ protected readProperties(readStyle: ReadStyle): Properties { // Skip if we're not reading the properties - if ((readStyle & ReadStyle.Average) === 0) { + if (!NumberUtils.hasFlag(readStyle, ReadStyle.Average)) { return undefined; } // Find the header and use it to generate the properties this.seek(this.mediaStartPosition); - const headerBlock = this.readBlock(ApeStreamHeader.size); + const headerBlock = this.readBlock(ApeStreamHeader.SIZE); const header = new ApeStreamHeader(headerBlock, this.mediaEndPosition - this.mediaStartPosition); return new Properties(header.durationMilliseconds, [header]); } } -//////////////////////////////////////////////////////////////////////////// +// ///////////////////////////////////////////////////////////////////////// // Register the file type [ "taglib/ape", diff --git a/src/ape/apeFileSettings.ts b/src/ape/apeFileSettings.ts index 57abf5ef..cb5fc795 100644 --- a/src/ape/apeFileSettings.ts +++ b/src/ape/apeFileSettings.ts @@ -5,8 +5,8 @@ import {NumberUtils} from "../utils"; * This class contains settings related to APE file operations. Open files will need to be re-read * in order for changes to take effect. */ -export default class AacSettings { - public static readonly supportedTagTypes = TagTypes.Ape | TagTypes.Id3v1 | TagTypes.Id3v2; +export default class ApeFileSettings { + public static readonly SUPPORTED_TAG_TYPES = TagTypes.Ape | TagTypes.Id3v1 | TagTypes.Id3v2; private static _defaultTagTypes = TagTypes.Ape; private static _preferApeTagAtFileEnd = true; @@ -19,13 +19,15 @@ export default class AacSettings { public static get defaultTagTypes(): TagTypes { return this._defaultTagTypes; } /** * Sets the default types of tags for an APE file. When opening a file, if these tag types do - * not exist on the file, they will be created. See {@link supportedTagTypes} for a list of tag + * not exist on the file, they will be created. See {@link SUPPORTED_TAG_TYPES} for a list of tag * types that are supported by node-taglib-sharp for APE files. */ public static set defaultTagTypes(value: TagTypes) { - const unsupportedTagTypes = NumberUtils.uintAnd(value, ~this.supportedTagTypes); + const unsupportedTagTypes = NumberUtils.uintAnd(value, ~this.SUPPORTED_TAG_TYPES); if (unsupportedTagTypes !== 0) { - throw new Error(`Argument error: node-taglib-sharp does not support tag types ${unsupportedTagTypes} for APE files`); + throw new Error( + `Argument error: node-taglib-sharp does not support tag types ${unsupportedTagTypes} for APE files` + ); } this._defaultTagTypes = value; diff --git a/src/ape/apeStreamHeader.ts b/src/ape/apeStreamHeader.ts index 040c30f5..0f47e1e1 100644 --- a/src/ape/apeStreamHeader.ts +++ b/src/ape/apeStreamHeader.ts @@ -1,6 +1,6 @@ import {ByteVector, StringType} from "../byteVector"; import {CorruptFileError} from "../errors"; -import {IAudioCodec, ILosslessAudioCodec, MediaTypes} from "../iCodec"; +import {IAudioCodec, ILosslessAudioCodec, MediaTypes} from "../properties"; import {Guards} from "../utils"; /** @@ -45,12 +45,12 @@ export class ApeStreamHeader implements IAudioCodec, ILosslessAudioCodec { /** * Identifier used to recognize a Monkey's Audio file */ - public static readonly fileIdentifier = ByteVector.fromString("MAC ", StringType.Latin1, undefined, true); + public static readonly FILE_IDENTIFIER = ByteVector.fromString("MAC ", StringType.Latin1).makeReadOnly(); /** * Size of a Monkey Audio Header */ - public static readonly size = 76; + public static readonly SIZE = 76; // #region Member variables @@ -110,29 +110,29 @@ export class ApeStreamHeader implements IAudioCodec, ILosslessAudioCodec { /** * Constructs and initializes a new {@link ApeStreamHeader} from a raw header block and stream * length. - * @param data Raw stream header data beginning with {@link ApeStreamHeader.fileIdentifier} + * @param data Raw stream header data beginning with {@link ApeStreamHeader.FILE_IDENTIFIER} * @param streamLength Length of the stream in bytes */ // @TODO: Consider tweaking to have this take a file public constructor(data: ByteVector, streamLength: number) { Guards.truthy(data, "data"); Guards.safeUint(streamLength, "streamLength"); - if (!data.startsWith(ApeStreamHeader.fileIdentifier)) { + if (!data.startsWith(ApeStreamHeader.FILE_IDENTIFIER)) { throw new CorruptFileError("Data does not begin with identifier"); } - if (data.length < ApeStreamHeader.size) { + if (data.length < ApeStreamHeader.SIZE) { throw new CorruptFileError("Insufficient data in stream header"); } this._streamLength = streamLength; - this._version = data.mid(4, 2).toUShort(false); - this._compression = data.mid(52, 2).toUShort(false); - this._blocksPerFrame = data.mid(56, 4).toUInt(false); - this._finalFrameBlocks = data.mid(60, 4).toUInt(false); - this._totalFrames = data.mid(64, 4).toUInt(false); - this._bitsPerSample = data.mid(68, 2).toUShort(false); - this._channels = data.mid(70, 2).toUShort(false); - this._sampleRate = data.mid(72, 4).toUInt(false); + this._version = data.subarray(4, 2).toUshort(false); + this._compression = data.subarray(52, 2).toUshort(false); + this._blocksPerFrame = data.subarray(56, 4).toUint(false); + this._finalFrameBlocks = data.subarray(60, 4).toUint(false); + this._totalFrames = data.subarray(64, 4).toUint(false); + this._bitsPerSample = data.subarray(68, 2).toUshort(false); + this._channels = data.subarray(70, 2).toUshort(false); + this._sampleRate = data.subarray(72, 4).toUint(false); } // #region Properties diff --git a/src/ape/apeTag.ts b/src/ape/apeTag.ts index 02c6c594..96fb6f8a 100644 --- a/src/ape/apeTag.ts +++ b/src/ape/apeTag.ts @@ -1,14 +1,13 @@ import * as DateFormat from "dateformat"; -import Picture from "../picture"; import {ApeTagFooter, ApeTagFooterFlags} from "./apeTagFooter"; import {ApeTagItem, ApeTagItemType} from "./apeTagItem"; import {ByteVector, StringType} from "../byteVector"; import {CorruptFileError} from "../errors"; import {File, FileAccessMode} from "../file"; -import {IPicture, PictureType} from "../iPicture"; +import {IPicture, Picture, PictureType} from "../picture"; import {Tag, TagTypes} from "../tag"; -import {Guards, StringComparison} from "../utils"; +import {Guards, NumberUtils, StringComparison} from "../utils"; /** * Provides a representation of an APEv2 tag which can be read from and written to disk. @@ -18,7 +17,7 @@ export default class ApeTag extends Tag { * Names of picture fields, indexed to correspond to their picture item names. * @private */ - private static readonly pictureItemNames = [ + private static readonly PICTURE_ITEM_NAMES = [ "Cover Art (other)", "Cover Art (icon)", "Cover Art (other icon)", @@ -42,7 +41,7 @@ export default class ApeTag extends Tag { "Cover Art (publisher logo)", "Embedded Object" ]; - private static readonly notPictureItemTypeId = 21; + private static readonly NOT_PICTURE_ITEM_TYPE_ID = 21; private _footer: ApeTagFooter; private _items: ApeTagItem[] = []; @@ -60,27 +59,26 @@ export default class ApeTag extends Tag { */ public static fromData(data: ByteVector): ApeTag { Guards.truthy(data, "data"); - if (data.length < ApeTagFooter.size) { + if (data.length < ApeTagFooter.SIZE) { throw new CorruptFileError("Does not contain enough footer data"); } const tag = new ApeTag(); // Read the footer - tag._footer = ApeTagFooter.fromData(data.mid(data.length - ApeTagFooter.size)); + tag._footer = ApeTagFooter.fromData(data.subarray(data.length - ApeTagFooter.SIZE)); // If we've read a header at the end of the block, the block is invalid - if ((tag._footer.flags & ApeTagFooterFlags.IsHeader) !== 0) { + if (NumberUtils.hasFlag(tag._footer.flags, ApeTagFooterFlags.IsHeader)) { throw new CorruptFileError("Footer was actually a header"); } if ((data.length < tag._footer.requiredDataSize)) { throw new CorruptFileError("Does not contain enough tag data"); } - tag.parse(data.mid( - data.length - tag._footer.requiredDataSize, - tag._footer.requiredDataSize - ApeTagFooter.size) - ); + const startIndex = data.length - tag._footer.requiredDataSize; + const length = tag._footer.requiredDataSize - ApeTagFooter.SIZE; + tag.parse(data.subarray(startIndex, length)); return tag; } @@ -102,10 +100,10 @@ export default class ApeTag extends Tag { * @remarks If `position` points to the beginning of the tag footer, the footer will be read * and then the parser will backup and start reading from the beginning of the file. */ - public static fromFile(file: File, position: number) { + public static fromFile(file: File, position: number): ApeTag { Guards.truthy(file, "file"); Guards.safeUint(position, "position"); - Guards.lessThanInclusive(position, file.length - ApeTagFooter.size, "position"); + Guards.lessThanInclusive(position, file.length - ApeTagFooter.SIZE, "position"); file.mode = FileAccessMode.Read; file.seek(position); @@ -113,14 +111,14 @@ export default class ApeTag extends Tag { const tag = new ApeTag(); // Read the header/footer in - tag._footer = ApeTagFooter.fromData(file.readBlock(ApeTagFooter.size)); + tag._footer = ApeTagFooter.fromData(file.readBlock(ApeTagFooter.SIZE)); // If we've read a header, we don't have to seek to read the content. If we've read a // footer, we need to move back to the start of the tag. - if ((tag._footer.flags & ApeTagFooterFlags.IsHeader) === 0) { + if (!NumberUtils.hasFlag(tag._footer.flags, ApeTagFooterFlags.IsHeader)) { file.seek(position - tag._footer.itemSize); } - tag.parse(file.readBlock(tag._footer.requiredDataSize - ApeTagFooter.size)); + tag.parse(file.readBlock(tag._footer.requiredDataSize - ApeTagFooter.SIZE)); return tag; } @@ -133,7 +131,7 @@ export default class ApeTag extends Tag { * Gets whether or not the current instance has a header when rendered. */ public get isHeaderPresent(): boolean { - return !!this._footer && (this._footer.flags & ApeTagFooterFlags.HeaderPresent) !== 0; + return !!this._footer && NumberUtils.hasFlag(this._footer.flags, ApeTagFooterFlags.HeaderPresent); } /** * Sets whether or not the current instance has a header when rendered. @@ -265,7 +263,7 @@ export default class ApeTag extends Tag { let asInt = Number.parseInt(text, 10); if (Number.isNaN(asInt)) { - text = text.substr(0, 4); + text = text.substring(0, 4); asInt = Number.parseInt(text, 10); if (Number.isNaN(asInt)) { return 0; @@ -278,22 +276,22 @@ export default class ApeTag extends Tag { set year(value: number) { this.setNumericValue("Year", value, 0); } /** @inheritDoc via Track item numerator */ - get track(): number { return this.getUInt32Value("Track", 0); } + get track(): number { return this.getUint32Value("Track", 0); } /** @inheritDoc via Track item numerator */ set track(value: number) { this.setNumericValue("Track", value, this.trackCount); } /** @inheritDoc via Track item denominator */ - get trackCount(): number { return this.getUInt32Value("Track", 1); } + get trackCount(): number { return this.getUint32Value("Track", 1); } /** @inheritDoc via Track item denominator */ set trackCount(value: number) { this.setNumericValue("Track", this.track, value); } /** @inheritDoc via Disc item numerator */ - get disc(): number { return this.getUInt32Value("Disc", 0); } + get disc(): number { return this.getUint32Value("Disc", 0); } /** @inheritDoc via Disc item numerator */ set disc(value: number) { this.setNumericValue("Disc", value, this.discCount); } /** @inheritDoc via Disc item denominator */ - get discCount(): number { return this.getUInt32Value("Disc", 1); } + get discCount(): number { return this.getUint32Value("Disc", 1); } /** @inheritDoc via Disc item denominator */ set discCount(value: number) { this.setNumericValue("Disc", this.disc, value); } @@ -308,7 +306,7 @@ export default class ApeTag extends Tag { set grouping(value: string) { this.setStringValue("Grouping", value); } /** @inheritDoc via BPM item */ - get beatsPerMinute(): number { return this.getUInt32Value("BPM", 0); } + get beatsPerMinute(): number { return this.getUint32Value("BPM", 0); } /** @inheritDoc via BPM item */ set beatsPerMinute(value: number) { this.setNumericValue("BPM", value, 0); } @@ -399,7 +397,7 @@ export default class ApeTag extends Tag { let text = this.getStringValue("REPLAYGAIN_TRACK_GAIN"); if (!text) { return NaN; } if (text.toLowerCase().endsWith("db")) { - text = text.substr(0, text.length - 2).trim(); + text = text.substring(0, text.length - 2).trim(); } return Number.parseFloat(text); @@ -434,7 +432,7 @@ export default class ApeTag extends Tag { let text = this.getStringValue("REPLAYGAIN_ALBUM_GAIN"); if (!text) { return NaN; } if (text.toLowerCase().endsWith("db")) { - text = text.substr(0, text.length - 2).trim(); + text = text.substring(0, text.length - 2).trim(); } return Number.parseFloat(text); @@ -473,8 +471,8 @@ export default class ApeTag extends Tag { continue; } - const comparison = (e: string) => StringComparison.CaseInsensitive(item.key, e); - const pictureTypeId = ApeTag.pictureItemNames.findIndex(comparison); + const comparison = (e: string): boolean => StringComparison.caseInsensitive(item.key, e); + const pictureTypeId = ApeTag.PICTURE_ITEM_NAMES.findIndex(comparison); if (pictureTypeId < 0) { continue; } @@ -484,9 +482,9 @@ export default class ApeTag extends Tag { continue; } - const pic = Picture.fromData(item.value.mid(descriptionEndIndex + 1)); - pic.description = item.value.toString(descriptionEndIndex, StringType.UTF8, 0); - pic.type = pictureTypeId !== ApeTag.notPictureItemTypeId ? pictureTypeId : PictureType.NotAPicture; + const pic = Picture.fromData(item.value.subarray(descriptionEndIndex + 1)); + pic.description = item.value.subarray(0, descriptionEndIndex).toString(StringType.UTF8); + pic.type = pictureTypeId !== ApeTag.NOT_PICTURE_ITEM_TYPE_ID ? pictureTypeId : PictureType.NotAPicture; pictures.push(pic); } @@ -495,7 +493,7 @@ export default class ApeTag extends Tag { } /** @inheritDoc via Cover Art items */ set pictures(value: IPicture[]) { - ApeTag.pictureItemNames.forEach((e) => this.removeItem(e)); + ApeTag.PICTURE_ITEM_NAMES.forEach((e) => this.removeItem(e)); if (!value || value.length === 0) { return; @@ -503,10 +501,10 @@ export default class ApeTag extends Tag { for (const pic of value) { let type = pic.type; - if (type > ApeTag.notPictureItemTypeId) { - type = ApeTag.notPictureItemTypeId; + if (type > ApeTag.NOT_PICTURE_ITEM_TYPE_ID) { + type = ApeTag.NOT_PICTURE_ITEM_TYPE_ID; } - const name = ApeTag.pictureItemNames[type]; + const name = ApeTag.PICTURE_ITEM_NAMES[type]; if (this.getItem(name)) { continue; @@ -596,7 +594,7 @@ export default class ApeTag extends Tag { */ public getItem(key: string): ApeTagItem { Guards.notNullOrUndefined(key, "key"); - return this._items.find((e) => StringComparison.CaseInsensitive(e.key, key)); + return this._items.find((e) => StringComparison.caseInsensitive(e.key, key)); } /** @@ -619,7 +617,7 @@ export default class ApeTag extends Tag { Guards.notNullOrUndefined(key, "key"); for (let i = this._items.length - 1 ; i >= 0; i--) { - if (StringComparison.CaseInsensitive(this._items[i].key, key)) { + if (StringComparison.caseInsensitive(this._items[i].key, key)) { this._items.splice(i, 1); } } @@ -640,9 +638,11 @@ export default class ApeTag extends Tag { this.isHeaderPresent = true; // Add the header/footer - data.insertByteVector(0, this._footer.renderHeader()); - data.addByteVector(this._footer.renderFooter()); - return data; + return ByteVector.concatenate( + this._footer.renderHeader(), + ... renderedItems, + this._footer.renderFooter() + ); } /** @@ -739,7 +739,7 @@ export default class ApeTag extends Tag { return item ? item.text : []; } - private getUInt32Value(key: string, index: number): number { + private getUint32Value(key: string, index: number): number { const text = this.getStringValue(key); if (!text) { return 0; @@ -757,7 +757,7 @@ export default class ApeTag extends Tag { } private getItemIndex(key: string): number { - return this._items.findIndex((e) => StringComparison.CaseInsensitive(e.key, key)); + return this._items.findIndex((e) => StringComparison.caseInsensitive(e.key, key)); } private parse(data: ByteVector): void { @@ -770,7 +770,7 @@ export default class ApeTag extends Tag { this.setItem(item); pos += item.size; } - } catch (e) { + } catch (e: unknown) { if (!CorruptFileError.errorIs(e)) { throw e; } diff --git a/src/ape/apeTagFooter.ts b/src/ape/apeTagFooter.ts index bdf3a1ba..2045f5af 100644 --- a/src/ape/apeTagFooter.ts +++ b/src/ape/apeTagFooter.ts @@ -1,6 +1,6 @@ import {ByteVector, StringType} from "../byteVector"; import {CorruptFileError} from "../errors"; -import {Guards} from "../utils"; +import {Guards, NumberUtils} from "../utils"; /** * Indicates the flags applied to a {@link ApeTagFooter} object. @@ -30,12 +30,12 @@ export class ApeTagFooter { /** * Identifier used to fina an APEv2 footer in a file. */ - public static readonly fileIdentifier = ByteVector.fromString("APETAGEX", StringType.Latin1, undefined, true); + public static readonly FILE_IDENTIFIER = ByteVector.fromString("APETAGEX", StringType.Latin1).makeReadOnly(); /** * Size of an APEv2 footer. */ - public static readonly size = 32; + public static readonly SIZE = 32; private _flags: ApeTagFooterFlags = 0; private _itemCount: number = 0; @@ -44,7 +44,7 @@ export class ApeTagFooter { // #region Constructors - private constructor() {} + private constructor() { /* empty to enforce static construction */ } /** * Constructs and initializes a new instance of {@link ApeTagFooter} by reading it from raw @@ -53,23 +53,23 @@ export class ApeTagFooter { */ public static fromData(data: ByteVector): ApeTagFooter { Guards.truthy(data, "data"); - if (data.length < ApeTagFooter.size) { + if (data.length < ApeTagFooter.SIZE) { throw new CorruptFileError("Provided data is smaller than object size"); } - if (!data.startsWith(ApeTagFooter.fileIdentifier)) { + if (!data.startsWith(ApeTagFooter.FILE_IDENTIFIER)) { throw new CorruptFileError("Provided data does not start with file identifier"); } const footer = new ApeTagFooter(); - footer._version = data.mid(8, 4).toUInt(false); - footer._itemCount = data.mid(16, 4).toUInt(false); - footer._flags = data.mid(20, 4).toUInt(false); + footer._version = data.subarray(8, 4).toUint(false); + footer._itemCount = data.subarray(16, 4).toUint(false); + footer._flags = data.subarray(20, 4).toUint(false); - const itemPlusFooterSize = footer._itemSize = data.mid(12, 4).toUInt(false); - if (itemPlusFooterSize < ApeTagFooter.size) { + const itemPlusFooterSize = footer._itemSize = data.subarray(12, 4).toUint(false); + if (itemPlusFooterSize < ApeTagFooter.SIZE) { throw new CorruptFileError("Tag size is out of bounds"); } - footer._itemSize = itemPlusFooterSize - ApeTagFooter.size; + footer._itemSize = itemPlusFooterSize - ApeTagFooter.SIZE; return footer; } @@ -128,7 +128,7 @@ export class ApeTagFooter { * Gets the size in bytes of the items contained in the tag and the footer. This is the minimum * amount of data required to read the entire tag. */ - public get requiredDataSize() { return this.itemSize + ApeTagFooter.size; } + public get requiredDataSize(): number { return this.itemSize + ApeTagFooter.SIZE; } /** * Gets the complete size of the tag represented by the current instance, including the header @@ -136,8 +136,8 @@ export class ApeTagFooter { */ public get tagSize(): number { // @TODO: Shouldn't this take into consideration footer missing flags? - return this._itemSize + ApeTagFooter.size + - ((this._flags & ApeTagFooterFlags.HeaderPresent) !== 0 ? ApeTagFooter.size : 0); + return this._itemSize + ApeTagFooter.SIZE + + (NumberUtils.hasFlag(this._flags, ApeTagFooterFlags.HeaderPresent) ? ApeTagFooter.SIZE : 0); } /** @@ -154,7 +154,7 @@ export class ApeTagFooter { } public renderHeader(): ByteVector { - return (this.flags & ApeTagFooterFlags.HeaderPresent) !== 0 + return NumberUtils.hasFlag(this.flags, ApeTagFooterFlags.HeaderPresent) ? this.render(true) : ByteVector.empty(); } @@ -162,32 +162,32 @@ export class ApeTagFooter { private render(isHeader: boolean): ByteVector { const v = ByteVector.concatenate( // File identifier - ApeTagFooter.fileIdentifier, + ApeTagFooter.FILE_IDENTIFIER, // Add the version number -- we always render a 2.000 tag regardless of what the tag // originally was. - ByteVector.fromUInt(2000, false), + ByteVector.fromUint(2000, false), // Add the tag size - ByteVector.fromUInt(this.itemSize + ApeTagFooter.size, false), + ByteVector.fromUint(this.itemSize + ApeTagFooter.SIZE, false), // Add the item count - ByteVector.fromUInt(this.itemCount, false) + ByteVector.fromUint(this.itemCount, false) ); // Render and add the flags let flags = 0; - if ((this.flags & ApeTagFooterFlags.HeaderPresent) !== 0) { - flags = (flags | ApeTagFooterFlags.HeaderPresent) >>> 0; // @TODO: Replace all bitwise logic with >>> 0 + if (NumberUtils.hasFlag(this.flags, ApeTagFooterFlags.HeaderPresent)) { + flags = NumberUtils.uintOr(flags, ApeTagFooterFlags.HeaderPresent); } // Footer is always present if (isHeader) { - flags = (flags | ApeTagFooterFlags.IsHeader) >>> 0; + flags = NumberUtils.uintOr(flags, ApeTagFooterFlags.IsHeader); } else { - flags = (flags & ~ApeTagFooterFlags.IsHeader) >>> 0; + flags = NumberUtils.uintAnd(flags, ~ApeTagFooterFlags.IsHeader); } - v.addByteVector(ByteVector.fromUInt(flags, false)); + v.addByteVector(ByteVector.fromUint(flags, false)); // Add the reserved 64bit v.addByteVector(ByteVector.fromSize(8)); diff --git a/src/ape/apeTagItem.ts b/src/ape/apeTagItem.ts index 11c8cff4..cae6bb4d 100644 --- a/src/ape/apeTagItem.ts +++ b/src/ape/apeTagItem.ts @@ -1,6 +1,6 @@ import {ByteVector, StringType} from "../byteVector"; import {CorruptFileError} from "../errors"; -import {Guards} from "../utils"; +import {Guards, NumberUtils} from "../utils"; /** * Indicates the type of data stored in a {@link ApeTagItem} object. @@ -22,6 +22,9 @@ export enum ApeTagItemType { Locator = 2 } +/** + * Class that represents a property in an APE tag. + */ export class ApeTagItem { private _data: ByteVector; private _isReadonly: boolean = false; @@ -32,7 +35,7 @@ export class ApeTagItem { // #region Constructors - private constructor() {} + private constructor() { /* empty to enforce static construction */ } /** * Constructs and initializes a new instance of {@link ApeTagItem} with a specified key and binary @@ -47,7 +50,7 @@ export class ApeTagItem { const item = new ApeTagItem(); item._key = key; item._type = ApeTagItemType.Binary; - item._data = value.isReadOnly ? value : ByteVector.fromByteVector(value, true); + item._data = value; return item; } @@ -69,16 +72,18 @@ export class ApeTagItem { throw new CorruptFileError("Not enough data for APE item"); } - const valueLength = data.mid(offset, 4).toUInt(false); - const flags = data.mid(offset + 4, 4).toUInt(false); + const valueLength = data.subarray(offset, 4).toUint(false); + const flags = data.subarray(offset + 4, 4).toUint(false); // Read flag data - item._isReadonly = (flags & 1) > 0; - item._type = ((flags >> 1) & 3); + item._isReadonly = NumberUtils.hasFlag(flags, 1); + item._type = NumberUtils.uintAnd(NumberUtils.uintRShift(flags, 1), 3); // Read key - const keyEndIndex = data.find(ByteVector.getTextDelimiter(StringType.UTF8), offset + 8); - item._key = data.toString(keyEndIndex - offset - 8, StringType.UTF8, offset + 8); + const keyStartIndex = offset + 8; + const keyEndIndex = data.offsetFind(ByteVector.getTextDelimiter(StringType.UTF8), offset + 8); + const keyLength = keyEndIndex - keyStartIndex; + item._key = data.subarray(keyStartIndex, keyLength).toString(StringType.UTF8); if (valueLength > data.length - keyEndIndex - 1) { throw new CorruptFileError("Invalid data length"); @@ -88,9 +93,9 @@ export class ApeTagItem { item._size = keyEndIndex - offset + 1 + valueLength; if (item._type === ApeTagItemType.Binary) { - item._data = ByteVector.fromByteVector(data.mid(keyEndIndex + 1), true); + item._data = data.subarray(keyEndIndex + 1).toByteVector(); } else { - item._text = data.mid(keyEndIndex + 1, valueLength).toStrings(StringType.UTF8, 0); + item._text = data.subarray(keyEndIndex + 1, valueLength).toStrings(StringType.UTF8); } return item; @@ -178,7 +183,7 @@ export class ApeTagItem { const newItem = new ApeTagItem(); newItem._type = this._type; newItem._key = this._key; - newItem._data = this._data ? ByteVector.fromByteVector(this._data, true) : undefined; + newItem._data = this._data ? this._data.toByteVector() : undefined; newItem._text = this._text ? this._text.slice() : undefined; newItem._isReadonly = this._isReadonly; newItem._size = this._size; @@ -200,18 +205,20 @@ export class ApeTagItem { value = this._data; } else { const vectors = this._text.reduce((acc, e, i) => { - return i > 0 - ? acc.concat(ByteVector.getTextDelimiter(StringType.UTF8), ByteVector.fromString(e)) - : [ByteVector.fromString(e)]; - }, undefined); + if (i > 0) { + acc.push(ByteVector.getTextDelimiter(StringType.UTF8)); + } + acc.push(ByteVector.fromString(e, StringType.UTF8)); + return acc; + }, []); value = ByteVector.concatenate(...vectors); } // Calculate the flags and length let flags = this._isReadonly ? 1 : 0; flags |= this._type << 1; - const flagsVector = ByteVector.fromUInt(flags, false); - const sizeVector = ByteVector.fromUInt(value.length, false); + const flagsVector = ByteVector.fromUint(flags, false); + const sizeVector = ByteVector.fromUint(value.length, false); // Put it all together const output = ByteVector.concatenate( diff --git a/src/asf/asfFile.ts b/src/asf/asfFile.ts index 961cf442..3fdb3f9c 100644 --- a/src/asf/asfFile.ts +++ b/src/asf/asfFile.ts @@ -1,9 +1,10 @@ import AsfTag from "./asfTag"; import HeaderObject from "./objects/headerObject"; -import Properties from "../properties"; import {File, FileAccessMode, ReadStyle} from "../file"; import {IFileAbstraction} from "../fileAbstraction"; +import {Properties} from "../properties"; import {Tag, TagTypes} from "../tag"; +import {NumberUtils} from "../utils"; /** * This class provides tagging and properties support for Microsoft's ASF files. @@ -19,12 +20,12 @@ export default class AsfFile extends File { try { const header = HeaderObject.fromFile(this, 0); if (header.hasContentDescriptors) { - this._tagTypesOnDisk |= TagTypes.Asf; + this.tagTypesOnDisk |= TagTypes.Asf; } this._asfTag = AsfTag.fromHeader(header); - if ((propertiesStyle & ReadStyle.Average) !== 0) { + if (NumberUtils.hasFlag(propertiesStyle, ReadStyle.Average)) { this._properties = header.properties; } } finally { @@ -43,13 +44,13 @@ export default class AsfFile extends File { // #region Methods /** @inheritDoc */ - public getTag(type: TagTypes, _create: boolean): Tag { + public getTag(type: TagTypes): Tag { return type === TagTypes.Asf ? this._asfTag : undefined; } /** @inheritDoc */ public removeTags(types: TagTypes): void { - if ((types & TagTypes.Asf) === TagTypes.Asf) { + if (NumberUtils.hasFlag(types, TagTypes.Asf)) { this._asfTag.clear(); } } @@ -65,10 +66,10 @@ export default class AsfFile extends File { if (!this._asfTag) { // This file doesn't have a tag, but clear it just to be safe header.removeContentDescriptor(); - this._tagTypesOnDisk &= ~TagTypes.Asf; + this.tagTypesOnDisk &= ~TagTypes.Asf; } else { // This file does have a tag, set the objects we have to it - this._tagTypesOnDisk |= TagTypes.Asf; + this.tagTypesOnDisk |= TagTypes.Asf; header.addUniqueObject(this._asfTag.contentDescriptionObject); header.addUniqueObject(this._asfTag.extendedContentDescriptionObject); header.extension.addUniqueObject(this._asfTag.metadataLibraryObject); @@ -77,7 +78,7 @@ export default class AsfFile extends File { // Write the updated header to the file const output = header.render(); const diff = output.length - header.originalSize; - super.insert(output, 0, header.originalSize); + super.insert(output, 0, header.originalSize + diff); } finally { this.mode = FileAccessMode.Closed; } @@ -86,7 +87,7 @@ export default class AsfFile extends File { // #endregion } -//////////////////////////////////////////////////////////////////////////// +// ///////////////////////////////////////////////////////////////////////// // Register the file type [ "taglib/wma", diff --git a/src/asf/asfTag.ts b/src/asf/asfTag.ts index 2fff0230..ad32694c 100644 --- a/src/asf/asfTag.ts +++ b/src/asf/asfTag.ts @@ -1,12 +1,11 @@ import ContentDescriptionObject from "./objects/contentDescriptionObject"; import Genres from "../genres"; import HeaderObject from "./objects/headerObject"; -import Picture from "../picture"; import ReadWriteUtils from "./readWriteUtils"; import {ByteVector, StringType} from "../byteVector"; import {DataType} from "./objects/descriptorBase"; import {ContentDescriptor, ExtendedContentDescriptionObject} from "./objects/extendedContentDescriptionObject"; -import {IPicture} from "../iPicture"; +import {IPicture, Picture} from "../picture"; import {MetadataDescriptor, MetadataLibraryObject} from "./objects/metadataLibraryObject"; import {Tag, TagTypes} from "../tag"; import {Guards} from "../utils"; @@ -22,7 +21,7 @@ export default class AsfTag extends Tag { private _extendedDescriptionObject: ExtendedContentDescriptionObject = ExtendedContentDescriptionObject.fromEmpty(); private _metadataLibraryObject: MetadataLibraryObject = MetadataLibraryObject.fromEmpty(); - private static readonly genreRegex = new RegExp(/\(([0-9]+)\)/); + private static readonly GENRE_REGEX = new RegExp(/\((\d+)\)/); // #region Constructors @@ -268,7 +267,7 @@ export default class AsfTag extends Tag { let genre = result[i].trim(); // Attempt to find a numeric genre in here - const genreMatch = AsfTag.genreRegex.exec(genre); + const genreMatch = AsfTag.GENRE_REGEX.exec(genre); if (genreMatch) { const numericGenre = Number.parseInt(genreMatch[1], 10); if (!Number.isNaN(numericGenre)) { @@ -304,7 +303,7 @@ export default class AsfTag extends Tag { return 0; } - const parsed = Number.parseInt(text.substr(0, 4), 10); + const parsed = Number.parseInt(text.substring(0, 4), 10); return Number.isNaN(parsed) ? 0 : parsed; } /** @@ -629,7 +628,7 @@ export default class AsfTag extends Tag { return Number.NaN; } if (valueString.toLowerCase().endsWith("db")) { - valueString = valueString.substr(0, valueString.length - 2).trim(); + valueString = valueString.substring(0, valueString.length - 2).trim(); } return Number.parseFloat(valueString); @@ -679,7 +678,7 @@ export default class AsfTag extends Tag { return Number.NaN; } if (valueString.toLowerCase().endsWith("db")) { - valueString = valueString.substr(0, valueString.length - 2).trim(); + valueString = valueString.substring(0, valueString.length - 2).trim(); } return Number.parseFloat(valueString); @@ -730,7 +729,7 @@ export default class AsfTag extends Tag { ... this.getDescriptors("WM/Picture"), ... this._metadataLibraryObject.getRecords(0, 0, "WM/Picture") ]; - return records.map((r) => AsfTag.pictureFromData(r.getBytes())) + return records.map((r) => AsfTag.pictureFromData(r.byteValue)) .filter((p) => !!p); } /** @@ -806,7 +805,7 @@ export default class AsfTag extends Tag { continue; } - const value = descriptor.getString(); + const value = descriptor.stringValue; if (value !== undefined) { return value; } @@ -818,12 +817,12 @@ export default class AsfTag extends Tag { public getDescriptorUint(... names: string[]): number { for (const descriptor of this.getDescriptors(... names)) { if (descriptor.type === DataType.DWord) { - const uintValue = descriptor.getUint(); + const uintValue = descriptor.uintValue; if (uintValue !== 0) { return uintValue; } } else if (descriptor.type === DataType.Unicode) { - const numericValue = Number.parseInt(descriptor.getString().trim(), 10); + const numericValue = Number.parseInt(descriptor.stringValue.trim(), 10); if (numericValue !== 0) { return numericValue; } @@ -917,31 +916,34 @@ export default class AsfTag extends Tag { offset += 1; // Get the Picture size - const pictureSize = data.mid(offset, 4).toUInt(false); + const pictureSize = data.subarray(offset, 4).toUint(false); offset += 4; - // Get the mime-type const delimiter = ByteVector.getTextDelimiter(StringType.UTF16LE); - const mimeTypeDelimiterIndex = data.find(delimiter, offset, delimiter.length); + + // Get the mime-type + const mimeTypeDelimiterIndex = data.offsetFind(delimiter, offset, delimiter.length); if (mimeTypeDelimiterIndex < 0 || mimeTypeDelimiterIndex - offset === 0) { return undefined; } - const mimeType = data.toString(mimeTypeDelimiterIndex - offset, StringType.UTF16LE, offset); + const mimeTypeLength = mimeTypeDelimiterIndex - offset; + const mimeType = data.subarray(offset, mimeTypeLength).toString(StringType.UTF16LE); offset = mimeTypeDelimiterIndex + delimiter.length; // Get the description - const descriptionDelimiterIndex = data.find(delimiter, offset, delimiter.length); + const descriptionDelimiterIndex = data.offsetFind(delimiter, offset, delimiter.length); if (descriptionDelimiterIndex < 0 || descriptionDelimiterIndex - offset === 0) { return undefined; } - const description = data.toString(descriptionDelimiterIndex - offset, StringType.UTF16LE, offset); + const descriptionLength = descriptionDelimiterIndex - offset; + const description = data.subarray(offset, descriptionLength).toString(StringType.UTF16LE); offset = descriptionDelimiterIndex + 2; - return Picture.fromFullData(data.mid(offset, pictureSize), pictureType, mimeType, description); + return Picture.fromFullData(data.subarray(offset, pictureSize), pictureType, mimeType, description); } /** @internal */ - public static pictureToData(picture: IPicture) { + public static pictureToData(picture: IPicture): ByteVector { return ByteVector.concatenate( picture.type, ReadWriteUtils.renderDWord(picture.data.length), diff --git a/src/asf/constants.ts b/src/asf/constants.ts index acb7dccc..0d3867f5 100644 --- a/src/asf/constants.ts +++ b/src/asf/constants.ts @@ -44,66 +44,66 @@ export class Guids { /** * Indicates that an object is a {@link ContentDescriptionObject}. */ - public static readonly AsfContentDescriptionObject = + public static readonly ASF_CONTENT_DESCRIPTION_OBJECT = new UuidWrapper("75B22633-668E-11CF-A6D9-00AA0062CE6C"); /** * Indicates that an object is a {@link ExtendedContentDescriptionObject}. */ - public static readonly AsfExtendedContentDescriptionObject = + public static readonly ASF_EXTENDED_CONTENT_DESCRIPTION_OBJECT = new UuidWrapper("D2D0A440-E307-11D2-97F0-00A0C95EA850"); /** * Indicates that an object is a {@link FilePropertiesObject}. */ - public static readonly AsfFilePropertiesObject = + public static readonly ASF_FILE_PROPERTIES_OBJECT = new UuidWrapper("8CABDCA1-A947-11CF-8EE4-00C00C205365"); /** * Indicates that an object is a {@link HeaderExtensionObject}. */ - public static readonly AsfHeaderExtensionObject = + public static readonly ASF_HEADER_EXTENSION_OBJECT = new UuidWrapper("5FBF03B5-A92E-11CF-8EE3-00C00C205365"); /** * Indicates that an object is a {@link HeaderObject}. */ - public static readonly AsfHeaderObject = + public static readonly ASF_HEADER_OBJECT = new UuidWrapper("75B22630-668E-11CF-A6D9-00AA0062CE6C"); /** * Indicates that an object is a {@link MetadataLibraryObject}. */ - public static readonly AsfMetadataLibraryObject = + public static readonly ASF_METADATA_LIBRARY_OBJECT = new UuidWrapper("44231C94-9498-49D1-A141-1D134E457054"); /** * Indicates that an object is a {@link PaddingObject}. */ - public static readonly AsfPaddingObject = + public static readonly ASF_PADDING_OBJECT = new UuidWrapper("1806D474-CADF-4509-A4BA-9AABCB96AAE8"); /** * Indicates that an object is a {@link StreamPropertiesObject}. */ - public static readonly AsfStreamPropertiesObject = + public static readonly ASF_STREAM_PROPERTIES_OBJECT = new UuidWrapper("B7DC0791-A9B7-11CF-8EE6-00C00C205365"); /** * Indicates that a {@link StreamPropertiesObject} contains information about an audio stream. */ - public static readonly AsfAudioMedia = + public static readonly ASF_AUDIO_MEDIA = new UuidWrapper("F8699E40-5B4D-11CF-A8FD-00805F5C442B"); /** - * Indicates that a {@link StreamPropertiesObject} contains information about an video stream. + * Indicates that a {@link StreamPropertiesObject} contains information about a video stream. */ - public static readonly AsfVideoMedia = + public static readonly ASF_VIDEO_MEDIA = new UuidWrapper("BC19EFC0-5B4D-11CF-A8FD-00805F5C442B"); /** * Indicates a placeholder portion of a file is correctly encoded. */ - public static readonly AsfReserved1 = + public static readonly ASF_RESERVED = new UuidWrapper("ABD3D211-A9BA-11cf-8EE6-00C00C205365"); } diff --git a/src/asf/objects/baseObject.ts b/src/asf/objects/baseObject.ts index 4a35f6a9..06411663 100644 --- a/src/asf/objects/baseObject.ts +++ b/src/asf/objects/baseObject.ts @@ -16,8 +16,7 @@ export default abstract class BaseObject { // #region Initializers - protected constructor() { - } + protected constructor() { /* empty to only allow construction via static constructors */ } /** * Initializes a new instance by reading the contents from a specified position in a specified @@ -87,7 +86,7 @@ export default abstract class BaseObject { protected renderInternal(data: ByteVector): ByteVector { const length = BigInt((!!data ? data.length : 0) + 24); return ByteVector.concatenate( - ByteVector.fromByteArray(this._id.toBytes()), + this._id.toBytes(), ReadWriteUtils.renderQWord(length), data ); diff --git a/src/asf/objects/contentDescriptionObject.ts b/src/asf/objects/contentDescriptionObject.ts index e5e87b33..8fdbed92 100644 --- a/src/asf/objects/contentDescriptionObject.ts +++ b/src/asf/objects/contentDescriptionObject.ts @@ -25,7 +25,7 @@ export default class ContentDescriptionObject extends BaseObject { public static fromEmpty(): ContentDescriptionObject { const instance = new ContentDescriptionObject(); - instance.initializeFromGuid(Guids.AsfContentDescriptionObject); + instance.initializeFromGuid(Guids.ASF_CONTENT_DESCRIPTION_OBJECT); return instance; } @@ -34,7 +34,7 @@ export default class ContentDescriptionObject extends BaseObject { const instance = new ContentDescriptionObject(); instance.initializeFromFile(file, position); - if (!instance.guid.equals(Guids.AsfContentDescriptionObject)) { + if (!instance.guid.equals(Guids.ASF_CONTENT_DESCRIPTION_OBJECT)) { throw new CorruptFileError("Object GUID is not the expected content description object guid"); } if (instance.originalSize < 34) { diff --git a/src/asf/objects/descriptorBase.ts b/src/asf/objects/descriptorBase.ts index 7c65fdd1..3f29f9ac 100644 --- a/src/asf/objects/descriptorBase.ts +++ b/src/asf/objects/descriptorBase.ts @@ -43,22 +43,25 @@ export enum DataType { Guid = 6 } +/** + * Type shortcut for all the types a descriptor can contain + */ export type DescriptorValue = bigint | boolean | ByteVector | number | string | UuidWrapper; /** * Abstract class that forms the basis of extended content descriptors and metadata library records. */ export abstract class DescriptorBase { - protected readonly _name: string; - protected readonly _type: DataType; + private readonly _name: string; + private readonly _type: DataType; - protected readonly _boolValue: boolean; - protected readonly _byteValue: ByteVector; - protected readonly _dWordValue: number; - protected readonly _guidValue: UuidWrapper; - protected readonly _qWordValue: bigint; - protected readonly _stringValue: string; - protected readonly _wordValue: number; + private readonly _boolValue: boolean; + private readonly _byteValue: ByteVector; + private readonly _dWordValue: number; + private readonly _guidValue: UuidWrapper; + private readonly _qWordValue: bigint; + private readonly _stringValue: string; + private readonly _wordValue: number; protected constructor(name: string, type: DataType, value: DescriptorValue) { this._name = name; @@ -108,7 +111,7 @@ export abstract class DescriptorBase { throw new Error("Invalid value type for datatype bytes"); } - this._byteValue = value; + this._byteValue = value.toByteVector(); break; case DataType.Guid: if (!(value instanceof UuidWrapper)) { @@ -134,58 +137,54 @@ export abstract class DescriptorBase { */ public get type(): DataType { return this._type; } - // #endregion - - // #region Public Methods - /** * Gets the boolean value of the current instance. * @returns boolean Boolean value of the current instance is returned if {@link type} is * {@link DataType.Bool}. `undefined` is returned otherwise. */ - public getBool(): boolean { return this._boolValue; } + public get boolValue(): boolean { return this._boolValue; } /** * Gets the binary contents of the current instance. * @returns ByteVector Byte contents of the current instance, if {@link type} is * {@link DataType.Bytes}. `undefined` is returned otherwise. */ - public getBytes(): ByteVector { return this._byteValue; } + public get byteValue(): ByteVector { return this._byteValue; } /** * Gets the guid contents of the current instance. * @returns UuidWrapper GUID contents of the current instance, if {@link type} is * {@link DataType.Guid}. `undefined` is returned otherwise. */ - public getGuid(): UuidWrapper { return this._guidValue; } + public get guidValue(): UuidWrapper { return this._guidValue; } /** * Gets the string contents of the current instance. * @returns string String contents of the current instance if {@link type} is * {@link DataType.Unicode}. `undefined` is returned otherwise. */ - public getString(): string { return this._stringValue; } + public get stringValue(): string { return this._stringValue; } /** * Gets the 32-bit double word contents of the current instance. * @returns number Double word contents of the current instance, if {@link type} is * {@link DataType.DWord}. `undefined` is returned otherwise. */ - public getUint(): number { return this._dWordValue; } + public get uintValue(): number { return this._dWordValue; } /** * Gets the 64-bit quad word contents of the current instance. * @returns bigint Quad word contents of the current instance, if {@link type} is * {@link DataType.QWord}. `undefined` is returned otherwise. */ - public getUlong(): bigint { return this._qWordValue; } + public get ulongValue(): bigint { return this._qWordValue; } /** * Gets the 16-bit word contents of the current instance. * @returns number Word contents of the current instance, if {@link type} is * {@link DataType.Word}. `undefined` is returned otherwise. */ - public getUshort(): number { return this._wordValue; } + public get ushortValue(): number { return this._wordValue; } public abstract render(): ByteVector; @@ -203,7 +202,7 @@ export abstract class DescriptorBase { case DataType.Unicode: return this._stringValue; case DataType.Bytes: - return this._byteValue.toString(undefined, StringType.UTF16LE); + return this._byteValue.toString(StringType.UTF16LE); case DataType.Guid: return this._guidValue.toString(); } diff --git a/src/asf/objects/extendedContentDescriptionObject.ts b/src/asf/objects/extendedContentDescriptionObject.ts index 73cc0e82..0e735dad 100644 --- a/src/asf/objects/extendedContentDescriptionObject.ts +++ b/src/asf/objects/extendedContentDescriptionObject.ts @@ -72,36 +72,36 @@ export class ContentDescriptor extends DescriptorBase { /** @inheritDoc */ public render(): ByteVector { let value: ByteVector; - switch (this._type) { + switch (this.type) { case DataType.QWord: - value = ReadWriteUtils.renderQWord(this._qWordValue); + value = ReadWriteUtils.renderQWord(this.ulongValue); break; case DataType.DWord: - value = ReadWriteUtils.renderDWord(this._dWordValue); + value = ReadWriteUtils.renderDWord(this.uintValue); break; case DataType.Word: - value = ReadWriteUtils.renderWord(this._wordValue); + value = ReadWriteUtils.renderWord(this.ushortValue); break; case DataType.Bool: // NOTE: for content descriptors, bool is a DWORD!!!! - value = ReadWriteUtils.renderDWord(this._boolValue ? 1 : 0); + value = ReadWriteUtils.renderDWord(this.boolValue ? 1 : 0); break; case DataType.Unicode: - value = ReadWriteUtils.renderUnicode(this._stringValue); + value = ReadWriteUtils.renderUnicode(this.stringValue); break; case DataType.Bytes: - value = this._byteValue; + value = this.byteValue; break; case DataType.Guid: - value = ByteVector.fromByteArray(this._guidValue.toBytes()); + value = this.guidValue.toBytes(); break; } - const nameBytes = ReadWriteUtils.renderUnicode(this._name); + const nameBytes = ReadWriteUtils.renderUnicode(this.name); return ByteVector.concatenate( ReadWriteUtils.renderWord(nameBytes.length), nameBytes, - ReadWriteUtils.renderWord(this._type), + ReadWriteUtils.renderWord(this.type), ReadWriteUtils.renderWord(value.length), value ); @@ -126,7 +126,7 @@ export class ExtendedContentDescriptionObject extends BaseObject { */ public static fromEmpty(): ExtendedContentDescriptionObject { const instance = new ExtendedContentDescriptionObject(); - instance.initializeFromGuid(Guids.AsfExtendedContentDescriptionObject); + instance.initializeFromGuid(Guids.ASF_EXTENDED_CONTENT_DESCRIPTION_OBJECT); return instance; } @@ -141,7 +141,7 @@ export class ExtendedContentDescriptionObject extends BaseObject { const instance = new ExtendedContentDescriptionObject(); instance.initializeFromFile(file, position); - if (!instance.guid.equals(Guids.AsfExtendedContentDescriptionObject)) { + if (!instance.guid.equals(Guids.ASF_EXTENDED_CONTENT_DESCRIPTION_OBJECT)) { throw new CorruptFileError("Object GUID does not match expected content description object GUID"); } if (instance.originalSize < 26) { @@ -224,7 +224,7 @@ export class ExtendedContentDescriptionObject extends BaseObject { } /** @inheritDoc */ - public render() { + public render(): ByteVector { const output = ByteVector.concatenate( ReadWriteUtils.renderWord(this._descriptors.length), ... this._descriptors.map((r) => r.render()) diff --git a/src/asf/objects/filePropertiesObject.ts b/src/asf/objects/filePropertiesObject.ts index a18357ac..041d5841 100644 --- a/src/asf/objects/filePropertiesObject.ts +++ b/src/asf/objects/filePropertiesObject.ts @@ -57,7 +57,7 @@ export default class FilePropertiesObject extends BaseObject { const instance = new FilePropertiesObject(); instance.initializeFromFile(file, position); - if (!instance.guid.equals(Guids.AsfFilePropertiesObject)) { + if (!instance.guid.equals(Guids.ASF_FILE_PROPERTIES_OBJECT)) { throw new CorruptFileError("Object GUID is not the expected file properties object GUID"); } diff --git a/src/asf/objects/headerExtensionObject.ts b/src/asf/objects/headerExtensionObject.ts index da75e987..f63422b0 100644 --- a/src/asf/objects/headerExtensionObject.ts +++ b/src/asf/objects/headerExtensionObject.ts @@ -1,12 +1,11 @@ import BaseObject from "./baseObject"; import ReadWriteUtils from "../readWriteUtils"; +import UnknownObject from "./unknownObject"; import {ByteVector} from "../../byteVector"; import {Guids, ObjectType} from "../constants"; import {CorruptFileError} from "../../errors"; import {File} from "../../file"; -import readWriteUtils from "../readWriteUtils"; import {MetadataLibraryObject} from "./metadataLibraryObject"; -import UnknownObject from "./unknownObject"; /** * This class extends {@link BaseObject} to provide a representation of an ASF header extension @@ -29,17 +28,17 @@ export default class HeaderExtensionObject extends BaseObject { const instance = new HeaderExtensionObject(); instance.initializeFromFile(file, position); - if (!instance.guid.equals(Guids.AsfHeaderExtensionObject)) { + if (!instance.guid.equals(Guids.ASF_HEADER_EXTENSION_OBJECT)) { throw new CorruptFileError("Object GUID does not match expected header extension object GUID"); } - if (!ReadWriteUtils.readGuid(file).equals(Guids.AsfReserved1)) { + if (!ReadWriteUtils.readGuid(file).equals(Guids.ASF_RESERVED)) { throw new CorruptFileError("Expected reserved1 GUID was not found"); } if (ReadWriteUtils.readWord(file) !== 6) { throw new CorruptFileError("Invalid reserved word, expected '6'"); } - let sizeRemaining = readWriteUtils.readDWord(file); + let sizeRemaining = ReadWriteUtils.readDWord(file); position += 0x170 / 8; while (sizeRemaining > 0) { @@ -84,7 +83,7 @@ export default class HeaderExtensionObject extends BaseObject { public render(): ByteVector { const renderedChildren = ByteVector.concatenate(...(this._children.map((o) => o.render()))); const output = ByteVector.concatenate( - Guids.AsfReserved1.toBytes(), + Guids.ASF_RESERVED.toBytes(), ReadWriteUtils.renderWord(6), ReadWriteUtils.renderDWord(renderedChildren.length), renderedChildren @@ -96,7 +95,7 @@ export default class HeaderExtensionObject extends BaseObject { file.seek(position); const guid = ReadWriteUtils.readGuid(file); - if (guid.equals(Guids.AsfMetadataLibraryObject)) { + if (guid.equals(Guids.ASF_METADATA_LIBRARY_OBJECT)) { return MetadataLibraryObject.fromFile(file, position); } diff --git a/src/asf/objects/headerObject.ts b/src/asf/objects/headerObject.ts index ac7149c5..576da8f0 100644 --- a/src/asf/objects/headerObject.ts +++ b/src/asf/objects/headerObject.ts @@ -1,8 +1,8 @@ import BaseObject from "./baseObject"; +import ContentDescriptionObject from "./contentDescriptionObject"; import FilePropertiesObject from "./filePropertiesObject"; import HeaderExtensionObject from "./headerExtensionObject"; import PaddingObject from "./paddingObject"; -import Properties from "../../properties"; import ReadWriteUtils from "../readWriteUtils"; import StreamPropertiesObject from "./streamPropertiesObject"; import UnknownObject from "./unknownObject"; @@ -10,9 +10,8 @@ import {ByteVector} from "../../byteVector"; import {Guids, ObjectType} from "../constants"; import {CorruptFileError} from "../../errors"; import {File} from "../../file"; -import {ICodec} from "../../iCodec"; +import {ICodec, Properties} from "../../properties"; import {Guards} from "../../utils"; -import ContentDescriptionObject from "./contentDescriptionObject"; import {ExtendedContentDescriptionObject} from "./extendedContentDescriptionObject"; /** @@ -38,7 +37,7 @@ export default class HeaderObject extends BaseObject { const instance = new HeaderObject(); instance.initializeFromFile(file, position); - if (!instance.guid.equals(Guids.AsfHeaderObject)) { + if (!instance.guid.equals(Guids.ASF_HEADER_OBJECT)) { throw new CorruptFileError("Object GUID does not match expected header object GUID"); } if (instance.originalSize < 26) { @@ -185,22 +184,22 @@ export default class HeaderObject extends BaseObject { file.seek(position); const guid = ReadWriteUtils.readGuid(file); - if (guid.equals(Guids.AsfFilePropertiesObject)) { + if (guid.equals(Guids.ASF_FILE_PROPERTIES_OBJECT)) { return FilePropertiesObject.fromFile(file, position); } - if (guid.equals(Guids.AsfStreamPropertiesObject)) { + if (guid.equals(Guids.ASF_STREAM_PROPERTIES_OBJECT)) { return StreamPropertiesObject.fromFile(file, position); } - if (guid.equals(Guids.AsfHeaderExtensionObject)) { + if (guid.equals(Guids.ASF_HEADER_EXTENSION_OBJECT)) { return HeaderExtensionObject.fromFile(file, position); } - if (guid.equals(Guids.AsfContentDescriptionObject)) { + if (guid.equals(Guids.ASF_CONTENT_DESCRIPTION_OBJECT)) { return ContentDescriptionObject.fromFile(file, position); } - if (guid.equals(Guids.AsfExtendedContentDescriptionObject)) { + if (guid.equals(Guids.ASF_EXTENDED_CONTENT_DESCRIPTION_OBJECT)) { return ExtendedContentDescriptionObject.fromFile(file, position); } - if (guid.equals(Guids.AsfPaddingObject)) { + if (guid.equals(Guids.ASF_PADDING_OBJECT)) { return PaddingObject.fromFile(file, position); } diff --git a/src/asf/objects/metadataLibraryObject.ts b/src/asf/objects/metadataLibraryObject.ts index cbb55236..d9d1bf04 100644 --- a/src/asf/objects/metadataLibraryObject.ts +++ b/src/asf/objects/metadataLibraryObject.ts @@ -117,37 +117,37 @@ export class MetadataDescriptor extends DescriptorBase { /** @inheritDoc */ public render(): ByteVector { let value: ByteVector; - switch (this._type) { + switch (this.type) { case DataType.QWord: - value = ReadWriteUtils.renderQWord(this._qWordValue); + value = ReadWriteUtils.renderQWord(this.ulongValue); break; case DataType.DWord: - value = ReadWriteUtils.renderDWord(this._dWordValue); + value = ReadWriteUtils.renderDWord(this.uintValue); break; case DataType.Word: - value = ReadWriteUtils.renderWord(this._wordValue); + value = ReadWriteUtils.renderWord(this.ushortValue); break; case DataType.Bool: // NOTE: For whatever reason metadata content descriptions are WORDs. - value = ReadWriteUtils.renderWord(this._boolValue ? 1 : 0); + value = ReadWriteUtils.renderWord(this.boolValue ? 1 : 0); break; case DataType.Unicode: - value = ReadWriteUtils.renderUnicode(this._stringValue); + value = ReadWriteUtils.renderUnicode(this.stringValue); break; case DataType.Bytes: - value = this._byteValue; + value = this.byteValue; break; case DataType.Guid: - value = ByteVector.fromByteArray(this._guidValue.toBytes()); + value = this.guidValue.toBytes(); break; } - const nameBytes = ReadWriteUtils.renderUnicode(this._name); + const nameBytes = ReadWriteUtils.renderUnicode(this.name); return ByteVector.concatenate( ReadWriteUtils.renderWord(this._languageListIndex), ReadWriteUtils.renderWord(this._streamNumber), ReadWriteUtils.renderWord(nameBytes.length), - ReadWriteUtils.renderWord(this._type), + ReadWriteUtils.renderWord(this.type), ReadWriteUtils.renderDWord(value.length), nameBytes, value @@ -175,7 +175,7 @@ export class MetadataLibraryObject extends BaseObject { */ public static fromEmpty(): MetadataLibraryObject { const instance = new MetadataLibraryObject(); - instance.initializeFromGuid(Guids.AsfMetadataLibraryObject); + instance.initializeFromGuid(Guids.ASF_METADATA_LIBRARY_OBJECT); return instance; } @@ -183,7 +183,7 @@ export class MetadataLibraryObject extends BaseObject { const instance = new MetadataLibraryObject(); instance.initializeFromFile(file, position); - if (!instance.guid.equals(Guids.AsfMetadataLibraryObject)) { + if (!instance.guid.equals(Guids.ASF_METADATA_LIBRARY_OBJECT)) { throw new CorruptFileError("Object GUID does not match expected metadata library object GUID"); } if (instance.originalSize < 26) { diff --git a/src/asf/objects/paddingObject.ts b/src/asf/objects/paddingObject.ts index d58ca619..9b175788 100644 --- a/src/asf/objects/paddingObject.ts +++ b/src/asf/objects/paddingObject.ts @@ -30,7 +30,7 @@ export default class PaddingObject extends BaseObject { const instance = new PaddingObject(); instance.initializeFromFile(file, position); - if (!instance.guid.equals(Guids.AsfPaddingObject)) { + if (!instance.guid.equals(Guids.ASF_PADDING_OBJECT)) { throw new CorruptFileError("Object GUID does not match expected padding object GUID"); } @@ -47,7 +47,7 @@ export default class PaddingObject extends BaseObject { Guards.safeUint(size, "size"); const instance = new PaddingObject(); - instance.initializeFromGuid(Guids.AsfPaddingObject); + instance.initializeFromGuid(Guids.ASF_PADDING_OBJECT); instance._size = size; return instance; diff --git a/src/asf/objects/streamPropertiesObject.ts b/src/asf/objects/streamPropertiesObject.ts index 30133148..fe078758 100644 --- a/src/asf/objects/streamPropertiesObject.ts +++ b/src/asf/objects/streamPropertiesObject.ts @@ -7,7 +7,7 @@ import {ByteVector} from "../../byteVector"; import {Guids, ObjectType} from "../constants"; import {CorruptFileError} from "../../errors"; import {File} from "../../file"; -import {ICodec} from "../../iCodec"; +import {ICodec} from "../../properties"; import {NumberUtils} from "../../utils"; /** @@ -40,7 +40,7 @@ export default class StreamPropertiesObject extends BaseObject { const instance = new StreamPropertiesObject(); instance.initializeFromFile(file, position); - if (!instance.guid.equals(Guids.AsfStreamPropertiesObject)) { + if (!instance.guid.equals(Guids.ASF_STREAM_PROPERTIES_OBJECT)) { throw new CorruptFileError("Object GUID is not the expected stream properties object GUID"); } @@ -57,8 +57,8 @@ export default class StreamPropertiesObject extends BaseObject { instance._flags = ReadWriteUtils.readWord(file); instance._reserved = ReadWriteUtils.readDWord(file); - instance._typeSpecificData = file.readBlock(typeSpecificDataLength); - instance._errorCorrectionData = file.readBlock(errorSpecificDataLength); + instance._typeSpecificData = file.readBlock(typeSpecificDataLength).toByteVector(); + instance._errorCorrectionData = file.readBlock(errorSpecificDataLength).toByteVector(); return instance; } @@ -73,10 +73,10 @@ export default class StreamPropertiesObject extends BaseObject { public get codec(): ICodec { if (!this._codec) { // Read the codec info from the type specific data - if (this._streamType.equals(Guids.AsfAudioMedia)) { + if (this._streamType.equals(Guids.ASF_AUDIO_MEDIA)) { this._codec = new RiffWaveFormatEx(this._typeSpecificData); } - if (this._streamType.equals(Guids.AsfVideoMedia)) { + if (this._streamType.equals(Guids.ASF_VIDEO_MEDIA)) { this._codec = new RiffBitmapInfoHeader(this._typeSpecificData, 11); } diff --git a/src/asf/objects/unknownObject.ts b/src/asf/objects/unknownObject.ts index a4170c6c..6a966b2a 100644 --- a/src/asf/objects/unknownObject.ts +++ b/src/asf/objects/unknownObject.ts @@ -23,7 +23,7 @@ export default class UnknownObject extends BaseObject { public static fromFile(file: File, position: number): UnknownObject { const instance = new UnknownObject(); instance.initializeFromFile(file, position); - instance._data = file.readBlock(instance.originalSize - 24); + instance._data = file.readBlock(instance.originalSize - 24).toByteVector(); return instance; } @@ -42,6 +42,7 @@ export default class UnknownObject extends BaseObject { this._data = value; } + /** @inheritDoc */ public get objectType(): ObjectType { return ObjectType.UnknownObject; } // #endregion diff --git a/src/asf/readWriteUtils.ts b/src/asf/readWriteUtils.ts index 821af65a..f0cc3325 100644 --- a/src/asf/readWriteUtils.ts +++ b/src/asf/readWriteUtils.ts @@ -12,7 +12,7 @@ export default { * @param file File to read the double word from */ readDWord: (file: File): number => { - return file.readBlock(4).toUInt(false); + return file.readBlock(4).toUint(false); }, /** @@ -20,7 +20,7 @@ export default { * @param file File to read the guid from */ readGuid: (file: File): UuidWrapper => { - return new UuidWrapper(file.readBlock(16).data); + return new UuidWrapper(file.readBlock(16)); }, /** @@ -39,7 +39,7 @@ export default { * @param file File to read unicode from */ readUnicode: (file: File, length: number): string => { - const string = file.readBlock(length).toString(undefined, StringType.UTF16LE); + const string = file.readBlock(length).toString(StringType.UTF16LE); const nullIndex = string.indexOf("\0"); return nullIndex >= 0 ? string.substring(0, nullIndex) : string; }, @@ -49,7 +49,7 @@ export default { * @param file File to read the word from */ readWord: (file: File): number => { - return file.readBlock(2).toUShort(false); + return file.readBlock(2).toUshort(false); }, /** @@ -57,7 +57,7 @@ export default { * @param value Double word to render */ renderDWord: (value: number): ByteVector => { - return ByteVector.fromUInt(value, false); + return ByteVector.fromUint(value, false); }, /** @@ -65,7 +65,7 @@ export default { * @param value Quad word to render */ renderQWord: (value: bigint): ByteVector => { - return ByteVector.fromULong(value, false); + return ByteVector.fromUlong(value, false); }, /** @@ -75,7 +75,7 @@ export default { renderUnicode: (value: string): ByteVector => { return ByteVector.concatenate( ByteVector.fromString(value, StringType.UTF16LE), - ByteVector.fromUShort(0, false) + ByteVector.fromUshort(0, false) ); }, @@ -84,6 +84,6 @@ export default { * @param value Word to render */ renderWord: (value: number): ByteVector => { - return ByteVector.fromUShort(value, false); + return ByteVector.fromUshort(value, false); }, }; diff --git a/src/byteVector.ts b/src/byteVector.ts index 03a49082..e09b80ac 100644 --- a/src/byteVector.ts +++ b/src/byteVector.ts @@ -2,23 +2,7 @@ import * as IConv from "iconv-lite"; import * as fs from "fs"; import {IFileAbstraction} from "./fileAbstraction"; import {IStream} from "./stream"; -import {Guards} from "./utils"; - -class IConvEncoding { - public readonly encoding: string; - - constructor(encoding: string) { - this.encoding = encoding; - } - - public decode(data: Buffer): string { - return IConv.decode(data, this.encoding); - } - - public encode(text: string): Uint8Array { - return IConv.encode(text, this.encoding); - } -} +import {Guards, NumberUtils} from "./utils"; /** * @summary Specifies the text encoding used when converting betweenInclusive a string and a @@ -53,14 +37,103 @@ export enum StringType { UTF16LE = 4 } -export class ByteVector { +/** + * Wrapper around the `iconv-lite` library to provide string encoding and decoding functionality. + */ +export class Encoding { + private static readonly ENCODINGS = new Map([ + [StringType.Latin1, new Encoding("latin1")], + [StringType.UTF8, new Encoding("utf8")], + [StringType.UTF16BE, new Encoding("utf16-be")], + [StringType.UTF16LE, new Encoding("utf16-le")] + ]); + + /** + * Contains the last generic UTF16 encoding read. Defaults to UTF16-LE + */ + private static _lastUtf16Encoding: StringType = StringType.UTF16LE; + + private readonly _encoding: string; - // #region Member Fields + private constructor(encoding: string) { + this._encoding = encoding; + } /** - * Contains values to use in CRC calculation + * Gets the appropriate encoding instance for encoding and decoding strings, based on the + * provided `type`. + * @param type Type of string to get an {@link Encoding} class instance for + * @param bom Optional, the byte order marker for the string. Used to determine UTF16 endianess */ - private static readonly _crcTable: Uint32Array = new Uint32Array([ + public static getEncoding(type: StringType, bom?: ByteVector): Encoding { + // When reading a collection of UTF16 strings, sometimes only the first one will contain + // the BOM. In that case, this field will inform the file what encoding to use for the + // second string. + if (type === StringType.UTF16) { + // If we have a BOM, return the appropriate encoding. Otherwise, assume we're + // reading from a string that was already identified. In that case, we'll use + // the last used encoding. + if (bom && bom.length >= 2) { + if (bom.get(0) === 0xFF && bom.get(1) === 0xFE) { + this._lastUtf16Encoding = StringType.UTF16LE; + } else { + this._lastUtf16Encoding = StringType.UTF16BE; + } + } + + type = this._lastUtf16Encoding; + } + + return this.ENCODINGS.get(type); + + // NOTE: The original .NET implementation has the notion of "broken" latin behavior that + // uses Encoding.Default. I have removed it in this port because 1) this behavior is + // not used anywhere in the library, 2) Encoding.Default could be anything depending + // on the machine's region, 3) in .NET Core this is always UTF8. + // If it turns out we need support for other non unicode encodings, we'll want to + // revisit this. + } + + public decode(data: Uint8Array): string { + // @TODO: The next version of iconv-lite will add Uint8Array to the types for decode. Until + // then, I have word it should work w/an 'unsafe' cast. See + // https://github.com/ashtuchkin/iconv-lite/issues/293 + return IConv.decode( data, this._encoding); + } + + public encode(text: string): Uint8Array { + return IConv.encode(text, this._encoding); + } +} + +/** + * Wrapper around a `Uint8Array` that provides functionality for reading and writing byte arrays. + * @remarks Implementation of this class uses a single `Uint8Array` to store bytes. Due to + * `Uint8Array`s being fixed length, any operation that inserts or removes values into the + * instance will result in a copy of the internal array being made. If multiple additions will + * be made, rather than using multiple inserts/adds, the {@link ByteVector.concatenate} method + * is provided to group additions/inserts and therefore improve performance. + * + * The original .NET implementation had an ubiquitous `mid` method that would return a subset + * of the bytes in the current instance. In versions <5 of the node port, `mid` would make a + * copy of the subset of the bytes. Since this was frequently done right before reading a + * number or string, this copy was extremely wasteful. In version 5, the `mid` method was + * replaced with `subarray` which behaves identically to `Uint8Array.subarray` and returns + * an instance that is a 'view' of an existing instance - no copying involved. However, all + * write operations make copies, instances that are backed by 'views' may waste memory by + * referencing a `Uint8Array` that is much larger than the view. + * + * With this in mind, best practices for using `ByteVectors`: + * * Calling {@link ByteVector.subarray} is cheap, use it when possible + * * If storing a subset of a `ByteVector`, store a copy with {@link ByteVector.toByteVector} + * * If building a `ByteVector`, use {@link ByteVector.concatenate} when possible + * * If the instance should be immutable, use {@link ByteVector.makeReadOnly} + */ +export class ByteVector { + + // #region Members + + private static readonly CRC_TABLE: Uint32Array = new Uint32Array([ 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, @@ -130,36 +203,23 @@ export class ByteVector { /** * Contains a one byte text delimiter */ - private static readonly _td1: ByteVector = ByteVector.fromSize(1, undefined, true); + private static readonly TD1: ByteVector = ByteVector.fromSize(1).makeReadOnly(); /** * Contains a two byte text delimiter */ - private static readonly _td2: ByteVector = ByteVector.fromSize(2, undefined, true); - - /** - * Contains the last generic UTF16 encoding read. Defaults to UTF16-LE - * @remarks When reading a collection of UTF16 strings, sometimes only the first one will - * contain the BOM. In that case, this field will inform the file what encoding to - * use for the second string. - */ - private static _lastUtf16IConvFunc: IConvEncoding = new IConvEncoding("utf16-le"); - - /** - * Contains the internal byte list - */ - private _data: Uint8Array; + private static readonly TD2: ByteVector = ByteVector.fromSize(2).makeReadOnly(); - /** - * Whether or not this byte vector is readonly - */ - private _isReadOnly: boolean; + private _bytes: Uint8Array; + private _isReadOnly: boolean = false; // #endregion // #region Constructors - private constructor() { } + private constructor(bytes: Uint8Array) { + this._bytes = bytes; + } /** * Creates a {@link ByteVector} from a collection of bytes, byte arrays, and byte vectors. This @@ -172,38 +232,46 @@ export class ByteVector { * `vectors` concatenated together */ // @TODO Remove usages of .addX when this can be substituted - public static concatenate(... vectors: Array): ByteVector { + public static concatenate(... vectors: Array): ByteVector { // Get the length of the vector we need to create - let totalLength = 0; - for (const vector of vectors) { + const totalLength = vectors.reduce((accum, vector) => { + if (vector === undefined || vector === null) { + // Ignore falsy values + return accum; + } if (typeof(vector) === "number") { - totalLength++; - } else { - totalLength += ( vector).length; + // Add 1 for a single byte + return accum + 1; } - // @TODO: Add support for skipping undefined and go back and look for instances where 1 - // byte is added after concatenating - } + + // Add length of vector to length + return accum + vector.length; + }, 0); // Create a single big vector and copy the contents into it const result = ByteVector.fromSize(totalLength); let currentPosition = 0; for (const v of vectors) { - if (( v).length === undefined) { + if (v === undefined || v === null) { + // Ignore falsy values + continue; + } + + if (typeof(v) === "number") { // We were given a single byte - const byte = v; - Guards.byte(byte, "Byte values"); - result.data[currentPosition] = byte; + Guards.byte(v, "Byte values"); + result._bytes[currentPosition] = v; currentPosition += 1; } else { // We were given an array of bytes - const vector = v; - for (let i = 0; i < vector.length; i++) { - result.data[currentPosition + i] = ( vector).get - ? ( vector).get(i) - : ( vector)[i]; + const getter = v instanceof ByteVector + ? (i: number) => v.get(i) + : (i: number) => v[i]; + + for (let i = 0; i < v.length; i++) { + result._bytes[currentPosition + i] = getter(i); } - currentPosition += vector.length; + currentPosition += v.length; } } @@ -214,105 +282,97 @@ export class ByteVector { * Creates an empty {@link ByteVector} */ public static empty(): ByteVector { - return this.fromSize(0); + return new ByteVector(new Uint8Array(0)); + } + + /** + * Creates a {@link ByteVector} from a base64 string. + * @param str Base64 string to convert into a byte vector + */ + public static fromBase64String(str: string): ByteVector { + Guards.notNullOrUndefined(str, "str"); + + const bytes = Buffer.from(str, "base64"); + return new ByteVector(bytes); } /** - * Creates a {@link ByteVector} from a `Uint8Array` or node `Buffer` - * @param data Uint8Array of the bytes to put in the ByteVector - * @param length Number of bytes to read - * @param isReadOnly If `true` then the ByteVector will be read only + * Creates a {@link ByteVector} from a `Uint8Array` or `Buffer` + * @param bytes Uint8Array of the bytes to put in the ByteVector + * @param length Optionally, number of bytes to read. If this is not provided, it will default + * to the full length of `bytes`. If it is less than the length of `bytes`, `bytes` will be + * copied into the {@see ByteVector}. */ public static fromByteArray( - data: Uint8Array | Buffer, - length: number = data.length, - isReadOnly: boolean = false + bytes: Uint8Array | Buffer | number[], + length: number = bytes.length ): ByteVector { - Guards.truthy(data, "data"); - Guards.uint(length, "length"); - if (length > data.length) { + Guards.truthy(bytes, "bytes"); + Guards.safeUint(length, "length"); + if (length > bytes.length) { throw new Error("Argument out of range: length must be less than or equal to the length of the byte array"); } - const vector = new ByteVector(); - vector._data = new Uint8Array(length); - vector._data.set(data.slice(0, length)); - vector._isReadOnly = isReadOnly; - return vector; - } + if (!(bytes instanceof Uint8Array || bytes instanceof Buffer)) { + bytes = new Uint8Array(bytes); + } - /** - * Creates a {@link ByteVector} as a copy of another ByteVector. - * @param original Data from this ByteVector will be copied into the new one - * @param isReadOnly If `true` then the ByteVector will be read only - */ - public static fromByteVector(original: ByteVector, isReadOnly: boolean = false): ByteVector { - if (!original) { - throw new Error("Argument null exception: original was not provided"); + if (length < bytes.length) { + bytes = new Uint8Array(bytes.subarray(0, length)); } - return ByteVector.fromByteArray(original._data, original.length, isReadOnly); + return new ByteVector(bytes); } /** * Creates a new instance by reading in the contents of a specified file abstraction. * @param abstraction File abstraction to read - * @param isReadOnly Whether or not the resulting ByteVector is readonly */ - public static fromFileAbstraction(abstraction: IFileAbstraction, isReadOnly: boolean = false): ByteVector { + public static fromFileAbstraction(abstraction: IFileAbstraction): ByteVector { Guards.truthy(abstraction, "abstraction"); const stream = abstraction.readStream; - const output = this.fromInternalStream(stream, isReadOnly); + const output = this.fromInternalStream(stream); abstraction.closeStream(stream); return output; } /** * Creates a 4 byte {@link ByteVector} with a signed 32-bit integer as the data - * @param value Signed 32-bit integer to use as the data. Must be a safe integer, storable in 4 - * bytes, cannot be a floating point number. - * @param mostSignificantByteFirst If `true`, `value` will be stored in big endian - * format. If `false`, `value` will be stored in little endian format - * @param isReadOnly If `true` then the ByteVector will be read only - */ - public static fromInt( - value: number, - mostSignificantByteFirst: boolean = true, - isReadOnly: boolean = false - ): ByteVector { + * @param value Signed 32-bit integer to use as the data. + * @param isBigEndian If `true`, `value` will be stored in big endian format. If `false`, + * `value` will be stored in little endian format + */ + public static fromInt(value: number, isBigEndian: boolean = true): ByteVector { Guards.int(value, "value"); const bytes = new Uint8Array(4); const dv = new DataView(bytes.buffer); - dv.setInt32(0, value, !mostSignificantByteFirst); - return ByteVector.fromByteArray(bytes, bytes.length, isReadOnly); + dv.setInt32(0, value, !isBigEndian); + + return new ByteVector(bytes); } /** * Creates a ByteVector using the contents of an TagLibSharp-node stream as the contents. This * method reads from the current offset of the stream, not the beginning of the stream * @param stream TagLibSharp-node internal stream object - * @param isReadOnly Whether or not the byte vector is readonly */ - public static fromInternalStream(stream: IStream, isReadOnly: boolean = false): ByteVector { + public static fromInternalStream(stream: IStream): ByteVector { + // @TODO: Validate how much memory is used vs doing a concatenate Guards.truthy(stream, "stream"); const vector = ByteVector.empty(); const bytes = new Uint8Array(4096); - let totalBytesRead = 0; - while (true) { const bytesRead = stream.read(bytes, 0, bytes.length); - vector.addByteArray(bytes); - totalBytesRead += bytesRead; - if (bytesRead < bytes.length) { - vector.resize(totalBytesRead); + vector.addByteArray(bytes, bytesRead); break; + } else { + vector.addByteArray(bytes); } } - vector._isReadOnly = isReadOnly; return vector; } @@ -320,15 +380,10 @@ export class ByteVector { * Creates an 8 byte {@link ByteVector} with a signed 64-bit integer as the data * @param value Signed 64-bit integer to use as the data. If using a `bigint`, it must fit * within 8 bytes. If using a `number`, it must be a safe integer. - * @param mostSignificantByteFirst If `true`, `value` will be stored in big endian - * format. If `false`, `value` will be stored in little endian format - * @param isReadOnly If `true` then the ByteVector will be read only - */ - public static fromLong( - value: bigint | number, - mostSignificantByteFirst: boolean = true, - isReadOnly: boolean = false - ): ByteVector { + * @param isBigEndian If `true`, `value` will be stored in big endian format. If `false`, + * `value` will be stored in little endian format + */ + public static fromLong(value: bigint | number, isBigEndian: boolean = true): ByteVector { let bigIntValue: bigint; if (typeof(value) === "number") { Guards.safeInt(value, "value"); @@ -340,85 +395,67 @@ export class ByteVector { const bytes = new Uint8Array(8); const dv = new DataView(bytes.buffer); - dv.setBigInt64(0, bigIntValue, !mostSignificantByteFirst); - return ByteVector.fromByteArray(bytes, bytes.length, isReadOnly); + dv.setBigInt64(0, bigIntValue, !isBigEndian); + + return new ByteVector(bytes); } /** * Creates a {@link ByteVector} using the contents of a file as the data * @param path Path to the file to store in the ByteVector - * @param isReadOnly If `true` then the ByteVector will be read only */ - public static fromPath(path: string, isReadOnly: boolean = false): ByteVector { - if (!path) { - throw new Error("Argument null exception: Path was not provided"); - } + public static fromPath(path: string): ByteVector { + Guards.truthy(path, "path"); // NOTE: We are doing this with read file b/c it removes the headache of working with streams + // @TODO: Add support for async file reading const fileBuffer = fs.readFileSync(path); - return ByteVector.fromByteArray(fileBuffer, fileBuffer.length, isReadOnly); + return ByteVector.fromByteArray(fileBuffer); } /** * Creates a 2 byte {@link ByteVector} with a signed 16-bit integer as the data - * @param value Signed 16-bit integer to use as the data. Must be a safe integer, storable in 2 - * bytes, cannot be a floating point number. - * @param mostSignificantByteFirst If `true`, `value` will be stored in big endian - * format. If `false`, `value` will be stored in little endian format - * @param isReadOnly If `true` then the ByteVector will be read only - */ - public static fromShort( - value: number, - mostSignificantByteFirst: boolean = true, - isReadOnly: boolean = false - ): ByteVector { + * @param value Signed 16-bit integer to use as the data. + * @param isBigEndian If `true`, `value` will be stored in big endian format. If `false`, + * `value` will be stored in little endian format + */ + public static fromShort(value: number, isBigEndian: boolean = true): ByteVector { Guards.short(value, "value"); const bytes = new Uint8Array(2); const dv = new DataView(bytes.buffer); - dv.setInt16(0, value, !mostSignificantByteFirst); - return ByteVector.fromByteArray(bytes, bytes.length, isReadOnly); + dv.setInt16(0, value, !isBigEndian); + + return new ByteVector(bytes); } /** * Creates a {@link ByteVector} of a given length with a given value for all the elements - * @param size Length of the ByteVector. Must be a positive safe integer, cannot be a float - * @param fill Byte value to initialize all elements to. Must be a positive 8-bit integer, - * cannot be floating point - * @param isReadOnly If `true` then the ByteVector will be read only - */ - public static fromSize( - size: number, - fill: number = 0x0, - isReadOnly: boolean = false - ): ByteVector { + * @param size Length of the ByteVector. Must be a positive safe integer + * @param fill Byte value to initialize all elements to. Must be a positive 8-bit integer + */ + public static fromSize(size: number, fill: number = 0x0): ByteVector { Guards.safeUint(size, "size"); Guards.byte(fill, "fill"); - const vector = new ByteVector(); - vector._data = new Uint8Array(size); - vector._data.fill(fill); - - vector._isReadOnly = isReadOnly; - - return vector; + const bytes = new Uint8Array(size); + bytes.fill(fill); + return new ByteVector(bytes); } /** * Creates {@link ByteVector} with the contents of a stream as the data. The stream will be read * to the end before the ByteVector is returned. * @param readStream Readable stream that will be read in entirety. - * @param isReadOnly If `true` then the ByteVector will be read only */ - public static fromStream(readStream: NodeJS.ReadableStream, isReadOnly: boolean = false): Promise { + public static fromStream(readStream: NodeJS.ReadableStream): Promise { return new Promise((complete, fail) => { if (!readStream) { - fail(new Error("Null argument exception: Stream was not provided")); + fail(new Error("Null argument exception: Stream was not provided")); } // Setup the output - const output = new ByteVector(); - output._data = new Uint8Array(0); + const output = ByteVector.empty(); // Setup the events to read the stream readStream.on("readable", () => { @@ -428,9 +465,11 @@ export class ByteVector { } }); readStream.on("end", () => { - output._isReadOnly = isReadOnly; complete(output); }); + readStream.on("error", (error: Error) => { + fail(error); + }); }); } @@ -441,79 +480,64 @@ export class ByteVector { * string will be encoded as UTF16-LE. * @param length Number of characters from the string to store in the ByteVector. Must be a * positive 32-bit integer. - * @param isReadOnly If `true` then the ByteVector will be read only */ public static fromString( text: string, - type: StringType = StringType.UTF8, - length: number = Number.MAX_SAFE_INTEGER, - isReadOnly: boolean = false + type: StringType, + length: number = Number.MAX_SAFE_INTEGER ): ByteVector { + // @TODO: Allow adding delimiters and find usages that immediately add a delimiter Guards.notNullOrUndefined(text, "text"); if (!Number.isInteger(length) || !Number.isSafeInteger(length) || length < 0) { throw new Error("Argument out of range exception: length is invalid"); } - const vector = new ByteVector(); - vector._data = new Uint8Array(0); - // If we're doing UTF16 w/o specifying an endian-ness, inject a BOM which also coerces // the converter to use UTF16LE - if (type === StringType.UTF16) { - vector.addByteArray(new Uint8Array([0xff, 0xfe])); - } + const vector = type === StringType.UTF16 + ? new ByteVector(new Uint8Array([0xff, 0xfe])) + : ByteVector.empty(); // NOTE: This mirrors the behavior from the original .NET implementation where empty // strings return an empty ByteVector (possibly with UTF16LE BOM) if (!text) { - vector._isReadOnly = isReadOnly; return vector; } + // Shorten text if only part of it was requested if (text.length > length) { - text = text.substr(0, length); + text = text.substring(0, length); } - const textBytes = ByteVector.getIConvEncoding(type, vector).encode(text); - vector.addByteArray(textBytes); - vector._isReadOnly = isReadOnly; + // Encode the string into bytes + const textBytes = Encoding.getEncoding(type, vector).encode(text); + vector.addByteArray(textBytes); return vector; } /** * Creates a 4 byte {@link ByteVector} with a positive 32-bit integer as the data - * @param value Positive 32-bit integer to use as the data. Must be a positive safe integer, - * storable in 4 bytes, cannot be a floating point number. - * @param mostSignificantByteFirst If `true`, `value` will be stored in big endian - * format. If `false`, `value` will be stored in little endian format - * @param isReadOnly If `true` then the ByteVector will be read only - */ - public static fromUInt( - value: number, - mostSignificantByteFirst: boolean = true, - isReadOnly: boolean = false - ): ByteVector { + * @param value Positive 32-bit integer to use as the data + * @param isBigEndian If `true`, `value` will be stored in big endian format. If `false`, + * `value` will be stored in little endian format + */ + public static fromUint(value: number, isBigEndian: boolean = true): ByteVector { Guards.uint(value, "value"); const bytes = new Uint8Array(4); const dv = new DataView(bytes.buffer); - dv.setUint32(0, value, !mostSignificantByteFirst); - return ByteVector.fromByteArray(bytes, bytes.length, isReadOnly); + dv.setUint32(0, value, !isBigEndian); + return new ByteVector(bytes); } /** * Creates an 8 byte {@link ByteVector} with a positive 64-bit integer as the data * @param value Positive 64-bit integer to use as the data. If using a `bigint` it must fit - * within 8 bytes. If using a `number` it must be a safe, positive integer. - * @param mostSignificantByteFirst If `true`, `value` will be stored in big endian - * format. If `false`, `value` will be stored in little endian format - * @param isReadOnly If `true` then the ByteVector will be read only - */ - public static fromULong( - value: bigint | number, - mostSignificantByteFirst: boolean = true, - isReadOnly: boolean = false - ): ByteVector { + * within 8 bytes. + * @param isBigEndian If `true`, `value` will be stored in big endian format. If `false`, + * `value` will be stored in little endian format + */ + public static fromUlong(value: bigint | number, isBigEndian: boolean = true): ByteVector { let bigIntValue: bigint; if (typeof(value) === "number") { Guards.safeUint(value, "value"); @@ -525,113 +549,167 @@ export class ByteVector { const bytes = new Uint8Array(8); const dv = new DataView(bytes.buffer); - dv.setBigUint64(0, bigIntValue, !mostSignificantByteFirst); - return ByteVector.fromByteArray(bytes, bytes.length, isReadOnly); + dv.setBigUint64(0, bigIntValue, !isBigEndian); + return new ByteVector(bytes); } /** - * Creates a 2 byte {@link ByteVector} with a positive 32-bit integer as the data - * @param value Positive 16-bit integer to use as the data. Must be a positive safe integer, - * storable in 2 bytes, cannot be a floating point number. - * @param mostSignificantByteFirst If `true`, `value` will be stored in big endian - * format. If `false`, `value` will be stored in little endian format - * @param isReadOnly If `true` then the ByteVector will be read only + * Creates a 2 byte {@link ByteVector} with a positive 16-bit integer as the data + * @param value Positive 16-bit integer to use as the data. + * @param isBigEndian If `true`, `value` will be stored in big endian format. If `false`, + * `value` will be stored in little endian format */ - public static fromUShort( - value: number, - mostSignificantByteFirst: boolean = true, - isReadOnly: boolean = false - ): ByteVector { + public static fromUshort(value: number, isBigEndian: boolean = true): ByteVector { Guards.ushort(value, "value"); const bytes = new Uint8Array(2); const dv = new DataView(bytes.buffer); - dv.setUint16(0, value, !mostSignificantByteFirst); - return ByteVector.fromByteArray(bytes, bytes.length, isReadOnly); + dv.setUint16(0, value, !isBigEndian); + return new ByteVector(bytes); } // #endregion // #region Properties - public static get lastUtf16Encoding(): string { return ByteVector._lastUtf16IConvFunc.encoding; } - public static set lastUtf16Encoding(encoding: string) { - ByteVector._lastUtf16IConvFunc = new IConvEncoding(encoding); - } - + /** + * Calculates the CRC32 of the current instance. + */ public get checksum(): number { let sum = 0; - for (const b of this._data) { - sum = (sum << 8) ^ ByteVector._crcTable[((sum >> 24) & 0xFF) ^ b]; + for (const b of this._bytes) { + const index = NumberUtils.uintXor(NumberUtils.uintAnd(NumberUtils.uintRShift(sum, 24), 0xFF), b); + sum = NumberUtils.uintXor(NumberUtils.uintLShift(sum, 8), ByteVector.CRC_TABLE[index]); } return sum; } /** - * Array of bytes currently stored in the current instance + * Whether the current instance has 0 bytes stored. */ - public get data(): Uint8Array { return this._data; } + public get isEmpty(): boolean { return this._bytes?.length === 0; } - public get hashCode(): number { return this.checksum; } + /** + * Whether the current instance is read-only. If `true`, any call that will modify the instance + * will throw. + */ + public get isReadOnly(): boolean { return this._isReadOnly; } /** - * Whether or not the current instance has 0 bytes stored + * Whether the current instance is a 'view' of another byte vector. */ - public get isEmpty(): boolean { return !this._data || this._data.length === 0; } + public get isView(): boolean { + return this._bytes.byteOffset !== 0 && this._bytes.byteLength !== this._bytes.buffer.byteLength; + } /** - * Whether or not the current instance is readonly. + * Number of bytes currently in this instance. */ - public get isReadOnly(): boolean { return this._isReadOnly; } + public get length(): number { return this._bytes.length; } + + // #endregion + + // #region Static Methods /** - * Number of bytes currently in this ByteVector + * Gets the appropriate length null-byte text delimiter for the specified `type`. + * @param type String type to get delimiter for */ - public get length(): number { return this._data.length; } + public static getTextDelimiter(type: StringType): ByteVector { + return type === StringType.UTF16 || type === StringType.UTF16BE || type === StringType.UTF16LE + ? ByteVector.TD2 + : ByteVector.TD1; + } + + /** + * Compares two byte vectors. Returns a numeric value + * @param a Byte vector to compare against `b` + * @param b Byte vector to compare against `a` + * @returns number `0` if the two vectors are the same. Any other value indicates the two are + * different. If the two vectors differ by length, this will be the length of `a` minus the + * length of `b`. If the lengths are the same it will be the difference between the first + * element that differs. + */ + public static compare(a: ByteVector, b: ByteVector): number { + Guards.truthy(a, "a"); + Guards.truthy(b, "b"); + + let diff = a.length - b.length; + for (let i = 0; diff === 0 && i < a.length; i++) { + diff = a.get(i) - b.get(i); + } + + return diff; + } + + /** + * Returns `true` if the contents of the two {@link ByteVector}s are identical, returns `false` + * otherwise + * @param first ByteVector to compare with `second` + * @param second ByteVector to compare with `first` + */ + public static equals(first: ByteVector, second: ByteVector): boolean { + const fNull = !first; + const sNull = !second; + if (fNull && sNull) { + // Since (f|s)null could be true with `undefined` OR `null`, we'll just let === decide it for us + return first === second; + } + + if (fNull || sNull) { + // If only one is null/undefined, then they are not equal + return false; + } + + return ByteVector.compare(first, second) === 0; + } // #endregion // #region Public Methods + /** + * Gets iterator for iterating over bytes in the current instance. + */ public *[Symbol.iterator](): Iterator { - for (const b of this._data) { + for (const b of this._bytes) { yield b; } } - public static getTextDelimiter(type: StringType): ByteVector { - return type === StringType.UTF16 || type === StringType.UTF16BE || type === StringType.UTF16LE - ? ByteVector._td2 - : ByteVector._td1; - } - /** - * Adds a single byte to the end of the {@link ByteVector} + * Adds a single byte to the end of the current instance * @param byte Value to add to the end of the ByteVector. Must be positive 8-bit integer. */ public addByte(byte: number): void { - this.throwIfReadOnly(); Guards.byte(byte, "byte"); + this.throwIfReadOnly(); this.addByteArray(new Uint8Array([byte])); } /** - * Adds an array of bytes to the end of the {@link ByteVector} + * Adds an array of bytes to the end of the current instance * @param data Array of bytes to add to the end of the ByteVector + * @param length Number of elements from `data` to copy into the current instance */ - public addByteArray(data: Uint8Array): void { - this.throwIfReadOnly(); + public addByteArray(data: Uint8Array, length?: number): void { Guards.truthy(data, "data"); + this.throwIfReadOnly(); - if (data.length === 0) { + if (data.length === 0 || length === 0) { return; } - const oldData = this._data; - this._data = new Uint8Array(oldData.length + data.length); - this._data.set(oldData); - this._data.set(data, oldData.length); + // Create a copy of the existing byte array with additional space at the end for the new + // byte array. Copy the new array into it. + length = length || data.length; + const oldData = this._bytes; + const newData = length !== data.length ? data.subarray(0, length) : data; + + this._bytes = new Uint8Array(oldData.length + length); + this._bytes.set(oldData); + this._bytes.set(newData, oldData.length); } /** @@ -639,20 +717,19 @@ export class ByteVector { * @param data ByteVector to add to the end of this ByteVector */ public addByteVector(data: ByteVector): void { - this.throwIfReadOnly(); Guards.truthy(data, "data"); + this.throwIfReadOnly(); - this.addByteArray(data._data); + this.addByteArray(data._bytes); } /** * Removes all elements from this {@link ByteVector} - * @remarks NOTE: This method replaces the internal byte array with a new one. Any - * existing references to {@link ByteVector.data} will remain unchanged. + * @remarks This method replaces the internal byte array with a new one. */ public clear(): void { this.throwIfReadOnly(); - this._data = new Uint8Array(0); + this._bytes = new Uint8Array(0); } /** @@ -660,36 +737,19 @@ export class ByteVector { * @param pattern ByteVector to search for at in this byte vector * @param offset Position in this byte vector to search for the pattern. If omitted, defaults * to `0` - * @param patternOffset Position in `pattern` to begin matching. If omitted, defaults - * to `0` - * @param patternLength Bytes of `pattern` to match. If omitted, defaults to all bytes - * in the pattern minus the offset - */ - public containsAt( - pattern: ByteVector, - offset: number = 0, - patternOffset: number = 0, - patternLength: number = pattern.length - patternOffset - ): boolean { + */ + public containsAt(pattern: ByteVector, offset: number = 0): boolean { Guards.truthy(pattern, "pattern"); - Guards.int(offset, "offset"); - Guards.int(patternOffset, "patternOffset"); - Guards.int(patternLength, "patternLength"); - - // Do some sanity checking -- all of these things are needed for the search to be valid - if ( - patternLength > this.length || - offset >= this.length || - patternOffset >= pattern.length || - patternLength <= 0 || - offset < 0 - ) { + Guards.safeInt(offset, "offset"); + + // Sanity check - make sure we're within the range of the comprehension + if (offset < 0 || offset >= this.length || pattern.length === 0) { return false; } - // Loop through looking for a mismatch - for (let i = 0; i < patternLength - patternOffset; i++) { - if (this._data[i + offset] !== pattern._data[i + patternOffset]) { + // Look through looking for a mismatch + for (let i = 0; i < pattern.length; i++) { + if (this._bytes[offset + i] !== pattern.get(i)) { return false; } } @@ -698,49 +758,41 @@ export class ByteVector { } /** - * Compares this byte vector to a different byte vector. Returns a numeric value - * @param other ByteVector to compare to this byte vector + * Compares the current instance to another byte vector. Returns a numeric result. + * @param other Other byte vector to compare against the current instance. */ public compareTo(other: ByteVector): number { - Guards.truthy(other, "other"); - - let diff = this.length - other.length; - - for (let i = 0; diff === 0 && i < this.length; i++) { - diff = this.get(i) - other.get(i); - } - - return diff; + return ByteVector.compare(this, other); } /** - * Determines whether or not this byte vector ends with the provided `pattern`. + * Determines whether this byte vector ends with the provided `pattern`. * @param pattern ByteVector to look for at the end of this byte vector */ public endsWith(pattern: ByteVector): boolean { - Guards.truthy(pattern, "pattern"); return this.containsAt(pattern, this.length - pattern.length); } /** - * Determines whether or not this byte vector ends with a part of the `pattern`. - * NOTE: if this byte vector ends with `pattern` perfectly, it must end with n-1 or - * less bytes + * Determines whether this byte vector ends with a part of the `pattern`. + * NOTE: if this instance ends with `pattern` perfectly, it must end with n-1 or + * fewer bytes. * @param pattern ByteVector to look for at the end of this byte vector */ public endsWithPartialMatch(pattern: ByteVector): number { Guards.truthy(pattern, "pattern"); + // Short circuit impossible calls if (pattern.length > this.length) { return -1; } + // Try to match the last n-1 bytes of the source (where n is the pattern length), if that + // fails, try to match n-2, n-3... until there are no more to try. const startIndex = this.length - pattern.length; - - // Try to match the last n-1bytes from the vector (where n is the pattern size) - // continue trying to match n-2, n-3...1 bytes - for (let i = 1; i < pattern.length; i++) { - if (this.containsAt(pattern, startIndex + i, 0, pattern.length - i)) { + for (let i = 0; i < pattern.length; i++) { + const patternSubset = pattern.subarray(0, pattern.length - i); + if (this.containsAt(patternSubset, startIndex + i)) { return startIndex + i; } } @@ -748,6 +800,14 @@ export class ByteVector { return -1; } + /** + * Determines if this instance has identical contents to the `other` instance. + * @param other Other instance to compare against the current instance. + */ + public equals(other: ByteVector): boolean { + return ByteVector.equals(this, other); + } + /** * Searches this instance for the `pattern`. Returns the index of the first instance * of the pattern, or `-1` if it was not found. Providing a `byteAlign` requires the @@ -756,49 +816,30 @@ export class ByteVector { * "ab" with byteAlign 2 will return 1. Searching "00ab" for "ab" with byteAlign 2 will return * 2. Searching "0abc" with byteAlign 2 will return -1. * @param pattern Pattern of bytes to search this instance for - * @param offset Optional, offset into this instance to start searching * @param byteAlign Optional, byte alignment the pattern much align to */ - public find(pattern: ByteVector, offset: number = 0, byteAlign: number = 1): number { + public find(pattern: ByteVector, byteAlign: number = 1): number { Guards.truthy(pattern, "pattern"); - Guards.uint(offset, "offset"); Guards.uint(byteAlign, "byteAlign"); Guards.greaterThanInclusive(byteAlign, 1, "byteAlign"); - if (pattern.length > this.length - offset) { + // Sanity check impossible matches + if (this.length === 0 || pattern.length === 0 || pattern.length > this.length) { return -1; } - // Let's go ahead and special case a pattern of size one since that' common and easy to make fast - if (pattern.length === 1) { - const p = pattern._data[0]; - for (let i = offset; i < this.length; i += byteAlign) { - if (this._data[i] === p) { - return i; + for (let i = 0; i < this.length; i += byteAlign) { + let j = 0; + while (j < pattern.length) { + if (this._bytes[i + j] !== pattern.get(j)) { + break; } - } - return -1; - } - - // Non-special cases - const lastOccurrence = new Int32Array(256); - lastOccurrence.fill(pattern.length); - for (let i = 0; i < pattern.length - 1; ++i) { - lastOccurrence[pattern._data[i]] = pattern.length - i - 1; - } - - for (let i = pattern.length - 1 + offset; i < this.length; i += lastOccurrence[this._data[i]]) { - let iBuffer = i; - let iPattern = pattern.length - 1; - - while (iPattern >= 0 && this._data[iBuffer] === pattern._data[iPattern]) { - --iBuffer; - --iPattern; + j++; } - if (iPattern === -1 && (iBuffer + 1 - offset) % byteAlign === 0) { - return iBuffer + 1; + if (j === pattern.length ) { + return i; } } @@ -806,13 +847,13 @@ export class ByteVector { } /** - * Gets the byte at the given `index` - * @param index Index into the byte vector to return + * Gets the byte at the given `index`. + * @param index Element index to return */ public get(index: number): number { Guards.uint(index, "index"); Guards.lessThanInclusive(index, this.length - 1, "index"); - return this._data[index]; + return this._bytes[index]; } /** @@ -822,135 +863,32 @@ export class ByteVector { * was not found/ */ public indexOf(item: number): number { - return this._data.indexOf(item); - } - - /** - * Inserts a single byte at the given index of this {@link ByteVector}, increasing the length of - * the ByteVector by one. - * @param index Index into this ByteVector at which the value will be inserted. - * @param byte Value to insert into the ByteVector. Must be a positive integer <=0xFF - */ - public insertByte(index: number, byte: number): void { - this.throwIfReadOnly(); - Guards.uint(index, "index"); - Guards.lessThanInclusive(index, this.length, "index"); - Guards.byte(byte, "byte"); - - const oldData = this._data; - this._data = new Uint8Array(oldData.length + 1); - - if (index > 0) { - this._data.set(oldData.subarray(0, index), 0); - } - this._data[index] = byte; - if (index < oldData.length) { - this._data.set(oldData.subarray(index), index + 1); - } - } - - /** - * Inserts an array of bytes into this {@link ByteVector} at the given index, increasing the - * length of this ByteVector by the length of the byte array. - * @param index Index into this ByteVector at which the bytes will be inserted. - * @param other Array of bytes to insert into the ByteVector. - */ - public insertByteArray(index: number, other: Uint8Array): void { - this.throwIfReadOnly(); - Guards.uint(index, "index"); - Guards.lessThanInclusive(index, this.length, "index"); - Guards.truthy(other, "other"); - - if (other.length === 0 ) { - return; - } - - const oldData = this._data; - this._data = new Uint8Array(oldData.length + other.length); - - if (index > 0) { - this._data.set(oldData.subarray(0, index), 0); - } - this._data.set(other, index); - if (index < oldData.length) { - this._data.set(oldData.subarray(index), index + other.length); - } - } - - /** - * Inserts another ByteVector into this {@link ByteVector} at the given index, increasing the - * length of this ByteVector by the length of the ByteVector. - * @param index Index into this ByteVector at which the ByteVector will be inserted. - * @param other ByteVector to insert into this ByteVector. - */ - public insertByteVector(index: number, other: ByteVector): void { - Guards.truthy(other, "other"); - this.insertByteArray(index, other._data); + return this._bytes.indexOf(item); } /** - * Returns a subarray of the current instance. This operation returns a new instance and does - * not alter the current instance. - * @param startIndex Index into the array to begin - * @param length Number of elements from the array to include. If omitted, defaults to the - * remainder of the array + * Makes the current instance read-only, causing any call that would modify it or allow it to + * be modified to throw. */ - public mid(startIndex: number, length: number = this._data.length - startIndex): ByteVector { - Guards.uint(startIndex, "startIndex"); - Guards.uint(length, "length"); - - if (length === 0) { - return ByteVector.fromSize(0); - } - - Guards.lessThanInclusive(startIndex, this.length - 1, "startIndex"); - Guards.lessThanInclusive(length, this.length - startIndex, "length"); - - return ByteVector.fromByteArray(this._data.subarray(startIndex, startIndex + length)); - } - - /** - * Removes a single byte from this {@ByteVector} - * @param index Index that will be removed from the ByteVector - */ - public removeAtIndex(index: number) { - this.throwIfReadOnly(); - Guards.uint(index, "index"); - Guards.lessThanInclusive(index, this.length - 1, "index"); - - const oldData = this._data; - this._data = new Uint8Array(oldData.length - 1); - if (index > 0) { - this._data.set(oldData.subarray(0, index), 0); - } - if (index < oldData.length) { - this._data.set(oldData.subarray(index + 1), index); - } + public makeReadOnly(): this { + this._isReadOnly = true; + return this; } /** - * Removes a range of bytes from this {@ByteVector} - * @param index Index into this ByteVector where the range to remove begins - * @param count Number of bytes to remove from this ByteVector + * Searches this instance for the `pattern` occurring after a given offset. Returns the index + * of the first instance of the pattern, relative to the start of the array, or `-1` if it was + * not found. Providing a `byteAlign` requires the pattern to appear at an index that is a + * multiple of the byteAlign parameter. Example: searching "abcd" for "ab" with byteAlign 1 + * will return 0. Searching "abcd" for "ab" with byteAlign 2 will return 1. Searching "00ab" + * for "ab" with byteAlign 2 will return 2. Searching "0abc" with byteAlign 2 will return -1. + * @param pattern Pattern of bytes to search this instance for + * @param offset Index into the instance to begin searching for `pattern` + * @param byteAlign Optional, byte alignment the pattern much align to */ - public removeRange(index: number, count: number) { - this.throwIfReadOnly(); - Guards.uint(index, "index"); - Guards.lessThanInclusive(index, this.length - 1, "index"); - Guards.uint(count, "count"); - - if (index + count > this.length) { - count = this.length - index; - } - - const oldData = this._data; - this._data = new Uint8Array(oldData.length - count); - if (index > 0) { - this._data.set(oldData.subarray(0, index), 0); - } - if (index < oldData.length) { - this._data.set(oldData.subarray(index + count), index); - } + public offsetFind(pattern: ByteVector, offset: number, byteAlign?: number): number { + const findIndex = this.subarray(offset).find(pattern, byteAlign); + return findIndex >= 0 ? findIndex + offset : findIndex; } /** @@ -961,22 +899,22 @@ export class ByteVector { * @param size Length of the byte vector after resizing. Must be unsigned 32-bit integer * @param padding Byte to fill any excess space created after resizing */ - public resize(size: number, padding: number = 0x0): ByteVector { - this.throwIfReadOnly(); + public resize(size: number, padding: number = 0x0): void { Guards.uint(size, "size"); Guards.byte(padding, "padding"); - if (this.length > size) { - this.removeRange(size, this.length - size); + const oldData = this._bytes; + if (size < this.length) { + // Shorten it + this._bytes = new Uint8Array(size); + this._bytes.set(oldData.subarray(0, size)); } else if (this.length < size) { - const oldData = this._data; - this._data = new Uint8Array(size); - this._data.set(oldData); - this._data.fill(padding, oldData.length); + // Lengthen it + this._bytes = new Uint8Array(size); + this._bytes.set(oldData); + this._bytes.fill(padding, oldData.length); } // Do nothing on same size - - return this; } /** @@ -988,39 +926,30 @@ export class ByteVector { * "ab" with byteAlign 2 will return 1. Searching "00ab" for "ab" with byteAlign 2 will return * 2. Searching "0abc" with byteAlign 2 will return -1. * @param pattern Pattern of bytes to search this instance for - * @param offset Optional, offset into this instance to start searching - * @param byteAlign Optional, byte alignment the pattern much align to + * @param byteAlign Optional, byte alignment the pattern must align to */ - public rFind(pattern: ByteVector, offset: number = 0, byteAlign: number = 1): number { + public rFind(pattern: ByteVector, byteAlign: number = 1): number { Guards.truthy(pattern, "pattern"); - Guards.uint(offset, "offset"); Guards.uint(byteAlign, "byteAlign"); Guards.greaterThanInclusive(byteAlign, 1, "byteAlign"); - if (pattern.length === 0 || pattern.length > this.length - offset) { + // Sanity check impossible matches + if (pattern.length === 0 || pattern.length > this.length) { return -1; } - // Let's go ahead and special case a pattern of size one since that' common and easy to make fast - if (pattern.length === 1) { - const p = pattern._data[0]; - for (let i = this.length - offset - 1; i >= 0; i -= byteAlign) { - if (this._data[i] === p) { - return i; + const alignOffset = this.length % byteAlign; + for (let i = this.length - alignOffset - pattern.length; i >= 0; i -= byteAlign) { + let j = 0; + while (j < pattern.length) { + if (this._bytes[i + j] !== pattern.get(j)) { + break; } - } - } - - // Non-special cases - const firstOccurrence = new Int32Array(256); - firstOccurrence.fill(pattern.length); - for (let i = pattern.length - 1; i > 0; --i) { - firstOccurrence[pattern.get(i)] = i; - } + j++; + } - for (let i = this.length - offset - pattern.length; i >= 0; i -= firstOccurrence[this.get(i)]) { - if ((offset - i) % byteAlign === 0 && this.containsAt(pattern, i)) { + if (j === pattern.length) { return i; } } @@ -1034,11 +963,42 @@ export class ByteVector { * @param value Value to set at the index. Must be a valid integer betweenInclusive 0x0 and 0xff */ public set(index: number, value: number): void { - this.throwIfReadOnly(); Guards.uint(index, "index"); - Guards.lessThanInclusive(index, this.length, "index"); + Guards.lessThanInclusive(index, this.length - 1, "index"); Guards.byte(value, "value"); - this._data[index] = value; + + this.splice(index, 1, [value]); + } + + /** + * Changes the contents of the current instance by removing or replacing existing elements + * and/or adding new elements. + * @param start Index at which to start changing the array. Must be less than the length of + * the instance + * @param deleteCount Number of elements in the array to remove from start. If greater than + * the remaining length of the element, it will be capped at the remaining length + * @param items Elements to add to the array beginning from start. If omitted, the method will + * only remove elements from the current instance. + */ + public splice(start: number, deleteCount: number, items?: ByteVector|Uint8Array|number[]): void { + Guards.safeUint(start, "start"); + Guards.lessThanInclusive(start, this.length, "start"); + Guards.safeUint(deleteCount, "deleteCount"); + this.throwIfReadOnly(); + + // Determine how many elements we're *actually* deleting + deleteCount = Math.min(deleteCount, this.length - start); + + const addCount = items ? items.length : 0; + const newBytes = new Uint8Array(this._bytes.length - deleteCount + addCount); + newBytes.set(this._bytes.subarray(0, start)); + if (items) { + items = items instanceof ByteVector ? items._bytes : items; + newBytes.set(items, start); + } + newBytes.set(this._bytes.subarray(start + deleteCount), start + addCount); + + this._bytes = newBytes; } /** @@ -1052,28 +1012,39 @@ export class ByteVector { * @returns ByteVector[] The split contents of the current instance */ public split(separator: ByteVector, byteAlign: number = 1, max: number = 0): ByteVector[] { - Guards.truthy(separator, "separator"); + Guards.truthy(separator, "pattern"); Guards.uint(byteAlign, "byteAlign"); Guards.greaterThanInclusive(byteAlign, 1, "byteAlign"); Guards.uint(max, "max"); - const list: ByteVector[] = []; - let previousOffset = 0; + const vectors = []; + const condition = (o: number): boolean => o !== -1 && (max < 1 || max > vectors.length + 1); + const increment = (o: number): number => this.offsetFind(separator, o + separator.length, byteAlign); - for ( - let offset = this.find(separator, 0, byteAlign); - offset !== -1 && (max < 1 || max > list.length + 1); - offset = this.find(separator, offset + separator.length, byteAlign) - ) { - list.push(this.mid(previousOffset, offset - previousOffset)); + let previousOffset = 0; + let offset = this.offsetFind(separator, 0, byteAlign); + for (offset; condition(offset); offset = increment(offset)) { + vectors.push(this.subarray(previousOffset, offset - previousOffset)); previousOffset = offset + separator.length; } if (previousOffset < this.length) { - list.push(this.mid(previousOffset, this.length - previousOffset)); + vectors.push(this.subarray(previousOffset)); } - return list; + return vectors; + } + + /** + * Returns a window over the current instance. + * @param startIndex Offset into this instance where the comprehension begins + * @param length Number of elements from the instance to include. If omitted, defaults to the + * remainder of the instance + */ + public subarray(startIndex: number, length: number = this._bytes.length - startIndex): ByteVector { + Guards.safeUint(startIndex, "startIndex"); + Guards.safeUint(length, "length"); + return new ByteVector(this._bytes.subarray(startIndex, startIndex + length)); } /** @@ -1082,13 +1053,41 @@ export class ByteVector { * @returns `true` if the pattern was found at the beginning of the current instance, `false` * otherwise. */ - public startsWith(pattern: ByteVector) { + public startsWith(pattern: ByteVector): boolean { return this.containsAt(pattern, 0); } - // #endregion + /** + * Returns the current instance as a base64 encoded string. + */ + public toBase64String(): string { + return Buffer.from(this._bytes.buffer, this._bytes.byteOffset, this._bytes.byteLength) + .toString("base64"); + } - // #region Conversions + /** + * Returns the bytes for the instance. Don't use it unless you need to. + * @internal + * @deprecated DON'T USE IT UNLESS YOU HAVE NO CHOICE. + */ + public toByteArray(): Uint8Array { + return this._bytes; + } + + /** + * Returns a writable copy of the bytes represented by this instance. + * @remarks This is a **copy** of the data. Use sparingly. + */ + public toByteVector(): ByteVector { + if (this.isView) { + const bytes = new Uint8Array(this._bytes); + return new ByteVector(bytes); + } + + // This is a concrete instance, return a new instance pointing to the existing bytes + // This is safe because the existing bytes will be copied on write + return new ByteVector(this._bytes); + } /** * Converts the first eight bytes of the current instance to a double-precision floating-point @@ -1103,9 +1102,8 @@ export class ByteVector { if (this.length < 8) { throw new Error("Invalid operation: Cannot convert a byte vector of <8 bytes to double"); } - const array = this.getSizedArray(8, mostSignificantByteFirst); - const dv = new DataView(array.buffer); - return dv.getFloat64(0); + const dv = new DataView(this._bytes.buffer, this._bytes.byteOffset, 8); + return dv.getFloat64(0, !mostSignificantByteFirst); } /** @@ -1117,12 +1115,8 @@ export class ByteVector { * @returns A float value containing the value read from the current instance. */ public toFloat(mostSignificantByteFirst: boolean = true): number { - // NOTE: This is the behavior from the .NET implementation, due to BitConverter behavior - if (this.length < 4) { - throw new Error("Invalid operation: Cannot convert a byte vector of <4 bytes to float"); - } - const dv = new DataView(this.getSizedArray(4, mostSignificantByteFirst).buffer); - return dv.getFloat32(0); + const dv = new DataView(this._bytes.buffer, this._bytes.byteOffset, 4); + return dv.getFloat32(0, !mostSignificantByteFirst); } /** @@ -1133,8 +1127,8 @@ export class ByteVector { * @returns A signed integer value containing the value read from the current instance */ public toInt(mostSignificantByteFirst: boolean = true): number { - const dv = new DataView(this.getSizedArray(4, mostSignificantByteFirst).buffer); - return dv.getInt32(0); + const dv = this.getSizedDataView(4, mostSignificantByteFirst); + return dv.getInt32(0, !mostSignificantByteFirst); } /** @@ -1146,8 +1140,8 @@ export class ByteVector { * represented as a BigInt due to JavaScript's 52-bit integer limitation. */ public toLong(mostSignificantByteFirst: boolean = true): bigint { - const dv = new DataView(this.getSizedArray(8, mostSignificantByteFirst).buffer); - return dv.getBigInt64(0); + const dv = this.getSizedDataView(8, mostSignificantByteFirst); + return dv.getBigInt64(0, !mostSignificantByteFirst); } /** @@ -1158,32 +1152,20 @@ export class ByteVector { * @returns A signed short value containing the value read from the current instance */ public toShort(mostSignificantByteFirst: boolean = true): number { - const dv = new DataView(this.getSizedArray(2, mostSignificantByteFirst).buffer); - return dv.getInt16(0); + const dv = this.getSizedDataView(2, mostSignificantByteFirst); + return dv.getInt16(0, !mostSignificantByteFirst); } /** * Converts a portion of the current instance to a string using a specified encoding - * @param count Integer value specifying the number of *bytes* to convert. * @param type Value indicating the encoding to use when converting to a string. - * @param offset Value specifying the index into the current instance at which to start - * converting. * @returns string String containing the converted bytes */ - public toString(count: number = this.length, type: StringType = StringType.UTF8, offset: number = 0): string { - if (!Number.isInteger(offset) || offset < 0 || offset > this.length) { - throw new Error("Argument out of range exception: offset is invalid"); - } - if (!Number.isInteger(count) || count < 0 || count + offset > this.length) { - throw new Error("Argument out of range exception: count is invalid"); - } - - const bom = type === StringType.UTF16 && this.length - offset > 1 ? this.mid(offset, 2) : null; - const buffer = Buffer.from(this.mid(offset, count)._data.buffer); - return ByteVector.getIConvEncoding(type, bom).decode(buffer); - - // NOTE: Original .NET implementation had explicit BOM stripping, which is unnecessary when - // we use IConv. + public toString(type: StringType): string { + const bom = type === StringType.UTF16 && this.length > 1 + ? this.subarray(0, 2) + : undefined; + return Encoding.getEncoding(type, bom).decode(this._bytes); } /** @@ -1191,52 +1173,37 @@ export class ByteVector { * using the specified encoding, assuming the values are `null` separated and limiting it to a * specified number of items. * @param type A {@link StringType} value indicating the encoding to use when converting - * @param offset Value specifying the index into the current instance at which to start - * converting. * @param count Value specifying a limit to the number of strings to create. Once the limit has * been reached, the last string will be filled by the remainder of the data * @returns string[] Array of strings containing the converted text. - * @remarks I'm not actually sure if this works as defined, but it behaves the same as the - * original .NET implementation, so that's good enough for now. */ - public toStrings(type: StringType, offset: number, count: number = Number.MAX_SAFE_INTEGER) { - if (!Number.isInteger(offset) || offset < 0 || offset > this.length) { - throw new Error("Argument out of range exception: offset is invalid"); - } - if (!Number.isInteger(count) || count < 0) { - throw new Error("Argument out of range exception: count is invalid"); - } - - const chunk = 0; - let position = offset; - - const list: string[] = []; - const separator = ByteVector.getTextDelimiter(type); - const align = separator.length; - - while (chunk < count && position < this.length) { - const start = position; - if (chunk + 1 === count) { - position = offset + count; - } else { - position = this.find(separator, start, align); - if (position < 0) { - position = this.length; - } + public toStrings(type: StringType, count: number = Number.MAX_SAFE_INTEGER): string[] { + Guards.safeUint(count, "count"); + + const delimiter = ByteVector.getTextDelimiter(type); + let ptr = 0; + const strings = []; + while (ptr < this.length && strings.length < count) { + // Find the next delimiter + const delimiterPosition = this.offsetFind(delimiter, ptr, delimiter.length); + if (delimiterPosition < 0) { + // We didn't find another delimiter, so break out of the loop + break; } - const length = position - start; + const str = this.subarray(ptr, delimiterPosition - ptr).toString(type); + strings.push(str); - if (length === 0) { - list.push(""); - } else { - list.push(this.toString(length, type, start)); - } + ptr = delimiterPosition + delimiter.length; + } - position += align; + // If there's any remaining bytes, convert them to string + if (ptr < this.length && strings.length < count) { + const str = this.subarray(ptr).toString(type); + strings.push(str); } - return list; + return strings; } /** @@ -1246,9 +1213,9 @@ export class ByteVector { * endian format) * @returns An unsigned integer value containing the value read from the current instance */ - public toUInt(mostSignificantByteFirst: boolean = true): number { - const dv = new DataView(this.getSizedArray(4, mostSignificantByteFirst).buffer); - return dv.getUint32(0); + public toUint(mostSignificantByteFirst: boolean = true): number { + const dv = this.getSizedDataView(4, mostSignificantByteFirst); + return dv.getUint32(0, !mostSignificantByteFirst); } /** @@ -1259,9 +1226,9 @@ export class ByteVector { * @returns An unsigned short value containing the value read from the current instance, * represented as a BigInt due to JavaScript's 32-bit integer limitation */ - public toULong(mostSignificantByteFirst: boolean = true): bigint { - const dv = new DataView(this.getSizedArray(8, mostSignificantByteFirst).buffer); - return dv.getBigUint64(0); + public toUlong(mostSignificantByteFirst: boolean = true): bigint { + const dv = this.getSizedDataView(8, mostSignificantByteFirst); + return dv.getBigUint64(0, !mostSignificantByteFirst); } /** @@ -1271,190 +1238,29 @@ export class ByteVector { * endian format) * @returns An unsigned short value containing the value read from the current instance */ - public toUShort(mostSignificantByteFirst: boolean = true): number { - const dv = new DataView(this.getSizedArray(2, mostSignificantByteFirst).buffer); - return dv.getUint16(0); - } - - // #endregion - - // #region Operator-Like Methods - - /** - * Creates a new {@link ByteVector} that contains the contents of `first` concatenated - * with `second`. This operation can be thought of as `first + second`. Note: Regardless - * of the value of {@link ByteVector.isReadOnly}, the created ByteVector will always be - * read/write. - * @param first ByteVector to which `second` will be added - * @param second ByteVector which will be added to `first` - */ - public static add(first: ByteVector, second: ByteVector): ByteVector { - const sum = ByteVector.fromByteVector(first); // Will throw on null/undefined - sum.addByteVector(second); // Will throw on null/undefined - return sum; - } - - /** - * Returns `true` if the contents of the two {@link ByteVector}s are identical, returns `false` - * otherwise - * @param first ByteVector to compare with `second` - * @param second ByteVector to compare with `first` - */ - public static equal(first: ByteVector, second: ByteVector): boolean { - const fNull = !first; - const sNull = !second; - if (fNull && sNull) { - // Since (f|s)null could be true with `undefined` OR `null`, we'll just let === decide it for us - return first === second; - } - - if (fNull || sNull) { - // If only one is null/undefined, then they are not equal - return false; - } - - return first.compareTo(second) === 0; - } - - /** - * Returns `false` if the contents of the two {@link ByteVector}s are identical, returns `true` - * otherwise - * @param first ByteVector to compare with `second` - * @param second ByteVector to compare with `first` - */ - public static notEqual(first: ByteVector, second: ByteVector): boolean { - return !ByteVector.equal(first, second); - } - - /** - * Returns `true` if `first` is greater than `second`. This is true if - * `first` is longer than `second` or if the first element in `first` - * that is different than the element at the same position in `second` is greater than. - * Returns `false` if the two {@link ByteVector}s are identical. - * @param first ByteVector to compare with `second` - * @param second ByteVector to compare with `first` - */ - public static greaterThan(first: ByteVector, second: ByteVector): boolean { - if (!first) { - throw new Error("Argument null exception: first is null"); - } - if (!second) { - throw new Error("Argument null exception: second is null"); - } - - return first.compareTo(second) > 0; - } - - /** - * Returns `true` if `first` is greater than `second`. This is true if - * `first` is longer than `second` or if the first element in `first` - * that is different than the element at the same position in `second` is greater than. - * Returns `true` if the two {@link ByteVector}s are identical. - * @param first ByteVector to compare with `second` - * @param second ByteVector to compare with `first` - */ - public static greaterThanEqual(first: ByteVector, second: ByteVector): boolean { - if (!first) { - throw new Error("Argument null exception: first is null"); - } - if (!second) { - throw new Error("Argument null exception: second is null"); - } - - return first.compareTo(second) >= 0; - } - - /** - * Returns `true` if `first` is less than `second`. This is true if - * `first` is shorter than `second` or if the first element in `first` - * that is different than the element at the same position in `second` is less than. - * Returns `false` if the two {@link ByteVector}s are identical. - * @param first ByteVector to compare with `second` - * @param second ByteVector to compare with `first` - */ - public static lessThan(first: ByteVector, second: ByteVector): boolean { - if (!first) { - throw new Error("Argument null exception: first is null"); - } - if (!second) { - throw new Error("Argument null exception: second is null"); - } - - return first.compareTo(second) < 0; - } - - /** - * Returns `true` if `first` is less than `second`. This is true if - * `first` is shorter than `second` or if the first element in `first` - * that is different than the element at the same position in `second` is less than. - * Returns `true` if the two {@link ByteVector}s are identical. - * @param first ByteVector to compare with `second` - * @param second ByteVector to compare with `first` - */ - public static lessThanEqual(first: ByteVector, second: ByteVector): boolean { - if (!first) { - throw new Error("Argument null exception: first is null"); - } - if (!second) { - throw new Error("Argument null exception: second is null"); - } - - return first.compareTo(second) <= 0; + public toUshort(mostSignificantByteFirst: boolean = true): number { + const dv = this.getSizedDataView(2, mostSignificantByteFirst); + return dv.getUint16(0, !mostSignificantByteFirst); } // #endregion - // #region Private Helpers - - private static getIConvEncoding(type: StringType, bom: ByteVector): IConvEncoding { - switch (type) { - case StringType.UTF16: - // If we have a BOM, return the appropriate encoding. Otherwise, assume we're - // reading from a string that was already identified. In that case, we'll use - // the last used encoding. - if (bom) { - if (bom.get(0) === 0xFF && bom.get(1) === 0xFE) { - ByteVector._lastUtf16IConvFunc = new IConvEncoding("utf16-le"); - } else if ( bom.get(0) === 0xFE && bom.get(1) === 0xFF) { - ByteVector._lastUtf16IConvFunc = new IConvEncoding("utf16-be"); - } - } - return ByteVector._lastUtf16IConvFunc; - case StringType.UTF16BE: - return new IConvEncoding("utf16-be"); - case StringType.UTF8: - return new IConvEncoding("utf8"); - case StringType.UTF16LE: - return new IConvEncoding("utf16-le"); + private getSizedDataView(size: number, mostSignificantByteFirst: boolean): DataView { + const difference = size - this._bytes.length; + if (difference <= 0) { + // Comprehension is at least the required size + return new DataView(this._bytes.buffer, this._bytes.byteOffset, size); } - // NOTE: The original .NET implementation has the notion of "broken" latin behavior that - // uses Encoding.Default. I have removed it in this port because 1) this behavior is - // not used anywhere in the library, 2) Encoding.Default could be anything depending - // on the machine's region, 3) in .NET Core this is always UTF8. - // If it turns out we need support for other non unicode encodings, we'll want to - // revisit this. - return new IConvEncoding("latin1"); + // Comprehension is too short. Pad it out. + const fullSizeArray = new Uint8Array(size); + fullSizeArray.set(this._bytes, mostSignificantByteFirst ? difference : 0); + return new DataView(fullSizeArray.buffer); } - private getSizedArray(size: number, mostSignificantByteFirst: boolean): Uint8Array { - const last = this.length > size ? size - 1 : this.length - 1; - const pad = size - (last + 1); - - const output = new Uint8Array(size); - for (let i = 0; i <= last; i++) { - const outIndex = pad + (mostSignificantByteFirst ? i : last - i); - output[outIndex] = this._data[i]; - } - - return output; - } - - private throwIfReadOnly() { + private throwIfReadOnly(): void { if (this._isReadOnly) { - throw new Error("Not supported: Cannot edit readonly byte vectors"); + throw new Error("Invalid operation: Cannot modify a read-only ByteVector"); } } - - // #endregion } diff --git a/src/combinedTag.ts b/src/combinedTag.ts index e5eabc7a..cada2d46 100644 --- a/src/combinedTag.ts +++ b/src/combinedTag.ts @@ -1,7 +1,7 @@ -import {IPicture} from "./iPicture"; -import {Tag, TagTypes} from "./tag"; -import {Guards} from "./utils"; import {NotSupportedError} from "./errors"; +import {IPicture} from "./picture"; +import {Tag, TagTypes} from "./tag"; +import {Guards, NumberUtils} from "./utils"; /** * This class provides a unified way of accessing tag data from multiple tag types. @@ -9,16 +9,20 @@ import {NotSupportedError} from "./errors"; export default abstract class CombinedTag extends Tag { private readonly _supportedTagTypes: TagTypes; private readonly _tags: Tag[]; + private readonly _writeToAll: boolean; /** * Constructs and initializes a new instance of {@link CombinedTag}. * @param supportedTagTypes Types of tags that are supported by this instance of the combined + * @param writeToAllTags Whether to write to all tags in the instance (`true`) or to the first + * tag in the instance (`false`). * @param tags Optionally, a list of tags to combine in the new instance. */ - protected constructor(supportedTagTypes: TagTypes, tags?: Tag[]) { + protected constructor(supportedTagTypes: TagTypes, writeToAllTags: boolean, tags?: Tag[]) { super(); this._supportedTagTypes = supportedTagTypes; this._tags = tags ? tags.slice(0) : []; + this._writeToAll = writeToAllTags; } // #region Properties @@ -45,10 +49,7 @@ export default abstract class CombinedTag extends Tag { */ public get supportedTagTypes(): TagTypes { return this._supportedTagTypes; } - /** - * Gets the tag types contained in the current instance. - * @returns TagTypes Bitwise combined tag types contained in all child tags. - */ + /** @inheritDoc */ public get tagTypes(): TagTypes { return this._tags.filter((t) => !!t).reduce((types, t) => types | t.tagTypes, TagTypes.None); } @@ -62,553 +63,252 @@ export default abstract class CombinedTag extends Tag { return this._tags.filter((t) => !!t).reduce((totalBytes, t) => totalBytes + t.sizeOnDisk, 0); } - /** - * Gets the title for the media described by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get title(): string { return this.getFirstValue((t) => t.title); } - /** - * Sets the title for the media described by the current instance. - * Sets the value on all child tags - */ - public set title(val: string) { this.setAllValues((t, v) => { t.title = v; }, val); } + /** @inheritDoc */ + public set title(val: string) { this.setValues((t, v) => { t.title = v; }, val); } - /** - * Gets the title used for sorting the media described by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get titleSort(): string { return this.getFirstValue((t) => t.titleSort); } - /** - * Sets the title used for sorting the media described by the current instance. - * Sets the value on all child tags - */ - public set titleSort(val: string) { this.setAllValues((t, v) => { t.titleSort = v; }, val); } + /** @inheritDoc */ + public set titleSort(val: string) { this.setValues((t, v) => { t.titleSort = v; }, val); } - /** - * Gets the subtitle for the media described by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - * @remarks This field gives a nice short precision to the title, which is typically below - * the title on the front cover of the media. Example: for "Back to the Future", this would - * be "It's About Time". - */ + /** @inheritDoc */ public get subtitle(): string { return this.getFirstValue((t) => t.subtitle); } - /** - * Sets the subtitle for the media described by the current instance. - * Sets the value on all child tags - */ - public set subtitle(val: string) { this.setAllValues((t, v) => { t.subtitle = v; }, val); } + /** @inheritDoc */ + public set subtitle(val: string) { this.setValues((t, v) => { t.subtitle = v; }, val); } - /** - * Gets the description for the media described by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - * @remarks This is especially relevant for a movie. For example, for "Back to the Future - * 2", this could be "After visiting 2015, Marty McFly must repeat his visit to 1955 to - * prevent disastrous changes to 1985...without interfering with his first trip". - */ + /** @inheritDoc */ public get description(): string { return this.getFirstValue((t) => t.description); } - /** - * Sets the description for the media described by the current instance. - * Sets the value on all child tags - */ - public set description(val: string) { this.setAllValues((t, v) => { t.description = v; }, val); } + /** @inheritDoc */ + public set description(val: string) { this.setValues((t, v) => { t.description = v; }, val); } - /** - * Gets the performers or artists who performed in the media described by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get performers(): string[] { return this.getFirstArray((t) => t.performers); } - /** - * Sets the performers in the media described by the current instance. - * Sets the value on all child tags - */ - public set performers(val: string[]) { this.setAllValues((t, v) => { t.performers = v; }, val); } + /** @inheritDoc */ + public set performers(val: string[]) { this.setValues((t, v) => { t.performers = v; }, val); } - /** - * Gets the performers or artists who performed in the media described by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get performersSort(): string[] { return this.getFirstArray((t) => t.performersSort); } - /** - * Sets the performers in the media described by the current instance. - * Sets the value on all child tags - */ - public set performersSort(val: string[]) { this.setAllValues((t, v) => { t.performersSort = v; }, val); } + /** @inheritDoc */ + public set performersSort(val: string[]) { this.setValues((t, v) => { t.performersSort = v; }, val); } - /** - * Gets the characters for a video media, or instruments played for music media. This should - * match the {@link performers} array (for each person correspond one/more role). Several roles - * for the same artist/actor can be made up with semicolons. For example, "Marty McFly; Marty - * McFly Jr.; Marlene McFly". - * Returns the first non-null/non-undefined value from the child tags. - * @remarks This is typically useful for movies, although the instrument played by each - * artist in a music file may be of relevance. - * It is highly important to match each role to the performers. This means that a role may - * be `null\undefined` to keep a match betweenInclusive performers[i] and performersRole[i]. - */ + /** @inheritDoc */ public get performersRole(): string[] { return this.getFirstArray((t) => t.performersRole); } - /** - * Sets the characters in a video media, or instruments played for music media. - * Sets the value on all child tags - */ - public set performersRole(val: string[]) { this.setAllValues((t, v) => { t.performersRole = v; }, val); } + /** @inheritDoc */ + public set performersRole(val: string[]) { this.setValues((t, v) => { t.performersRole = v; }, val); } - /** - * Gets the band or artist is credited in the creation of the entire album or collection - * containing the media described by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get albumArtists(): string[] { return this.getFirstArray((t) => t.albumArtists); } - /** - * Sets the band or artist is credited in the creation of the entire album or collection - * containing the media described by the current instance. - * Sets the value on all child tags - */ - public set albumArtists(val: string[]) { this.setAllValues((t, v) => { t.albumArtists = v; }, val); } + /** @inheritDoc */ + public set albumArtists(val: string[]) { this.setValues((t, v) => { t.albumArtists = v; }, val); } - /** - * Gets the band or artist is credited in the creation of the entire album or collection - * containing the media described by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get albumArtistsSort(): string[] { return this.getFirstArray((t) => t.albumArtistsSort); } - /** - * Sets the band or artist is credited in the creation of the entire album or collection - * containing the media described by the current instance. - * Sets the value on all child tags - */ - public set albumArtistsSort(val: string[]) { this.setAllValues((t, v) => { t.albumArtistsSort = v; }, val); } + /** @inheritDoc */ + public set albumArtistsSort(val: string[]) { this.setValues((t, v) => { t.albumArtistsSort = v; }, val); } - /** - * Gets the composers of the media represented by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get composers(): string[] { return this.getFirstArray((t) => t.composers); } - /** - * Sets the composers of the media represented by the current instance. - * Sets the value on all child tags - */ - public set composers(val: string[]) { this.setAllValues((t, v) => { t.composers = v; }, val); } + /** @inheritDoc */ + public set composers(val: string[]) { this.setValues((t, v) => { t.composers = v; }, val); } - /** - * Gets the composers of the media represented by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get composersSort(): string[] { return this.getFirstArray((t) => t.composersSort); } - /** - * Sets the composers of the media represented by the current instance. - * Sets the value on all child tags - */ - public set composersSort(val: string[]) { this.setAllValues((t, v) => { t.composersSort = v; }, val); } + /** @inheritDoc */ + public set composersSort(val: string[]) { this.setValues((t, v) => { t.composersSort = v; }, val); } - /** - * Gets the album title for the media described by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get album(): string { return this.getFirstValue((t) => t.album); } - /** - * Sets the album title for the media described by the current instance. - * Sets the value on all child tags - */ - public set album(val: string) { this.setAllValues((t, v) => { t.album = v; }, val); } + /** @inheritDoc */ + public set album(val: string) { this.setValues((t, v) => { t.album = v; }, val); } - /** - * Gets the album title for sorting the media described by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get albumSort(): string { return this.getFirstValue((t) => t.albumSort); } - /** - * Sets the album title for sorting the media described by the current instance. - * Sets the value on all child tags - */ - public set albumSort(val: string) { this.setAllValues((t, v) => { t.albumSort = v; }, val); } + /** @inheritDoc */ + public set albumSort(val: string) { this.setValues((t, v) => { t.albumSort = v; }, val); } - /** - * Gets a user comment for the media described by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get comment(): string { return this.getFirstValue((t) => t.comment); } - /** - * Sets a user comment for the media described by the current instance. - * Sets the value on all child tags - */ - public set comment(val: string) { this.setAllValues((t, v) => { t.comment = v; }, val); } + /** @inheritDoc */ + public set comment(val: string) { this.setValues((t, v) => { t.comment = v; }, val); } - /** - * Gets the album genres of the media represented by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get genres(): string[] { return this.getFirstArray((t) => t.genres); } - /** - * Sets the album genres of the media described by the current instance. - * Sets the value on all child tags - */ - public set genres(val: string[]) { this.setAllValues((t, v) => { t.genres = v; }, val); } + /** @inheritDoc */ + public set genres(val: string[]) { this.setValues((t, v) => { t.genres = v; }, val); } - /** - * Gets the year that the media represented by the current instance was recorded. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get year(): number { return this.getFirstValue((t) => t.year, 0); } - /** - * Sets the year that the media represented by the current instance was recorded. Must be a - * positive integer. - * Sets the value on all child tags - */ - public set year(val: number) { this.setAllUint((t, v) => { t.year = v; }, val); } + /** @inheritDoc */ + public set year(val: number) { this.setUint((t, v) => { t.year = v; }, val); } - /** - * Gets the position of the media represented by the current instance in its containing album. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get track(): number { return this.getFirstValue((t) => t.track, 0); } - /** - * Sets the position of the media represented by the current instance in its containing album. - * Must be a positive integer positive integer. - * Sets the value on all child tags - */ - public set track(val: number) { this.setAllUint((t, v) => { t.track = v; }, val); } + /** @inheritDoc */ + public set track(val: number) { this.setUint((t, v) => { t.track = v; }, val); } - /** - * Gets the number of tracks in the album containing the media represented by the current - * instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get trackCount(): number { return this.getFirstValue((t) => t.trackCount, 0); } - /** - * Sets the number of tracks in the album containing the media represented by the current - * instance. Must be a positive integer positive integer. - * Sets the value on all child tags - */ - public set trackCount(val: number) { this.setAllUint((t, v) => { t.trackCount = v; }, val); } + /** @inheritDoc */ + public set trackCount(val: number) { this.setUint((t, v) => { t.trackCount = v; }, val); } - /** - * Gets the number of the disc containing the media represented by the current instance in a - * boxed set. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get disc(): number { return this.getFirstValue((t) => t.disc, 0); } - /** - * Sets the number of the disc containing the media represented by the current instance in a - * boxed set. Must be a positive integer positive integer. - * Sets the value on all child tags - */ - public set disc(val: number) { this.setAllUint((t, v) => { t.disc = v; }, val); } + /** @inheritDoc */ + public set disc(val: number) { this.setUint((t, v) => { t.disc = v; }, val); } - /** - * Gets the number of the discs in the boxed set containing the media represented by the - * current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get discCount(): number { return this.getFirstValue((t) => t.discCount, 0); } - /** - * Sets the number of the discs in the boxed set containing the media represented by the - * current instance. Must be a positive integer positive integer. - * Sets the value on all child tags - */ - public set discCount(val: number) { this.setAllUint((t, v) => { t.discCount = v; }, val); } + /** @inheritDoc */ + public set discCount(val: number) { this.setUint((t, v) => { t.discCount = v; }, val); } - /** - * Gets the lyrics or script of the media represented by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get lyrics(): string { return this.getFirstValue((t) => t.lyrics); } - /** - * Sets the lyrics or script of the media represented by the current instance. - * Sets the value on all child tags - */ - public set lyrics(val: string) { this.setAllValues((t, v) => { t.lyrics = v; }, val); } + /** @inheritDoc */ + public set lyrics(val: string) { this.setValues((t, v) => { t.lyrics = v; }, val); } - /** - * Gets the grouping on the album which the media in the current instance belongs to. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get grouping(): string { return this.getFirstValue((t) => t.grouping); } - /** - * Sets the grouping on the album which the media in the current instance belongs to. - * Sets the value on all child tags - */ - public set grouping(val: string) { this.setAllValues((t, v) => { t.grouping = v; }, val); } + /** @inheritDoc */ + public set grouping(val: string) { this.setValues((t, v) => { t.grouping = v; }, val); } - /** - * Gets the number of beats per minute of the media represented by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get beatsPerMinute(): number { return this.getFirstValue((t) => t.beatsPerMinute, 0); } - /** - * Sets the number of beats per minute of the media represented by the current instance. Must - * be a positive integer positive integer. - * Sets the value on all child tags - */ - public set beatsPerMinute(val: number) { this.setAllUint((t, v) => { t.beatsPerMinute = v; }, val); } + /** @inheritDoc */ + public set beatsPerMinute(val: number) { this.setUint((t, v) => { t.beatsPerMinute = v; }, val); } - /** - * Gets the conductor or director of the media represented by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get conductor(): string { return this.getFirstValue((t) => t.conductor); } - /** - * Sets the conductor or director of the media represented by the current instance. - * Sets the value on all child tags - */ - public set conductor(val: string) { this.setAllValues((t, v) => { t.conductor = v; }, val); } + /** @inheritDoc */ + public set conductor(val: string) { this.setValues((t, v) => { t.conductor = v; }, val); } - /** - * Gets the copyright information of the media represented by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get copyright(): string { return this.getFirstValue((t) => t.copyright); } - /** - * Sets the copyright information of the media represented by the current instance. - * Sets the value on all child tags - */ - public set copyright(val: string) { this.setAllValues((t, v) => { t.copyright = v; }, val); } + /** @inheritDoc */ + public set copyright(val: string) { this.setValues((t, v) => { t.copyright = v; }, val); } - /** - * Gets the date at which the tag has been written. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get dateTagged(): Date { return this.getFirstValue((t) => t.dateTagged); } - /** - * Sets the date at which the tag has been written - */ - public set dateTagged(val: Date) { this.setAllValues((t, v) => { t.dateTagged = v; }, val); } + /** @inheritDoc */ + public set dateTagged(val: Date) { this.setValues((t, v) => { t.dateTagged = v; }, val); } - /** - * Gets the MusicBrainz artist ID. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get musicBrainzArtistId(): string { return this.getFirstValue((t) => t.musicBrainzArtistId); } - /** - * Sets the MusicBrainz artist ID. - * Sets the value on all child tags - */ - public set musicBrainzArtistId(val: string) { this.setAllValues((t, v) => { t.musicBrainzArtistId = v; }, val); } + /** @inheritDoc */ + public set musicBrainzArtistId(val: string) { this.setValues((t, v) => { t.musicBrainzArtistId = v; }, val); } - /** - * Gets the MusicBrainz release group ID. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get musicBrainzReleaseGroupId(): string { return this.getFirstValue((t) => t.musicBrainzReleaseGroupId); } - /** - * Sets the MusicBrainz release group ID. - * Sets the value on all child tags - */ + /** @inheritDoc */ public set musicBrainzReleaseGroupId(val: string) { - this.setAllValues((t, v) => { t.musicBrainzReleaseGroupId = v; }, val); + this.setValues((t, v) => { t.musicBrainzReleaseGroupId = v; }, val); } - /** - * Gets the MusicBrainz release ID. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get musicBrainzReleaseId(): string { return this.getFirstValue((t) => t.musicBrainzReleaseId); } - /** - * Sets the MusicBrainz release ID. - * Sets the value on all child tags - */ - public set musicBrainzReleaseId(val: string) { this.setAllValues((t, v) => { t.musicBrainzReleaseId = v; }, val); } + /** @inheritDoc */ + public set musicBrainzReleaseId(val: string) { this.setValues((t, v) => { t.musicBrainzReleaseId = v; }, val); } - /** - * Gets the MusicBrainz release artist ID. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get musicBrainzReleaseArtistId(): string { return this.getFirstValue((t) => t.musicBrainzReleaseArtistId); } - /** - * Sets the MusicBrainz release artist ID. - * Sets the value on all child tags - */ + /** @inheritDoc */ public set musicBrainzReleaseArtistId(val: string) { - this.setAllValues((t, v) => { t.musicBrainzReleaseArtistId = v; }, val); + this.setValues((t, v) => { t.musicBrainzReleaseArtistId = v; }, val); } - /** - * Gets the MusicBrainz track ID. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get musicBrainzTrackId(): string { return this.getFirstValue((t) => t.musicBrainzTrackId); } - /** - * Sets the MusicBrainz track ID. - * Sets the value on all child tags - */ - public set musicBrainzTrackId(val: string) { this.setAllValues((t, v) => { t.musicBrainzTrackId = v; }, val); } + /** @inheritDoc */ + public set musicBrainzTrackId(val: string) { this.setValues((t, v) => { t.musicBrainzTrackId = v; }, val); } - /** - * Gets the MusicBrainz disc ID. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get musicBrainzDiscId(): string { return this.getFirstValue((t) => t.musicBrainzDiscId); } - /** - * Sets the MusicBrainz disc ID. - * Sets the value on all child tags - */ - public set musicBrainzDiscId(val: string) { this.setAllValues((t, v) => { t.musicBrainzDiscId = v; }, val); } + /** @inheritDoc */ + public set musicBrainzDiscId(val: string) { this.setValues((t, v) => { t.musicBrainzDiscId = v; }, val); } - /** - * Gets the MusicIP PUID. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get musicIpId(): string { return this.getFirstValue((t) => t.musicIpId); } - /** - * Sets the MusicIP PUID. - * Sets the value on all child tags - */ - public set musicIpId(val: string) { this.setAllValues((t, v) => { t.musicIpId = v; }, val); } + /** @inheritDoc */ + public set musicIpId(val: string) { this.setValues((t, v) => { t.musicIpId = v; }, val); } - /** - * Gets the Amazon ID. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get amazonId(): string { return this.getFirstValue((t) => t.amazonId); } - /** - * Sets the Amazon ID. - * Sets the value on all child tags - */ - public set amazonId(val: string) { this.setAllValues((t, v) => { t.amazonId = v; }, val); } + /** @inheritDoc */ + public set amazonId(val: string) { this.setValues((t, v) => { t.amazonId = v; }, val); } - /** - * Gets the MusicBrainz release status. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get musicBrainzReleaseStatus(): string { return this.getFirstValue((t) => t.musicBrainzReleaseStatus); } - /** - * Sets the MusicBrainz release status. - * Sets the value on all child tags - */ + /** @inheritDoc */ public set musicBrainzReleaseStatus(val: string) { - this.setAllValues((t, v) => { t.musicBrainzReleaseStatus = v; }, val); + this.setValues((t, v) => { t.musicBrainzReleaseStatus = v; }, val); } - /** - * Gets the MusicBrainz release type. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get musicBrainzReleaseType(): string { return this.getFirstValue((t) => t.musicBrainzReleaseType); } - /** - * Sets the MusicBrainz release type. - * Sets the value on all child tags - */ + /** @inheritDoc */ public set musicBrainzReleaseType(val: string) { - this.setAllValues((t, v) => { t.musicBrainzReleaseStatus = v; }, val); + this.setValues((t, v) => { t.musicBrainzReleaseType = v; }, val); } - /** - * Gets the MusicBrainz release country. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get musicBrainzReleaseCountry(): string { return this.getFirstValue((t) => t.musicBrainzReleaseCountry); } - /** - * Sets the MusicBrainz release country. - * Sets the value on all child tags - */ + /** @inheritDoc */ public set musicBrainzReleaseCountry(val: string) { - this.setAllValues((t, v) => { t.musicBrainzReleaseCountry = v; }, val); + this.setValues((t, v) => { t.musicBrainzReleaseCountry = v; }, val); } - /** - * Gets the ReplayGain track gain in dB. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get replayGainTrackGain(): number { return this.getFirstValue((t) => t.replayGainTrackGain, NaN); } - /** - * Sets the ReplayGain track gain in dB. - * Sets the value on all child tags - */ - public set replayGainTrackGain(val: number) { this.setAllValues((t, v) => { t.replayGainTrackGain = v; }, val); } + /** @inheritDoc */ + public set replayGainTrackGain(val: number) { this.setValues((t, v) => { t.replayGainTrackGain = v; }, val); } - /** - * Gets the ReplayGain track peak sample. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get replayGainTrackPeak(): number { return this.getFirstValue((t) => t.replayGainTrackPeak, NaN); } - /** - * Sets the ReplayGain track peak sample. - * Sets the value on all child tags - */ - public set replayGainTrackPeak(val: number) { this.setAllValues((t, v) => { t.replayGainTrackPeak = v; }, val); } + /** @inheritDoc */ + public set replayGainTrackPeak(val: number) { this.setValues((t, v) => { t.replayGainTrackPeak = v; }, val); } - /** - * Gets the ReplayGain album gain in dB. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get replayGainAlbumGain(): number { return this.getFirstValue((t) => t.replayGainAlbumGain, NaN); } - /** - * Sets the ReplayGain album gain in dB. - * Sets the value on all child tags - */ - public set replayGainAlbumGain(val: number) { this.setAllValues((t, v) => { t.replayGainAlbumGain = v; }, val); } + /** @inheritDoc */ + public set replayGainAlbumGain(val: number) { this.setValues((t, v) => { t.replayGainAlbumGain = v; }, val); } - /** - * Gets the ReplayGain album peak sample. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get replayGainAlbumPeak(): number { return this.getFirstValue((t) => t.replayGainAlbumPeak, NaN); } - /** - * Sets the ReplayGain album peak sample. - * Sets the value on all child tags - */ - public set replayGainAlbumPeak(val: number) { this.setAllValues((t, v) => { t.replayGainAlbumPeak = v; }, val); } + /** @inheritDoc */ + public set replayGainAlbumPeak(val: number) { this.setValues((t, v) => { t.replayGainAlbumPeak = v; }, val); } - /** - * Gets the initial key of the media represented by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get initialKey(): string { return this.getFirstValue((t) => t.initialKey); } - /** - * Sets the initial key of the media represented by the current instance. - * Sets the value on all child tags - */ - public set initialKey(val: string) { this.setAllValues((t, v) => { t.initialKey = v; }, val); } + /** @inheritDoc */ + public set initialKey(val: string) { this.setValues((t, v) => { t.initialKey = v; }, val); } - /** - * Gets the remixer of the media represented by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get remixedBy(): string { return this.getFirstValue((t) => t.remixedBy); } - /** - * Sets the remixer of the media represented by the current instance. - * Sets the value on all child tags - */ - public set remixedBy(val: string) { this.setAllValues((t, v) => { t.remixedBy = v; }, val); } + /** @inheritDoc */ + public set remixedBy(val: string) { this.setValues((t, v) => { t.remixedBy = v; }, val); } - /** - * Gets the publisher of the media represented by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get publisher(): string { return this.getFirstValue((t) => t.publisher); } - /** - * Sets the publisher of the media represented by the current instance. - * Sets the value on all child tags - */ - public set publisher(val: string) { this.setAllValues((t, v) => { t.publisher = v; }, val); } + /** @inheritDoc */ + public set publisher(val: string) { this.setValues((t, v) => { t.publisher = v; }, val); } - /** - * Gets the ISRC (International Standard Recording Code) of the media represented by the - * current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get isrc(): string { return this.getFirstValue((t) => t.isrc); } - /** - * Sets the ISRC (International Standard Recording Code) of the media represented by the - * current instance. - * Sets the value on all child tags - */ - public set isrc(val: string) { this.setAllValues((t, v) => { t.isrc = v; }, val); } + /** @inheritDoc */ + public set isrc(val: string) { this.setValues((t, v) => { t.isrc = v; }, val); } - /** - * Gets a collection of pictures associated with the media represented by the current instance. - * Returns the first non-null/non-undefined value from the child tags. - */ + /** @inheritDoc */ public get pictures(): IPicture[] { return this.getFirstArray((t) => t.pictures); } - /** - * Sets the collection of pictures associated with the current media. - * Sets the value on all child tags - */ - public set pictures(val: IPicture[]) { this.setAllValues((t, v) => { t.pictures = v; }, val); } + /** @inheritDoc */ + public set pictures(val: IPicture[]) { this.setValues((t, v) => { t.pictures = v; }, val); } - /** - * Whether or not the current instance is empty. If all child tags are empty, `true` is - * returned, `false` otherwise. - */ + /** @inheritDoc */ + public get isCompilation(): boolean { return this.getFirstValue((t) => t.isCompilation); } + /** @inheritDoc */ + public set isCompilation(val: boolean) { this.setValues((t, v) => { t.isCompilation = v; }, val); } + + /** @inheritDoc */ public get isEmpty(): boolean { return this._tags.every((t) => t.isEmpty); } @@ -641,7 +341,7 @@ export default abstract class CombinedTag extends Tag { */ public getTag(tagType: TagTypes): TTag { // Make sure the tag type can possibly be stored here - if ((tagType & this._supportedTagTypes) === 0) { + if (!NumberUtils.hasFlag(this._supportedTagTypes, tagType)) { return undefined; } @@ -669,8 +369,7 @@ export default abstract class CombinedTag extends Tag { for (let i = this._tags.length - 1; i >= 0; i--) { const tag = this._tags[i]; - const isMatch = (tag.tagTypes & tagTypes) !== 0; - if (isMatch) { + if (NumberUtils.hasFlag(tag.tagTypes, tagTypes)) { if (tag instanceof CombinedTag) { tag.removeTags(tagTypes); } else { @@ -682,12 +381,21 @@ export default abstract class CombinedTag extends Tag { // #region Protected/Private Methods - protected addTag(tag: Tag) { + protected addTag(tag: Tag): void { if (tag) { this._tags.push(tag); } } + /** + * This is used for special cases where the order of tags is important. + * @protected + */ + protected replaceTag(oldTag: Tag, newTag: Tag): void { + const index = this._tags.indexOf(oldTag); + this._tags.splice(index, 1, newTag); + } + /** * Verifies if a tag can be added to the current instance. The criteria for validation are: * * A tag of the given tag type does not already exist @@ -695,10 +403,10 @@ export default abstract class CombinedTag extends Tag { * @param tagType Tag type that the caller wants to create */ protected validateTagCreation(tagType: TagTypes): void { - if ((this._supportedTagTypes & tagType) === 0) { + if (!NumberUtils.hasFlag(this._supportedTagTypes, tagType)) { throw new NotSupportedError(`Tag of type ${tagType} is not supported on this CombinedTag`); } - if ((this.tagTypes & tagType) !== 0) { + if (NumberUtils.hasFlag(this.tagTypes, tagType)) { throw new Error(`Cannot create tag of type ${tagType} because one already exists`); } } @@ -721,19 +429,26 @@ export default abstract class CombinedTag extends Tag { return tagWithProperty ? propertyFn(tagWithProperty) : defaultValue; } - private setAllUint(propertyFn: (t: Tag, val: number) => void, val: number): void { + private setUint(propertyFn: (t: Tag, val: number) => void, val: number): void { Guards.uint(val, "val"); - this._tags.forEach((t) => { - if (!t) { return; } - propertyFn(t, val); - }); + + if (this._writeToAll) { + this._tags.forEach((t) => { propertyFn(t, val); }); + } else { + if (this._tags.length > 0) { + propertyFn(this._tags[0], val); + } + } } - private setAllValues(propertyFn: (t: Tag, val: T) => void, val: T): void { - this._tags.forEach((t) => { - if (!t) { return; } - propertyFn(t, val); - }); + private setValues(propertyFn: (t: Tag, val: T) => void, val: T): void { + if (this._writeToAll) { + this._tags.forEach((t) => { propertyFn(t, val); }); + } else { + if (this._tags.length > 0) { + propertyFn(this._tags[0], val); + } + } } // #endregion diff --git a/src/errors.ts b/src/errors.ts index de7105c4..6777f42e 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -5,7 +5,7 @@ export class CorruptFileError extends Error { super(msg); } - public static errorIs(e: Error): boolean { + public static errorIs(e: unknown): boolean { return e.hasOwnProperty("isCorruptFileError"); } } @@ -17,7 +17,7 @@ export class NotImplementedError extends Error { super(`Not implemented${message ? `: ${message}` : ""}`); } - public static errorIs(e: Error): boolean { + public static errorIs(e: unknown): boolean { return e.hasOwnProperty("isNotImplementedError"); } } @@ -29,7 +29,7 @@ export class NotSupportedError extends Error { super(`Not supported${message ? `: ${message}` : ""}`); } - public static errorIs(e: Error): boolean { + public static errorIs(e: unknown): boolean { return e.hasOwnProperty("isNotSupportedError"); } } @@ -41,7 +41,7 @@ export class UnsupportedFormatError extends Error { super(`Unsupported format${message ? `: ${message}` : ""}`); } - public static errorIs(e: Error): boolean { + public static errorIs(e: unknown): boolean { return e.hasOwnProperty("isUnsupportedFormatError"); } } diff --git a/src/file.ts b/src/file.ts index 4e26f54b..2c47a5b0 100644 --- a/src/file.ts +++ b/src/file.ts @@ -1,6 +1,7 @@ -import Properties from "./properties"; import {ByteVector} from "./byteVector"; import {IFileAbstraction, LocalFileAbstraction} from "./fileAbstraction"; +import {IDisposable} from "./interfaces"; +import {Properties} from "./properties"; import {IStream, SeekOrigin} from "./stream"; import {Tag, TagTypes} from "./tag"; import {FileUtils, Guards} from "./utils"; @@ -79,17 +80,18 @@ export type FileTypeConstructor = new (abstraction: IFileAbstraction, style: Rea * use {@link File.createFromPath} or {@link File.createFromAbstraction} as it automatically * detects the appropriate class from the file extension or provided MimeType. */ -export abstract class File { +export abstract class File implements IDisposable { // #region Member Variables - private static readonly _bufferSize: number = 1024; + private static readonly BUFFER_SIZE: number = 1024; private static _fileTypes: {[mimeType: string]: FileTypeConstructor} = {}; private static _fileTypeResolvers: FileTypeResolver[] = []; - protected _fileAbstraction: IFileAbstraction; - protected _fileStream: IStream; // Not intended to be used by implementing classes - protected _tagTypesOnDisk: TagTypes = TagTypes.None; + // @TODO: Remove protected member variables + private readonly _fileAbstraction: IFileAbstraction; + private _fileStream: IStream; + private _tagTypesOnDisk: TagTypes = TagTypes.None; private _corruptionReasons: string[] = []; private _mimeType: string; @@ -99,7 +101,7 @@ export abstract class File { Guards.truthy(file, "file"); this._fileAbstraction = typeof(file) === "string" ? new LocalFileAbstraction(file) - : file; + : file; } /** @@ -168,7 +170,7 @@ export abstract class File { /** * Gets the buffer size to use when reading large blocks of data */ - public static get bufferSize(): number { return File._bufferSize; } + public static get bufferSize(): number { return File.BUFFER_SIZE; } /** * Reasons for which this file is marked as corrupt. @@ -180,6 +182,12 @@ export abstract class File { */ public get fileAbstraction(): IFileAbstraction { return this._fileAbstraction; } + /** + * Shortcut property to determine if a file has tags in memory. + * NOTE: Just because `tag !== undefined` does not mean there are tags in memory. + */ + public get hasTags(): boolean { return this.tagTypes !== TagTypes.None; } + /** * Indicates whether or not this file may be corrupt. Files with unknown corruptions should not * be written. @@ -279,6 +287,7 @@ export abstract class File { * Gets the tag types contained in the physical file represented by the current instance. */ public get tagTypesOnDisk(): TagTypes { return this._tagTypesOnDisk; } + protected set tagTypesOnDisk(value: TagTypes) { this._tagTypesOnDisk = value; } // #endregion @@ -316,14 +325,14 @@ export abstract class File { /** * Used for removing a file type constructor during unit testing */ - public static removeFileType(mimeType: string) { + public static removeFileType(mimeType: string): void { delete File._fileTypes[mimeType]; } /** * Used for removing a file type resolver during unit testing */ - public static removeFileTypeResolver(resolver: FileTypeResolver) { + public static removeFileTypeResolver(resolver: FileTypeResolver): void { const index = File._fileTypeResolvers.indexOf(resolver); if (index >= 0) { File._fileTypeResolvers.splice(index, 1); @@ -333,7 +342,7 @@ export abstract class File { /** * Dispose the current instance. Equivalent to setting the mode to closed. */ - public dispose() { + public dispose(): void { this.mode = FileAccessMode.Closed; } @@ -353,7 +362,7 @@ export abstract class File { this.mode = FileAccessMode.Read; - if (pattern.length > File._bufferSize) { + if (pattern.length > File.BUFFER_SIZE) { return -1; } @@ -364,8 +373,8 @@ export abstract class File { try { // Start the search at the offset. this._fileStream.position = startPosition; - let buffer = this.readBlock(File._bufferSize); - for (buffer; buffer.length > 0; buffer = this.readBlock(File._bufferSize)) { + let buffer = this.readBlock(File.BUFFER_SIZE); + for (buffer; buffer.length > 0; buffer = this.readBlock(File.BUFFER_SIZE)) { const location = buffer.find(pattern); if (before) { const beforeLocation = buffer.find(before); @@ -380,7 +389,7 @@ export abstract class File { // Ensure that we always rewind the stream a little so we never have a partial // match where our data exists betweenInclusive the end of read A and the start of read B. - bufferOffset += File._bufferSize - pattern.length; + bufferOffset += File.BUFFER_SIZE - pattern.length; if (before && before.length > pattern.length) { bufferOffset -= before.length - pattern.length; } @@ -454,7 +463,9 @@ export abstract class File { // We need to write out as much as we're replacing, then shuffle the rest to the end // Step 1: Write the number of bytes to replace - this._fileStream.write(data, 0, replace); + if (replace > 0) { + this._fileStream.write(data, 0, replace); + } // Step 2: Resize the file to fit all the new bytes const bytesToAdd = data.length - replace; @@ -537,7 +548,7 @@ export abstract class File { this.mode = FileAccessMode.Write; - const bufferLength = File._bufferSize; + const bufferLength = File.BUFFER_SIZE; let readPosition = start + length; let writePosition = start; let buffer: ByteVector; @@ -578,7 +589,7 @@ export abstract class File { this.mode = FileAccessMode.Read; - if (pattern.length > File._bufferSize) { + if (pattern.length > File.BUFFER_SIZE) { return -1; } @@ -588,7 +599,7 @@ export abstract class File { // Start the search at the offset let bufferOffset = this.length - startPosition; - let readSize = Math.min(bufferOffset, File._bufferSize); + let readSize = Math.min(bufferOffset, File.BUFFER_SIZE); bufferOffset -= readSize; this._fileStream.position = bufferOffset; @@ -601,9 +612,9 @@ export abstract class File { return bufferOffset + location; } - readSize = Math.min(bufferOffset, File._bufferSize); + readSize = Math.min(bufferOffset, File.BUFFER_SIZE); bufferOffset -= readSize; - if (readSize + pattern.length > File._bufferSize) { + if (readSize + pattern.length > File.BUFFER_SIZE) { bufferOffset += pattern.length; } diff --git a/src/flac/flacBlock.ts b/src/flac/flacBlock.ts index 29991b44..389196b5 100644 --- a/src/flac/flacBlock.ts +++ b/src/flac/flacBlock.ts @@ -1,6 +1,6 @@ -import ILazy from "../iLazy"; import {ByteVector} from "../byteVector"; import {File, FileAccessMode} from "../file"; +import {ILazy} from "../interfaces"; import {Guards, NumberUtils} from "../utils"; /** @@ -47,7 +47,7 @@ export enum FlacBlockType { * Represents a FLAC metadata block */ export class FlacBlock implements ILazy { - public static readonly headerSize = 4; + public static readonly HEADER_SIZE = 4; private _blockStart: number; private _data: ByteVector; @@ -58,7 +58,7 @@ export class FlacBlock implements ILazy { // #region Constructors - private constructor() {} + private constructor() { /* private to enforce creation via static constructors */ } /** * Constructs and initializes a new instance, lazily, by reading it from a file. @@ -78,7 +78,7 @@ export class FlacBlock implements ILazy { block._file = file; block._blockStart = position; - const headerBytes = file.readBlock(4).toUInt(); + const headerBytes = file.readBlock(4).toUint(); block._dataSize = NumberUtils.uintAnd(headerBytes, 0x00ffffff); block._isLastBlock = !!NumberUtils.uintAnd(headerBytes, 0x80000000); block._type = NumberUtils.uintAnd(headerBytes, 0x7f000000) >>> 24; @@ -100,7 +100,7 @@ export class FlacBlock implements ILazy { const block = new FlacBlock(); block._type = type; - block._data = data; + block._data = data.toByteVector(); block._dataSize = data.length; block._isLastBlock = false; @@ -156,7 +156,7 @@ export class FlacBlock implements ILazy { * Gets the total size of the block as it appears on disk. This equals the size of the data * plus the size of the header. */ - public get totalSize(): number { return this.dataSize + FlacBlock.headerSize; } + public get totalSize(): number { return this.dataSize + FlacBlock.HEADER_SIZE; } /** * Gets the type of data contained in the current instance. @@ -176,9 +176,9 @@ export class FlacBlock implements ILazy { // Read the data from the file const originalFileMode = this._file.mode; try { - this._file.mode = FileAccessMode.Read - this._file.seek(this._blockStart + FlacBlock.headerSize); - this._data = this._file.readBlock(this._dataSize); + this._file.mode = FileAccessMode.Read; + this._file.seek(this._blockStart + FlacBlock.HEADER_SIZE); + this._data = this._file.readBlock(this._dataSize).toByteVector(); } finally { this._file.mode = originalFileMode; } @@ -202,7 +202,7 @@ export class FlacBlock implements ILazy { ); return ByteVector.concatenate( - ByteVector.fromUInt(header), + ByteVector.fromUint(header), this._data ); } diff --git a/src/flac/flacFile.ts b/src/flac/flacFile.ts index de2f54ee..80c1f241 100644 --- a/src/flac/flacFile.ts +++ b/src/flac/flacFile.ts @@ -2,7 +2,7 @@ import EndTag from "../sandwich/endTag"; import FlacFileSettings from "./flacFileSettings"; import FlacStreamHeader from "./flacStreamHeader"; import FlacTag from "./flacTag"; -import Properties from "../properties"; +import Settings from "../settings"; import StartTag from "../sandwich/startTag"; import XiphComment from "../xiph/xiphComment"; import XiphPicture from "../xiph/xiphPicture"; @@ -11,8 +11,10 @@ import {CorruptFileError} from "../errors"; import {File, FileAccessMode, ReadStyle} from "../file"; import {IFileAbstraction} from "../fileAbstraction"; import {FlacBlock, FlacBlockType} from "./flacBlock"; +import {Properties} from "../properties"; import {ISandwichFile} from "../sandwich/sandwichFile"; import {Tag, TagTypes} from "../tag"; +import {NumberUtils} from "../utils"; /** * This class extends {@link File} to provide tagging and properties for FLAC audio files. @@ -23,7 +25,7 @@ import {Tag, TagTypes} from "../tag"; * {@link FlacFileSettings}. */ export default class FlacFile extends File implements ISandwichFile { - public static readonly fileIdentifier = ByteVector.fromString("fLaC", StringType.Latin1, undefined, true); + public static readonly FILE_IDENTIFIER = ByteVector.fromString("fLaC", StringType.Latin1).makeReadOnly(); private readonly _properties: Properties; private readonly _tag: FlacTag; @@ -56,7 +58,7 @@ export default class FlacFile extends File implements ISandwichFile { const xiphComment = this.readXiphComments(propertiesStyle); this._tag = new FlacTag(startTag, endTag, xiphComment, pictures); - this._tagTypesOnDisk = this._tag.tagTypes; + this.tagTypesOnDisk = this._tag.tagTypes; } finally { this.mode = FileAccessMode.Closed; } @@ -66,12 +68,14 @@ export default class FlacFile extends File implements ISandwichFile { // complete tag information. const allTagTypes = [TagTypes.Xiph, TagTypes.Id3v2, TagTypes.Ape, TagTypes.Id3v1]; for (const tagType of allTagTypes) { - if ((FlacFileSettings.defaultTagTypes & tagType) === 0 || (this._tag.tagTypes & tagType) !== 0) { + const isDefaultTag = NumberUtils.hasFlag(FlacFileSettings.defaultTagTypes, tagType); + const existsAlready = NumberUtils.hasFlag(this._tag.tagTypes, tagType); + if (!isDefaultTag || existsAlready) { continue; } // Desired tag does not exist, create it - this._tag.createTag(tagType, true); + this._tag.createTag(tagType, Settings.copyExistingTagsToNewDefaultTags); } } @@ -148,7 +152,7 @@ export default class FlacFile extends File implements ISandwichFile { let paddingLength: number; if (metadataBytes.length < oldMetadataLength) { // Case 1: New metadata blocks are smaller than old ones. Use remaining space as padding - paddingLength = oldMetadataLength - metadataBytes.length - FlacBlock.headerSize; + paddingLength = oldMetadataLength - metadataBytes.length - FlacBlock.HEADER_SIZE; } else { // Case 2: New metadata block is bigger than (or equal to) old ones. Add standard padding // @TODO: Allow configuring padding length @@ -181,7 +185,7 @@ export default class FlacFile extends File implements ISandwichFile { return pos + b.totalSize; }, this._mediaStartPosition + 4); - this._tagTypesOnDisk = this.tagTypes; + this.tagTypesOnDisk = this.tagTypes; } finally { this.mode = FileAccessMode.Closed; @@ -191,7 +195,7 @@ export default class FlacFile extends File implements ISandwichFile { private readMetadataBlocks(): FlacBlock[] { // Make sure we've got the header at the beginning of the file this.seek(this._mediaStartPosition); - if (ByteVector.notEqual(this.readBlock(4), FlacFile.fileIdentifier)) { + if (!this.readBlock(4).equals(FlacFile.FILE_IDENTIFIER)) { throw new CorruptFileError("FLAC header not found after any starting tags"); } @@ -210,11 +214,11 @@ export default class FlacFile extends File implements ISandwichFile { private readPictures(readStyle: ReadStyle): XiphPicture[] { return this._metadataBlocks.filter((b) => b.type === FlacBlockType.Picture) - .map((b) => XiphPicture.fromFlacBlock(b, (readStyle & ReadStyle.PictureLazy) !== 0)); + .map((b) => XiphPicture.fromFlacBlock(b, NumberUtils.hasFlag(readStyle, ReadStyle.PictureLazy))); } private readProperties(readStyle: ReadStyle): Properties { - if ((readStyle & ReadStyle.Average) === 0) { + if (!NumberUtils.hasFlag(readStyle, ReadStyle.Average)) { return undefined; } @@ -225,17 +229,17 @@ export default class FlacFile extends File implements ISandwichFile { // @TODO: For precise calculation, read the audio frames const lastBlock = this._metadataBlocks[this._metadataBlocks.length - 1]; - const metadataEndPosition = lastBlock.blockStart + lastBlock.dataSize + FlacBlock.headerSize; + const metadataEndPosition = lastBlock.blockStart + lastBlock.dataSize + FlacBlock.HEADER_SIZE; const streamLength = this._mediaEndPosition - metadataEndPosition; const header = new FlacStreamHeader(this._metadataBlocks[0].data, streamLength); return new Properties(header.durationMilliseconds, [header]); } - private readXiphComments(_readStyle: ReadStyle): XiphComment { + private readXiphComments(readStyle: ReadStyle): XiphComment { // Collect all the xiph comments const xiphComments = this._metadataBlocks.filter((b) => b.type === FlacBlockType.XiphComment) - .map((b) => XiphComment.fromData(b.data)); + .map((b) => XiphComment.fromData(b.data, (readStyle & ReadStyle.PictureLazy) !== 0)); // If we don't have any Xiph comments, just return undefined if (xiphComments.length === 0) { @@ -260,7 +264,7 @@ export default class FlacFile extends File implements ISandwichFile { // #endregion } -//////////////////////////////////////////////////////////////////////////// +// ///////////////////////////////////////////////////////////////////////// // Register the file type [ "taglib/flac", diff --git a/src/flac/flacFileSettings.ts b/src/flac/flacFileSettings.ts index 6eb8954d..14d6c617 100644 --- a/src/flac/flacFileSettings.ts +++ b/src/flac/flacFileSettings.ts @@ -6,7 +6,7 @@ import {NumberUtils} from "../utils"; * re-read in order for changes to take effect. */ export default class FlacFileSettings { - public static readonly supportedTagTypes = TagTypes.Id3v1 | TagTypes.Id3v2 | TagTypes.Ape | TagTypes.Xiph; + public static readonly SUPPORTED_TAG_TYPES = TagTypes.Id3v1 | TagTypes.Id3v2 | TagTypes.Ape | TagTypes.Xiph; private static _defaultTagTypes = TagTypes.Xiph; private static _preferApeTagAtFileEnd = true; @@ -19,13 +19,15 @@ export default class FlacFileSettings { public static get defaultTagTypes(): TagTypes { return this._defaultTagTypes; } /** * Sets the default types of tags for an MPEG audio file. When opening a file, if these tag - * types do not exist on the file, they will be created. See {@link supportedTagTypes} for a - * list of tag types that are supported by node-taglib-sharp for MPEG container files. + * types do not exist on the file, they will be created. See {@link SUPPORTED_TAG_TYPES} for a + * list of tag types that are supported by node-taglib-sharp for FLAC files. */ public static set defaultTagTypes(value: TagTypes) { - const unsupportedTagTypes = NumberUtils.uintAnd(value, ~this.supportedTagTypes); + const unsupportedTagTypes = NumberUtils.uintAnd(value, ~this.SUPPORTED_TAG_TYPES); if (unsupportedTagTypes !== 0) { - throw new Error(`Argument error: node-taglib-sharp does not support tag types ${unsupportedTagTypes} for MPEG audio files`); + throw new Error( + `Argument error: node-taglib-sharp does not support tag types ${unsupportedTagTypes} for FLAC files` + ); } this._defaultTagTypes = value; diff --git a/src/flac/flacStreamHeader.ts b/src/flac/flacStreamHeader.ts index 13e9254b..af172012 100644 --- a/src/flac/flacStreamHeader.ts +++ b/src/flac/flacStreamHeader.ts @@ -1,6 +1,6 @@ import {ByteVector} from "../byteVector"; import {CorruptFileError} from "../errors"; -import {ILosslessAudioCodec, MediaTypes} from "../iCodec"; +import {ILosslessAudioCodec, MediaTypes} from "../properties"; import {Guards, NumberUtils} from "../utils"; /** @@ -29,9 +29,9 @@ export default class FlacStreamHeader implements ILosslessAudioCodec { // See https://www.xiph.org/flac/format.html#metadata_block_streaminfo for the details of // how the header is defined // NOTE: We're completely ignoring block/frame size - const int2 = data.mid(8, 4).toUInt(true); - const int3 = data.mid(12, 4).toUInt(true); - const int4 = data.mid(16, 4).toUInt(true); + const int2 = data.subarray(8, 4).toUint(true); + const int3 = data.subarray(12, 4).toUint(true); + const int4 = data.subarray(16, 4).toUint(true); // # of channels is bits 100-103 this._audioChannels = NumberUtils.uintRShift(NumberUtils.uintAnd(int3, 0x0E000000), 25) + 1; diff --git a/src/flac/flacTag.ts b/src/flac/flacTag.ts index 43b56d92..92f6c986 100644 --- a/src/flac/flacTag.ts +++ b/src/flac/flacTag.ts @@ -4,9 +4,9 @@ import FlacFileSettings from "./flacFileSettings"; import StartTag from "../sandwich/startTag"; import XiphComment from "../xiph/xiphComment"; import XiphPicture from "../xiph/xiphPicture"; -import {IPicture} from "../iPicture"; +import {IPicture} from "../picture"; import {Tag, TagTypes} from "../tag"; -import {Guards} from "../utils"; +import {Guards, NumberUtils} from "../utils"; /** * Collection of tags that can be stored in a FLAC file. @@ -16,7 +16,7 @@ import {Guards} from "../utils"; * class provides a unified access into all the tags a FLAC file may contain. */ export default class FlacTag extends CombinedTag { - private static readonly _defaultTagMappingTable = new Map boolean>([ + private static readonly DEFAULT_TAG_LOCATION_MAPPING = new Map boolean>([ [TagTypes.Ape, () => FlacFileSettings.preferApeTagAtFileEnd], [TagTypes.Id3v1, () => true], [TagTypes.Id3v2, () => FlacFileSettings.preferId3v2TagAtFileEnd] @@ -35,7 +35,7 @@ export default class FlacTag extends CombinedTag { * @param flacPictures Optional, array of pictures found in the file */ public constructor(startTag: StartTag, endTag: EndTag, xiphTag: XiphComment, flacPictures: XiphPicture[]) { - super(FlacFileSettings.supportedTagTypes); + super(FlacFileSettings.SUPPORTED_TAG_TYPES, true); Guards.truthy(startTag, "startTag"); Guards.truthy(endTag, "endTag"); @@ -48,53 +48,6 @@ export default class FlacTag extends CombinedTag { this._pictures = flacPictures || []; } - /** @inheritDoc */ - public clear(): void { - this._pictures.splice(0, this._pictures.length); - super.clear(); - } - - /** @inheritDoc */ - public createTag(tagType: TagTypes, copy: boolean): Tag { - this.validateTagCreation(tagType); - - // Create the desired tag - let tag: Tag; - switch (tagType) { - case TagTypes.Xiph: - // XIPH comments we create directly - this._xiphComment = XiphComment.fromEmpty(); - tag = this._xiphComment; - this.addTag(tag); - break; - case TagTypes.Id3v1: - case TagTypes.Id3v2: - case TagTypes.Ape: - // Sandwich tags, we farm out to the start/end tags - const targetTag = FlacTag._defaultTagMappingTable.get(tagType)() ? this._endTag : this._startTag; - tag = targetTag.createTag(tagType, false); - } - - // Copy the contents if desired - if (copy) { - this.copyTo(tag, true); - } - - return tag; - } - - /** @inheritDoc */ - public removeTags(tagTypes: TagTypes): void { - if ((tagTypes & TagTypes.Xiph) !== 0) { - this._xiphComment = undefined; - } - if ((tagTypes & TagTypes.FlacPictures) !== 0) { - this._pictures.splice(0, this._pictures.length); - } - - super.removeTags(tagTypes); - } - // #region Properties /** @@ -138,4 +91,51 @@ export default class FlacTag extends CombinedTag { } // #endregion + + /** @inheritDoc */ + public clear(): void { + this._pictures.splice(0, this._pictures.length); + super.clear(); + } + + /** @inheritDoc */ + public createTag(tagType: TagTypes, copy: boolean): Tag { + this.validateTagCreation(tagType); + + // Create the desired tag + let tag: Tag; + switch (tagType) { + case TagTypes.Xiph: + // XIPH comments we create directly + this._xiphComment = XiphComment.fromEmpty(); + tag = this._xiphComment; + this.addTag(tag); + break; + case TagTypes.Id3v1: + case TagTypes.Id3v2: + case TagTypes.Ape: + // Sandwich tags, we farm out to the start/end tags + const targetTag = FlacTag.DEFAULT_TAG_LOCATION_MAPPING.get(tagType)() ? this._endTag : this._startTag; + tag = targetTag.createTag(tagType, false); + } + + // Copy the contents if desired + if (copy) { + this.copyTo(tag, true); + } + + return tag; + } + + /** @inheritDoc */ + public removeTags(tagTypes: TagTypes): void { + if (NumberUtils.hasFlag(tagTypes, TagTypes.Xiph)) { + this._xiphComment = undefined; + } + if (NumberUtils.hasFlag(tagTypes, TagTypes.FlacPictures)) { + this._pictures.splice(0, this._pictures.length); + } + + super.removeTags(tagTypes); + } } diff --git a/src/genres.ts b/src/genres.ts index 82714f4b..72aa2546 100644 --- a/src/genres.ts +++ b/src/genres.ts @@ -195,7 +195,7 @@ const videoGenres = [ ]; -function stringToByte(text: string, allowParenthesis: boolean): number { +const stringToByte = (text: string, allowParenthesis: boolean): number => { if (allowParenthesis) { const trimRegex = /^\(+|\)+$/g; text = text.replace(trimRegex, ""); diff --git a/src/iCodec.ts b/src/iCodec.ts deleted file mode 100644 index 92a36a3f..00000000 --- a/src/iCodec.ts +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Indicates the types o media represented by a {@link ICodec} or {@link Properties}. These values - * can be combined to represent multiple media types. - */ -export enum MediaTypes { - /** - * No media is present - */ - None = 0, - - /** - * Audio is present - */ - Audio = 1, - - /** - * Video is present - */ - Video = 2, - - /** - * A photo is present - */ - Photo = 4, - - /** - * Text is present - */ - Text = 8, - - /** - * Lossless audio is present. This also implies audio is present. - */ - LosslessAudio = 17 -} - -/** - * Interface that provides basic information common to all media codecs - */ -export interface ICodec { - /** - * Gets a text description of the media represented by the current instance. - */ - description: string; - - /** - * Duration of the media in milliseconds represented by the current instance. - * @TODO Ensure milliseconds is the right way to interpret this field - */ - durationMilliseconds: number; - - /** - * Types of media represented by the current instance, bitwise combined. - */ - mediaTypes: MediaTypes; -} - -/** - * Interface that inherits the common codec information and adds audio-specific information. - * When dealing with an {@link ICodec}, if {@link ICodec.mediaTypes} contains - * {@link MediaTypes.Audio}, it is safe to assume that the object also inherits {@link IAudioCodec} - * and can be recast without issue. - */ -export interface IAudioCodec extends ICodec { - /** - * Bitrate of the audio in kilobits per second represented by the current instance. - */ - audioBitrate: number; - - /** - * Number of channels in the audio represented by the current instance. - */ - audioChannels: number; - - /** - * Sample rate of the audio represented by the current instance. - */ - audioSampleRate: number; -} - -/** - * This interface provides information specific to lossless audio codecs. - * When dealing with an {@link ICodec}, if {@link ICodec.mediaTypes} contains - * {@link MediaTypes.LosslessAudio}, it is safe to assume that the object also inherits - * {@link ILosslessAudioCodec} and can be recast without issue. - */ -export interface ILosslessAudioCodec extends IAudioCodec { - /** - * Number of bits per sample in the audio represented by the current instance. - */ - bitsPerSample: number; -} - -/** - * Interface that inherits the common codec information and adds video-specific information. - * When dealing with an {@link ICodec}, if {@link ICodec.mediaTypes} contains - * {@link MediaTypes.Video}, it is safe to assume that the object also inherits {@link IVideoCodec} - * and can be recast without issue. - */ -export interface IVideoCodec extends ICodec { - /** - * Height of the video in pixels represented by the current instance. - */ - videoHeight: number; - - /** - * Width of the video in pixels represented by the current instance. - */ - videoWidth: number; -} - -/** - * Interface that inherits the common codec information and adds photo-specific information. - * When dealing with an {@link ICodec}, if {@link ICodec.mediaTypes} contains - * {@link MediaTypes.Photo}, it is safe to assume that the object also inherits {@link IPhotoCodec} - * and can be recast without issue. - */ -export interface IPhotoCodec extends ICodec { - /** - * Height of the photo in pixels represented by the current instance. - */ - photoHeight: number; - - /** - * Format-specific quality indicator of the photo represented by the current instance. - * A value of `0` means there was no quality indicator for the format or file. - */ - photoQuality: number; - - /** - * Width of the photo in pixels represented by the current instance. - */ - photoWidth: number; -} diff --git a/src/iLazy.ts b/src/iLazy.ts deleted file mode 100644 index d30e687d..00000000 --- a/src/iLazy.ts +++ /dev/null @@ -1,4 +0,0 @@ -export default interface ILazy { - isLoaded: boolean; - load(): void; -} diff --git a/src/iPicture.ts b/src/iPicture.ts deleted file mode 100644 index e3412dce..00000000 --- a/src/iPicture.ts +++ /dev/null @@ -1,147 +0,0 @@ -import {ByteVector} from "./byteVector"; - -/** - * The type of content appearing in an {@link IPicture} instance. - */ -export enum PictureType { - /** - * @summary The picture is of a type other than those specified. - */ - Other = 0x00, - - /** - * @summary The picture is a 32x32 PNG image that should be used when displaying the file in a browser. - */ - FileIcon = 0x01, - - /** - * @summary The picture is of an icon different from {@link FileIcon} - */ - OtherFileIcon = 0x02, - - /** - * @summary The picture is of the front cover of the album. - */ - FrontCover = 0x03, - - /** - * @summary The picture is of the back cover of the album. - */ - BackCover = 0x04, - - /** - * @summary The picture is of a leaflet page including with the album. - */ - LeafletPage = 0x05, - - /** - * @summary The picture is of the album or disc itself. - */ - Media = 0x06, - - /** - * @summary The picture is of the lead artist or soloist. - */ - LeadArtist = 0x07, - - /** - * @summary The picture is of the artist or performer. - */ - Artist = 0x08, - - /** - * @summary The picture is of the conductor. - */ - Conductor = 0x09, - - /** - * @summary The picture is of the band or orchestra. - */ - Band = 0x0A, - - /** - * @summary The picture is of the composer. - */ - Composer = 0x0B, - - /** - * @summary The picture is of the lyricist or text writer. - */ - Lyricist = 0x0C, - - /** - * @summary The picture is of the recording location or studio. - */ - RecordingLocation = 0x0D, - - /** - * @summary The picture is one taken during the track's recording. - */ - DuringRecording = 0x0E, - - /** - * @summary The picture is one taken during the track's performance. - */ - DuringPerformance = 0x0F, - - /** - * @summary The picture is a capture from a movie screen. - */ - MovieScreenCapture = 0x10, - - /** - * @summary The picture is of a large, colored fish. - */ - ColoredFish = 0x11, - - /** - * @summary The picture is an illustration related to the track. - */ - Illustration = 0x12, - - /** - * @summary The picture contains the logo of the band or performer. - */ - BandLogo = 0x13, - - /** - * @summary The picture is the logo of the publisher or record - */ - PublisherLogo = 0x14, - - /** - * @summary In fact, this is not a Picture, but another file-type. - */ - NotAPicture = 0xff -} - -/** - * Interface that provides generic information about a picture, including its contents, as used by - * various formats. - */ -export interface IPicture { - /** - * Gets and sets the mime-type of the picture data stored in the current instance. - */ - mimeType: string; - - /** - * Gets and sets the type of the content visible in the picture stored in the current instance. - */ - type: PictureType; - - /** - * Gets and sets a filename of the picture stored in the current instance. Optional. - */ - filename: string; - - /** - * Gets and sets a description of the picture stored in the current instance. Optional. - */ - description: string; - - /** - * Gets and sets the picture data stored in the current instance. - */ - data: ByteVector; -} diff --git a/src/id3v1/id3v1Tag.ts b/src/id3v1/id3v1Tag.ts index 33c5596a..298149dd 100644 --- a/src/id3v1/id3v1Tag.ts +++ b/src/id3v1/id3v1Tag.ts @@ -11,15 +11,19 @@ import {Guards} from "../utils"; export default class Id3v1Tag extends Tag { // #region Member Fields + private static readonly COMMENT_LENGTH = 28; + private static readonly TITLE_ARTIST_ALBUM_LENGTH = 30; + private static readonly YEAR_LENGTH = 4; + /** * Identifier used to recognize an ID3v1 tag. */ - public static readonly fileIdentifier = ByteVector.fromString("TAG", StringType.UTF8); + public static readonly FILE_IDENTIFIER = ByteVector.fromString("TAG", StringType.UTF8); /** * Size of an ID3v1 tag. */ - public static readonly size = 128; + public static readonly TOTAL_SIZE = 128; private _album: string; private _artist: string; @@ -42,7 +46,7 @@ export default class Id3v1Tag extends Tag { // Some initial sanity checking Guards.truthy(data, "data"); - if (!data.startsWith(Id3v1Tag.fileIdentifier)) { + if (!data.startsWith(Id3v1Tag.FILE_IDENTIFIER)) { throw new CorruptFileError("Id3v1 data does not start with identifier"); } @@ -68,14 +72,14 @@ export default class Id3v1Tag extends Tag { file.mode = FileAccessMode.Read; - if (position > file.length - Id3v1Tag.size) { + if (position > file.length - Id3v1Tag.TOTAL_SIZE) { throw new Error("Argument out of range: position must be less than the length of the file"); } file.seek(position); // Read the tag, it's always 128 bytes - const data = file.readBlock(Id3v1Tag.size); + const data = file.readBlock(Id3v1Tag.TOTAL_SIZE); return new Id3v1Tag(data); } @@ -86,17 +90,17 @@ export default class Id3v1Tag extends Tag { * Renders the current instance as a raw ID3v1 tag. */ public render(): ByteVector { - const data = ByteVector.empty(); - data.addByteVector(Id3v1Tag.fileIdentifier); - data.addByteVector(ByteVector.fromString(this._title || "", StringType.Latin1).resize(30)); - data.addByteVector(ByteVector.fromString(this._artist || "", StringType.Latin1).resize(30)); - data.addByteVector(ByteVector.fromString(this._album || "", StringType.Latin1).resize(30)); - data.addByteVector(ByteVector.fromString(this._year || "", StringType.Latin1).resize(4)); - data.addByteVector(ByteVector.fromString(this._comment || "", StringType.Latin1).resize(28)); - data.addByte(0x00); - data.addByte(this._track); - data.addByte(this._genre); - return data; + return ByteVector.concatenate( + Id3v1Tag.FILE_IDENTIFIER, + ... Id3v1Tag.renderField(this._title, Id3v1Tag.TITLE_ARTIST_ALBUM_LENGTH), + ... Id3v1Tag.renderField(this._artist, Id3v1Tag.TITLE_ARTIST_ALBUM_LENGTH), + ... Id3v1Tag.renderField(this._album, Id3v1Tag.TITLE_ARTIST_ALBUM_LENGTH), + ... Id3v1Tag.renderField(this._year, Id3v1Tag.YEAR_LENGTH), + ... Id3v1Tag.renderField(this._comment, Id3v1Tag.COMMENT_LENGTH), + 0x00, + this._track, + this._genre + ); } // #region Tag Overrides @@ -105,7 +109,7 @@ export default class Id3v1Tag extends Tag { public get tagTypes(): TagTypes { return TagTypes.Id3v1; } /** @inheritDoc */ - public get sizeOnDisk(): number { return Id3v1Tag.size; } + public get sizeOnDisk(): number { return Id3v1Tag.TOTAL_SIZE; } /** @inheritDoc */ public get title(): string { return this._title || undefined; } @@ -171,7 +175,8 @@ export default class Id3v1Tag extends Tag { * the property being zeroed. */ public set year(value: number) { - this._year = Number.isSafeInteger(value) && value > 0 && value < 10000 ? value.toString(10) : ""; + Guards.uint(value, "value"); + this._year = value < 10000 ? value.toString(10) : ""; } /** @inheritDoc */ @@ -182,7 +187,8 @@ export default class Id3v1Tag extends Tag { * the property being zeroed. */ public set track(value: number) { - this._track = Number.isSafeInteger(value) && value > 0 && value < 256 ? value : 0; + Guards.uint(value, "value"); + this._track = value < 256 ? value : 0; } /** @inheritDoc */ @@ -201,10 +207,10 @@ export default class Id3v1Tag extends Tag { // #region Private Helpers private parse(data: ByteVector): void { - this._title = Id3v1Tag.parseString(data.mid(3, 30)); - this._artist = Id3v1Tag.parseString(data.mid(33, 30)); - this._album = Id3v1Tag.parseString(data.mid(63, 30)); - this._year = Id3v1Tag.parseString(data.mid(93, 4)); + this._title = Id3v1Tag.parseString(data.subarray(3, Id3v1Tag.TITLE_ARTIST_ALBUM_LENGTH)); + this._artist = Id3v1Tag.parseString(data.subarray(33, Id3v1Tag.TITLE_ARTIST_ALBUM_LENGTH)); + this._album = Id3v1Tag.parseString(data.subarray(63, Id3v1Tag.TITLE_ARTIST_ALBUM_LENGTH)); + this._year = Id3v1Tag.parseString(data.subarray(93, Id3v1Tag.YEAR_LENGTH)); // Check for ID3v1.1 // NOTE: ID3v1 does not support "track zero", this is not a bug in TagLib. Since a zeroed @@ -212,10 +218,10 @@ export default class Id3v1Tag extends Tag { // string, a value of zero must be assumed to be just that. if (data.get(125) === 0 && data.get(126) !== 0) { // ID3v1.1 detected - this._comment = Id3v1Tag.parseString(data.mid(97, 28)); + this._comment = Id3v1Tag.parseString(data.subarray(97, Id3v1Tag.COMMENT_LENGTH)); this._track = data.get(126); } else { - this._comment = Id3v1Tag.parseString(data.mid(97, 30)); + this._comment = Id3v1Tag.parseString(data.subarray(97, Id3v1Tag.TITLE_ARTIST_ALBUM_LENGTH)); this._track = 0; } @@ -225,12 +231,21 @@ export default class Id3v1Tag extends Tag { private static parseString(data: ByteVector): string { Guards.truthy(data, "data"); - const output = data.toString(undefined, StringType.Latin1).trim(); + const output = data.toString(StringType.Latin1).trim(); const i = output.indexOf("\0"); return i >= 0 ? output.substring(0, i) : output; } + private static renderField(value: string, maxLength: number): ByteVector[] { + const valueToWrite = value?.substring(0, maxLength) || ""; + const remainingBytes = maxLength - valueToWrite.length; + return [ + ByteVector.fromString(valueToWrite, StringType.Latin1), + remainingBytes > 0 ? ByteVector.fromSize(remainingBytes) : undefined + ]; + } + // #endregion } diff --git a/src/id3v2/frameIdentifiers.ts b/src/id3v2/frameIdentifiers.ts index 5b9150a5..d1dd34d5 100644 --- a/src/id3v2/frameIdentifiers.ts +++ b/src/id3v2/frameIdentifiers.ts @@ -1,6 +1,5 @@ import {ByteVector, StringType} from "../byteVector"; import {NotSupportedError} from "../errors"; -import {Guards} from "../utils"; /** * @summary Represents the identifier of a frame, depending on the version this may be 3 or 4 @@ -18,55 +17,71 @@ import {Guards} from "../utils"; * compare instances because they should always be the same. */ export class FrameIdentifier { - private versionTable: {[key: number]: ByteVector} = { - 2: undefined, - 3: undefined, - 4: undefined - }; + private readonly _version2: ByteVector; + private readonly _version3: ByteVector; + private readonly _version4: ByteVector public constructor(v4: string, v3: string, v2: string) { - this.versionTable[4] = v4 - ? ByteVector.fromString(v4, StringType.Latin1, undefined, true) + if (!v4 && !v3 && !v2) { + throw new Error("A frame identifier for at least one ID3v2 version must be supplied"); + } + + this._version4 = v4 + ? ByteVector.fromString(v4, StringType.Latin1).makeReadOnly() : undefined; - this.versionTable[3] = v3 - ? (v3 === v4 ? this.versionTable[4] : ByteVector.fromString(v3, StringType.Latin1, undefined, true)) + this._version3 = v3 + ? (v3 === v4 ? this._version4 : ByteVector.fromString(v3, StringType.Latin1).makeReadOnly()) : undefined; - this.versionTable[2] = v2 - ? ByteVector.fromString(v2, StringType.Latin1, undefined, true) + this._version2 = v2 + ? ByteVector.fromString(v2, StringType.Latin1).makeReadOnly() : undefined; } public get isTextFrame(): boolean { - const T = "T".codePointAt(0); - return (this.versionTable[2] && this.versionTable[2].get(0) === T) - || (this.versionTable[3] && this.versionTable[3].get(0) === T) - || (this.versionTable[4] && this.versionTable[4].get(0) === T); + const t = 0x54; // T + return (this._version2?.get(0) === t) + || (this._version3?.get(0) === t) + || (this._version4?.get(0) === t); } public get isUrlFrame(): boolean { - const W = "W".codePointAt(0); - return (this.versionTable[2] && this.versionTable[2].get(0) === W) - || (this.versionTable[3] && this.versionTable[3].get(0) === W) - || (this.versionTable[4] && this.versionTable[4].get(0) === W); + const w = 0x57; // W + return (this._version2?.get(0) === w) + || (this._version3?.get(0) === w) + || (this._version4?.get(0) === w); } public render(version: number): ByteVector { - Guards.byte(version, "version"); - Guards.betweenInclusive(version, 2, 4, "version"); - if (!this.versionTable[version]) { - const newest = this.versionTable[4] || this.versionTable[3] || this.versionTable[2]; - throw new NotSupportedError(`Frame ${newest} is not supported in ID3v2 version ${version}`); + let bytesForVersion; + switch (version) { + case 2: + bytesForVersion = this._version2; + break; + case 3: + bytesForVersion = this._version3; + break; + case 4: + bytesForVersion = this._version4; + break; + default: + throw new Error("Argument error: version must be a value between 2 and 4"); } - return ByteVector.fromByteVector(this.versionTable[version]); + if (!bytesForVersion) { + throw new NotSupportedError(`Frame ${this.toString()} is not supported in ID3v2 version ${version}`); + } + + return bytesForVersion; } public toString(): string { - const newest = this.versionTable[4] || this.versionTable[3] || this.versionTable[2]; - return newest.toString(); + const newest = this._version4 || this._version3 || this._version2; + return newest.toString(StringType.Latin1); } } +/* eslint-disable @typescript-eslint/naming-convention */ + // Pre-create the unique identifiers const uniqueFrameIdentifiers: {[key: string]: FrameIdentifier} = { AENC: new FrameIdentifier("AENC", "AENC", "CRA"), // Audio encryption diff --git a/src/id3v2/frames/attachmentFrame.ts b/src/id3v2/frames/attachmentFrame.ts index b0a4033c..643b1159 100644 --- a/src/id3v2/frames/attachmentFrame.ts +++ b/src/id3v2/frames/attachmentFrame.ts @@ -1,14 +1,12 @@ import Id3v2Settings from "../id3v2Settings"; -import Picture from "../../picture"; -import PictureLazy from "../../pictureLazy"; import {ByteVector, StringType} from "../../byteVector"; import {CorruptFileError} from "../../errors"; +import {IFileAbstraction} from "../../fileAbstraction"; import {Frame, FrameClassType} from "./frame"; import {Id3v2FrameHeader} from "./frameHeader"; import {FrameIdentifiers} from "../frameIdentifiers"; -import {IPicture, PictureType} from "../../iPicture"; +import {IPicture, Picture, PictureLazy, PictureType} from "../../picture"; import {Guards} from "../../utils"; -import {IFileAbstraction} from "../../fileAbstraction"; export default class AttachmentFrame extends Frame implements IPicture { // NOTE: It probably doesn't look necessary to implement IPicture, but it makes converting a @@ -227,8 +225,8 @@ export default class AttachmentFrame extends Frame implements IPicture { const frameId = value === PictureType.NotAPicture ? FrameIdentifiers.GEOB : FrameIdentifiers.APIC; - if (this._header.frameId !== frameId) { - this._header = new Id3v2FrameHeader(frameId); + if (this.header.frameId !== frameId) { + this.header = new Id3v2FrameHeader(frameId); } this._type = value; @@ -241,7 +239,7 @@ export default class AttachmentFrame extends Frame implements IPicture { /** @inheritDoc */ public clone(): Frame { const frame = new AttachmentFrame(new Id3v2FrameHeader(this.frameId)); - frame._data = this._data ? ByteVector.fromByteVector(this._data) : undefined; + frame._data = this._data?.toByteVector(); frame._description = this._description; frame._encoding = this._encoding; frame._filename = this._filename; @@ -301,51 +299,50 @@ export default class AttachmentFrame extends Frame implements IPicture { this._rawVersion = version; } - protected renderFields(version: number) { + protected renderFields(version: number): ByteVector { this.parseFromRaw(); const encoding = AttachmentFrame.correctEncoding(this.textEncoding, version); - const data = ByteVector.empty(); + let data; if (this.frameId === FrameIdentifiers.APIC) { // Render an ID3v2 attached picture - data.addByte(encoding); - + let extensionData; if (version === 2) { let ext = Picture.getExtensionFromMimeType(this.mimeType); ext = ext && ext.length >= 3 ? ext.substring(ext.length - 3).toUpperCase() : "XXX"; - data.addByteVector(ByteVector.fromString(ext)); + extensionData = ByteVector.fromString(ext, StringType.Latin1); } else { - data.addByteVector(ByteVector.fromString(this.mimeType, StringType.Latin1)); - data.addByteVector(ByteVector.getTextDelimiter(StringType.Latin1)); + extensionData = ByteVector.concatenate( + ByteVector.fromString(this.mimeType, StringType.Latin1), + ByteVector.getTextDelimiter(StringType.Latin1) + ); } - data.addByte(this._type); - data.addByteVector(ByteVector.fromString(this.description, encoding)); - data.addByteVector(ByteVector.getTextDelimiter(encoding)); + data = ByteVector.concatenate( + encoding, + extensionData, + this._type, + ByteVector.fromString(this.description, encoding), + ByteVector.getTextDelimiter(encoding), + this._data + ); } else if (this.frameId === FrameIdentifiers.GEOB) { // Make an ID3v2 general encapsulated object - data.addByte(encoding); - - if (this.mimeType) { - data.addByteVector(ByteVector.fromString(this.mimeType, StringType.Latin1)); - } - data.addByteVector(ByteVector.getTextDelimiter(StringType.Latin1)); - - if (this._filename) { - data.addByteVector(ByteVector.fromString(this._filename, encoding)); - } - data.addByteVector(ByteVector.getTextDelimiter(encoding)); - - if (this.description) { - data.addByteVector(ByteVector.fromString(this.description, encoding)); - } - data.addByteVector(ByteVector.getTextDelimiter(encoding)); + data = ByteVector.concatenate( + encoding, + this._mimeType ? ByteVector.fromString(this._mimeType, StringType.Latin1) : undefined, + ByteVector.getTextDelimiter(StringType.Latin1), + this._filename ? ByteVector.fromString(this._filename, encoding) : undefined, + ByteVector.getTextDelimiter(encoding), + this._description ? ByteVector.fromString(this._description, encoding) : undefined, + ByteVector.getTextDelimiter(encoding), + this._data + ); } else { throw new Error("Invalid operation: Bad frame type"); } - data.addByteVector(this._data); return data; } @@ -354,7 +351,7 @@ export default class AttachmentFrame extends Frame implements IPicture { this.parseFromRawData(false); } else if (this._rawPicture) { if (this._rawVersion !== undefined) { - this._rawData = this._rawPicture.data; + this._rawData = this._rawPicture.data.toByteVector(); this._rawPicture = undefined; this.parseFromRawData(true); } else { @@ -375,6 +372,7 @@ export default class AttachmentFrame extends Frame implements IPicture { const delim = ByteVector.getTextDelimiter(this._encoding); let descriptionEndIndex; + // @TODO: Maybe make two different classes? if (this.frameId === FrameIdentifiers.APIC) { // Retrieve an ID3v2 attached picture if (this._rawVersion > 2) { @@ -383,39 +381,42 @@ export default class AttachmentFrame extends Frame implements IPicture { // Picture type $xx // Description $00 (00) // Picture data - const mimeTypeEndIndex = data.find(ByteVector.getTextDelimiter(StringType.Latin1), 1); - if (mimeTypeEndIndex === -1) { + const mimeTypeEndIndex = data.offsetFind(ByteVector.getTextDelimiter(StringType.Latin1), 1); + if (mimeTypeEndIndex < 0) { return; } const mimeTypeLength = mimeTypeEndIndex - 1; - this._mimeType = data.toString(mimeTypeLength, StringType.Latin1, 1); + this._mimeType = data.subarray(1, mimeTypeLength).toString(StringType.Latin1); this._type = data.get(mimeTypeEndIndex + 1); - descriptionEndIndex = data.find(delim, mimeTypeEndIndex + 2, delim.length); + descriptionEndIndex = data.offsetFind(delim, mimeTypeEndIndex + 2, delim.length); + if (descriptionEndIndex < 0) { + return; + } + const descriptionLength = descriptionEndIndex - mimeTypeEndIndex - 2; - this._description = data.toString( - descriptionLength, - this._encoding, - mimeTypeEndIndex + 2 - ); + this._description = data.subarray(mimeTypeEndIndex + 2, descriptionLength).toString(this._encoding); } else { // Text encoding $xx // Image format $xx xx xx // Picture type $xx // Description $00 (00) // Picture data - const imageFormat = data.toString(3, StringType.Latin1, 1); + const imageFormat = data.subarray(1, 3).toString(StringType.Latin1); this._mimeType = Picture.getMimeTypeFromFilename(imageFormat); this._type = data.get(4); - descriptionEndIndex = data.find(delim, 5, delim.length); + descriptionEndIndex = data.offsetFind(delim, 5, delim.length); + if (descriptionEndIndex < 0) { + return; + } const descriptionLength = descriptionEndIndex - 5; - this._description = data.toString(descriptionLength, this._encoding, 5); + this._description = data.subarray(5, descriptionLength).toString(this._encoding); } - this._data = data.mid(descriptionEndIndex + delim.length); + this._data = data.subarray(descriptionEndIndex + delim.length).toByteVector(); } else if (this.frameId === FrameIdentifiers.GEOB) { // Retrieve an ID3v2 generic encapsulated object // Text encoding $xx @@ -428,17 +429,20 @@ export default class AttachmentFrame extends Frame implements IPicture { return; } const mimeTypeLength = mimeTypeEndIndex - 1; - this._mimeType = data.toString(mimeTypeLength, StringType.Latin1, 1); + this._mimeType = data.subarray(1, mimeTypeLength) + .toString(StringType.Latin1); - const filenameEndIndex = data.find(delim, mimeTypeEndIndex + 1, delim.length); + const filenameEndIndex = data.offsetFind(delim, mimeTypeEndIndex + 1, delim.length); const filenameLength = filenameEndIndex - mimeTypeEndIndex - 1; - this._filename = data.toString(filenameLength, this._encoding, mimeTypeEndIndex + 1); + this._filename = data.subarray(mimeTypeEndIndex + 1, filenameLength) + .toString(this._encoding); - descriptionEndIndex = data.find(delim, filenameEndIndex + delim.length, delim.length); + descriptionEndIndex = data.offsetFind(delim, filenameEndIndex + delim.length, delim.length); const descriptionLength = descriptionEndIndex - filenameEndIndex - delim.length; - this._description = data.toString(descriptionLength, this._encoding, filenameEndIndex + delim.length); + this._description = data.subarray(filenameEndIndex + delim.length, descriptionLength) + .toString(this._encoding); - this._data = data.mid(descriptionEndIndex + delim.length); + this._data = data.subarray(descriptionEndIndex + delim.length).toByteVector(); this._type = PictureType.NotAPicture; } else { // Unsupported @@ -452,18 +456,18 @@ export default class AttachmentFrame extends Frame implements IPicture { this._rawPicture = undefined; // Bring over values from the picture - this._data = ByteVector.fromByteVector(picture.data); + this._data = picture.data.toByteVector(); this._description = picture.description; this._filename = picture.filename; this._mimeType = picture.mimeType; this._type = picture.type; - this._header.frameSize = this._data.length; + this.header.frameSize = this._data.length; this._encoding = Id3v2Settings.defaultEncoding; // Switch the frame ID if we discovered the attachment isn't an image if (this._type === PictureType.NotAPicture) { - this._header.frameId = FrameIdentifiers.GEOB; + this.header.frameId = FrameIdentifiers.GEOB; } } } diff --git a/src/id3v2/frames/commentsFrame.ts b/src/id3v2/frames/commentsFrame.ts index f4e481c5..6de1a31f 100644 --- a/src/id3v2/frames/commentsFrame.ts +++ b/src/id3v2/frames/commentsFrame.ts @@ -124,7 +124,7 @@ export default class CommentsFrame extends Frame { /** * Gets the comment text stored in the current instance, or empty string if not set. */ - public get text() { return this._text || ""; } + public get text(): string { return this._text || ""; } /** * Sets the comment text stored in the current instance. * @param value Comment text to store @@ -249,17 +249,17 @@ export default class CommentsFrame extends Frame { return this.text; } - protected parseFields(data: ByteVector, _version: number): void { + protected parseFields(data: ByteVector): void { if (data.length < 4) { throw new CorruptFileError("Not enough bytes in field"); } this.textEncoding = data.get(0); - this._language = data.toString(3, StringType.Latin1, 1); + this._language = data.subarray(1, 3).toString(StringType.Latin1); // Instead of splitting into two strings, in the format [{desc}\0{value}], try splitting // into three strings in case of a malformatted [{desc}\0{value}\0]. - const split = data.toStrings(this.textEncoding, 4, 3); + const split = data.subarray(4).toStrings(this.textEncoding, 3); if (split.length === 0) { // No data in the frame. @@ -277,12 +277,12 @@ export default class CommentsFrame extends Frame { protected renderFields(version: number): ByteVector { const encoding = Frame.correctEncoding(this.textEncoding, version); - const v = ByteVector.empty(); - v.addByte(encoding); - v.addByteVector(ByteVector.fromString(this.language, StringType.Latin1)); - v.addByteVector(ByteVector.fromString(this.description, encoding)); - v.addByteVector(ByteVector.getTextDelimiter(encoding)); - v.addByteVector(ByteVector.fromString(this.text, encoding)); - return v; + return ByteVector.concatenate( + encoding, + ByteVector.fromString(this.language, StringType.Latin1), + ByteVector.fromString(this.description, encoding), + ByteVector.getTextDelimiter(encoding), + ByteVector.fromString(this.text, encoding) + ); } } diff --git a/src/id3v2/frames/eventTimeCodeFrame.ts b/src/id3v2/frames/eventTimeCodeFrame.ts index 48a33d87..87c665a2 100644 --- a/src/id3v2/frames/eventTimeCodeFrame.ts +++ b/src/id3v2/frames/eventTimeCodeFrame.ts @@ -88,7 +88,7 @@ export class EventTimeCodeFrame extends Frame { offset: number, header: Id3v2FrameHeader, version: number - ) { + ): EventTimeCodeFrame { Guards.truthy(data, "data"); Guards.uint(offset, "offset"); Guards.truthy(header, "header"); @@ -105,7 +105,7 @@ export class EventTimeCodeFrame extends Frame { * @param data Raw representation of the new frame * @param version ID3v2 version the raw frame is encoded with, must be a positive 8-bit integer */ - public static fromRawData(data: ByteVector, version: number) { + public static fromRawData(data: ByteVector, version: number): EventTimeCodeFrame { Guards.truthy(data, "data"); Guards.byte(version, "version"); @@ -146,14 +146,14 @@ export class EventTimeCodeFrame extends Frame { /** @inheritDoc */ public clone(): Frame { - const frame = new EventTimeCodeFrame(this._header); + const frame = new EventTimeCodeFrame(this.header); frame.timestampFormat = this.timestampFormat; frame.events = this.events.map((i) => i.clone()); return frame; } /** @inheritDoc */ - protected parseFields(data: ByteVector, _version: number): void { + protected parseFields(data: ByteVector): void { this._events = []; this._timestampFormat = data.get(0); @@ -173,7 +173,7 @@ export class EventTimeCodeFrame extends Frame { } /** @inheritDoc */ - protected renderFields(_version: number): ByteVector { + protected renderFields(): ByteVector { // Docs state event codes must be sorted chronologically const events = this.events.sort((a, b) => a.time - b.time) .map((e) => e.render()); diff --git a/src/id3v2/frames/frame.ts b/src/id3v2/frames/frame.ts index 330950c7..f432a0bb 100644 --- a/src/id3v2/frames/frame.ts +++ b/src/id3v2/frames/frame.ts @@ -1,11 +1,10 @@ import Id3v2Settings from "../id3v2Settings"; import SyncData from "../syncData"; import {ByteVector, StringType} from "../../byteVector"; -import {CorruptFileError} from "../../errors"; +import {CorruptFileError, NotImplementedError} from "../../errors"; import {Id3v2FrameFlags, Id3v2FrameHeader} from "./frameHeader"; -import {Guards} from "../../utils"; -import {NotImplementedError} from "../../errors"; import {FrameIdentifier} from "../frameIdentifiers"; +import {Guards, NumberUtils} from "../../utils"; export enum FrameClassType { AttachmentFrame, @@ -30,9 +29,8 @@ export enum FrameClassType { export abstract class Frame { // #region Member Variables - protected _header: Id3v2FrameHeader; - private _encryptionId: number; + private _header: Id3v2FrameHeader; private _groupId: number; // #endregion @@ -53,7 +51,7 @@ export abstract class Frame { * `undefined` if not set. */ public get encryptionId(): number | undefined { - return (this.flags & Id3v2FrameFlags.Encryption) !== 0 + return NumberUtils.hasFlag(this.flags, Id3v2FrameFlags.Encryption) ? this._encryptionId : undefined; } @@ -83,6 +81,18 @@ export abstract class Frame { */ public set flags(value: Id3v2FrameFlags) { this._header.flags = value; } + /** + * Gets the header for the frame. For new frames this should not exist. + * @protected + */ + protected get header(): Id3v2FrameHeader { return this._header; } + /** + * Sets the header for the frame. + * @param value Header for the frame + * @protected + */ + protected set header(value: Id3v2FrameHeader) { this._header = value; } + public abstract get frameClassType(): FrameClassType; /** @@ -97,7 +107,7 @@ export abstract class Frame { * `undefined` if not set. */ public get groupId(): number | undefined { - return (this.flags & Id3v2FrameFlags.GroupingIdentity) !== 0 + return NumberUtils.hasFlag(this.flags, Id3v2FrameFlags.GroupingIdentity) ? this._groupId : undefined; } @@ -137,12 +147,12 @@ export abstract class Frame { * Renders the current instance, encoded in a specified ID3v2 version. * @param version Version of ID3v2 to use when encoding the current instance */ - public render(version: number) { + public render(version: number): ByteVector { Guards.byte(version, "version"); // Remove flags that are not supported by older versions of ID3v2 if (version < 4) { - const v4Flags = Id3v2FrameFlags.DataLengthIndicator | Id3v2FrameFlags.Desynchronized; + const v4Flags = Id3v2FrameFlags.DataLengthIndicator | Id3v2FrameFlags.Unsynchronized; this.flags &= ~(v4Flags); } if (version < 3) { @@ -155,7 +165,7 @@ export abstract class Frame { this.flags &= ~(v3Flags); } - const fieldData = this.renderFields(version); + let fieldData = this.renderFields(version); // If we don't have any content, don't render anything. This will cause the frame to not be // rendered @@ -163,35 +173,42 @@ export abstract class Frame { return ByteVector.empty(); } - const frontData = ByteVector.empty(); - - if ((this.flags & (Id3v2FrameFlags.Compression | Id3v2FrameFlags.DataLengthIndicator)) !== 0) { - frontData.addByteVector(ByteVector.fromUInt(fieldData.length)); + const frontData: Array = []; + if (NumberUtils.hasFlag(this.flags, (Id3v2FrameFlags.Compression | Id3v2FrameFlags.DataLengthIndicator))) { + frontData.push(ByteVector.fromUint(fieldData.length)); } - if ((this.flags & Id3v2FrameFlags.GroupingIdentity) !== 0) { - frontData.addByte(this._groupId); + if (NumberUtils.hasFlag(this.flags, Id3v2FrameFlags.GroupingIdentity)) { + frontData.push(this._groupId); } - if ((this.flags & Id3v2FrameFlags.Encryption) !== 0) { - frontData.addByte(this._encryptionId); + if (NumberUtils.hasFlag(this.flags, Id3v2FrameFlags.Encryption)) { + frontData.push(this._encryptionId); } - // @FIXME: Implement compression - if ((this.flags & Id3v2FrameFlags.Compression) !== 0) { + // @TODO: Implement compression + if (NumberUtils.hasFlag(this.flags, Id3v2FrameFlags.Compression)) { throw new NotImplementedError("Compression is not yet supported"); } - // @FIXME: Implement encryption - if ((this.flags & Id3v2FrameFlags.Encryption) !== 0) { + // @TODO: Implement encryption + if (NumberUtils.hasFlag(this.flags, Id3v2FrameFlags.Encryption)) { throw new NotImplementedError("Encryption is not yet supported"); } - if ((this.flags & Id3v2FrameFlags.Desynchronized) !== 0) { - SyncData.unsyncByteVector(fieldData); - } - if (frontData.length > 0) { - fieldData.insertByteVector(0, frontData); + if (NumberUtils.hasFlag(this.flags, Id3v2FrameFlags.Unsynchronized)) { + fieldData = SyncData.unsyncByteVector(fieldData); } - this._header.frameSize = fieldData.length; + // Update the header size with the size of the rendered bytes and any "front" data + const frontDataSize = frontData.reduce( + (accum, e) => { + accum += e instanceof ByteVector ? e.length : 1; + return accum; + }, + 0 + ); + this._header.frameSize = fieldData.length + frontDataSize; + + return ByteVector.concatenate( this._header.render(version), + ...frontData, fieldData ); } @@ -237,12 +254,12 @@ export abstract class Frame { let dataOffset = offset + (dataIncludesHeader ? Id3v2FrameHeader.getSize(version) : 0); let dataLength = this.size; - if ((this.flags & (Id3v2FrameFlags.Compression | Id3v2FrameFlags.DataLengthIndicator)) !== 0) { + if (NumberUtils.hasFlag(this.flags, (Id3v2FrameFlags.Compression | Id3v2FrameFlags.DataLengthIndicator))) { dataOffset += 4; dataLength -= 4; } - if ((this.flags & Id3v2FrameFlags.GroupingIdentity) !== 0) { + if (NumberUtils.hasFlag(this.flags, Id3v2FrameFlags.GroupingIdentity)) { if (frameData.length <= dataOffset) { throw new CorruptFileError("Frame data incomplete"); } @@ -250,7 +267,7 @@ export abstract class Frame { dataLength--; } - if ((this.flags & Id3v2FrameFlags.Encryption) !== 0) { + if (NumberUtils.hasFlag(this.flags, Id3v2FrameFlags.Encryption)) { if (frameData.length <= dataOffset) { throw new CorruptFileError("Frame data incomplete"); } @@ -263,19 +280,18 @@ export abstract class Frame { throw new CorruptFileError("Frame size less than zero"); } - const data = frameData.mid(dataOffset, dataLength); - - if ((this.flags & Id3v2FrameFlags.Desynchronized) !== 0) { - SyncData.resyncByteVector(data); + let data = frameData.subarray(dataOffset, dataLength); + if (NumberUtils.hasFlag(this.flags, Id3v2FrameFlags.Unsynchronized)) { + data = SyncData.resyncByteVector(data); } // @FIXME: Implement encryption - if ((this.flags & Id3v2FrameFlags.Encryption) !== 0) { + if (NumberUtils.hasFlag(this.flags, Id3v2FrameFlags.Encryption)) { throw new NotImplementedError("Encryption is not supported"); } // @FIXME: Implement compression - if ((this.flags & Id3v2FrameFlags.Compression) !== 0) { + if (NumberUtils.hasFlag(this.flags, Id3v2FrameFlags.Compression)) { throw new NotImplementedError("Compression is not supported"); } diff --git a/src/id3v2/frames/frameFactory.ts b/src/id3v2/frames/frameFactory.ts index ae559852..9881d589 100644 --- a/src/id3v2/frames/frameFactory.ts +++ b/src/id3v2/frames/frameFactory.ts @@ -19,8 +19,15 @@ import {RelativeVolumeFrame} from "./relativeVolumeFrame"; import {SynchronizedLyricsFrame} from "./synchronizedLyricsFrame"; import {TextInformationFrame, UserTextInformationFrame} from "./textInformationFrame"; import {UrlLinkFrame, UserUrlLinkFrame} from "./urlLinkFrame"; -import {Guards} from "../../utils"; +import {Guards, NumberUtils} from "../../utils"; +/** + * Type shortcut for a method that returns a {@link Frame}. + * @param data Byte vector that contains the frame + * @param offset Position into the byte vector where the frame begins + * @param header The header that describes the frame + * @param version ID3v2 version the frame is encoded with. Must be unsigned 8-bit int + */ export type FrameCreator = (data: ByteVector, offset: number, header: Id3v2FrameHeader, version: number) => Frame; let customFrameCreators: FrameCreator[] = []; @@ -29,7 +36,7 @@ let customFrameCreators: FrameCreator[] = []; * Performs the necessary operations to determine and create the correct child classes of * {@link Frame} for a given raw ID3v2 frame. * By default, this will only load frames contained in the library. To add additional frames to the - * process, register a frame creator with addFrameCreator. + * process, register a frame creator with {@see addFrameCreator}. */ export default { /** @@ -43,8 +50,7 @@ export default { * * version: number ID3v2 version the raw frame data is stored in (should be byte) * * returns Frame if method was able to match the frame, falsy otherwise */ - addFrameCreator: (creator: FrameCreator): - void => { + addFrameCreator: (creator: FrameCreator): void => { Guards.truthy(creator, "creator"); customFrameCreators.unshift(creator); }, @@ -70,8 +76,14 @@ export default { * * frame: {@link Frame} that was read * * offset: updated offset where the next frame starts */ - createFrame: (data: ByteVector, file: File, offset: number, version: number, alreadyUnsynced: boolean): - {frame: Frame, offset: number} => { + // @TODO: Split into fromFile and fromData + createFrame: ( + data: ByteVector, + file: File, + offset: number, + version: number, + alreadyUnsynced: boolean + ): {frame: Frame, offset: number} => { Guards.uint(offset, "offset"); Guards.byte(version, "version"); @@ -95,7 +107,7 @@ export default { return undefined; } - const header = Id3v2FrameHeader.fromData(data.mid(position, frameHeaderSize), version); + const header = Id3v2FrameHeader.fromData(data.subarray(position, frameHeaderSize), version); const frameStartIndex = offset + frameHeaderSize; const frameEndIndex = offset + header.frameSize + frameHeaderSize; const frameSize = frameEndIndex - frameStartIndex; @@ -103,18 +115,17 @@ export default { // Illegal frames are filtered out when creating the frame header // Mark the frame as unsynchronized if the entire tag is already unsynchronized - // @TODO Standardize on "Desynchronized" if (alreadyUnsynced) { - header.flags &= ~Id3v2FrameFlags.Desynchronized; + header.flags &= ~Id3v2FrameFlags.Unsynchronized; } // TODO: Support compression - if ((header.flags & Id3v2FrameFlags.Compression) !== 0) { + if (NumberUtils.hasFlag(header.flags, Id3v2FrameFlags.Compression)) { throw new NotImplementedError("Compression is not supported"); } // TODO: Support encryption - if ((header.flags & Id3v2FrameFlags.Encryption) !== 0) { + if (NumberUtils.hasFlag(header.flags, Id3v2FrameFlags.Encryption)) { throw new NotImplementedError("Encryption is not supported"); } @@ -155,10 +166,13 @@ export default { // Read remaining part of the frame for the non lazy Frame file.seek(frameStartIndex); - data.addByteVector(file.readBlock(frameSize)); + data = ByteVector.concatenate( + data, + file.readBlock(frameSize) + ); } - let func; + let func: FrameCreator; if (header.frameId === FrameIdentifiers.TXXX) { // User text identification frame func = UserTextInformationFrame.fromOffsetRawData; @@ -216,7 +230,7 @@ export default { frame: func(data, position, header, version), offset: frameEndIndex }; - } catch (e) { + } catch (e: unknown) { if (CorruptFileError.errorIs(e) || NotImplementedError.errorIs(e)) { throw e; } diff --git a/src/id3v2/frames/frameHeader.ts b/src/id3v2/frames/frameHeader.ts index 05a3d62b..95b78981 100644 --- a/src/id3v2/frames/frameHeader.ts +++ b/src/id3v2/frames/frameHeader.ts @@ -1,8 +1,8 @@ import SyncData from "../syncData"; import {ByteVector, StringType} from "../../byteVector"; import {CorruptFileError} from "../../errors"; -import {Guards} from "../../utils"; import {FrameIdentifier, FrameIdentifiers} from "../frameIdentifiers"; +import {Guards, NumberUtils} from "../../utils"; export enum Id3v2FrameFlags { /** @@ -41,9 +41,9 @@ export enum Id3v2FrameFlags { Encryption = 0x0004, /** - * Frame data has been desynchronized. + * Frame data has been unsynchronized using the ID3v2 unsynchronization scheme. */ - Desynchronized = 0x0002, + Unsynchronized = 0x0002, /** * Frame has a data length indicator. @@ -100,7 +100,7 @@ export class Id3v2FrameHeader { } // Set frame ID -- first 3 bytes - frameId = FrameIdentifiers[data.toString(3, StringType.Latin1)]; + frameId = FrameIdentifiers[data.subarray(0, 3).toString(StringType.Latin1)]; // If the full header information was not passed in, do not continue to the steps // to parse the frame size and flags. @@ -108,7 +108,7 @@ export class Id3v2FrameHeader { break; } - frameSize = data.mid(3, 3).toUInt(); + frameSize = data.subarray(3, 3).toUint(); break; case 3: @@ -117,7 +117,7 @@ export class Id3v2FrameHeader { } // Set the frame ID -- first 4 bytes - frameId = FrameIdentifiers[data.toString(4, StringType.Latin1)]; + frameId = FrameIdentifiers[data.subarray(0, 4).toString(StringType.Latin1)]; // If the full header information was not passed in, do not continue to the steps // to parse the frame size and flags. @@ -126,10 +126,12 @@ export class Id3v2FrameHeader { } // Store the flags internally as version 2.4 - frameSize = data.mid(4, 4).toUInt(); - flags = ((data.get(8) << 7) & 0x7000) - | ((data.get(9) >> 4) & 0x000C) - | ((data.get(9) << 1) & 0x0040); + frameSize = data.subarray(4, 4).toUint(); + flags = NumberUtils.uintOr( + NumberUtils.uintAnd(NumberUtils.uintLShift(data.get(8), 7), 0x7000), + NumberUtils.uintAnd(NumberUtils.uintRShift(data.get(9), 4), 0x000C), + NumberUtils.uintAnd(NumberUtils.uintLShift(data.get(9), 1), 0x0040) + ); break; case 4: @@ -138,7 +140,7 @@ export class Id3v2FrameHeader { } // Set the frame ID -- the first 4 bytes - frameId = FrameIdentifiers[data.toString(4, StringType.Latin1)]; + frameId = FrameIdentifiers[data.subarray(0, 4).toString(StringType.Latin1)]; // If the full header information was not passed in, do not continue to the steps to // ... eh, you probably get it by now. @@ -146,8 +148,8 @@ export class Id3v2FrameHeader { return; } - frameSize = SyncData.toUint(data.mid(4, 4)); - flags = data.mid(8, 2).toUShort(); + frameSize = SyncData.toUint(data.subarray(4, 4)); + flags = data.subarray(8, 2).toUshort(); break; } @@ -168,7 +170,7 @@ export class Id3v2FrameHeader { * Sets the flags applied to the current instance. */ public set flags(value: Id3v2FrameFlags) { - if ((value & (Id3v2FrameFlags.Compression | Id3v2FrameFlags.Encryption)) !== 0) { + if (NumberUtils.hasFlag(value, (Id3v2FrameFlags.Compression | Id3v2FrameFlags.Encryption))) { throw new Error("Argument invalid: Encryption and compression are not supported"); } this._flags = value; @@ -207,7 +209,7 @@ export class Id3v2FrameHeader { * Gets the size of a header for a specified ID3v2 version. * @param version Version of ID3v2 to get the size for. Must be a positive integer < 256 */ - public static getSize(version: number) { + public static getSize(version: number): number { Guards.byte(version, "version"); return version < 3 ? 6 : 10; } @@ -221,29 +223,31 @@ export class Id3v2FrameHeader { Guards.betweenInclusive(version, 2, 4, "version"); // Start by rendering the frame identifier - const data = this._frameId.render(version); + const byteVectors = [this._frameId.render(version)]; switch (version) { case 2: - data.addByteVector(ByteVector.fromUInt(this._frameSize).mid(1, 3)); + byteVectors.push(ByteVector.fromUint(this._frameSize).subarray(1, 3)); break; case 3: - const newFlags = (this._flags << 1) & 0xE000 - | (this._flags << 4) & 0x00C0 - | (this._flags >> 1) & 0x0020; - - data.addByteVector(ByteVector.fromUInt(this._frameSize)); - data.addByteVector(ByteVector.fromUShort(newFlags)); + const newFlags = NumberUtils.uintOr( + NumberUtils.uintAnd(NumberUtils.uintLShift(this._flags, 1), 0xE000), + NumberUtils.uintAnd(NumberUtils.uintLShift(this._flags, 4), 0x00C0), + NumberUtils.uintAnd(NumberUtils.uintRShift(this._flags, 1), 0x0020) + ); + + byteVectors.push(ByteVector.fromUint(this._frameSize)); + byteVectors.push(ByteVector.fromUshort(newFlags)); break; case 4: - data.addByteVector(SyncData.fromUint(this._frameSize)); - data.addByteVector(ByteVector.fromUShort(this._flags)); + byteVectors.push(SyncData.fromUint(this._frameSize)); + byteVectors.push(ByteVector.fromUshort(this._flags)); break; } - return data; + return ByteVector.concatenate(... byteVectors); } // #endregion diff --git a/src/id3v2/frames/musicCdIdentifierFrame.ts b/src/id3v2/frames/musicCdIdentifierFrame.ts index db7191ee..a11c1334 100644 --- a/src/id3v2/frames/musicCdIdentifierFrame.ts +++ b/src/id3v2/frames/musicCdIdentifierFrame.ts @@ -25,7 +25,11 @@ export default class MusicCdIdentifierFrame extends Frame { * @param header Header of the frame found at `offset` in the data * @param version ID3v2 version the frame was originally encoded with */ - public static fromOffsetRawData(data: ByteVector, offset: number, header: Id3v2FrameHeader, version: number) { + public static fromOffsetRawData( + data: ByteVector, + offset: number, + header: Id3v2FrameHeader, version: number + ): MusicCdIdentifierFrame { Guards.truthy(data, "data"); Guards.uint(offset, "offset"); Guards.truthy(header, "header"); @@ -67,26 +71,17 @@ export default class MusicCdIdentifierFrame extends Frame { /** @inheritDoc */ public clone(): Frame { const frame = new MusicCdIdentifierFrame(new Id3v2FrameHeader(FrameIdentifiers.MCDI)); - if (this.data) { - frame.data = ByteVector.fromByteVector(this.data); - } + frame.data = this._data?.toByteVector(); return frame; } - /** - * Populates the values in the current instance. - * @param data ByteVector containing the extracted field data. - * @param version Ignored. - */ - protected parseFields(data: ByteVector, version: number): void { - this.data = data; + /** @inheritDoc */ + protected parseFields(data: ByteVector): void { + this._data = data; } - /** - * Renders the value in current instance into field data. - * @param version Ignored. - */ - protected renderFields(version: number): ByteVector { - return this.data || ByteVector.empty(); + /** @inheritDoc */ + protected renderFields(): ByteVector { + return this._data || ByteVector.empty(); } } diff --git a/src/id3v2/frames/playCountFrame.ts b/src/id3v2/frames/playCountFrame.ts index 8e72bceb..b68c8099 100644 --- a/src/id3v2/frames/playCountFrame.ts +++ b/src/id3v2/frames/playCountFrame.ts @@ -94,17 +94,19 @@ export default class PlayCountFrame extends Frame { } /** @inheritDoc */ - protected parseFields(data: ByteVector, _version: number) { - this.playCount = data.toULong(); + protected parseFields(data: ByteVector): void { + this.playCount = data.toUlong(); } /** @inheritDoc */ - protected renderFields(_version: number): ByteVector { - const data = ByteVector.fromULong(this.playCount); - while (data.length > 4 && data.get(0) === 0) { - data.removeAtIndex(0); + protected renderFields(): ByteVector { + const data = ByteVector.fromUlong(this.playCount); + + let ptr = 0; + while (ptr < data.length - 4 && data.get(ptr) === 0) { + ptr++; } - return data; + return data.subarray(ptr); } } diff --git a/src/id3v2/frames/popularimeterFrame.ts b/src/id3v2/frames/popularimeterFrame.ts index a508af51..10eb2b27 100644 --- a/src/id3v2/frames/popularimeterFrame.ts +++ b/src/id3v2/frames/popularimeterFrame.ts @@ -136,7 +136,7 @@ export default class PopularimeterFrame extends Frame { } /** @inheritDoc */ - protected parseFields(data: ByteVector, _version: number): void { + protected parseFields(data: ByteVector): void { const delim = ByteVector.getTextDelimiter(StringType.Latin1); const delimIndex = data.find(delim); @@ -152,26 +152,21 @@ export default class PopularimeterFrame extends Frame { throw new CorruptFileError("Popularimeter frame with play count must have at least 4 bytes of play count"); } - this._user = data.toString(delimIndex, StringType.Latin1, 0); + this._user = data.subarray(0, delimIndex).toString(StringType.Latin1); this._rating = data.get(delimIndex + 1); // Play count may be omitted if (bytesAfterOwner > 1) { - this._playCount = data.mid(delimIndex + 2).toULong(); + this._playCount = data.subarray(delimIndex + 2).toUlong(); } } /** @inheritDoc */ - protected renderFields(_version: number): ByteVector { - const data = ByteVector.concatenate( - ByteVector.fromString(this._user, StringType.Latin1), - ByteVector.getTextDelimiter(StringType.Latin1), - this.rating - ); - + protected renderFields(): ByteVector { // Only include personal play count if it's desired + let playCountData: ByteVector; if (this.playCount !== undefined) { - const playCountData = ByteVector.fromULong(this.playCount); + playCountData = ByteVector.fromUlong(this.playCount); // Remove zero bytes from beginning of play count, leaving at least 4 bytes let firstNonZeroIndex = 0; @@ -179,9 +174,14 @@ export default class PopularimeterFrame extends Frame { firstNonZeroIndex++; } - data.addByteVector(playCountData.mid(firstNonZeroIndex)); + playCountData = playCountData.subarray(firstNonZeroIndex); } - return data; + return ByteVector.concatenate( + ByteVector.fromString(this._user, StringType.Latin1), + ByteVector.getTextDelimiter(StringType.Latin1), + this.rating, + playCountData + ); } } diff --git a/src/id3v2/frames/privateFrame.ts b/src/id3v2/frames/privateFrame.ts index 96b0dc5d..46de2c6b 100644 --- a/src/id3v2/frames/privateFrame.ts +++ b/src/id3v2/frames/privateFrame.ts @@ -106,25 +106,25 @@ export default class PrivateFrame extends Frame { public static find(frames: PrivateFrame[], owner: string): PrivateFrame { Guards.truthy(frames, "frames"); - return frames.find((f) => f.owner === owner); + return frames.find((f) => f._owner === owner); } /** @inheritDoc */ public clone(): Frame { - const frame = PrivateFrame.fromOwner(this.owner); - frame.privateData = ByteVector.fromByteVector(this.privateData); + const frame = PrivateFrame.fromOwner(this._owner); + frame._privateData = this._privateData.toByteVector(); return frame; } /** @inheritDoc */ - protected parseFields(data: ByteVector, _version: number): void { + protected parseFields(data: ByteVector): void { if (data.length < 1) { throw new CorruptFileError("A private frame must contain at least 1 byte"); } const l = data.split(ByteVector.getTextDelimiter(StringType.Latin1), 1, 2); - this._owner = l[0].toString(l[0].length, StringType.Latin1); - this._privateData = l.length === 2 ? l[1] : ByteVector.empty(); + this._owner = l[0].toString(StringType.Latin1); + this._privateData = l[1]?.toByteVector() || ByteVector.empty(); } /** @inheritDoc */ @@ -134,7 +134,7 @@ export default class PrivateFrame extends Frame { } return ByteVector.concatenate( - ByteVector.fromString(this.owner, StringType.Latin1), + ByteVector.fromString(this._owner, StringType.Latin1), ByteVector.getTextDelimiter(StringType.Latin1), this._privateData ); diff --git a/src/id3v2/frames/relativeVolumeFrame.ts b/src/id3v2/frames/relativeVolumeFrame.ts index cf5962d7..e4cc38cd 100644 --- a/src/id3v2/frames/relativeVolumeFrame.ts +++ b/src/id3v2/frames/relativeVolumeFrame.ts @@ -69,15 +69,9 @@ export class ChannelData { const channelType = bytes.get(0); const channelData = new ChannelData(channelType); - channelData._volumeAdjustment = bytes.mid(1, 2).toShort(); + channelData._volumeAdjustment = bytes.subarray(1, 2).toShort(); channelData._peakBits = bytes.get(3); - - const peakByteCount = Math.ceil(channelData._peakBits / 8); - const peakBytes = bytes.mid(4); - const zeroes = ByteVector.fromSize(peakByteCount - peakBytes.length, 0x00); - peakBytes.insertByteVector(0, zeroes); - channelData._peakVolume = peakBytes.toULong(); - + channelData._peakVolume = bytes.subarray(4).toUlong(); return channelData; } @@ -98,6 +92,7 @@ export class ChannelData { * @param value Bits used to express the peak volume. Must be an integer betweenInclusive 1 and 64 */ public set peakBits(value: number) { + // @TODO: This should be calculated based on peak volume Guards.byte(value, "value"); Guards.betweenInclusive(value, 1, 64, "value"); this._peakBits = value; @@ -157,7 +152,7 @@ export class ChannelData { this._channel, ByteVector.fromShort(this._volumeAdjustment), this._peakBits, - ByteVector.fromULong(this._peakVolume).mid(8 - peakByteCount) + ByteVector.fromUlong(this._peakVolume).subarray(8 - peakByteCount) ); } } @@ -291,7 +286,7 @@ export class RelativeVolumeFrame extends Frame { * @param type Which channel to set the value for * @param value Peak volume */ - public setPeakBits(type: ChannelType, value: number) { this._channels[type].peakBits = value; } + public setPeakBits(type: ChannelType, value: number): void { this._channels[type].peakBits = value; } /** * Sets the peak volume for a specified channel. @@ -321,18 +316,18 @@ export class RelativeVolumeFrame extends Frame { // #region Protected/Private Methods /** @inheritDoc */ - protected parseFields(data: ByteVector, _version: number): void { + protected parseFields(data: ByteVector): void { const identifierEndIndex = data.find(ByteVector.getTextDelimiter(StringType.Latin1)); if (identifierEndIndex < 0) { return; } - this._identification = data.toString(identifierEndIndex, StringType.Latin1); + this._identification = data.subarray(0, identifierEndIndex).toString(StringType.Latin1); let pos = identifierEndIndex + 1; while (pos < data.length) { const dataLength = 4 + Math.ceil(data.get(pos + 3) / 8); - const dataBytes = data.mid(pos, dataLength); + const dataBytes = data.subarray(pos, dataLength); // If we're at the end of the vector, we'll just end processing if (dataBytes.length !== dataLength) { @@ -346,7 +341,7 @@ export class RelativeVolumeFrame extends Frame { } /** @inheritDoc */ - protected renderFields(_version: number): ByteVector { + protected renderFields(): ByteVector { const data = ByteVector.fromString(this.identification, StringType.Latin1); data.addByteVector(ByteVector.getTextDelimiter(StringType.Latin1)); diff --git a/src/id3v2/frames/synchronizedLyricsFrame.ts b/src/id3v2/frames/synchronizedLyricsFrame.ts index 49a538f2..45458a61 100644 --- a/src/id3v2/frames/synchronizedLyricsFrame.ts +++ b/src/id3v2/frames/synchronizedLyricsFrame.ts @@ -60,7 +60,7 @@ export class SynchronizedText { return ByteVector.concatenate( ByteVector.fromString(this.text, encoding), ByteVector.getTextDelimiter(encoding), - ByteVector.fromUInt(this.time) + ByteVector.fromUint(this.time) ); } } @@ -114,7 +114,11 @@ export class SynchronizedLyricsFrame extends Frame { * @param header Header of the frame found at `offset` in `data` * @param version ID3v2 version the frame was originally encoded with */ - public static fromOffsetRawData(data: ByteVector, offset: number, header: Id3v2FrameHeader, version: number) { + public static fromOffsetRawData( + data: ByteVector, + offset: number, + header: Id3v2FrameHeader, version: number + ): SynchronizedLyricsFrame { Guards.truthy(data, "data"); Guards.uint(offset, "offset"); Guards.truthy(header, "header"); @@ -211,6 +215,7 @@ export class SynchronizedLyricsFrame extends Frame { * Sets the type of text contained in the current instance. * @param value Type of the synchronized text */ + // @TODO: Rename to Content Type to match spec public set textType(value: SynchronizedTextType) { this._textType = value; } // #endregion @@ -231,7 +236,7 @@ export class SynchronizedLyricsFrame extends Frame { description: string, textType: SynchronizedTextType, language?: string - ) { + ): SynchronizedLyricsFrame { Guards.truthy(frames, "frames"); return frames.find((f) => { if (f.description !== description) { return false; } @@ -263,7 +268,7 @@ export class SynchronizedLyricsFrame extends Frame { description: string, language: string, textType: SynchronizedTextType - ) { + ): SynchronizedLyricsFrame { Guards.truthy(frames, "frames"); let bestValue = -1; @@ -310,42 +315,47 @@ export class SynchronizedLyricsFrame extends Frame { // #endregion /** @inheritDoc */ - protected parseFields(data: ByteVector, _version: number): void { + protected parseFields(data: ByteVector): void { if (data.length < 6) { throw new CorruptFileError("Not enough bytes in field"); } + // Read the basic information of the frame this.textEncoding = data.get(0); - this._language = data.toString(3, StringType.Latin1, 1); + this._language = data.subarray(1, 3).toString(StringType.Latin1); this.format = data.get(4); this.textType = data.get(5); const delim = ByteVector.getTextDelimiter(this.textEncoding); - let delimIndex = data.find(delim, 6, delim.length); - if (delimIndex < 0) { + // Read the description of the frame + const descriptionEndIndex = data.offsetFind(delim, 6, delim.length); + if (descriptionEndIndex < 0) { throw new CorruptFileError("Text delimiter expected"); } + const descriptionLength = descriptionEndIndex - 6; + this.description = data.subarray(6, descriptionLength).toString(this.textEncoding); - this.description = data.toString(delimIndex - 6, this.textEncoding, 6); - - let offset = delimIndex + delim.length; - const l = []; + let offset = 6 + descriptionLength + delim.length; + const l: SynchronizedText[] = []; while (offset + delim.length + 4 < data.length) { - delimIndex = data.find(delim, offset, delim.length); - - if (delimIndex < offset) { - throw new CorruptFileError("Text delimiter expected"); + // Determine length of lyrics + const lyricsLength = data.subarray(offset).find(delim, delim.length); + if (lyricsLength < 0) { + throw new CorruptFileError("Text delimiter for synchronized lyric not found"); } - const text = data.toString(delimIndex - offset, this.textEncoding, offset); - offset = delimIndex + delim.length; + // Read lyrics + const text = data.subarray(offset, lyricsLength).toString(this.textEncoding); + // Read time code + offset += lyricsLength + delim.length; if (offset + 4 > data.length) { + // This handles malformed frames that don't have the timecode break; } - const time = data.mid(offset, 4).toUInt(); + const time = data.subarray(offset, 4).toUint(); l.push(new SynchronizedText(time, text)); offset += 4; diff --git a/src/id3v2/frames/termsOfUseFrame.ts b/src/id3v2/frames/termsOfUseFrame.ts index 952aa662..a2f76290 100644 --- a/src/id3v2/frames/termsOfUseFrame.ts +++ b/src/id3v2/frames/termsOfUseFrame.ts @@ -139,7 +139,7 @@ export default class TermsOfUseFrame extends Frame { * @returns TermsOfUseFrame Frame containing the matching frame or `undefined` if a match was * not found */ - public static findPreferred(frames: TermsOfUseFrame[], language: string) { + public static findPreferred(frames: TermsOfUseFrame[], language: string): TermsOfUseFrame { Guards.truthy(frames, "frames"); let bestFrame: TermsOfUseFrame; @@ -172,26 +172,25 @@ export default class TermsOfUseFrame extends Frame { // #region Protected Methods /** @inheritDoc */ - protected parseFields(data: ByteVector, _version: number): void { + protected parseFields(data: ByteVector): void { if (data.length < 4) { throw new CorruptFileError("Not enough bytes in field"); } this.textEncoding = data.get(0); - this._language = data.toString(3, StringType.Latin1, 1); - this.text = data.toString(data.length - 4, this.textEncoding, 4); + this._language = data.subarray(1, 3).toString(StringType.Latin1); + this.text = data.subarray(4).toString(this.textEncoding); } /** @inheritDoc */ - protected renderFields(version: number) { + protected renderFields(version: number): ByteVector { const encoding = Frame.correctEncoding(this.textEncoding, version); - const v = ByteVector.empty(); - v.addByte(encoding); - v.addByteVector(ByteVector.fromString(this.language, StringType.Latin1)); - v.addByteVector(ByteVector.fromString(this.text, encoding)); - - return v; + return ByteVector.concatenate( + encoding, + ByteVector.fromString(this.language, StringType.Latin1), + ByteVector.fromString(this.text, encoding) + ); } // #endregion diff --git a/src/id3v2/frames/textInformationFrame.ts b/src/id3v2/frames/textInformationFrame.ts index b5728f55..66a23aa2 100644 --- a/src/id3v2/frames/textInformationFrame.ts +++ b/src/id3v2/frames/textInformationFrame.ts @@ -128,11 +128,11 @@ import {Guards, StringComparison, StringUtils} from "../../utils"; * (TIT2) for sorting purposes. */ export class TextInformationFrame extends Frame { - private static COVER_ABBREV = "CR"; - private static COVER_STRING = "Cover"; - private static REMIX_ABBREV = "RX"; - private static REMIX_STRING = "Remix"; - private static SPLIT_FRAME_TYPES = [ + private static readonly COVER_ABBREV = "CR"; + private static readonly COVER_STRING = "Cover"; + private static readonly REMIX_ABBREV = "RX"; + private static readonly REMIX_STRING = "Remix"; + private static readonly SPLIT_FRAME_TYPES = [ FrameIdentifiers.TCOM, FrameIdentifiers.TEXT, FrameIdentifiers.TMCL, @@ -147,6 +147,7 @@ export class TextInformationFrame extends Frame { FrameIdentifiers.TPE4 ]; + // @TODO: no protected access to members protected _encoding: StringType = Id3v2Settings.defaultEncoding; protected _rawData: ByteVector; protected _rawVersion: number; @@ -279,7 +280,7 @@ export class TextInformationFrame extends Frame { const frame = TextInformationFrame.fromIdentifier(this.frameId, this._encoding); frame._textFields = this._textFields.slice(); if (this._rawData) { - frame._rawData = ByteVector.fromByteVector(this._rawData); + frame._rawData = this._rawData.toByteVector(); } frame._rawVersion = this._rawVersion; return frame; @@ -366,7 +367,7 @@ export class TextInformationFrame extends Frame { // TCON on ID3v2.4 is encoded as a separate field for each genre. Fields can either be // the old numeric ID3v1 genres (no parenthesis) or free text. RX/CR can also be used. // This way is **much** better... - const genres = data.toStrings(this._encoding, 1); + const genres = data.subarray(1).toStrings(this._encoding); const textGenres = genres.map((g) => { switch (g) { case TextInformationFrame.COVER_ABBREV: @@ -380,9 +381,9 @@ export class TextInformationFrame extends Frame { }); fieldList.push(...textGenres); } else if (this._rawVersion > 3 || this.frameId === FrameIdentifiers.TXXX) { - fieldList.push(...data.toStrings(this._encoding, 1)); - } else if (data.length > 1 && !ByteVector.equal(data.mid(1, delim.length), delim)) { - let value = data.toString(data.length - 1, this._encoding, 1); + fieldList.push(...data.subarray(1).toStrings(this._encoding)); + } else if (data.length > 1 && !data.containsAt(delim, 1)) { + let value = data.subarray(1).toString(this._encoding); // Truncate values containing NULL bytes const nullIndex = value.indexOf("\x00"); @@ -394,6 +395,7 @@ export class TextInformationFrame extends Frame { // Some frames are designed to be split into multiple parts by a / fieldList.push(... value.split("/")); } else if (this.frameId === FrameIdentifiers.TCON) { + // @TODO: Can we just make a separate class for TCON? // TCON in ID3v2.2 and ID3v2.3 is specified as // * (xx) - where xx is a number from the ID3v1 genre list // * (xx)yy - where xx is a number from the ID3v1 genre list and yyy is a @@ -411,7 +413,7 @@ export class TextInformationFrame extends Frame { break; } - const number = value.substr(1, closing - 1); + const number = value.substring(1, closing); let text: string; if (number === TextInformationFrame.COVER_ABBREV) { @@ -430,11 +432,11 @@ export class TextInformationFrame extends Frame { // Number in parenthesis was a numeric genre fieldList.push(text); - value = StringUtils.trimStart(value.substr(closing + 1), "/ "); + value = StringUtils.trimStart(value.substring(closing + 1), "/ "); // Ignore genre if the same genre appears after the numeric genre if (value.startsWith(text)) { - value = StringUtils.trimStart(value.substr(text.length), "/ "); + value = StringUtils.trimStart(value.substring(text.length), "/ "); } } @@ -707,7 +709,7 @@ export class UserTextInformationFrame extends TextInformationFrame { ): UserTextInformationFrame { Guards.truthy(frames, "frames"); - const comparison = caseSensitive ? StringComparison.CaseSensitive : StringComparison.CaseInsensitive; + const comparison = caseSensitive ? StringComparison.caseSensitive : StringComparison.caseInsensitive; return frames.find((f) => comparison(f.description, description)); } @@ -716,7 +718,7 @@ export class UserTextInformationFrame extends TextInformationFrame { const frame = UserTextInformationFrame.fromDescription(undefined, this._encoding); frame._textFields = this._textFields.slice(); if (this._rawData) { - frame._rawData = ByteVector.fromByteVector(this._rawData); + frame._rawData = this._rawData.toByteVector(); } frame._rawVersion = this._rawVersion; return frame; diff --git a/src/id3v2/frames/uniqueFileIdentifierFrame.ts b/src/id3v2/frames/uniqueFileIdentifierFrame.ts index 022624de..02cc1150 100644 --- a/src/id3v2/frames/uniqueFileIdentifierFrame.ts +++ b/src/id3v2/frames/uniqueFileIdentifierFrame.ts @@ -31,7 +31,7 @@ export default class UniqueFileIdentifierFrame extends Frame { const frame = new UniqueFileIdentifierFrame(new Id3v2FrameHeader(FrameIdentifiers.UFID)); frame._owner = owner; - frame._identifier = identifier; + frame._identifier = identifier?.toByteVector(); return frame; } @@ -121,29 +121,27 @@ export default class UniqueFileIdentifierFrame extends Frame { public clone(): Frame { const frame = new UniqueFileIdentifierFrame(new Id3v2FrameHeader(FrameIdentifiers.UFID)); frame._owner = this._owner; - if (this._identifier) { - frame.identifier = ByteVector.fromByteVector(this.identifier); - } + frame._identifier = this._identifier?.toByteVector(); return frame; } /** @inheritDoc */ - protected parseFields(data: ByteVector, _version: number): void { + protected parseFields(data: ByteVector): void { const fields = data.split(ByteVector.getTextDelimiter(StringType.Latin1)); if (fields.length !== 2) { return; } - this._owner = fields[0].toString(undefined, StringType.Latin1); - this._identifier = fields[1]; + this._owner = fields[0].toString(StringType.Latin1); + this._identifier = fields[1].toByteVector(); } /** @inheritDoc */ - protected renderFields(_version: number): ByteVector { + protected renderFields(): ByteVector { return ByteVector.concatenate( - ByteVector.fromString(this.owner, StringType.Latin1), + ByteVector.fromString(this._owner, StringType.Latin1), ByteVector.getTextDelimiter(StringType.Latin1), - this.identifier + this._identifier ); } diff --git a/src/id3v2/frames/unknownFrame.ts b/src/id3v2/frames/unknownFrame.ts index 696f150c..8b88bd71 100644 --- a/src/id3v2/frames/unknownFrame.ts +++ b/src/id3v2/frames/unknownFrame.ts @@ -21,11 +21,7 @@ export default class UnknownFrame extends Frame { Guards.truthy(identifier, "identifier"); const frame = new UnknownFrame(new Id3v2FrameHeader(identifier)); - if (data) { - frame.data = data; - } else { - frame.data = undefined; - } + frame.data = data?.toByteVector(); return frame; } @@ -79,16 +75,16 @@ export default class UnknownFrame extends Frame { /** @inheritDoc */ public clone(): Frame { - return UnknownFrame.fromData(this._header.frameId, this.data); + return UnknownFrame.fromData(this.header.frameId, this.data); } /** @inheritDoc */ - protected parseFields(data: ByteVector, _version: number): void { - this.data = data; + protected parseFields(data: ByteVector): void { + this.data = data.toByteVector(); } /** @inheritDoc */ - protected renderFields(_version: number): ByteVector { + protected renderFields(): ByteVector { return this.data || ByteVector.empty(); } } diff --git a/src/id3v2/frames/unsynchronizedLyricsFrame.ts b/src/id3v2/frames/unsynchronizedLyricsFrame.ts index 79daa752..89e4b19c 100644 --- a/src/id3v2/frames/unsynchronizedLyricsFrame.ts +++ b/src/id3v2/frames/unsynchronizedLyricsFrame.ts @@ -223,15 +223,15 @@ export default class UnsynchronizedLyricsFrame extends Frame { } /** @inheritDoc */ - protected parseFields(data: ByteVector, _version: number): void { + protected parseFields(data: ByteVector): void { if (data.length < 4) { throw new CorruptFileError("Not enough bytes in field."); } this.textEncoding = data.get(0); - this._language = data.toString(3, StringType.Latin1, 1); + this._language = data.subarray(1, 3).toString(StringType.Latin1); - const split = data.toStrings(this.textEncoding, 4, 2); + const split = data.subarray(4).toStrings(this.textEncoding, 2); if (split.length === 1) { // Bad lyrics frame. Assume that it lacks a description this._description = ""; diff --git a/src/id3v2/frames/urlLinkFrame.ts b/src/id3v2/frames/urlLinkFrame.ts index 7911848a..7b7d465f 100644 --- a/src/id3v2/frames/urlLinkFrame.ts +++ b/src/id3v2/frames/urlLinkFrame.ts @@ -32,6 +32,7 @@ import {Guards} from "../../utils"; * for the publisher. */ export class UrlLinkFrame extends Frame { + // @TODO: Don't allow protected member variables protected _encoding: StringType = StringType.Latin1; protected _rawData: ByteVector; protected _rawVersion: number; @@ -151,9 +152,7 @@ export class UrlLinkFrame extends Frame { public clone(): UrlLinkFrame { const frame = UrlLinkFrame.fromIdentity(this.frameId); frame._textFields = this._textFields.slice(); - if (this._rawData) { - frame._rawData = ByteVector.fromByteVector(this._rawData); - } + frame._rawData = this._rawData?.toByteVector(); frame._rawVersion = this._rawVersion; return frame; } @@ -167,7 +166,7 @@ export class UrlLinkFrame extends Frame { /** @inheritDoc */ protected parseFields(data: ByteVector, version: number): void { Guards.byte(version, "version"); - this._rawData = data; + this._rawData = data.toByteVector(); this._rawVersion = version; } @@ -185,33 +184,24 @@ export class UrlLinkFrame extends Frame { // Text Encoding $xx // Description $00 (00) // URL - const encoding = data.get(0); + const encoding = data.get(index); const delim = ByteVector.getTextDelimiter(encoding); - const delimIndex = data.find(delim, 1, delim.length); + index++; + const delimIndex = data.offsetFind(delim, index, delim.length); if (delimIndex >= 0) { - const description = data.toString(delimIndex - 1, encoding, 1); + const descriptionLength = delimIndex - index; + const description = data.subarray(index, descriptionLength).toString(encoding); fieldList.push(description); - index += delimIndex - 1 + delim.length; + index += descriptionLength + delim.length; } - - index += 1; } if (index < data.length) { // Read the url from the data - let url = data.toString(data.length - index, StringType.Latin1, index); - - // Do a fast removal of end bytes - if (url.length > 1 && url[url.length - 1] === "\0") { - for (let i = url.length - 1; i >= 0; i--) { - if (url[i] !== "\0") { - url = url.substr(0, i + 1); - break; - } - } - } + let url = data.subarray(index).toString(StringType.Latin1); + url = url.replace(/[\s\0]+$/, ""); fieldList.push(url); } @@ -220,30 +210,31 @@ export class UrlLinkFrame extends Frame { /** @inheritDoc */ protected renderFields(version: number): ByteVector { + // @TODO: Move WXXX rendering to WXXX class if (this._rawData && this._rawVersion === version) { return this._rawData; } const encoding = UrlLinkFrame.correctEncoding(this.textEncoding, version); const isWxxx = this.frameId === FrameIdentifiers.WXXX; - const v = isWxxx - ? ByteVector.fromByteArray(new Uint8Array([encoding])) - : ByteVector.empty(); - let text = this._textFields; + let textFields = this._textFields; if (version > 3 || isWxxx) { if (isWxxx) { - if (text.length === 0) { - text = [undefined, undefined]; - } else if (text.length === 1) { - text = [text[0], undefined]; + if (textFields.length === 0) { + textFields = [undefined, undefined]; + } else if (textFields.length === 1) { + textFields = [textFields[0], undefined]; } } } // @TODO: is this correct formatting? - v.addByteVector(ByteVector.fromString(text.join("/"), StringType.Latin1)); + const text = textFields.join("/"); - return v; + return ByteVector.concatenate( + isWxxx ? encoding : undefined, + ByteVector.fromString(text, StringType.Latin1) + ); } // #endregion @@ -385,12 +376,10 @@ export class UserUrlLinkFrame extends UrlLinkFrame { /** @inheritDoc */ public clone(): UserUrlLinkFrame { - const frame = UserUrlLinkFrame.fromDescription(null); + const frame = UserUrlLinkFrame.fromDescription(undefined); frame._encoding = this._encoding; frame._textFields = this._textFields.slice(); - if (this._rawData) { - frame._rawData = ByteVector.fromByteVector(this._rawData); - } + frame._rawData = this._rawData?.toByteVector(); frame._rawVersion = this._rawVersion; return frame; } diff --git a/src/id3v2/id3v2ExtendedHeader.ts b/src/id3v2/id3v2ExtendedHeader.ts index ed2753aa..39297444 100644 --- a/src/id3v2/id3v2ExtendedHeader.ts +++ b/src/id3v2/id3v2ExtendedHeader.ts @@ -5,7 +5,7 @@ import {Guards} from "../utils"; export default class Id3v2ExtendedHeader { private _size: number; - private constructor() {} + private constructor() { /* private to enforce construction via static methods */ } /** * Constructs and initializes a new instance by reading the raw contents. @@ -35,7 +35,7 @@ export default class Id3v2ExtendedHeader { protected parse(data: ByteVector, version: number): void { this._size = (version === 3 ? 4 : 0) - + SyncData.toUint(data.mid(0, 4)); + + SyncData.toUint(data.subarray(0, 4)); // TODO: Are we going to actually support any of the flags? } diff --git a/src/id3v2/id3v2Settings.ts b/src/id3v2/id3v2Settings.ts index 5b667e49..81b2bec4 100644 --- a/src/id3v2/id3v2Settings.ts +++ b/src/id3v2/id3v2Settings.ts @@ -15,7 +15,7 @@ export default class Id3v2Settings { /** * Private constructor to prevent inadvertent construction */ - private constructor() {} + private constructor() { /* private to prevent construction */ } /** * Gets the encoding to use when creating new frames. diff --git a/src/id3v2/id3v2Tag.ts b/src/id3v2/id3v2Tag.ts index 83ab97fe..d099c5cd 100644 --- a/src/id3v2/id3v2Tag.ts +++ b/src/id3v2/id3v2Tag.ts @@ -1,4 +1,5 @@ import * as DateFormat from "dateformat"; +import itiriri from "itiriri"; import AttachmentFrame from "./frames/attachmentFrame"; import CommentsFrame from "./frames/commentsFrame"; @@ -16,7 +17,7 @@ import {Frame, FrameClassType} from "./frames/frame"; import {FrameIdentifier, FrameIdentifiers} from "./frameIdentifiers"; import {Id3v2FrameFlags} from "./frames/frameHeader"; import {Id3v2TagHeader, Id3v2TagHeaderFlags} from "./id3v2TagHeader"; -import {IPicture} from "../iPicture"; +import {IPicture} from "../picture"; import {Tag, TagTypes} from "../tag"; import {TextInformationFrame, UserTextInformationFrame} from "./frames/textInformationFrame"; import {UrlLinkFrame} from "./frames/urlLinkFrame"; @@ -70,7 +71,7 @@ export default class Id3v2Tag extends Tag { throw new CorruptFileError("Provided data does not enough tag data"); } - tag.parse(data.mid(Id3v2Settings.headerSize, tag._header.tagSize), undefined, 0, ReadStyle.None); + tag.parse(data.subarray(Id3v2Settings.headerSize, tag._header.tagSize), undefined, 0, ReadStyle.None); return tag; } @@ -132,7 +133,7 @@ export default class Id3v2Tag extends Tag { public static set language(value: string) { Id3v2Tag._language = !value || value.length < 3 ? " " - : value.substr(0, 3); + : value.substring(0, 3); } /** @@ -152,18 +153,20 @@ export default class Id3v2Tag extends Tag { public get frames(): Frame[] { return this._frameList; } /** - * Gets whether or not the album described by the current instance is a compilation. - * This property is implemented using the TCMP Text Information Frame to provide support for a - * feature of the Apple iPod and iTunes products. + * @inheritDoc + * @remarks This property is implemented using the TCMP Text Information Frame to provide + * support for a feature of the Apple iPod and iTunes products (ie, this is a non-standard + * field). */ public get isCompilation(): boolean { const val = this.getTextAsString(FrameIdentifiers.TCMP); return !!val && val !== "0"; } /** - * Gets whether or not the album described by the current instance is a compilation. - * This property is implemented using the TCMP Text Information Frame to provide support for a - * feature of the Apple iPod and iTunes products. + * @inheritDoc + * @remarks This property is implemented using the TCMP Text Information Frame to provide + * support for a feature of the Apple iPod and iTunes products (ie, this is a non-standard + * field). * @param value Whether or not the album described by the current instance is a compilation */ public set isCompilation(value: boolean) { @@ -207,7 +210,7 @@ export default class Id3v2Tag extends Tag { let tdrcText = tyerFrames[0].text[0]; if (tdatFrames.length > 0) { const tdatText = tdatFrames[0].text[0]; - tdrcText += `-${tdatText.substr(0, 2)}-${tdatText.substr(2, 2)}`; + tdrcText += `-${tdatText.substring(0, 2)}-${tdatText.substring(2, 4)}`; if (timeFrames.length > 0) { const timeText = timeFrames[0].text[0]; tdrcText += `T${timeText}`; @@ -225,14 +228,14 @@ export default class Id3v2Tag extends Tag { if (tdrcFrames.length > 0) { const tdrcText = tdrcFrames[0].text[0]; this.removeFrames(FrameIdentifiers.TDRC); - this.setTextFrame(FrameIdentifiers.TYER, tdrcText.substr(0, 4)); + this.setTextFrame(FrameIdentifiers.TYER, tdrcText.substring(0, 4)); if (tdrcText.length >= 10) { - this.setTextFrame(FrameIdentifiers.TDAT, tdrcText.substr(6, 5).replace("-", "")); + this.setTextFrame(FrameIdentifiers.TDAT, tdrcText.substring(6, 11).replace("-", "")); } if (tdrcText.length === 19) { - this.setTextFrame(FrameIdentifiers.TIME, tdrcText.substr(11, 8)); + this.setTextFrame(FrameIdentifiers.TIME, tdrcText.substring(11, 19)); } } } @@ -271,6 +274,8 @@ export default class Id3v2Tag extends Tag { /** @inheritDoc via TPE1 frame */ set performers(value: string[]) { this.setTextFrame(FrameIdentifiers.TPE1, ...value); + + // Reset the performer roles this._performersRole = []; } @@ -296,12 +301,14 @@ export default class Id3v2Tag extends Tag { // [ "instrument", "artist1,artist2", ... ] // We want: // { "artist1": ["instrument", ...], "artist2": ["instrument", ...], ...} - const map = this.performers.reduce((o: any, v: string) => { - o[v] = []; - return o; - }, {}); - const frameData = this.getTextAsArray(FrameIdentifiers.TMCL); + + // Initialize the map with all the known performers + const map = this.performers.reduce((accum: Map, performer: string) => { + accum.set(performer, []); + return accum; + }, new Map()) + for (let i = 0; i + 1 < frameData.length; i += 2) { const instrument = frameData[i]; const performers = frameData[i + 1]; @@ -311,16 +318,19 @@ export default class Id3v2Tag extends Tag { const performersList = performers.split(","); for (const performer of performersList) { - if (!map[performer]) { + if (!map.has(performer)) { + // Skip unknown performers continue; } - map[performer].push(instrument); + map.get(performer).push(instrument); } } // Collapse the instrument lists and return that - this._performersRole = Object.values(map).map((e: string[]) => e.length > 0 ? e.join(";") : undefined); + this._performersRole = itiriri(map.values()) + .map((e: string[]) => e.length > 0 ? e.join("; ") : undefined) + .toArray(); return this._performersRole; } /** @inheritDoc via TMCL frame */ @@ -411,7 +421,7 @@ export default class Id3v2Tag extends Tag { if (tdrcText && tdrcText.length >= 4) { // @TODO: Check places where we use this pattern... .parseInt doesn't parse the whole string if it started // with good data - return Number.parseInt(tdrcText.substr(0, 4), 10); + return Number.parseInt(tdrcText.substring(0, 4), 10); } // Case 2: We have a TYER frame (v2.3/v2.2) @@ -419,7 +429,7 @@ export default class Id3v2Tag extends Tag { if (tyerText && tyerText.length >= 4) { // @TODO: Check places where we use this pattern... .parseInt doesn't parse the whole string if it started // with good data - return Number.parseInt(tyerText.substr(0, 4), 10); + return Number.parseInt(tyerText.substring(0, 4), 10); } // Case 3: Neither, return 0 @@ -619,7 +629,7 @@ export default class Id3v2Tag extends Tag { let text = this.getUserTextAsString("REPLAYGAIN_TRACK_GAIN", false); if (!text) { return NaN; } if (text.toLowerCase().endsWith("db")) { - text = text.substr(0, text.length - 2).trim(); + text = text.substring(0, text.length - 2).trim(); } return Number.parseFloat(text); @@ -654,7 +664,7 @@ export default class Id3v2Tag extends Tag { let text = this.getUserTextAsString("REPLAYGAIN_ALBUM_GAIN", false); if (!text) { return NaN; } if (text.toLowerCase().endsWith("db")) { - text = text.substr(0, text.length - 2).trim(); + text = text.substring(0, text.length - 2).trim(); } return Number.parseFloat(text); @@ -910,7 +920,6 @@ export default class Id3v2Tag extends Tag { // We need to render the "tag data" first so that we have to correct size to render in the // tag's header. The "tag data" (everything that is included in Header.tagSize) includes // the extended header, frames and padding, but does not include the tag's header or footer - const hasFooter = (this._header.flags & Id3v2TagHeaderFlags.FooterPresent) !== 0; const unsyncAtFrameLevel = (this._header.flags & Id3v2TagHeaderFlags.Unsynchronization) !== 0 && this.version >= 4; @@ -919,22 +928,20 @@ export default class Id3v2Tag extends Tag { this._header.majorVersion = hasFooter ? 4 : this.version; - const tagData = ByteVector.empty(); - // TODO: Render the extended header this._header.flags &= ~Id3v2TagHeaderFlags.ExtendedHeader; // Loop through the frames rendering them and adding them to tag data - for (const frame of this._frameList) { + const renderedFrames = this._frameList.map((frame) => { if (unsyncAtFrameLevel) { - frame.flags |= Id3v2FrameFlags.Desynchronized; + frame.flags |= Id3v2FrameFlags.Unsynchronized; } if ((frame.flags & Id3v2FrameFlags.TagAlterPreservation) !== 0 ) { - continue; + return undefined; } try { - tagData.addByteVector(frame.render(this._header.majorVersion)); + return frame.render(this._header.majorVersion); } catch (e) { if (NotImplementedError.errorIs(e)) { // Swallow not implemented errors @@ -944,29 +951,41 @@ export default class Id3v2Tag extends Tag { throw e; } } - } + }); - // Add unsynchronization bytes if necessary + // Put the tag data together and unsynchronize it. + let frameBytes = ByteVector.concatenate(... renderedFrames); if (unsyncAtTagLevel) { - SyncData.unsyncByteVector(tagData); + frameBytes = SyncData.unsyncByteVector(frameBytes); } // Compute the amount of padding and append that to tag data + let paddingBytes; if (!hasFooter) { - const size = tagData.length < this._header.tagSize - ? this._header.tagSize - tagData.length + const size = frameBytes.length < this._header.tagSize + ? this._header.tagSize - frameBytes.length : 1024; - tagData.addByteVector(ByteVector.fromSize(size)); + paddingBytes = ByteVector.fromSize(size); } // Set the tag size and add the header/footer - this._header.tagSize = tagData.length; - tagData.insertByteVector(0, this._header.render()); + this._header.tagSize = frameBytes.length; + if (paddingBytes) { + this._header.tagSize += paddingBytes.length; + } + const headerBytes = this._header.render(); + + let footerBytes; if (hasFooter) { - tagData.addByteVector(Id3v2TagFooter.fromHeader(this._header).render()); + footerBytes = Id3v2TagFooter.fromHeader(this._header).render(); } - return tagData; + return ByteVector.concatenate( + headerBytes, + frameBytes, + paddingBytes, + footerBytes + ); } /** @@ -1070,7 +1089,7 @@ export default class Id3v2Tag extends Tag { // #endregion // #region Protected/Private Methods - + // @TODO: Split into parseFromFile and parseFromData protected parse(data: ByteVector, file: File, position: number, style: ReadStyle): void { // If the entire tag is marked as unsynchronized, and this tag is version ID3v2.3 or lower, // resynchronize it. @@ -1090,7 +1109,7 @@ export default class Id3v2Tag extends Tag { } if (fullTagUnsync) { - SyncData.resyncByteVector(data); + data = SyncData.resyncByteVector(data); } let frameDataPosition = data ? 0 : position; @@ -1189,7 +1208,7 @@ export default class Id3v2Tag extends Tag { const frame = UniqueFileIdentifierFrame.find(frames, owner); // If the frame existed, frame.identifier is a byte vector, get a string - const result = frame ? frame.identifier.toString() : undefined; + const result = frame ? frame.identifier.toString(StringType.Latin1) : undefined; return result || undefined; } diff --git a/src/id3v2/id3v2TagFooter.ts b/src/id3v2/id3v2TagFooter.ts index 1b5c9ca6..4f5a9f11 100644 --- a/src/id3v2/id3v2TagFooter.ts +++ b/src/id3v2/id3v2TagFooter.ts @@ -1,12 +1,16 @@ import Id3v2Settings from "./id3v2Settings"; import SyncData from "./syncData"; -import {ByteVector} from "../byteVector"; +import {ByteVector, StringType} from "../byteVector"; import {CorruptFileError} from "../errors"; import {Id3v2TagHeader, Id3v2TagHeaderFlags} from "./id3v2TagHeader"; -import {Guards} from "../utils"; +import {Guards, NumberUtils} from "../utils"; export default class Id3v2TagFooter { - private static readonly _fileIdentifier: ByteVector = ByteVector.fromString("3DI", undefined, undefined, true); + /** + * Identifier used to recognize an ID3v2 footer. + */ + public static readonly FILE_IDENTIFIER = ByteVector.fromString("3DI", StringType.Latin1).makeReadOnly(); + private _flags: Id3v2TagHeaderFlags = Id3v2TagHeaderFlags.FooterPresent; private _majorVersion: number = 0; private _revisionNumber: number = 0; @@ -21,7 +25,7 @@ export default class Id3v2TagFooter { if (data.length < Id3v2Settings.footerSize) { throw new CorruptFileError("Provided data is smaller than object size."); } - if (!data.startsWith(Id3v2TagFooter.fileIdentifier)) { + if (!data.startsWith(Id3v2TagFooter.FILE_IDENTIFIER)) { throw new CorruptFileError("Provided data does not start with the file identifier"); } @@ -31,13 +35,13 @@ export default class Id3v2TagFooter { footer._flags = data.get(5); // TODO: Is there any point to supporting footers on versions less than 4? - if (footer._majorVersion === 2 && (footer._flags & 127) !== 0) { + if (footer._majorVersion === 2 && NumberUtils.hasFlag(footer._flags, 127)) { throw new CorruptFileError("Invalid flags set on version 2 tag"); } - if (footer._majorVersion === 3 && (footer._flags & 15) !== 0) { + if (footer._majorVersion === 3 && NumberUtils.hasFlag(footer._flags, 15)) { throw new CorruptFileError("Invalid flags set on version 3 tag"); } - if (footer._majorVersion === 4 && (footer._flags & 7) !== 0) { + if (footer._majorVersion === 4 && NumberUtils.hasFlag(footer._flags, 7)) { throw new CorruptFileError("Invalid flags set on version 4 tag"); } @@ -47,7 +51,7 @@ export default class Id3v2TagFooter { } } - footer.tagSize = SyncData.toUint(data.mid(6, 4)); + footer.tagSize = SyncData.toUint(data.subarray(6, 4)); return footer; } @@ -71,11 +75,6 @@ export default class Id3v2TagFooter { // #region Properties - /** - * Identifier used to recognize an ID3v2 footer. - */ - public static get fileIdentifier(): ByteVector { return this._fileIdentifier; } - /** * Gets the complete size of the tag described by the current instance including the header * and footer. @@ -95,11 +94,11 @@ export default class Id3v2TagFooter { */ public set flags(value: Id3v2TagHeaderFlags) { const version3Flags = Id3v2TagHeaderFlags.ExtendedHeader | Id3v2TagHeaderFlags.ExperimentalIndicator; - if ((value & version3Flags) !== 0 && this.majorVersion < 3) { + if (NumberUtils.hasFlag(value, version3Flags) && this.majorVersion < 3) { throw new Error("Feature only supported in version 2.3+"); } const version4Flags = Id3v2TagHeaderFlags.FooterPresent; - if ((value & version4Flags) !== 0 && this.majorVersion < 4) { + if (NumberUtils.hasFlag(value, version4Flags) && this.majorVersion < 4) { throw new Error("Feature only supported in version 2.4+"); } @@ -157,7 +156,7 @@ export default class Id3v2TagFooter { */ public set tagSize(value: number) { Guards.uint(value, "value"); - if ((value & 0xF0000000) !== 0) { + if (NumberUtils.hasFlag(value, 0xF0000000)) { throw new Error("Argument out of range: value must be a 28-bit unsigned integer"); } @@ -168,7 +167,7 @@ export default class Id3v2TagFooter { public render(): ByteVector { return ByteVector.concatenate( - Id3v2TagFooter.fileIdentifier, + Id3v2TagFooter.FILE_IDENTIFIER, this.majorVersion, this.revisionNumber, this.flags, diff --git a/src/id3v2/id3v2TagHeader.ts b/src/id3v2/id3v2TagHeader.ts index a704d6f0..274deeac 100644 --- a/src/id3v2/id3v2TagHeader.ts +++ b/src/id3v2/id3v2TagHeader.ts @@ -2,7 +2,7 @@ import Id3v2Settings from "./id3v2Settings"; import SyncData from "./syncData"; import {ByteVector, StringType} from "../byteVector"; import {CorruptFileError} from "../errors"; -import {Guards} from "../utils"; +import {Guards, NumberUtils} from "../utils"; export enum Id3v2TagHeaderFlags { /** @@ -26,18 +26,18 @@ export enum Id3v2TagHeaderFlags { ExtendedHeader = 0x40, /** - * The tag described by the header has been desynchronized. + * The tag described by the header has been unsynchronized using the ID3v2 unsynchronization + * scheme. */ Unsynchronization = 0x80, } export class Id3v2TagHeader { - private static readonly _fileIdentifier: ByteVector = ByteVector.fromString( - "ID3", - StringType.Latin1, - undefined, - true - ); + /** + * The identifier used to recognize an ID3v2 header. + */ + public static readonly FILE_IDENTIFIER = ByteVector.fromString("ID3", StringType.Latin1).makeReadOnly(); + private _flags: Id3v2TagHeaderFlags = Id3v2TagHeaderFlags.None; private _majorVersion: number = 0; private _revisionNumber: number = 0; @@ -52,7 +52,7 @@ export class Id3v2TagHeader { if (data.length < Id3v2Settings.headerSize) { throw new CorruptFileError("Provided data is smaller than object size"); } - if (!data.startsWith(Id3v2TagHeader.fileIdentifier)) { + if (!data.startsWith(Id3v2TagHeader.FILE_IDENTIFIER)) { throw new CorruptFileError("Provided data does not start with the file identifier"); } @@ -62,13 +62,13 @@ export class Id3v2TagHeader { header._flags = data.get(5); // Make sure flags provided are legal - if (header._majorVersion === 2 && (header._flags & 63) !== 0) { + if (header._majorVersion === 2 && NumberUtils.hasFlag(header._flags, 63)) { throw new CorruptFileError("Invalid flags set on version 2 tag"); } - if (header._majorVersion === 3 && (header._flags & 15) !== 0) { + if (header._majorVersion === 3 && NumberUtils.hasFlag(header._flags, 15)) { throw new CorruptFileError("Invalid flags set on version 3 tag"); } - if (header._majorVersion === 4 && (header._flags & 7) !== 0) { + if (header._majorVersion === 4 && NumberUtils.hasFlag(header._flags, 7)) { throw new CorruptFileError("Invalid flags set on version 4 tag"); } @@ -78,24 +78,19 @@ export class Id3v2TagHeader { throw new CorruptFileError("One of the bytes in the tag size was greater than the allowed 128"); } } - header.tagSize = SyncData.toUint(data.mid(6, 4)); + header.tagSize = SyncData.toUint(data.subarray(6, 4)); return header; } // #region Properties - /** - * The identifier used to recognize an ID3v2 header. - */ - public static get fileIdentifier(): ByteVector { return Id3v2TagHeader._fileIdentifier; } - /** * Gets the complete size of the tag described by the current instance including the header * and footer. */ public get completeTagSize(): number { - return (this._flags & Id3v2TagHeaderFlags.FooterPresent) > 0 + return NumberUtils.hasFlag(this._flags, Id3v2TagHeaderFlags.FooterPresent) ? this.tagSize + Id3v2Settings.headerSize + Id3v2Settings.footerSize : this.tagSize + Id3v2Settings.headerSize; } @@ -112,11 +107,11 @@ export class Id3v2TagHeader { public set flags(value: Id3v2TagHeaderFlags) { // @TODO: Does it make sense to check for flags for major version <4? const version3Flags = Id3v2TagHeaderFlags.ExtendedHeader | Id3v2TagHeaderFlags.ExperimentalIndicator; - if ((value & version3Flags) !== 0 && this.majorVersion < 3) { + if (NumberUtils.hasFlag(value, version3Flags) && this.majorVersion < 3) { throw new Error("Feature only supported in version 2.3+"); } const version4Flags = Id3v2TagHeaderFlags.FooterPresent; - if ((value & version4Flags) !== 0 && this.majorVersion < 4) { + if (NumberUtils.hasFlag(value, version4Flags) && this.majorVersion < 4) { throw new Error("Feature only supported in version 2.4+"); } @@ -181,7 +176,7 @@ export class Id3v2TagHeader { */ public set tagSize(value: number) { Guards.uint(value, "value"); - if ((value & 0xF0000000) !== 0) { + if (NumberUtils.hasFlag(value, 0xF0000000)) { throw new Error("Argument out of range: value must be a 28-bit unsigned integer"); } @@ -195,7 +190,7 @@ export class Id3v2TagHeader { */ public render(): ByteVector { return ByteVector.concatenate( - Id3v2TagHeader.fileIdentifier, + Id3v2TagHeader.FILE_IDENTIFIER, this.majorVersion, this.revisionNumber, this.flags, diff --git a/src/id3v2/syncData.ts b/src/id3v2/syncData.ts index bf556731..7ad56637 100644 --- a/src/id3v2/syncData.ts +++ b/src/id3v2/syncData.ts @@ -1,5 +1,5 @@ import {ByteVector} from "../byteVector"; -import {Guards} from "../utils"; +import {Guards, NumberUtils} from "../utils"; /** * Support for encoding and decoding unsynchronized data and numbers. @@ -22,7 +22,7 @@ export default { const out = ByteVector.fromSize(4, 0); for (let i = 0; i < 4; i++) { - out.set(i, value >> ((3 - i) * 7) & 0x7F); + out.set(i, NumberUtils.uintAnd(NumberUtils.uintRShift(value, (3 - i) * 7), 0x7F)); } return out; @@ -36,25 +36,33 @@ export default { * returned. * @param data Object to resynchronize */ - resyncByteVector: (data: ByteVector): void => { + resyncByteVector: (data: ByteVector): ByteVector => { Guards.truthy(data, "data"); - let i = 0; - let j = 0; - while (i < data.length - 1) { - if (i !== j) { - data.set(j, data.get(i)); - } + let leadingPtr = 0; + let trailingPtr = 0; + const outputList: ByteVector[] = []; + while (leadingPtr < data.length - 1) { + const currentByte = data.get(leadingPtr); + const nextByte = data.get(leadingPtr + 1); + if (currentByte === 0xFF && nextByte === 0x00) { + // Put the segment into the list + const length = leadingPtr - trailingPtr + 1; + outputList.push(data.subarray(trailingPtr, length)); - i += (data.get(i) === 0xFF && data.get(i + 1) === 0x00) ? 2 : 1; - j ++; + leadingPtr += 2; + trailingPtr = leadingPtr; + } else { + leadingPtr++; + } } - if (i < data.length) { - data.set(j++, data.get(i++)); + if (trailingPtr < data.length) { + // Put the remaining segment onto the list + outputList.push(data.subarray(trailingPtr, data.length - trailingPtr)); } - data.resize(j); + return ByteVector.concatenate(... outputList); }, /** @@ -83,13 +91,35 @@ export default { * as synchronization bytes. * @param data Object to unsynchronize */ - unsyncByteVector: (data: ByteVector): void => { + unsyncByteVector: (data: ByteVector): ByteVector => { Guards.notNullOrUndefined(data, "data"); - for (let i = data.length - 2; i >= 0; i--) { - if (data.get(i) === 0xFF && (data.get(i + 1) === 0 || (data.get(i + 1) & 0xE0) !== 0)) { - data.insertByte(i + 1, 0x0); + // Inserting bytes is expensive. So, lets build a list of segments, add the 0x0 bytes and + // then concatenate them together at the end. + let leadingPtr = 0; + let trailingPtr = 0; + const outputList: Array = []; + while (leadingPtr < data.length - 1) { + const currentByte = data.get(leadingPtr); + const nextByte = data.get(leadingPtr + 1); + if (currentByte === 0xFF && (nextByte === 0x00 || (nextByte & 0xE0) === 0xE0)) { + // Put the segment and an empty byte on the list + const length = leadingPtr - trailingPtr + 1; + outputList.push(data.subarray(trailingPtr, length)); + outputList.push(0x00); + + leadingPtr++; + trailingPtr = leadingPtr; + } else { + leadingPtr++; } } + + if (trailingPtr < data.length) { + // Put the remaining segment onto the list + outputList.push(data.subarray(trailingPtr, data.length - trailingPtr)); + } + + return ByteVector.concatenate(... outputList); } }; diff --git a/src/index.ts b/src/index.ts index b82655d9..211bee30 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,11 +8,8 @@ export {LocalFileAbstraction} from "./fileAbstraction"; // Base Tag Classes export {default as CombinedTag} from "./combinedTag"; export {default as Genres} from "./genres"; -export {ICodec, IAudioCodec, ILosslessAudioCodec, IVideoCodec, IPhotoCodec, MediaTypes} from "./iCodec"; -export {IPicture, PictureType} from "./iPicture"; -export {default as Picture} from "./picture"; -export {default as PictureLazy} from "./pictureLazy"; -export {default as Properties} from "./properties"; +export {IPicture, Picture, PictureLazy, PictureType} from "./picture"; +export {ICodec, IAudioCodec, ILosslessAudioCodec, IVideoCodec, IPhotoCodec, MediaTypes, Properties} from "./properties"; export {Tag, TagTypes} from "./tag"; // AAC ///////////////////////////////////////////////////////////////////// @@ -125,6 +122,16 @@ export {default as MpegVbriHeader} from "./mpeg/vbriHeader"; export {default as MpegVideoHeader} from "./mpeg/mpegVideoHeader"; export {default as MpegXingHeader} from "./mpeg/xingHeader"; +// OGG ///////////////////////////////////////////////////////////////////// +export {default as OggFile} from "./ogg/oggFile"; +export {default as OggFileSettings} from "./ogg/oggFileSettings"; +export {default as OggTag} from "./ogg/oggTag"; + +export {default as OggCodecFactory} from "./ogg/codecs/codecFactory"; +export {default as OggOpusCodec} from "./ogg/codecs/opus"; +export {default as OggTheoraCodec} from "./ogg/codecs/theora"; +export {default as OggVorbisCodec} from "./ogg/codecs/vorbis"; + // RIFF //////////////////////////////////////////////////////////////////// export {default as RiffFile} from "./riff/riffFile"; export { diff --git a/src/interfaces.ts b/src/interfaces.ts new file mode 100644 index 00000000..b003e470 --- /dev/null +++ b/src/interfaces.ts @@ -0,0 +1,24 @@ +/** + * Interface for objects that can (and should) be disposed after they are no longer needed. + */ +export interface IDisposable { + /** + * Disposes the current instance. + */ + dispose(): void; +} + +/** + * Interface for objects that can be lazily loaded. + */ +export interface ILazy { + /** + * Gets whether the object has been loaded. + */ + isLoaded: boolean; + + /** + * Loads the object. + */ + load(): void; +} diff --git a/src/mpeg/mpegAudioFile.ts b/src/mpeg/mpegAudioFile.ts index 4e20f41c..d62c6c94 100644 --- a/src/mpeg/mpegAudioFile.ts +++ b/src/mpeg/mpegAudioFile.ts @@ -1,11 +1,12 @@ import MpegAudioFileSettings from "./mpegAudioFileSettings"; import MpegAudioHeader from "./mpegAudioHeader"; import SandwichFile from "../sandwich/sandwichFile"; -import Properties from "../properties"; import {CorruptFileError} from "../errors"; import {File, ReadStyle} from "../file"; import {IFileAbstraction} from "../fileAbstraction"; +import {Properties} from "../properties"; import {TagTypes} from "../tag"; +import {NumberUtils} from "../utils"; /** * This class extends {@link SandwichFile} to provide tagging and properties support for @@ -16,7 +17,7 @@ import {TagTypes} from "../tag"; * `file.removeTags(file.tagTypes & ~file.tagTypesOnDisk);` */ export default class MpegAudioFile extends SandwichFile { - private static readonly _defaultTagLocationMapping = new Map boolean>([ + private static readonly DEFAULT_TAG_LOCATION_MAPPING = new Map boolean>([ [TagTypes.Ape, () => MpegAudioFileSettings.preferApeTagAtFileEnd], [TagTypes.Id3v1, () => true], [TagTypes.Id3v2, () => MpegAudioFileSettings.preferId3v2TagAtFileEnd] @@ -25,11 +26,11 @@ export default class MpegAudioFile extends SandwichFile { private _firstHeader: MpegAudioHeader; public constructor(file: IFileAbstraction|string, propertiesStyle: ReadStyle) { - super(file, propertiesStyle, MpegAudioFile._defaultTagLocationMapping, MpegAudioFileSettings.defaultTagTypes); + super(file, propertiesStyle, MpegAudioFile.DEFAULT_TAG_LOCATION_MAPPING, MpegAudioFileSettings.defaultTagTypes); } protected readProperties(readStyle: ReadStyle): Properties { - if ((readStyle & ReadStyle.Average) === 0) { + if (!NumberUtils.hasFlag(readStyle, ReadStyle.Average)) { return undefined; } @@ -47,7 +48,7 @@ export default class MpegAudioFile extends SandwichFile { } } -//////////////////////////////////////////////////////////////////////////// +// ///////////////////////////////////////////////////////////////////////// // Register the file type [ "taglib/mp3", diff --git a/src/mpeg/mpegAudioFileSettings.ts b/src/mpeg/mpegAudioFileSettings.ts index b18fbf75..2fbddf02 100644 --- a/src/mpeg/mpegAudioFileSettings.ts +++ b/src/mpeg/mpegAudioFileSettings.ts @@ -6,7 +6,7 @@ import {NumberUtils} from "../utils"; * re-read in order for changes to take effect. */ export default class MpegAudioFileSettings { - public static readonly supportedTagTypes = TagTypes.Id3v1 | TagTypes.Id3v2 | TagTypes.Ape; + public static readonly SUPPORTED_TAG_TYPES = TagTypes.Id3v1 | TagTypes.Id3v2 | TagTypes.Ape; private static _defaultTagTypes = TagTypes.Id3v1 | TagTypes.Id3v2; private static _preferApeTagAtFileEnd = true; @@ -19,13 +19,16 @@ export default class MpegAudioFileSettings { public static get defaultTagTypes(): TagTypes { return this._defaultTagTypes; } /** * Sets the default types of tags for an MPEG audio file. When opening a file, if these tag - * types do not exist on the file, they will be created. See {@link supportedTagTypes} for a + * types do not exist on the file, they will be created. See {@link SUPPORTED_TAG_TYPES} for a * list of tag types that are supported by node-taglib-sharp for MPEG container files. */ public static set defaultTagTypes(value: TagTypes) { - const unsupportedTagTypes = NumberUtils.uintAnd(value, ~this.supportedTagTypes); + const unsupportedTagTypes = NumberUtils.uintAnd(value, ~this.SUPPORTED_TAG_TYPES); if (unsupportedTagTypes !== 0) { - throw new Error(`Argument error: node-taglib-sharp does not support tag types ${unsupportedTagTypes} for MPEG audio files`); + throw new Error( + "Argument error: node-taglib-sharp does not support tag types" + + `${unsupportedTagTypes} for MPEG audio files` + ); } this._defaultTagTypes = value; diff --git a/src/mpeg/mpegAudioHeader.ts b/src/mpeg/mpegAudioHeader.ts index eae84adb..eba25655 100644 --- a/src/mpeg/mpegAudioHeader.ts +++ b/src/mpeg/mpegAudioHeader.ts @@ -3,23 +3,25 @@ import VbriHeader from "./vbriHeader"; import {ByteVector} from "../byteVector"; import {CorruptFileError} from "../errors"; import {File} from "../file"; -import {IAudioCodec, MediaTypes} from "../iCodec"; +import {IAudioCodec, MediaTypes} from "../properties"; import {ChannelMode, MpegVersion} from "./mpegEnums"; -import {Guards} from "../utils"; +import {Guards, NumberUtils} from "../utils"; /** * Provides information about an MPEG audio stream. For more information and definition of the * header, see http://www.mpgedit.org/mpgedit/mpeg_format/mpeghdr.htm */ export default class MpegAudioHeader implements IAudioCodec { - public static readonly Unknown: MpegAudioHeader = MpegAudioHeader.fromInfo( + // @TODO: make an enum for header flags + + public static readonly UNKNOWN: MpegAudioHeader = MpegAudioHeader.fromInfo( 0, 0, - XingHeader.unknown, - VbriHeader.unknown + XingHeader.UNKNOWN, + VbriHeader.UNKNOWN ); - private static readonly bitrates: number[][][] = [ + private static readonly BITRATES: number[][][] = [ [ // Version 1 [0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, -1], // layer 1 [0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, -1], // layer 2 @@ -32,13 +34,13 @@ export default class MpegAudioHeader implements IAudioCodec { ] ]; - private static readonly blockSize: number[][] = [ + private static readonly BLOCK_SIZES: number[][] = [ [0, 384, 1152, 1152], // Version 1 [0, 384, 1152, 576], // Version 2 [0, 384, 1152, 576] // Version 2.5 ]; - private static readonly sampleRates: number[][] = [ + private static readonly SAMPLE_RATES: number[][] = [ [44100, 48000, 32000, 0], // Version 1 [22050, 24000, 16000, 0], // Version 2 [11025, 12000, 8000, 0] // Version 2.5 @@ -52,7 +54,7 @@ export default class MpegAudioHeader implements IAudioCodec { // #region Constructors - private constructor() {} + private constructor() { /* private to enforce construction via static methods */ } /** * Constructs and initializes a new instance by reading its contents from a data @@ -63,7 +65,7 @@ export default class MpegAudioHeader implements IAudioCodec { * @param position Position into `file` where the header begins, must be a positive * 8-bit integer. */ - public static fromData(data: ByteVector, file: File, position: number) { + public static fromData(data: ByteVector, file: File, position: number): MpegAudioHeader { Guards.truthy(data, "data"); Guards.truthy(file, "file"); Guards.safeUint(position, "position"); @@ -77,15 +79,15 @@ export default class MpegAudioHeader implements IAudioCodec { throw new CorruptFileError(error); } - header._flags = data.toUInt(); - header._xingHeader = XingHeader.unknown; - header._vbriHeader = VbriHeader.unknown; + header._flags = data.toUint(); + header._xingHeader = XingHeader.UNKNOWN; + header._vbriHeader = VbriHeader.UNKNOWN; // Check for a Xing header that will help us in gathering info about a VBR stream file.seek(position + XingHeader.xingHeaderOffset(header.version, header.channelMode)); const xingData = file.readBlock(16); - if (xingData.length === 16 && xingData.startsWith(XingHeader.fileIdentifier)) { + if (xingData.length === 16 && xingData.startsWith(XingHeader.FILE_IDENTIFIER)) { header._xingHeader = XingHeader.fromData(xingData); } @@ -94,11 +96,11 @@ export default class MpegAudioHeader implements IAudioCodec { } // A Xing header could not be found, next check for a Fraunhofer VBRI header - file.seek(position + VbriHeader.vbriHeaderOffset); + file.seek(position + VbriHeader.VBRI_HEADER_OFFSET); // Only get the first 24 bytes of the header. We're not interested in the TOC entries. const vbriData = file.readBlock(24); - if (vbriData.length === 24 && vbriData.startsWith(VbriHeader.fileIdentifier)) { + if (vbriData.length === 24 && vbriData.startsWith(VbriHeader.FILE_IDENTIFIER)) { header._vbriHeader = VbriHeader.fromData(vbriData); } @@ -158,8 +160,8 @@ export default class MpegAudioHeader implements IAudioCodec { const index1 = this.version === MpegVersion.Version1 ? 0 : 1; const index2 = this.audioLayer - 1; - const index3 = (this._flags >> 12) & 0x0f; - return MpegAudioHeader.bitrates[index1][index2][index3]; + const index3 = NumberUtils.uintAnd(NumberUtils.uintRShift(this._flags, 12), 0x0f); + return MpegAudioHeader.BITRATES[index1][index2][index3]; } /** @inheritDoc IAudioCodec.audioChannels */ @@ -186,7 +188,7 @@ export default class MpegAudioHeader implements IAudioCodec { * Gets the MPEG audio layer used to encode the audio represented by the current instance. */ public get audioLayer(): number { - switch ((this._flags >> 17) & 0x03) { + switch (NumberUtils.uintAnd(NumberUtils.uintRShift(this._flags, 17), 0x03)) { case 1: return 3; case 2: @@ -199,14 +201,14 @@ export default class MpegAudioHeader implements IAudioCodec { /** @inheritDoc IAudioCodec.audioSampleRate */ public get audioSampleRate(): number { const index1 = this.version; - const index2 = (this._flags >> 10) & 0x03; - return MpegAudioHeader.sampleRates[index1][index2]; + const index2 = NumberUtils.uintAnd(NumberUtils.uintRShift(this._flags, 10), 0x03); + return MpegAudioHeader.SAMPLE_RATES[index1][index2]; } /** * Gets the MPEG audio channel mode of the audio represented by the current instance. */ - public get channelMode(): ChannelMode { return (this._flags >> 6) & 0x03; } + public get channelMode(): ChannelMode { return NumberUtils.uintAnd(NumberUtils.uintRShift(this._flags, 6), 0x03); } /** @inheritDoc ICodec.description */ public get description(): string { @@ -235,14 +237,15 @@ export default class MpegAudioHeader implements IAudioCodec { public get durationMilliseconds(): number { if (this._durationMilliseconds > 0) { return this._durationMilliseconds; } + const blockSizeForVersionAndLayer = MpegAudioHeader.BLOCK_SIZES[this.version][this.audioLayer]; if (this._xingHeader.totalFrames > 0) { // Read the length and the bitrate from the Xing header - const timePerFrameSeconds = MpegAudioHeader.blockSize[this.version][this.audioLayer] / this.audioSampleRate; + const timePerFrameSeconds = blockSizeForVersionAndLayer / this.audioSampleRate; const durationSeconds = timePerFrameSeconds * this._xingHeader.totalFrames; this._durationMilliseconds = durationSeconds * 1000; } else if (this._vbriHeader.totalFrames > 0) { // Read the length and the bitrate from the VBRI header - const timePerFrameSeconds = MpegAudioHeader.blockSize[this.version][this.audioLayer] / this.audioSampleRate; + const timePerFrameSeconds = blockSizeForVersionAndLayer / this.audioSampleRate; const durationSeconds = Math.round(timePerFrameSeconds * this._vbriHeader.totalFrames); this._durationMilliseconds = durationSeconds * 1000; } else if (this.audioFrameLength > 0 && this.audioBitrate > 0) { @@ -258,6 +261,8 @@ export default class MpegAudioHeader implements IAudioCodec { return this._durationMilliseconds; } + // TODO: Introduce an MPEG flags enum + /** * Whether or not the current audio is copyrighted. */ @@ -297,7 +302,7 @@ export default class MpegAudioHeader implements IAudioCodec { } /** - * Gets the VBRI header found in the audio. {@link VbriHeader.unknown} is returned if no header + * Gets the VBRI header found in the audio. {@link VbriHeader.UNKNOWN} is returned if no header * was found. */ public get vbriHeader(): VbriHeader { return this._vbriHeader; } @@ -317,7 +322,7 @@ export default class MpegAudioHeader implements IAudioCodec { } /** - * Gets the Xing header found in the audio. {@link XingHeader.unknown} is returned if no header + * Gets the Xing header found in the audio. {@link XingHeader.UNKNOWN} is returned if no header * was found. */ public get xingHeader(): XingHeader { return this._xingHeader; } @@ -352,12 +357,12 @@ export default class MpegAudioHeader implements IAudioCodec { do { // @TODO: ugh, this has that bizarre 3 byteoffset into each read, remove it file.seek(position + 3); - buffer = buffer.mid(buffer.length - 3); + buffer = buffer.subarray(buffer.length - 3); buffer.addByteVector(file.readBlock(File.bufferSize)); for (let i = 0; i < buffer.length - 3 && (length === undefined || position + i < end); i++) { if (buffer.get(i) === 0xFF && buffer.get(i + 1) > 0xE0) { - const data = buffer.mid(i, 4); + const data = buffer.subarray(i, 4); if (!this.getHeaderError(data)) { try { return MpegAudioHeader.fromData(data, file, position + i); @@ -389,15 +394,15 @@ export default class MpegAudioHeader implements IAudioCodec { // - Bits 4 and 5 can be 00, 10, or 11 but not 01 // - One or more of bits 6 and 7 must be set // - Bit 8 can be anything - if ((data.get(1) & 0xE6) <= 0xE0 || (data.get(1) & 0x18) === 0x08) { + if (NumberUtils.uintAnd(data.get(1), 0xE6) <= 0xE0 || NumberUtils.uintAnd(data.get(1), 0x18) === 0x08) { return "Second byte did not match MPEG sync"; } - const flags = data.toUInt(); - if (((flags >> 12) & 0x0F) === 0x0F) { + const flags = data.toUint(); + if (NumberUtils.hasFlag(NumberUtils.uintRShift(flags, 12), 0x0F, true)) { return "Header uses invalid bitrate index"; } - if (((flags >> 10) & 0x03) === 0x03) { + if (NumberUtils.hasFlag(NumberUtils.uintRShift(flags, 10), 0x03, true)) { return "Invalid sample rate"; } diff --git a/src/mpeg/mpegContainerFile.ts b/src/mpeg/mpegContainerFile.ts index f21c7137..a640c9e2 100644 --- a/src/mpeg/mpegContainerFile.ts +++ b/src/mpeg/mpegContainerFile.ts @@ -1,14 +1,15 @@ +import MpegContainerFileSettings from "./mpegContainerFileSettings"; import MpegAudioHeader from "./mpegAudioHeader"; import MpegVideoHeader from "./mpegVideoHeader"; import SandwichFile from "../sandwich/sandwichFile"; -import Properties from "../properties"; import {ByteVector} from "../byteVector"; import {CorruptFileError, UnsupportedFormatError} from "../errors"; import {File, ReadStyle} from "../file"; import {IFileAbstraction} from "../fileAbstraction"; import {MpegVersion} from "./mpegEnums"; +import {Properties} from "../properties"; import {TagTypes} from "../tag"; -import MpegContainerFileSettings from "./mpegContainerFileSettings"; +import {NumberUtils} from "../utils"; /** * Indicates the type of marker found in an MPEG file. @@ -69,12 +70,12 @@ enum MpegFileMarker { * `file.removeTags(file.tagTypes & ~file.tagTypesOnDisk);` */ export default class MpegContainerFile extends SandwichFile { - private static readonly _defaultTagLocationMapping = new Map boolean>([ + private static readonly DEFAULT_TAG_LOCATION_MAPPING = new Map boolean>([ [TagTypes.Ape, () => true], [TagTypes.Id3v1, () => true], [TagTypes.Id3v2, () => true] ]); - private static readonly _markerStart = ByteVector.fromByteArray(new Uint8Array([0, 0, 1])); + private static readonly MARKER_START = ByteVector.fromByteArray([0, 0, 1]); private _audioFound = false; private _audioHeader: MpegAudioHeader; @@ -88,7 +89,7 @@ export default class MpegContainerFile extends SandwichFile { super( file, propertiesStyle, - MpegContainerFile._defaultTagLocationMapping, + MpegContainerFile.DEFAULT_TAG_LOCATION_MAPPING, MpegContainerFileSettings.defaultTagTypes ); } @@ -96,7 +97,7 @@ export default class MpegContainerFile extends SandwichFile { /** @inheritDoc */ protected readProperties(readStyle: ReadStyle): Properties { // Skip processing if we aren't supposed to read the properties - if ((readStyle & ReadStyle.Average) === 0) { + if (!NumberUtils.hasFlag(readStyle, ReadStyle.Average)) { return; } @@ -126,7 +127,7 @@ export default class MpegContainerFile extends SandwichFile { // #region Private Methods private findFirstMarker(position: number): {marker: MpegFileMarker, position: number} { - position = this.find(MpegContainerFile._markerStart, position); + position = this.find(MpegContainerFile.MARKER_START, position); if (position < 0) { throw new CorruptFileError("Marker not found"); } @@ -139,7 +140,7 @@ export default class MpegContainerFile extends SandwichFile { private findNextMarkerPosition(position: number, marker: MpegFileMarker): number { const packet = ByteVector.concatenate( - MpegContainerFile._markerStart, + MpegContainerFile.MARKER_START, marker ); position = this.find(packet, position); @@ -155,7 +156,7 @@ export default class MpegContainerFile extends SandwichFile { this.seek(position); const identifier = this.readBlock(4); - if (identifier.length === 4 && identifier.startsWith(MpegContainerFile._markerStart)) { + if (identifier.length === 4 && identifier.startsWith(MpegContainerFile.MARKER_START)) { return identifier.get(3); } @@ -164,7 +165,8 @@ export default class MpegContainerFile extends SandwichFile { private readAudioPacket(position: number): number { this.seek(position + 4); - const length = this.readBlock(2).toUShort(); + const headerBytes = this.readBlock(21); + const length = headerBytes.subarray(0, 2).toUshort(); const returnValue = position + length; if (this._audioFound) { @@ -172,14 +174,14 @@ export default class MpegContainerFile extends SandwichFile { } // There is a maximum of 16 stuffing bytes, read to the PTS/DTS flags - const packetHeaderBytes = this.readBlock(19); + const packetHeaderBytes = headerBytes.subarray(2, 19); let i = 0; while (i < packetHeaderBytes.length && packetHeaderBytes.get(i) === 0xFF) { // Byte is a stuffing byte i++; } - if ((packetHeaderBytes.get(i) & 0x40 ) !== 0) { + if (NumberUtils.hasFlag(packetHeaderBytes.get(i), 0x40 )) { // STD buffer size is unexpected for audio packets, but whatever i++; } @@ -187,8 +189,8 @@ export default class MpegContainerFile extends SandwichFile { // Decode the PTS/DTS flags const timestampFlags = packetHeaderBytes.get(i); const dataOffset = 4 + 2 + i // Packet marker + packet length + stuffing bytes/STD buffer size - + ((timestampFlags & 0x20) > 0 ? 4 : 0) // Presentation timestamp - + ((timestampFlags & 0x10) > 0 ? 4 : 0); // Decode timestamp + + (NumberUtils.hasFlag(timestampFlags, 0x20) ? 4 : 0) // Presentation timestamp + + (NumberUtils.hasFlag(timestampFlags, 0x10) ? 4 : 0); // Decode timestamp // Decode the MPEG audio header this._audioHeader = MpegAudioHeader.find(this, position + dataOffset, length - 9); @@ -215,7 +217,7 @@ export default class MpegContainerFile extends SandwichFile { case MpegFileMarker.SystemPacket: case MpegFileMarker.PaddingPacket: this.seek(position + 4); - position += this.readBlock(2).toUShort() + 6; + position += this.readBlock(2).toUshort() + 6; break; case MpegFileMarker.VideoPacket: position = this.readVideoPacket(position); @@ -237,13 +239,13 @@ export default class MpegContainerFile extends SandwichFile { this.seek(position + 4); const versionInfo = this.readBlock(1).get(0); - if ((versionInfo & 0xF0) === 0x20) { + if (NumberUtils.uintAnd(versionInfo, 0xF0) === 0x20) { this._version = MpegVersion.Version1; packetSize = 12; - } else if ((versionInfo & 0xC0) === 0x40) { + } else if (NumberUtils.uintAnd(versionInfo, 0xC0) === 0x40) { this._version = MpegVersion.Version2; this.seek(position + 13); - packetSize = 14 + (this.readBlock(1).get(0) & 0x07); + packetSize = 14 + NumberUtils.uintAnd(this.readBlock(1).get(0), 0x07); } else { throw new UnsupportedFormatError("Unknown MPEG version"); } @@ -262,21 +264,25 @@ export default class MpegContainerFile extends SandwichFile { this.seek(position); if (this._version === MpegVersion.Version1) { const data = this.readBlock(5); - high = ((data.get(0) >>> 3) & 0x01) >>> 0; - low = (((data.get(0) >>> 1) & 0x03 << 30) - | (data.get(1) << 22) - | ((data.get(2) >>> 1) << 15) - | (data.get(3) << 7) - | (data.get(4) >>> 1)) >>> 0; + high = NumberUtils.uintAnd(NumberUtils.uintRShift(data.get(0), 3), 0x01); + low = NumberUtils.uintOr( + NumberUtils.uintLShift(NumberUtils.uintAnd(NumberUtils.uintRShift(data.get(0), 1), 0x03), 30), + NumberUtils.uintLShift(data.get(1), 22), + NumberUtils.uintLShift(NumberUtils.uintRShift(data.get(2), 1), 15), + NumberUtils.uintLShift(data.get(3), 7), + NumberUtils.uintRShift(data.get(4), 1) + ); } else { const data = this.readBlock(6); - high = ((data.get(0) & 0x20) >>> 5); - low = (((data.get(0) & 0x03) << 28) - | (data.get(1) << 20) - | ((data.get(2) & 0xF8) << 12) - | ((data.get(2) & 0x03) << 13) - | (data.get(3) << 5) - | (data.get(4) >>> 3)) >>> 0; + high = NumberUtils.uintRShift(NumberUtils.uintAnd(data.get(0), 0x20), 5); + low = NumberUtils.uintOr( + NumberUtils.uintLShift(NumberUtils.uintAnd(data.get(0), 0x03), 28), + NumberUtils.uintLShift(data.get(1), 20), + NumberUtils.uintLShift(NumberUtils.uintAnd(data.get(2), 0xF8), 12), + NumberUtils.uintLShift(NumberUtils.uintAnd(data.get(2), 0x03), 13), + NumberUtils.uintLShift(data.get(3), 5), + NumberUtils.uintRShift(data.get(4), 3) + ); } return (high * 0x10000 * 0x10000 + low) / 90000; @@ -284,7 +290,7 @@ export default class MpegContainerFile extends SandwichFile { private readVideoPacket(position: number): number { this.seek(position + 4); - const length = this.readBlock(2).toUShort(); + const length = this.readBlock(2).toUshort(); let offset = position + 6; while (!this._videoFound && offset < position + length) { @@ -307,7 +313,7 @@ export default class MpegContainerFile extends SandwichFile { private rFindMarkerPosition(position: number, marker: MpegFileMarker): number { const packet = ByteVector.concatenate( - MpegContainerFile._markerStart, + MpegContainerFile.MARKER_START, marker ); position = this.rFind(packet, position); @@ -322,7 +328,7 @@ export default class MpegContainerFile extends SandwichFile { // #endregion } -//////////////////////////////////////////////////////////////////////////// +// ///////////////////////////////////////////////////////////////////////// // Register the file type [ "taglib/mpg", diff --git a/src/mpeg/mpegContainerFileSettings.ts b/src/mpeg/mpegContainerFileSettings.ts index 3f966e50..e1d155c3 100644 --- a/src/mpeg/mpegContainerFileSettings.ts +++ b/src/mpeg/mpegContainerFileSettings.ts @@ -6,7 +6,7 @@ import {NumberUtils} from "../utils"; * be re-read in order for changes to take effect. */ export default class MpegContainerFileSettings { - public static readonly supportedTagTypes = TagTypes.Id3v1 | TagTypes.Id3v2 | TagTypes.Ape; + public static readonly SUPPORTED_TAG_TYPES = TagTypes.Id3v1 | TagTypes.Id3v2 | TagTypes.Ape; private static _defaultTagTypes = TagTypes.Id3v1 | TagTypes.Id3v2; @@ -17,13 +17,15 @@ export default class MpegContainerFileSettings { public static get defaultTagTypes(): TagTypes { return this._defaultTagTypes; } /** * Sets the default types of tags for an MPEG container file. When opening a file, if these tag - * types do not exist on the file, they will be created. See {@link supportedTagTypes} for a + * types do not exist on the file, they will be created. See {@link SUPPORTED_TAG_TYPES} for a * list of tag types that are supported by node-taglib-sharp for MPEG container files. */ public static set defaultTagTypes(value: TagTypes) { - const unsupportedTagTypes = NumberUtils.uintAnd(value, ~this.supportedTagTypes); + const unsupportedTagTypes = NumberUtils.uintAnd(value, ~this.SUPPORTED_TAG_TYPES); if (unsupportedTagTypes !== 0) { - throw new Error(`Argument error: node-taglib-sharp does not support tag types ${unsupportedTagTypes} for AAC files`); + throw new Error( + `Argument error: node-taglib-sharp does not support tag types ${unsupportedTagTypes} for AAC files` + ); } this._defaultTagTypes = value; diff --git a/src/mpeg/mpegVideoHeader.ts b/src/mpeg/mpegVideoHeader.ts index bdd0c1b7..8ab0d688 100644 --- a/src/mpeg/mpegVideoHeader.ts +++ b/src/mpeg/mpegVideoHeader.ts @@ -1,13 +1,13 @@ import {CorruptFileError} from "../errors"; import {File} from "../file"; -import {IVideoCodec, MediaTypes} from "../iCodec"; -import {Guards} from "../utils"; +import {IVideoCodec, MediaTypes} from "../properties"; +import {Guards, NumberUtils} from "../utils"; /** * Provides information about an MPEG video stream. */ export default class MpegVideoHeader implements IVideoCodec { - private static readonly _frameRates = [ + private static readonly FRAME_RATES = [ 0, 24000 / 1001, 24, 25, 30000 / 1001, 30, 50, 60000 / 1001, 60 ]; @@ -33,10 +33,10 @@ export default class MpegVideoHeader implements IVideoCodec { throw new CorruptFileError("Insufficient data in header"); } - this._videoWidth = data.mid(0, 2).toUShort() >>> 4; - this._videoHeight = (data.mid(1, 2).toShort() & 0x0FFF) >>> 0; - this._frameRateIndex = (data.get(3) & 0x0F) >>> 0; - this._videoBitrate = ((data.mid(4, 3).toUInt() >>> 6) & 0x3FFFF) >>> 0; + this._videoWidth = data.subarray(0, 2).toUshort() >>> 4; + this._videoHeight = NumberUtils.uintAnd(data.subarray(1, 2).toUshort(), 0x0FFF); + this._frameRateIndex = NumberUtils.uintAnd(data.get(3), 0x0F); + this._videoBitrate = NumberUtils.uintAnd(NumberUtils.uintRShift(data.subarray(4, 3).toUint(), 6), 0x3FFFF); } // #region @@ -59,7 +59,7 @@ export default class MpegVideoHeader implements IVideoCodec { /** @inheritDoc */ public get videoFrameRate(): number { - return this._frameRateIndex < 9 ? MpegVideoHeader._frameRates[this._frameRateIndex] : 0; + return this._frameRateIndex < 9 ? MpegVideoHeader.FRAME_RATES[this._frameRateIndex] : 0; } /** @inheritDoc */ diff --git a/src/mpeg/vbriHeader.ts b/src/mpeg/vbriHeader.ts index 9412461e..7e1c51b5 100644 --- a/src/mpeg/vbriHeader.ts +++ b/src/mpeg/vbriHeader.ts @@ -1,4 +1,4 @@ -import {ByteVector} from "../byteVector"; +import {ByteVector, StringType} from "../byteVector"; import {CorruptFileError} from "../errors"; import {Guards} from "../utils"; @@ -9,18 +9,18 @@ export default class VbriHeader { /** * Identifier that appears in the file to indicate the start of the VBRI header. */ - public static readonly fileIdentifier = ByteVector.fromString("VBRI", undefined, undefined, true); + public static readonly FILE_IDENTIFIER = ByteVector.fromString("VBRI", StringType.Latin1).makeReadOnly(); /** * An empty and unset VBRI header. */ - public static readonly unknown = VbriHeader.fromInfo(0, 0); + public static readonly UNKNOWN = VbriHeader.fromInfo(0, 0); /** * Offset at which a VBRI header would appear in an MPEG audio packet. Always 32 bytes after * the end of the first MPEG header. */ - public static readonly vbriHeaderOffset = 0x24; + public static readonly VBRI_HEADER_OFFSET = 0x24; private _isPresent: boolean; private _totalFrames: number; @@ -28,7 +28,7 @@ export default class VbriHeader { // #region Constructors - private constructor() {} + private constructor() { /* private to enforce construction via static methods */ } /** * Constructs a new instance with a specified frame count and size. @@ -54,14 +54,14 @@ export default class VbriHeader { Guards.truthy(data, "data"); // Check to see if a valid VBRI header is available - if (!data.startsWith(VbriHeader.fileIdentifier)) { + if (!data.startsWith(VbriHeader.FILE_IDENTIFIER)) { throw new CorruptFileError("Not a valid VBRI header"); } // Size start at position 10 const header = new VbriHeader(); - header._totalSize = data.mid(10, 4).toUInt(); - header._totalFrames = data.mid(14, 4).toUInt(); + header._totalSize = data.subarray(10, 4).toUint(); + header._totalFrames = data.subarray(14, 4).toUint(); header._isPresent = true; return header; diff --git a/src/mpeg/xingHeader.ts b/src/mpeg/xingHeader.ts index b3134312..ca7a82bc 100644 --- a/src/mpeg/xingHeader.ts +++ b/src/mpeg/xingHeader.ts @@ -1,7 +1,7 @@ -import {ByteVector} from "../byteVector"; +import {ByteVector, StringType} from "../byteVector"; import {CorruptFileError} from "../errors"; import {ChannelMode, MpegVersion} from "./mpegEnums"; -import {Guards} from "../utils"; +import {Guards, NumberUtils} from "../utils"; /** * Information about a variable bitrate MPEG audio stream @@ -10,12 +10,12 @@ export default class XingHeader { /** * Identifier that appears in a file to indicate the start of a Xing header. */ - public static readonly fileIdentifier = ByteVector.fromString("Xing", undefined, undefined, true); + public static readonly FILE_IDENTIFIER = ByteVector.fromString("Xing", StringType.Latin1).makeReadOnly(); /** * An empty an unset Xing header */ - public static readonly unknown = XingHeader.fromInfo(0, 0); + public static readonly UNKNOWN = XingHeader.fromInfo(0, 0); private _isPresent: boolean; private _totalFrames: number; @@ -23,7 +23,7 @@ export default class XingHeader { // #region Constructors - private constructor() {} + private constructor() { /* private to enforce construction via static methods */ } /** * Constructs a new instance with a specified frame count and size. @@ -49,22 +49,22 @@ export default class XingHeader { Guards.truthy(data, "data"); // Check to see if a valid Xing header is available - if (!data.startsWith(XingHeader.fileIdentifier)) { + if (!data.startsWith(XingHeader.FILE_IDENTIFIER)) { throw new CorruptFileError("Not a valid Xing header"); } const header = new XingHeader(); let position = 8; - if ((data.get(7) & 0x01) !== 0) { - header._totalFrames = data.mid(position, 4).toUInt(); + if (NumberUtils.hasFlag(data.get(7), 0x01)) { + header._totalFrames = data.subarray(position, 4).toUint(); position += 4; } else { header._totalFrames = 0; } - if ((data.get(7) & 0x02) !== 0) { - header._totalSize = data.mid(position, 4).toUInt(); + if (NumberUtils.hasFlag(data.get(7), 0x02)) { + header._totalSize = data.subarray(position, 4).toUint(); } else { header._totalSize = 0; } diff --git a/src/ogg/codecs/codecFactory.ts b/src/ogg/codecs/codecFactory.ts new file mode 100644 index 00000000..2efcf4d7 --- /dev/null +++ b/src/ogg/codecs/codecFactory.ts @@ -0,0 +1,78 @@ +import IOggCodec from "./iOggCodec"; +import Opus from "./opus"; +import Theora from "./theora"; +import Vorbis from "./vorbis"; +import {ByteVector} from "../../byteVector"; +import {UnsupportedFormatError} from "../../errors"; +import {Guards} from "../../utils"; + +/** + * Type shortcut for a method that can generate a codec object based on the first packet of the + * bit stream. + * @param firstPacket First packet in the bit stream + * @returns (IOggCodec | undefined) Generated {@see IOggCodec} is returned if a codec could be + * constructed from the first packet, otherwise `undefined` is returned. + */ +export type CodecProvider = (firstPacket: ByteVector) => IOggCodec | undefined; + +/** + * Factory for creating codecs from the first packet of the Ogg bitstream. + * @remarks By default, only codecs provided by the library will be matched. However, custom codec + * support can be added by using {@see addCodecProvider}. + */ +export default class CodecFactory { + private static _customCodecProviders: CodecProvider[] = []; + + /** + * Adds a custom codec provider to try before using standard codec creation methods. + * Codec providers are used before standard methods so custom checking can be used and new + * formats can be added. They are executed in reverse order in which they are added. + * @param provider Codec provider function + * * firstPacket: ByteVector First packet of the bitstream + * * returns IOggCodec if method was able to match the packet, falsy otherwise + */ + public static addCodecProvider(provider: CodecProvider): void { + Guards.truthy(provider, "provider"); + CodecFactory._customCodecProviders.push(provider); + } + + /** + * Clears the custom providers from the factory. + */ + public static clearCustomProviders(): void { + CodecFactory._customCodecProviders = []; + } + + /** + * Determines the correc codec to use for a stream header packet. + * @param packet First packet of an Ogg logical bitstream. + */ + public static getCodec(packet: ByteVector): IOggCodec { + Guards.truthy(packet, "packet"); + + // Check custom providers first + let codec: IOggCodec; + for (const provider of CodecFactory._customCodecProviders) { + codec = provider(packet); + } + if (codec) { + return codec; + } + + // Try the known codecs + if (Vorbis.isHeaderPacket(packet)) { + // Vorbis + codec = new Vorbis(packet); + } else if (Theora.isHeaderPacket(packet)) { + // Theora + codec = new Theora(packet); + } else if (Opus.isHeaderPacket(packet)) { + // Opus + codec = new Opus(packet); + } else { + throw new UnsupportedFormatError("Unknown Ogg codec"); + } + + return codec; + } +} diff --git a/src/ogg/codecs/iOggCodec.ts b/src/ogg/codecs/iOggCodec.ts new file mode 100644 index 00000000..10fcaead --- /dev/null +++ b/src/ogg/codecs/iOggCodec.ts @@ -0,0 +1,36 @@ +import XiphComment from "../../xiph/xiphComment"; +import {ByteVector} from "../../byteVector"; +import {ICodec} from "../../properties"; + +/** + * Interface for an OGG codec. + */ +export default interface IOggCodec extends ICodec { + /** + * Gets the raw Xiph comment data contained in the codec. + */ + get commentData(): ByteVector; + + /** + * Reads an Ogg packet that has been encountered in the stream, looking for the comment data. + * @param packet Packet to read + * @returns boolean `true` if the codec has read all the necessary packets for the stream and + * does not need to be called again, + */ + readPacket(packet: ByteVector): boolean; + + /** + * Sets the file offset information necessary for calculating the duration of the stream. Once + * called, the duration can be accessed by calling {@see ICodec.durationMilliseconds}. + * @param firstGranularPosition First granular position of the stream + * @param lastGranularPosition Last granular position of the stream + */ + setDuration(firstGranularPosition: number, lastGranularPosition: number): void; + + /** + * Renders and write the provided comment into the provided list of packets. + * @param packets List of packets the comment packet should be written into. + * @param comment Xiph comment to write into the list of packets. + */ + writeCommentPacket(packets: ByteVector[], comment: XiphComment): void; +} diff --git a/src/ogg/codecs/opus.ts b/src/ogg/codecs/opus.ts new file mode 100644 index 00000000..3cac9dd2 --- /dev/null +++ b/src/ogg/codecs/opus.ts @@ -0,0 +1,141 @@ +import IOggCodec from "./iOggCodec"; +import XiphComment from "../../xiph/xiphComment"; +import {ByteVector, StringType} from "../../byteVector"; +import {IAudioCodec, MediaTypes} from "../../properties"; +import {Guards} from "../../utils"; + +/** + * Represents an Ogg Opus bitstream for use within an Ogg file. + */ +export default class Opus implements IOggCodec, IAudioCodec { + private static readonly HEADER_IDENTIFIER = ByteVector.fromString("OpusHead", StringType.Latin1).makeReadOnly(); + private static readonly COMMENT_IDENTIFIER = ByteVector.fromString("OpusTags", StringType.Latin1).makeReadOnly(); + + private readonly _channelCount: number; + private readonly _inputSampleRate: number; + private readonly _opusVersion: number; + private readonly _preSkip: number; + private readonly _streamCount: number; + private _commentData: ByteVector; + private _durationMilliseconds: number; + + /** + * Constructs and initializes a new instance using the provided header packet to read the + * codec's header information. + * @param headerPacket Packet containing the header of the stream + */ + public constructor(headerPacket: ByteVector) { + Guards.truthy(headerPacket, "headerPacket"); + if (!headerPacket.startsWith(Opus.HEADER_IDENTIFIER)) { + throw new Error(`Argument error: Header packet must start with magic signature`); + } + + // Head the header + this._opusVersion = headerPacket.get(8); + this._channelCount = headerPacket.get(9); + this._preSkip = headerPacket.subarray(10, 2).toUint(false); + this._inputSampleRate = headerPacket.subarray(12, 4).toUint(false); + + const channelMappingFamily = headerPacket.get(18); + if (channelMappingFamily === 0) { + this._streamCount = 1; + } else { + this._streamCount = headerPacket.get(19); + } + } + + // #region Properties + + /** + * @inheritDoc + * @remarks Always returns zero since bitrate is variable and no information is stored in the + * Ogg header (unlike Vorbis). + */ + public get audioBitrate(): number { return 0; } + + /** + * @inheritDoc + * @remarks This is the *input* sample rate used when the file was created. Opus uses a variety + * of sample rates internally, and as such the output sample rate is dependent on the + * decoder used. In most modern hardware cases, this will be 48kHz. + */ + public get audioSampleRate(): number { return this._inputSampleRate; } + + /** @inheritDoc */ + public get audioChannels(): number { return this._channelCount; } + + /** + * Gets the raw Xiph comment data contained in the codec. + */ + public get commentData(): ByteVector { return this._commentData; } + + /** @inheritDoc */ + public get description(): string { return `Opus v${this._opusVersion} Audio`; } + + /** @inheritDoc */ + public get durationMilliseconds(): number { return this._durationMilliseconds || 0; } + + /** @inheritDoc */ + public get mediaTypes(): MediaTypes { return MediaTypes.Audio; } + + /** + * Gets the number of streams contained in the bitstream. + */ + public get streamCount(): number { return this._streamCount; } + + // #endregion + + // #region Methods + + /** + * Determines whether an Opus header packet based on the presence of the Opus header + * packet magic signature. + * @param headerPacket Packet to check + */ + public static isHeaderPacket(headerPacket: ByteVector): boolean { + return headerPacket.startsWith(Opus.HEADER_IDENTIFIER); + } + + /** @inheritDoc */ + public readPacket(packet: ByteVector): boolean { + Guards.truthy(packet, "packet"); + + if (!this._commentData && packet.startsWith(Opus.COMMENT_IDENTIFIER)) { + this._commentData = packet.subarray(Opus.COMMENT_IDENTIFIER.length).toByteVector(); + } + + return !!this._commentData; + } + + /** @inheritDoc */ + // NOTE: This is not static b/c it must be part of the interface. + public writeCommentPacket(packets: ByteVector[], comment: XiphComment): void { + Guards.truthy(packets, "packets"); + Guards.truthy(comment, "comment"); + + const data = ByteVector.concatenate( + Opus.COMMENT_IDENTIFIER, + comment.render(true) + ); + + if (packets.length > 1 && packets[1].startsWith(Opus.COMMENT_IDENTIFIER)) { + // Replace the comments packet as the 2nd packet + packets[1] = data; + } else { + // Insert the comments packet as the 2nd packet + packets.splice(1, 0, data); + } + } + + public setDuration(firstGranularPosition: number, lastGranularPosition: number): void { + Guards.safeUint(firstGranularPosition, "firstGranularPosition"); + Guards.safeUint(lastGranularPosition, "lastGranularPosition"); + + // NOTE: It probably looks wrong to use 48kHz all the time, but this is actually correct as + // per the Opus guide https://wiki.xiph.org/OpusFAQ + const durationSeconds = (lastGranularPosition - firstGranularPosition - this._preSkip) / 48000; + this._durationMilliseconds = durationSeconds * 1000; + } + + // #endregion +} diff --git a/src/ogg/codecs/theora.ts b/src/ogg/codecs/theora.ts new file mode 100644 index 00000000..517c5725 --- /dev/null +++ b/src/ogg/codecs/theora.ts @@ -0,0 +1,125 @@ +import IOggCodec from "./iOggCodec"; +import XiphComment from "../../xiph/xiphComment"; +import {ByteVector, StringType} from "../../byteVector"; +import {IVideoCodec, MediaTypes} from "../../properties"; +import {Guards, NumberUtils} from "../../utils"; + +/** + * Types of packets that occur within an Ogg Theora bitstream. + */ +enum TheoraPacketType { + IdentificationHeader = 0x80, + CommentHeader = 0x81 +} + +/** + * Represents an Ogg Theora bitstream for use in an Ogg file. + */ +export default class Theora implements IOggCodec, IVideoCodec { + private static readonly IDENTIFIER = ByteVector.fromString("theora", StringType.Latin1).makeReadOnly(); + + private readonly _fpsDenominator: number; + private readonly _fpsNumerator: number; + private readonly _height: number; + private readonly _keyframeGranuleShift: number; + private readonly _majorVersion: number; + private readonly _minorVersion: number; + private readonly _reversionVersion: number; + private readonly _width: number; + private _commentData: ByteVector; + private _durationMilliseconds: number; + + /** + * Constructs and initializes a new instance using the provided header packet. + * @param headerPacket Packet that contains the Theora header data + */ + public constructor(headerPacket: ByteVector) { + Guards.truthy(headerPacket, "headerPacket"); + if (!Theora.isHeaderPacket(headerPacket)) { + throw new Error("Argument error: packet must have proper signature for Theora header packet"); + } + + // NOTE: See https://www.theora.org/doc/Theora.pdf section 6.2 for header spec + + this._majorVersion = headerPacket.get(7); + this._minorVersion = headerPacket.get(8); + this._reversionVersion = headerPacket.get(9); + this._width = NumberUtils.uintAnd(headerPacket.subarray(14, 3).toUint(), 0x0FFFFF); + this._height = NumberUtils.uintAnd(headerPacket.subarray(17, 3).toUint(), 0x0FFFFF); + this._fpsNumerator = headerPacket.subarray(22, 4).toUint(); + this._fpsDenominator = headerPacket.subarray(26, 4).toUint(); + + const lastBits = headerPacket.subarray(40, 2).toShort(); + this._keyframeGranuleShift = NumberUtils.uintAnd(NumberUtils.uintRShift(lastBits, 5), 0x1F); + } + + /** @inheritDoc */ + public get commentData(): ByteVector { return this._commentData; } + + /** @inheritDoc */ + public get description(): string { return `Theora v${this._majorVersion}.${this._minorVersion} Video`; } + + /** @inheritDoc */ + public get durationMilliseconds(): number { return this._durationMilliseconds || 0; } + + /** @inheritDoc */ + public get mediaTypes(): MediaTypes { return MediaTypes.Video; } + + /** @inheritDoc */ + public get videoHeight(): number { return this._height; } + + /** @inheritDoc */ + public get videoWidth(): number { return this._width; } + + /** + * Checks to see if packet is a Theora header packet. + * @param packet Packet to check + */ + public static isHeaderPacket(packet: ByteVector): boolean { + return packet.get(0) === TheoraPacketType.IdentificationHeader && packet.containsAt(Theora.IDENTIFIER, 1); + } + + /** @inheritDoc */ + public readPacket(packet: ByteVector): boolean { + Guards.truthy(packet, "packet"); + + if (!this._commentData && packet.get(0) === TheoraPacketType.CommentHeader) { + this._commentData = packet.subarray(7).toByteVector(); + } + + return !!this._commentData; + } + + /** @inheritDoc */ + public setDuration(firstGranularPosition: number, lastGranularPosition: number): void { + Guards.safeUint(firstGranularPosition, "firstGranularPosition"); + Guards.safeUint(lastGranularPosition, "lastGranularPosition"); + + const durationSeconds = this.getGranuleTime(lastGranularPosition) - this.getGranuleTime(firstGranularPosition); + this._durationMilliseconds = durationSeconds * 1000; + } + + /** @inheritDoc */ + public writeCommentPacket(packets: ByteVector[], comment: XiphComment): void { + Guards.truthy(packets, "packets"); + Guards.truthy(comment, "comment"); + + const data = ByteVector.concatenate( + TheoraPacketType.CommentHeader, + Theora.IDENTIFIER, + comment.render(true) + ); + + if (packets.length > 1 && packets[1].get(0) === TheoraPacketType.CommentHeader) { + packets[1] = data; + } else { + packets.splice(1, 0, data); + } + } + + private getGranuleTime(granularPosition: number): number { + const iFrame = NumberUtils.uintRShift(granularPosition, this._keyframeGranuleShift); + const pFrame = granularPosition - NumberUtils.uintLShift(iFrame, this._keyframeGranuleShift); + return (iFrame + pFrame) * (this._fpsDenominator / this._fpsNumerator); + } +} diff --git a/src/ogg/codecs/vorbis.ts b/src/ogg/codecs/vorbis.ts new file mode 100644 index 00000000..b6d63cac --- /dev/null +++ b/src/ogg/codecs/vorbis.ts @@ -0,0 +1,144 @@ +import IOggCodec from "./iOggCodec"; +import XiphComment from "../../xiph/xiphComment"; +import {ByteVector, StringType} from "../../byteVector"; +import {IAudioCodec, MediaTypes} from "../../properties"; +import {Guards} from "../../utils"; + +/** + * Types of packets that occur within an Ogg Vorbis bitstream. + */ +enum VorbisPacketType { + Header = 1, + Comment= 3 +} + +/** + * Represents an Ogg Vorbis bitstream for use in an Ogg file. + */ +export default class Vorbis implements IOggCodec, IAudioCodec { + private static readonly IDENTIFIER = ByteVector.fromString("vorbis", StringType.Latin1).makeReadOnly(); + + private readonly _bitrateMaximum: number; + private readonly _bitrateMinimum: number; + private readonly _bitrateNominal: number; + private readonly _channels: number; + private readonly _sampleRate: number; + private readonly _vorbisVersion: number; + private _commentData: ByteVector; + private _durationMilliseconds: number; + + /** + * Constructs and initializes a new instance using the provided header packet. + * @param headerPacket Packet that contains the Vorbis header data + */ + public constructor(headerPacket: ByteVector) { + Guards.truthy(headerPacket, "headerPacket"); + if (!headerPacket.containsAt(Vorbis.IDENTIFIER, 1)) { + throw new Error("Argument error: header packet must start with Vorbis ID"); + } + if (headerPacket.get(0) !== VorbisPacketType.Header) { + throw new Error("Argument error: header packet must be a header packet"); + } + + // NOTE: See https://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-630004.2.2 for details on + // the Vorbis header. + + this._vorbisVersion = headerPacket.subarray(7, 4).toUint(false); + this._channels = headerPacket.get(11); + this._sampleRate = headerPacket.subarray(12, 4).toUint(false); + this._bitrateMaximum = headerPacket.subarray(16, 4).toInt(false); + this._bitrateNominal = headerPacket.subarray(20, 4).toInt(false); + this._bitrateMinimum = headerPacket.subarray(24, 4).toInt(false); + } + + // #region Properties + + /** + * @inheritDoc + * @remarks For Vorbis files, this is the nominal bitrate as specified in the identification + * header. This may be significantly different than the actual average since this header + * only provides decoding hints. + */ + public get audioBitrate(): number { + // NOTE: The original .NET implementation had a + 0.5 at the beginning but this isn't + // listed anywhere in the Vorbis spec, so I removed it. + return this._bitrateNominal / 1000; + } + + /** @inheritDoc */ + public get audioChannels(): number { return this._channels; } + + /** @inheritDoc */ + public get audioSampleRate(): number { return this._sampleRate; } + + /** + * Gets the raw Xiph comment data contained in the codec. + */ + public get commentData(): ByteVector { return this._commentData; } + + /** @inheritDoc */ + public get description(): string { return `Vorbis v${this._vorbisVersion} Audio`; } + + /** @inheritDoc */ + public get durationMilliseconds(): number { return this._durationMilliseconds || 0; } + + /** @inheritDoc */ + public get mediaTypes(): MediaTypes { return MediaTypes.Audio; } + + // #endregion + + // #region Methods + + /** + * Determines if a packet is a Vorbis header packet. + * @param packet Packet to check + */ + public static isHeaderPacket(packet: ByteVector): boolean { + return packet.get(0) === VorbisPacketType.Header && packet.containsAt(Vorbis.IDENTIFIER, 1); + } + + /** @inheritDoc */ + public readPacket(packet: ByteVector): boolean { + Guards.truthy(packet, "packet"); + if (!packet.containsAt(Vorbis.IDENTIFIER, 1)) { + // Ignore invalid packets + return false; + } + + if (!this._commentData && packet.get(0) === VorbisPacketType.Comment) { + this._commentData = packet.subarray(7).toByteVector(); + } + + return !!this._commentData; + } + + /** @inheritDoc */ + public setDuration(firstGranularPosition: number, lastGranularPosition: number): void { + Guards.safeUint(firstGranularPosition, "firstGranularPosition"); + Guards.safeUint(lastGranularPosition, "lastGranularPosition"); + + const durationSeconds = this._sampleRate === 0 + ? 0 + : (lastGranularPosition - firstGranularPosition) / this._sampleRate; + this._durationMilliseconds = durationSeconds * 1000; + } + + /** @inheritDoc */ + public writeCommentPacket(packets: ByteVector[], comment: XiphComment): void { + Guards.truthy(packets, "packets"); + Guards.truthy(comment, "xiphComment"); + + const data = ByteVector.concatenate( + VorbisPacketType.Comment, + Vorbis.IDENTIFIER, + comment.render(true) + ); + if (packets.length > 1 && packets[1].get(0) === VorbisPacketType.Comment) { + packets[1] = data; + } else { + packets.splice(1, 0, data); + } + } + + // #endregion +} diff --git a/src/ogg/oggBitStream.ts b/src/ogg/oggBitStream.ts new file mode 100644 index 00000000..e1df0f33 --- /dev/null +++ b/src/ogg/oggBitStream.ts @@ -0,0 +1,82 @@ +import CodecFactory from "./codecs/codecFactory"; +import IOggCodec from "./codecs/iOggCodec"; +import OggPage from "./oggPage"; +import {ByteVector} from "../byteVector"; +import {Guards} from "../utils"; +import {OggPageFlags} from "./oggPageHeader"; + +/** + * This class accepts a sequence of pages belonging to a single logical bitstream, processes them, + * and extracts the tagging and media information. + */ +export default class OggBitStream { + private readonly _codec: IOggCodec; + private readonly _firstAbsoluteGranularPosition: number; + private _previousPacket: ByteVector; + + /** + * Constructs and initializes a new instance capable of processing a specified page. + * @param page Page of the stream to be processed by the new instance + */ + public constructor(page: OggPage) { + Guards.truthy(page, "page"); + + // Assume that the first packet is completely enclosed. This should be sufficient for + // codec recognition + this._codec = CodecFactory.getCodec(page.packets[0]); + this._firstAbsoluteGranularPosition = page.header.absoluteGranularPosition; + } + + /** + * Gets the codec object used to interpret the stream represented by the current instance. + */ + public get codec(): IOggCodec { return this._codec; } + + /** + * Reads the next logical page in the stream. + * @param page Next logical page in the stream + * @returns boolean `true` if the codec has read all the necessary packets in the stream. + * `false` otherwise + */ + public readPage(page: OggPage): boolean { + Guards.truthy(page, "page"); + + const packets = page.packets; + for (let i = 0; i < packets.length; i++) { + let packet = packets[i]; + + // If we're at the first packet of the page, and we're continuing an old packet, + // combine the old one with the new one. + if (i === 0 && + (page.header.flags & OggPageFlags.FirstPacketContinued) !== 0 && + this._previousPacket + ) { + this._previousPacket.addByteVector(packet); + packet = this._previousPacket; + } + + this._previousPacket = undefined; + + if (i === packets.length - 1 && !page.header.lastPacketComplete) { + // We're at the last packet of the page and it's continued on the next page. Store it. + this._previousPacket = packet; + } else if (this._codec.readPacket(packet)) { + // This isn't the last packet, we need to process it. + return true; + } + } + + return false; + } + + /** + * Sets the duration of the stream using the first granular position of the stream and the last + * granular position of the stream. + * @internal + */ + public setDuration(lastAbsoluteGranularPosition: number): void { + Guards.safeUint(lastAbsoluteGranularPosition, "lastAbsoluteGranularPosition"); + + this._codec.setDuration(this._firstAbsoluteGranularPosition, lastAbsoluteGranularPosition); + } +} diff --git a/src/ogg/oggFile.ts b/src/ogg/oggFile.ts new file mode 100644 index 00000000..93f7791d --- /dev/null +++ b/src/ogg/oggFile.ts @@ -0,0 +1,226 @@ +import OggTag from "./oggTag"; +import OggBitStream from "./oggBitStream"; +import OggPage from "./oggPage"; +import OggPaginator from "./oggPaginator"; +import XiphComment from "../xiph/xiphComment"; +import {ByteVector} from "../byteVector"; +import {CorruptFileError} from "../errors"; +import {File, FileAccessMode, ReadStyle} from "../file"; +import {IFileAbstraction} from "../fileAbstraction"; +import {OggPageFlags, OggPageHeader} from "./oggPageHeader"; +import {Properties} from "../properties"; +import {Tag, TagTypes} from "../tag"; +import {NumberUtils} from "../utils"; + +/** + * Provides tagging and properties support for Ogg files. + */ +export default class OggFile extends File { + + private readonly _properties: Properties; + private readonly _tag: OggTag; + + /** @inheritDoc */ + public constructor(file: IFileAbstraction | string, readStyle: ReadStyle) { + super(file); + + this.mode = FileAccessMode.Read; + try { + // Read the file + const streamsResult = this.readStreams(); + const codecs = []; + + // Read the streams and extract the Xiph comments from them + const commentMapping = new Map(); + for (const [id, bitStream] of streamsResult.streams.entries()) { + commentMapping.set( + id, + XiphComment.fromData( + bitStream.codec.commentData, + NumberUtils.hasFlag(readStyle, ReadStyle.PictureLazy) + ) + ); + codecs.push(bitStream.codec); + } + this._tag = new OggTag(commentMapping); + + // Read the properties if requested + // TODO: Read bitrate more accurately if accurate read style provided + if (NumberUtils.hasFlag(readStyle, ReadStyle.Average)) { + // Find the last page header and use its position to determine the duration of the + // file. + const lastPageHeaderOffset = this.rFind(OggPageHeader.HEADER_IDENTIFIER); + if (lastPageHeaderOffset < 0) { + throw new CorruptFileError("Could not find last Ogg page header"); + } + + const lastPageHeader = OggPageHeader.fromFile(this, lastPageHeaderOffset); + streamsResult.streams.get(lastPageHeader.streamSerialNumber) + .setDuration(lastPageHeader.absoluteGranularPosition); + const duration = streamsResult.streams.get(lastPageHeader.streamSerialNumber) + .codec.durationMilliseconds; + this._properties = new Properties(duration, codecs); + } + + // NOTE: All known Ogg formats require a comment header. This means an Ogg file will + // always have a tag. + + } finally { + this.mode = FileAccessMode.Closed; + } + } + + // #region Properties + + /** @inheritDoc */ + public get properties(): Properties { return this._properties; } + + /** @inheritDoc */ + public get tag(): Tag { return this._tag; } + + // #endregion + + // #region Methods + + /** @inheritDoc */ + public getTag(type: TagTypes): Tag { + if (type === TagTypes.Xiph) { + return this._tag.comments[0]; + } + + return undefined; + } + + /** @inheritDoc */ + public removeTags(types: TagTypes): void { + if ((types & TagTypes.Xiph) !== 0) { + this._tag.clear(); + } + } + + /** @inheritDoc */ + public save(): void { + this.preSave(); + + this.mode = FileAccessMode.Write; + try { + // Re-read the pages for the streams + const pages: OggPage[] = []; + const streamsResult = this.readStreams(pages); + const paginators = new Map(); + const newPages: OggPage[][] = []; + const shifts = new Map(); + + // Have the paginators process the pages + for (const page of pages) { + const streamSerialNumber = page.header.streamSerialNumber; + if (!paginators.has(streamSerialNumber)) { + paginators.set( + streamSerialNumber, + new OggPaginator(streamsResult.streams.get(streamSerialNumber).codec) + ); + } + + paginators.get(streamSerialNumber).addPage(page); + } + + // Repaginate the pages + for (const streamSerialNumber of paginators.keys()) { + paginators.get(streamSerialNumber).writeComment(this._tag.getComment(streamSerialNumber)); + const paginateResults = paginators.get(streamSerialNumber).paginate(); + newPages.push(paginateResults.pages); + shifts.set(streamSerialNumber, paginateResults.change); + } + + // Render the updated pages + const output = ByteVector.empty(); + let isEmpty; + do { + isEmpty = true; + for (const streamPages of newPages) { + if (streamPages.length === 0) { + continue; + } + + output.addByteVector(streamPages[0].render()); + streamPages.shift(); + + if (streamPages.length !== 0) { + isEmpty = false; + } + } + } while (!isEmpty); + + // Write the output to the file + this.insert(output, 0, streamsResult.end); + OggPage.overwriteSequenceNumbers(this, output.length, shifts); + + this.tagTypesOnDisk = this.tagTypes; + + } finally { + this.mode = FileAccessMode.Closed; + } + } + + private readStreams(pages?: OggPage[]): {end: number, streams: Map} { + const streams = new Map(); + const activeStreams = []; + + let position = 0; + do { + let stream: OggBitStream; + const page = OggPage.fromFile(this, position); + + if ((page.header.flags & OggPageFlags.FirstPageOfStream) !== 0) { + stream = new OggBitStream(page); + streams.set(page.header.streamSerialNumber, stream); + activeStreams.push(stream); + } + + if (!stream) { + stream = streams.get(page.header.streamSerialNumber); + } + + const streamIndex = activeStreams.indexOf(stream); + if (streamIndex >= 0 && stream.readPage(page)) { + activeStreams.splice(streamIndex, 1); + } + + if (pages) { + pages.push(page); + } + + position += page.size; + } while (activeStreams.length > 0); + + return { + end: position, + streams: streams + }; + } + + // #endregion +} + +// ///////////////////////////////////////////////////////////////////////// +// Register the file type +[ + "taglib/ogg", + "taglib/oga", + "taglib/ogv", + "taglib/opus", + "application/ogg", + "application/x-ogg", + "audio/vorbis", + "audio/x-vorbis", + "audio/x-vorbis+ogg", + "audio/ogg", + "audio/x-ogg", + "video/ogg", + "video/x-ogm+ogg", + "video/x-theora+ogg", + "video/x-theora", + "audio/opus", + "audio/x-opus", + "audio/x-opus+ogg" +].forEach((mt) => File.addFileType(mt, OggFile)); diff --git a/src/ogg/oggFileSettings.ts b/src/ogg/oggFileSettings.ts new file mode 100644 index 00000000..e980c3ce --- /dev/null +++ b/src/ogg/oggFileSettings.ts @@ -0,0 +1,22 @@ +/** + * This class contains settings related to Ogg file operations. Open files will need to be re-read + * in order for changes to take effect. + */ +export default class OggFileSettings { + private static _writeToAllComments = false; + + /** + * Gets whether changes to Ogg tag fields should be written to all Xiph comments or just the + * first Xiph comment in the file. + * @remarks Ogg files are required to have one Xiph comment per stream. In files with multiple + * streams, this means there are multiple Xiph comments per file. + */ + public static get writeToAllComments(): boolean { return this._writeToAllComments; } + /** + * Sets whether changes to Ogg tag fields should be written to all Xiph comments or just the + * first Xiph comment in the file. + * @remarks Ogg files are required to have one Xiph comment per stream. In files with multiple + * streams, this means there are multiple Xiph comments per file. + */ + public static set writeToAllComments(value: boolean) { this._writeToAllComments = value; } +} diff --git a/src/ogg/oggPage.ts b/src/ogg/oggPage.ts new file mode 100644 index 00000000..de2ef2ec --- /dev/null +++ b/src/ogg/oggPage.ts @@ -0,0 +1,143 @@ +import itiriri from "itiriri"; +import {ByteVector} from "../byteVector"; +import {File} from "../file"; +import {OggPageHeader} from "./oggPageHeader"; +import {Guards} from "../utils"; + +export default class OggPage { + private readonly _header: OggPageHeader; + private readonly _packets: ByteVector[]; + + // #region Constructors + + private constructor(header: OggPageHeader) { + this._header = header; + this._packets = []; + } + + /** + * Constructs and initializes a new instance by reading a raw Ogg page from a specified + * position in a specified file. + * @param file File to read the new instance from + * @param position Offset in the file where the page begins. + */ + public static fromFile(file: File, position: number): OggPage { + Guards.truthy(file, "file"); + Guards.safeUint(position, "position"); + + const page = new OggPage(OggPageHeader.fromFile(file, position)); + file.seek(position + page._header.size); + + for (const packetSize of page._header.packetSizes) { + page._packets.push(file.readBlock(packetSize)); + } + + return page; + } + + /** + * Constructs and initializes a new instance with a specified header and list of packets. + * @param header Header of the page + * @param packets Packets contained in the page + */ + public static fromPackets(header: OggPageHeader, packets: ByteVector[]): OggPage { + Guards.truthy(packets, "packets"); + Guards.truthy(header, "header"); + + const page = new OggPage(header); + page._packets.splice(0, page._packets.length, ... packets); + page._header.packetSizes = packets.map((p) => p.length); + + return page; + } + + // #endregion + + // #region Properties + + /** + * Gets the header of the current instance. + */ + public get header(): OggPageHeader { return this._header; } + + /** + * Gets the packets contained in the current instance. + */ + public get packets(): ByteVector[] { return this._packets.slice(); } + + /** + * Gets the total size of the current instance as it appears on disk. + */ + public get size(): number { return this._header.size + this._header.dataSize; } + + // #endregion + + /** + * Overwrites all page headers in a file starting at a specified position, shifting the page + * sequence numbers a set amount. + * @param file File to update + * @param position Offset into the file to begin updating + * @param shiftTable Map where the key is the serial number of the stream to update and the + * value is the amount to offset the page sequence numbers in the stream + * @remarks When the number of pages in a stream changes, all subsequent pages in the stream + * need to have their page sequence numbers updated in order to remain valid. Additionally, + * when the page sequence number changes, the page needs to have its checksum recomputed. + * This makes for a costly calculation if large comment data is added. + * @internal + */ + public static overwriteSequenceNumbers(file: File, position: number, shiftTable: Map): void { + Guards.truthy(file, "file"); + Guards.truthy(shiftTable, "shiftTable"); + Guards.safeUint(position, "position"); + + // Check to see if there are any changes to be made + if (itiriri(shiftTable.values()).every((e) => e === 0)) { + return; + } + + while (position < file.length - OggPageHeader.MINIMUM_SIZE) { + const header = OggPageHeader.fromFile(file, position); + const size = header.size + header.dataSize; + + if (shiftTable.has(header.streamSerialNumber) && shiftTable.get(header.streamSerialNumber) !== 0) { + file.seek(position); + const pageData = file.readBlock(size); + const newData = ByteVector.fromUint( + header.pageSequenceNumber + shiftTable.get(header.streamSerialNumber), + false + ); + + for (let i = 18; i < 22; i++) { + pageData.set(i, newData.get(i - 18)); + } + for (let i = 22; i < 26; i++) { + pageData.set(i, 0); + } + + newData.addByteVector(ByteVector.fromUint(pageData.checksum, false)); + file.seek(position + 18); + file.writeBlock(newData); + } + + position += size; + } + } + + /** + * Renders the current instance as a raw Ogg page. + */ + public render(): ByteVector { + const data = ByteVector.concatenate( + this._header.render(), + ... this._packets + ); + + // Computer the checksum for the Ogg page. THe checksum is taken over the entire page with + // the 4 bytes reserved for the checksum zeroed and then inserted in bytes 22-25 of the + // page header. + const checksum = ByteVector.fromUint(data.checksum, false); + data.splice(22, 4, checksum); + + return data; + } +} diff --git a/src/ogg/oggPageHeader.ts b/src/ogg/oggPageHeader.ts new file mode 100644 index 00000000..a11d7f56 --- /dev/null +++ b/src/ogg/oggPageHeader.ts @@ -0,0 +1,263 @@ +import {ByteVector, StringType} from "../byteVector"; +import {CorruptFileError, UnsupportedFormatError} from "../errors"; +import {File} from "../file"; +import {Guards, NumberUtils} from "../utils"; + +/** + * Indicates the special properties of a {@see OggPageHeader}. + */ +export enum OggPageFlags { + /** The page is a normal page. */ + None = 0, + + /** The first packet of the page is continued from the previous page. */ + FirstPacketContinued = 1, + + /** The page is the first page of the stream. */ + FirstPageOfStream = 2, + + /** The page is the last page of the stream. */ + LastPageOfStream = 4 +} + +/** + * This structure provides a representation of an Ogg page header. + */ +export class OggPageHeader { + public static readonly MINIMUM_SIZE = 27; + public static readonly HEADER_IDENTIFIER = ByteVector.fromString("OggS", StringType.Latin1).makeReadOnly(); + + private _absoluteGranularPosition: number; + private _dataSize: number; + private _flags: OggPageFlags; + private _lastPacketComplete: boolean; + private _packetSizes: number[]; + private _pageSequenceNumber: number; + private _size: number; + private _streamSerialNumber: number; + private _version: number; + + // #region Constructors + + private constructor() { /* private to enforce construction via static methods */ } + + /** + * Constructs and initializes a new instance by reading a raw Ogg page header from a specified + * position in a specified file. + * @param file File from which the contents of the new instance are to be read + * @param position Position in the file where the header begins + */ + public static fromFile(file: File, position: number): OggPageHeader { + Guards.truthy(file, "file"); + Guards.safeUint(position, "position"); + if (position > file.length - this.MINIMUM_SIZE) { + throw new Error(`Argument out of range: page header must be at least ${this.MINIMUM_SIZE} bytes`); + } + + file.seek(position); + const data = file.readBlock(this.MINIMUM_SIZE); + if (data.length < this.MINIMUM_SIZE || !data.startsWith(this.HEADER_IDENTIFIER)) { + throw new CorruptFileError("Error reading page header"); + } + + const header = new OggPageHeader(); + header._version = data.get(4); + header._flags = data.get(5); + + const absoluteGranularPosition = data.subarray(6, 8).toUlong(false); + if (absoluteGranularPosition > Number.MAX_SAFE_INTEGER) { + throw new UnsupportedFormatError( + "Granular position is too large to be handled with this version of node-taglib-sharp" + ); + } + header._absoluteGranularPosition = Number(absoluteGranularPosition); + header._streamSerialNumber = data.subarray(14, 4).toUint(false); + header._pageSequenceNumber = data.subarray(18, 4).toUint(false); + + // Byte 27 is the number of page segments, which is the only variable length portion of the + // page header. After reading the number of page segments, we'll then read in the + // corresponding data for this count. + const pageSegmentCount = data.get(26); + const pageSegments = file.readBlock(pageSegmentCount); + + // Another sanity check + if (pageSegmentCount < 1 || pageSegments.length !== pageSegmentCount) { + throw new CorruptFileError("Incorrect number of page segments"); + } + + // The base size of an Ogg page is 27 bytes + the number of lacing values + header._size = this.MINIMUM_SIZE + pageSegmentCount; + header._packetSizes = []; + + let packetSize = 0; + header._dataSize = 0; + + for (let i = 0; i < pageSegmentCount; i++) { + header._dataSize += pageSegments.get(i); + packetSize += pageSegments.get(i); + + if (pageSegments.get(i) < 255) { + header._packetSizes.push(packetSize); + packetSize = 0; + } + } + + if (packetSize > 0) { + header._packetSizes.push(packetSize); + } + + header._lastPacketComplete = pageSegments.get(pageSegmentCount - 1) < 255; + + return header; + } + + /** + * Constructs and initializes a new instance with a given stream serial number, page number, + * and flags. + * @param streamSerialNumber Serial number for the stream containing the page described by the + * new instance + * @param pageNumber Index of the page described by the new instance in the stream + * @param flags Flags that apply to the new instance. + */ + public static fromInfo(streamSerialNumber: number, pageNumber: number, flags: OggPageFlags): OggPageHeader { + Guards.uint(streamSerialNumber, "streamSerialNumber"); + Guards.uint(pageNumber, "pageNumber"); + + const header = new OggPageHeader(); + header._version = 0; + header._flags = flags; + header._absoluteGranularPosition = 0; + header._streamSerialNumber = streamSerialNumber; + header._pageSequenceNumber = pageNumber; + header._size = 0; + header._dataSize = 0; + header._packetSizes = []; + header._lastPacketComplete = false; + + if (pageNumber === 0 && !NumberUtils.hasFlag(flags, OggPageFlags.FirstPacketContinued)) { + header._flags |= OggPageFlags.FirstPageOfStream; + } + + return header; + } + + /** + * Constructs and initializes a new instance by copying the values from another instance, + * offsetting the page number and applying new flags. + * @param original Object to copy values from + * @param offset How much to offset the page sequence number in the new instance + * @param flags Flags to use in the new instance + */ + public static fromPageHeader(original: OggPageHeader, offset: number, flags: OggPageFlags): OggPageHeader { + Guards.truthy(original, "original"); + Guards.uint(offset, "offset"); + + const header = new OggPageHeader(); + header._version = original._version; + header._flags = flags; + header._absoluteGranularPosition = original._absoluteGranularPosition; + header._streamSerialNumber = original._streamSerialNumber; + header._pageSequenceNumber = original._pageSequenceNumber + offset; + header._size = original._size; + header._dataSize = original._dataSize; + header._packetSizes = []; + header._lastPacketComplete = false; + + if (header._pageSequenceNumber === 0 && !NumberUtils.hasFlag(flags, OggPageFlags.FirstPacketContinued)) { + header._flags |= OggPageFlags.FirstPageOfStream; + } + + return header; + } + + // #endregion + + // #region Properties + + /** + * Gets the absolute granular position of the page described by the current instance. + */ + public get absoluteGranularPosition(): number { return this._absoluteGranularPosition; } + + /** + * Gets the size of the data portion of the page described by the current instance as it + * appeared on disk. + */ + public get dataSize(): number { return this._dataSize; } + + /** + * Gets the flags for the page described by the current instance. + */ + public get flags(): OggPageFlags { return this._flags; } + + /** + * Gets whether or not the final packet is continued on the next page. If `true`, the final + * packet is complete and not continued on the next page. + */ + public get lastPacketComplete(): boolean { return this._lastPacketComplete; } + + /** + * Gets the sizes for the packets in the page described by the current instance. + */ + public get packetSizes(): number[] { return this._packetSizes; } + /** + * Sets the sizes for the packets in the page described by the current instnace. + * @internal + */ + public set packetSizes(value: number[]) { + Guards.truthy(value, "value"); + Guards.all(value, Guards.int, "value"); + this._packetSizes.splice(0, this._packetSizes.length, ... value); + } + + /** + * Gets the sequence number of the page described by the current instance. + */ + public get pageSequenceNumber(): number { return this._pageSequenceNumber; } + + /** + * Gets the size of the header as it appeared on disk. + */ + public get size(): number { return this._size; } + + /** + * Gets the serial number of the stream that the current instance belongs to. + */ + public get streamSerialNumber(): number { return this._streamSerialNumber; } + + // #endregion + + // #region Methods + + public render(): ByteVector { + const lacingValues = this._packetSizes.reduce((accum, ps, i) => { + // The size of a packet in an Ogg page is indicated by a series of "lacing values" + // where the sum of the values is the packet size in bytes. Each of these values is a + // byte. A value of less than 255 indicates the end of the packet. + const quot = Math.floor(ps / 255); + const rem = ps % 255; + accum.push(ByteVector.fromSize(quot, 0xFF)); + if (i < this._packetSizes.length - 1 || rem !== 0) { + accum.push(rem); + } + + return accum; + }, > []); + const lacingBytes = ByteVector.concatenate(...lacingValues); + + return ByteVector.concatenate( + OggPageHeader.HEADER_IDENTIFIER, + this._version, + this._flags, + ByteVector.fromUlong(this._absoluteGranularPosition, false), + ByteVector.fromUint(this._streamSerialNumber, false), + ByteVector.fromUint(this._pageSequenceNumber, false), + ByteVector.fromSize(4), // Checksum to be filled later + lacingBytes.length, + lacingBytes + ); + } + + // #endregion +} + diff --git a/src/ogg/oggPaginator.ts b/src/ogg/oggPaginator.ts new file mode 100644 index 00000000..05bd3652 --- /dev/null +++ b/src/ogg/oggPaginator.ts @@ -0,0 +1,150 @@ +import IOggCodec from "./codecs/iOggCodec"; +import OggPage from "./oggPage"; +import XiphComment from "../xiph/xiphComment"; +import {ByteVector} from "../byteVector"; +import {OggPageFlags, OggPageHeader} from "./oggPageHeader"; + +/** + * This class accepts a sequence of pages for a single Ogg stream, accepts changes, and produces a + * new sequence of pages to write to disk. + */ +export default class OggPaginator { + private readonly _packets: ByteVector[] = []; + private _codec: IOggCodec; + private _firstPageHeader: OggPageHeader; + private _pagesRead: number = 0; + + /** + * Constructs and initializes a new instance for a given codec. + * @param codec Object to use when processing packets. + */ + public constructor(codec: IOggCodec) { + this._codec = codec; + } + + /** + * Adds the next page to the current instance. + * @param page The next page found in the stream + */ + public addPage(page: OggPage): void { + this._pagesRead++; + + if (!this._firstPageHeader) { + this._firstPageHeader = page.header; + } + + if (page.packets.length === 0) { + return; + } + + for (let i = 0; i < page.packets.length; i++) { + if ((page.header.flags & OggPageFlags.FirstPacketContinued) !== 0 && i === 0 && page.packets.length > 0) { + this._packets[this._packets.length - 1].addByteVector(page.packets[0]); + } else { + this._packets.push(page.packets[i]); + } + } + } + + /** + * Repaginates the pages passed into the current instance to handle changes made to the Xiph + * comment. + */ + public paginate(): {change: number, pages: OggPage[]} { + // Original .NET comments --- + // Ogg Pagination: Welcome to sucksville! + // If you don't understand this, you're not alone. + // It is confusing as Hell. + // http://xiph.org/ogg/doc/framing.html + + // node-taglib-sharp comments --- + // Rather than try to understand this right now, let's just copy it as-is. + + if (this._pagesRead === 0) { + return {change: 0, pages: []}; + } + + const packets = this._packets.slice(); + const firstHeader = this._firstPageHeader; + const pages = []; + let count = this._pagesRead; + let index = 0; + + if (firstHeader.pageSequenceNumber === 0) { + pages.push(OggPage.fromPackets(firstHeader, [packets[0]])); + index++; + packets.shift(); + count--; + } + + let lacingPerPage = 0xfc; + if (count > 0) { + let totalLacingBytes = 0; + for (let i = 0; i < packets.length; i++) { + totalLacingBytes += OggPaginator.getLacingValueLength(packets, i); + } + + lacingPerPage = Math.min(Math.floor(totalLacingBytes / count + 1), lacingPerPage); + } + + let pagePackets = []; + let lacingBytesUsed = 0; + let firstPacketContinued = false; + + while (packets.length > 0) { + const packetBytes = OggPaginator.getLacingValueLength(packets, 0); + const remaining = lacingPerPage - lacingBytesUsed; + const wholePacket = packetBytes <= remaining; + if (wholePacket) { + pagePackets.push(packets.shift()); + lacingBytesUsed += packetBytes; + } else { + pagePackets.push(packets[0].subarray(0, remaining * 0xff)); + packets[0] = packets[0].subarray(remaining * 0xff); + lacingBytesUsed += remaining; + } + + if (lacingBytesUsed === lacingPerPage) { + const header = OggPageHeader.fromPageHeader( + firstHeader, + index, + firstPacketContinued ? OggPageFlags.FirstPacketContinued : OggPageFlags.None); + pages.push(OggPage.fromPackets(header, pagePackets)); + + pagePackets = []; + lacingBytesUsed = 0; + index++; + count--; + firstPacketContinued = !wholePacket; + } + } + + if (pagePackets.length > 0) { + const header = OggPageHeader.fromInfo( + firstHeader.streamSerialNumber, + index, + firstPacketContinued ? OggPageFlags.FirstPacketContinued : OggPageFlags.None); + pages.push(OggPage.fromPackets(header, pagePackets)); + index++; + count--; + } + + return { + change: -count, + pages: pages + }; + } + + /** + * Writes a Xiph comment in the codec-specific comment packet. + * @param comment Comment to store in the comment packet. + */ + public writeComment(comment: XiphComment): void { + this._codec.writeCommentPacket(this._packets, comment); + } + + private static getLacingValueLength(packets: ByteVector[], index: number): number { + const size = packets[index].length; + return Math.floor(size / 0xff) + ((index + 1 < packets.length || size % 0xff > 0) ? 1 : 0); + } +} diff --git a/src/ogg/oggTag.ts b/src/ogg/oggTag.ts new file mode 100644 index 00000000..5e466d4b --- /dev/null +++ b/src/ogg/oggTag.ts @@ -0,0 +1,100 @@ +import itiriri from "itiriri"; + +import CombinedTag from "../combinedTag"; +import OggFileSettings from "./oggFileSettings"; +import XiphComment from "../xiph/xiphComment"; +import {Tag, TagTypes} from "../tag"; +import {Guards} from "../utils"; + +/** + * This class combines a collection of {@link XiphComment} objects so that tagging properties can + * be read from each but are only set to the first comment of the file. + */ +export default class OggTag extends CombinedTag { + private _comments: Map; + + /** + * Constructs and initializes a new instance with no contents. + */ + public constructor(comments: Map) { + super(TagTypes.None, OggFileSettings.writeToAllComments, Array.from(comments.values())); + + this._comments = comments; + } + + // #region Methods + + /** + * Gets the list of comments in the current instance, in the order they were added. + * @remarks Modifying this array makes no changes to the file. Use {@link setComment}. + */ + public get comments(): XiphComment[] { return Array.from(this._comments.values()); } + + /** + * Gets the list of stream serial numbers that have comments associated with them. + * @remarks Modifying this array makes no changes to the file. Use {@link setComment}. + */ + public get serialNumbers(): number[] { return Array.from(this._comments.keys()); } + + /** + * Retrieves a Xiph comment for a given stream. + * @param streamSerialNumber Serial number of the stream that contains the desired comment. + * Must be a positive 32-bit integer. + * @returns XiphComment Xiph comment of the provided stream is returned if it exists, otherwise + * `undefined` is returned. + */ + public getComment(streamSerialNumber: number): XiphComment { + Guards.uint(streamSerialNumber, "streamSerialNumber"); + return this._comments.get(streamSerialNumber); + } + + /** + * Stores or removes a Xiph comment in a given stream. + * @param streamSerialNumber Serial number of the stream in which to store the comment. Must be + * a positive 32-bit integer + * @param comment Xiph comment to store in the stream. Use `undefined` to clear the comment + * from the stream + * @remarks As per Ogg spec, each stream must have a Xiph comment header. Therefore, comments + * cannot be set to a falsy value. + */ + public setComment(streamSerialNumber: number, comment: XiphComment): void { + Guards.uint(streamSerialNumber, "streamSerialNumber"); + Guards.truthy(comment, "comment"); + + const oldComment = this._comments.get(streamSerialNumber); + if (!oldComment) { + throw new Error("Argument out of range: new tags cannot be added to Ogg files."); + } + + super.replaceTag(oldComment, comment); + this._comments.set(streamSerialNumber, comment); + } + + // #endregion + + // #region Tag Implementation + + /** @inheritDoc */ + // TODO: This value is never updated after a save!! + public get sizeOnDisk(): number { + return itiriri(this._comments.values()).reduce((accum, c) => accum + c.sizeOnDisk, 0); + } + + /** + * @inheritDoc + * @remarks Tags cannot be added or removed from Ogg files. This will always throw. + */ + public createTag(): Tag { + throw new Error("Invalid operation: tags cannot be added or removed from Ogg files."); + } + + /** + * @inheritDoc + * @remarks Tags cannot be added or removed from Ogg files. This will do nothing. + */ + public removeTags(): void { + /* no-op */ + } + + // #endregion +} diff --git a/src/picture.ts b/src/picture.ts index 63197519..3835f54e 100644 --- a/src/picture.ts +++ b/src/picture.ts @@ -1,16 +1,164 @@ import * as path from "path"; import {ByteVector} from "./byteVector"; -import {IFileAbstraction} from "./fileAbstraction"; -import {IPicture, PictureType} from "./iPicture"; +import {IFileAbstraction, LocalFileAbstraction} from "./fileAbstraction"; +import {ILazy} from "./interfaces"; import {FileUtils, Guards} from "./utils"; +import {SeekOrigin} from "./stream"; + +/** + * The type of content appearing in an {@link IPicture} instance. + */ +export enum PictureType { + /** + * @summary The picture is of a type other than those specified. + */ + Other = 0x00, + + /** + * @summary The picture is a 32x32 PNG image that should be used when displaying the file in a browser. + */ + FileIcon = 0x01, + + /** + * @summary The picture is of an icon different from {@link FileIcon} + */ + OtherFileIcon = 0x02, + + /** + * @summary The picture is of the front cover of the album. + */ + FrontCover = 0x03, + + /** + * @summary The picture is of the back cover of the album. + */ + BackCover = 0x04, + + /** + * @summary The picture is of a leaflet page including with the album. + */ + LeafletPage = 0x05, + + /** + * @summary The picture is of the album or disc itself. + */ + Media = 0x06, + + /** + * @summary The picture is of the lead artist or soloist. + */ + LeadArtist = 0x07, + + /** + * @summary The picture is of the artist or performer. + */ + Artist = 0x08, + + /** + * @summary The picture is of the conductor. + */ + Conductor = 0x09, + + /** + * @summary The picture is of the band or orchestra. + */ + Band = 0x0A, + + /** + * @summary The picture is of the composer. + */ + Composer = 0x0B, + + /** + * @summary The picture is of the lyricist or text writer. + */ + Lyricist = 0x0C, + + /** + * @summary The picture is of the recording location or studio. + */ + RecordingLocation = 0x0D, + + /** + * @summary The picture is one taken during the track's recording. + */ + DuringRecording = 0x0E, + + /** + * @summary The picture is one taken during the track's performance. + */ + DuringPerformance = 0x0F, + + /** + * @summary The picture is a capture from a movie screen. + */ + MovieScreenCapture = 0x10, + + /** + * @summary The picture is of a large, colored fish. + */ + ColoredFish = 0x11, + + /** + * @summary The picture is an illustration related to the track. + */ + Illustration = 0x12, + + /** + * @summary The picture contains the logo of the band or performer. + */ + BandLogo = 0x13, + + /** + * @summary The picture is the logo of the publisher or record + */ + PublisherLogo = 0x14, + + /** + * @summary In fact, this is not a Picture, but another file-type. + */ + NotAPicture = 0xff +} + +/** + * Interface that provides generic information about a picture, including its contents, as used by + * various formats. + */ +export interface IPicture { + /** + * Gets and sets the mime-type of the picture data stored in the current instance. + */ + mimeType: string; + + /** + * Gets and sets the type of the content visible in the picture stored in the current instance. + */ + type: PictureType; + + /** + * Gets and sets a filename of the picture stored in the current instance. Optional. + */ + filename: string; + + /** + * Gets and sets a description of the picture stored in the current instance. Optional. + */ + description: string; + + /** + * Gets and sets the picture data stored in the current instance. + */ + data: ByteVector; +} /** * This class implements {@link IPicture} and provides a mechanism for loading pictures from files. */ -export default class Picture implements IPicture { +export class Picture implements IPicture { // #region Constants - private static readonly _lutExtensionMime: string[] = [ + // @TODO: Just do this as a friggin dictionary + private static readonly EXTENSION_TO_MIMETYPES: string[] = [ "bin", "application/octet-stream", // Any kind of binary data - placed at top to act as default "aac", "audio/aac", // AAC audio file "abw", "application/x-abiword", // AbiWord document @@ -92,13 +240,13 @@ export default class Picture implements IPicture { // #region Constructors - private constructor() {} + private constructor() { /* private to enforce construction via static methods */ } /** * Constructs and initializes a new instance from a file located at the provided path. The type * and description of the picture are determined by the extension of the file. The file is * loaded completely. - * @param filePath Path to the file to use to use for the file + * @param filePath Path to the file to use for the file */ public static fromPath(filePath: string): Picture { Guards.truthy(filePath, "filePath"); @@ -122,7 +270,7 @@ export default class Picture implements IPicture { Guards.truthy(data, "data"); const picture = new Picture(); - picture.data = ByteVector.fromByteVector(data); + picture.data = data.toByteVector(); const ext = Picture.getExtensionFromData(data); picture.mimeType = Picture.getMimeTypeFromFilename(ext); @@ -151,7 +299,7 @@ export default class Picture implements IPicture { Guards.notNullOrUndefined(description, "description"); const picture = new Picture(); - picture.data = data; + picture.data = data.toByteVector(); picture.type = type; picture.mimeType = mimeType; picture.description = description; @@ -250,9 +398,9 @@ export default class Picture implements IPicture { public static getExtensionFromMimeType(mime: string): string { let ext: string; - for (let i = 0; i < this._lutExtensionMime.length; i += 2) { - if (this._lutExtensionMime[i + 1] === mime) { - ext = this._lutExtensionMime[i]; + for (let i = 0; i < this.EXTENSION_TO_MIMETYPES.length; i += 2) { + if (this.EXTENSION_TO_MIMETYPES[i + 1] === mime) { + ext = this.EXTENSION_TO_MIMETYPES[i]; break; } } @@ -275,9 +423,9 @@ export default class Picture implements IPicture { } const ext = FileUtils.getExtension(name); - for (let i = 0; i < this._lutExtensionMime.length; i += 2) { - if (this._lutExtensionMime[i] === ext) { - mimeType = this._lutExtensionMime[i + 1]; + for (let i = 0; i < this.EXTENSION_TO_MIMETYPES.length; i += 2) { + if (this.EXTENSION_TO_MIMETYPES[i] === ext) { + mimeType = this.EXTENSION_TO_MIMETYPES[i + 1]; break; } } @@ -287,3 +435,208 @@ export default class Picture implements IPicture { // #endregion } + +/** + * This class implements {@link IPicture} and provides mechanisms for loading pictures from files. + * Contrary to {@link Picture}, a reference to a file where the picture is located can be given and + * the picture is lazily loaded from the file, meaning that it will be read from the file only when + * needed. This saves time and memory if the picture loading is not required. + */ +export class PictureLazy implements IPicture, ILazy { + private _data: ByteVector; + private _description: string; + private _file: IFileAbstraction; + private _filename: string; + private _mimeType: string; + private _streamOffset: number; + private _streamSize: number; + private _type: PictureType; + + // #region Constructors + + private constructor() { /* private to enforce construction via static methods */ } + + /** + * Constructs a new picture using data that's already been read into memory. The content + * will not be lazily loaded. + * @param data ByteVector Object containing picture data + */ + public static fromData(data: ByteVector): PictureLazy { + Guards.truthy(data, "data"); + + const picture = new PictureLazy(); + picture._data = data.toByteVector(); + + const extension = Picture.getExtensionFromData(data); + if (extension) { + picture._type = PictureType.FrontCover; + picture._filename = `cover${extension}`; + picture._description = picture._filename; + } else { + picture._type = PictureType.NotAPicture; + picture._filename = "UnknownType"; + } + picture._mimeType = Picture.getMimeTypeFromFilename(picture._filename); + + return picture; + } + + /** + * Constructs a new instance from a file abstraction. The content will be lazily loaded. + * @param file File abstraction containing the file to read + * @param offset Index into the file where the picture is located, must be a 32-bit integer + * @param size Optionally, size of the picture in bytes. If omitted, all bytes of file will be + * read when lazily loaded. Must be a 32-bit integer or `undefined` + */ + public static fromFile(file: IFileAbstraction, offset: number, size?: number): PictureLazy { + Guards.truthy(file, "file"); + Guards.safeInt(offset, "offset"); + if (size !== undefined) { + Guards.safeUint(offset, "size"); + } + + const picture = new PictureLazy(); + picture._file = file; + picture._streamOffset = offset; + picture._streamSize = size; + picture._filename = file.name; + picture._description = file.name; + + if (picture._filename && picture._filename.indexOf(".") > -1) { + picture._mimeType = Picture.getMimeTypeFromFilename(picture._filename); + picture._type = picture._mimeType.startsWith("image/") ? PictureType.FrontCover : PictureType.NotAPicture; + } + + return picture; + } + + /** + * Constructs a new instance that will be lazily loaded from the filePath provided. + * @param filePath Path to the file to read + */ + public static fromPath(filePath: string): PictureLazy { + Guards.truthy(filePath, "path"); + + const picture = new PictureLazy(); + picture._file = new LocalFileAbstraction(filePath); + picture._filename = path.basename(filePath); + picture._description = picture._filename; + picture._mimeType = Picture.getMimeTypeFromFilename(picture._filename); + picture._type = picture._mimeType.startsWith("image/") ? PictureType.FrontCover : PictureType.NotAPicture; + + return picture; + } + + // #endregion + + // #region Properties + + /** @inheritDoc */ + public get data(): ByteVector { + this.load(); + return this._data; + } + /** @inheritDoc */ + public set data(value: ByteVector) { this._data = value; } + + /** @inheritDoc */ + public get description(): string { return this._description; } + /** @inheritDoc */ + public set description(value: string) { this._description = value; } + + /** @inheritDoc */ + public get filename(): string { + this.load(); + return this._filename; + } + /** @inheritDoc */ + public set filename(value: string) { this._filename = value; } + + /** @inheritDoc */ + public get isLoaded(): boolean { return !!this._data; } + + /** @inheritDoc */ + public get mimeType(): string { + if (!this._mimeType) { this.load(); } + return this._mimeType; + } + /** @inheritDoc */ + public set mimeType(value: string) { this._mimeType = value; } + + /** @inheritDoc */ + public get type(): PictureType { + if (this._type === PictureType.Other && !this._mimeType) { this.load(); } + return this._type; + } + /** @inheritDoc */ + public set type(value: PictureType) { this._type = value; } + + // #endregion + + // #region Methods + + /** @inheritDoc */ + public load(): void { + // Already loaded? + if (this._data) { + return; + } + + // Load the picture from the stream for the file + let stream; + try { + if (this._streamSize === 0) { + // Picture is 0 bytes, just use an empty byte vector for the data + this._data = ByteVector.empty(); + } else if (this._streamSize !== undefined) { + // Picture length was defined, read those bytes as the data + stream = this._file.readStream; + stream.seek(this._streamOffset, SeekOrigin.Begin); + + let count = 0; + let read = 0; + let needed = this._streamSize; + const buffer = new Uint8Array(needed); + + do { + count = stream.read(buffer, read, needed); + read += count; + needed -= count; + } while (needed > 0 && count !== 0); + + this._data = ByteVector.fromByteArray(buffer, read).toByteVector(); + } else { + // Picture length was not defined, read entire stream as the data + stream = this._file.readStream; + stream.seek(this._streamOffset, SeekOrigin.Begin); + this._data = ByteVector.fromInternalStream(stream); + } + } finally { + // Free any open resources + if (stream && this._file) { + this._file.closeStream(stream); + } + this._file = undefined; + } + + // Retrieve remaining properties from data (if required) + if (!this._mimeType) { + const ext = Picture.getExtensionFromData(this._data); + this._mimeType = Picture.getMimeTypeFromFilename(ext); + if (ext) { + this._type = PictureType.FrontCover; + if (!this._filename) { + this._filename = `cover${ext}`; + this._description = this._filename; + } + } else { + this._type = PictureType.NotAPicture; + if (!this._filename) { + this._filename = "UnknownType"; + } + } + } + } + + // #endregion +} diff --git a/src/pictureLazy.ts b/src/pictureLazy.ts deleted file mode 100644 index 5dd7d770..00000000 --- a/src/pictureLazy.ts +++ /dev/null @@ -1,213 +0,0 @@ -import * as Path from "path"; -import ILazy from "./iLazy"; -import Picture from "./picture"; -import {ByteVector} from "./byteVector"; -import {IFileAbstraction, LocalFileAbstraction} from "./fileAbstraction"; -import {IPicture, PictureType} from "./iPicture"; -import {SeekOrigin} from "./stream"; -import {Guards} from "./utils"; - -/** - * This class implements {@link IPicture} and provides mechanisms for loading pictures from files. - * Contrary to {@link Picture}, a reference to a file where the picture is located can be given and - * the picture is lazily loaded from the file, meaning that it will be read from the file only when - * needed. This saves time and memory if the picture loading is not required. - */ -export default class PictureLazy implements IPicture, ILazy { - private _data: ByteVector; - private _description: string; - private _file: IFileAbstraction; - private _filename: string; - private _mimeType: string; - private _streamOffset: number; - private _streamSize: number; - private _type: PictureType; - - // #region Constructors - - private constructor() {} - - /** - * Constructs a new picture using data that's already been read into memory. The content - * will not be lazily loaded. - * @param data ByteVector Object containing picture data - */ - public static fromData(data: ByteVector): PictureLazy { - Guards.truthy(data, "data"); - - const picture = new PictureLazy(); - picture._data = ByteVector.fromByteVector(data); - - const extension = Picture.getExtensionFromData(data); - if (extension) { - picture._type = PictureType.FrontCover; - picture._filename = `cover${extension}`; - picture._description = picture._filename; - } else { - picture._type = PictureType.NotAPicture; - picture._filename = "UnknownType"; - } - picture._mimeType = Picture.getMimeTypeFromFilename(picture._filename); - - return picture; - } - - /** - * Constructs a new instance from a file abstraction. The content will be lazily loaded. - * @param file File abstraction containing the file to read - * @param offset Index into the file where the picture is located, must be a 32-bit integer - * @param size Optionally, size of the picture in bytes. If omitted, all bytes of file will be - * read when lazily loaded. Must be a 32-bit integer or `undefined` - */ - public static fromFile(file: IFileAbstraction, offset: number, size?: number): PictureLazy { - Guards.truthy(file, "file"); - Guards.safeInt(offset, "offset"); - if (size !== undefined) { - Guards.safeUint(offset, "size"); - } - - const picture = new PictureLazy(); - picture._file = file; - picture._streamOffset = offset; - picture._streamSize = size; - picture._filename = file.name; - picture._description = file.name; - - if (picture._filename && picture._filename.indexOf(".") > -1) { - picture._mimeType = Picture.getMimeTypeFromFilename(picture._filename); - picture._type = picture._mimeType.startsWith("image/") ? PictureType.FrontCover : PictureType.NotAPicture; - } - - return picture; - } - - /** - * Constructs a new instance that will be lazily loaded from the path provided. - * @param path Path to the file to read - */ - public static fromPath(path: string): PictureLazy { - Guards.truthy(path, "path"); - - const picture = new PictureLazy(); - picture._file = new LocalFileAbstraction(path); - picture._filename = Path.basename(path); - picture._description = picture._filename; - picture._mimeType = Picture.getMimeTypeFromFilename(picture._filename); - picture._type = picture._mimeType.startsWith("image/") ? PictureType.FrontCover : PictureType.NotAPicture; - - return picture; - } - - // #endregion - - // #region Properties - - /** @inheritDoc */ - public get data(): ByteVector { - if (!this._data) { this.load(); } - return this._data; - } - /** @inheritDoc */ - public set data(value: ByteVector) { this._data = value; } - - /** @inheritDoc */ - public get description(): string { return this._description; } - /** @inheritDoc */ - public set description(value: string) { this._description = value; } - - /** @inheritDoc */ - public get filename(): string { - if (!this._filename) { this.load(); } - return this._filename; - } - /** @inheritDoc */ - public set filename(value: string) { this._filename = value; } - - /** @inheritDoc */ - public get isLoaded(): boolean { return !!this._data; } - - /** @inheritDoc */ - public get mimeType(): string { - if (!this._mimeType) { this.load(); } - return this._mimeType; - } - /** @inheritDoc */ - public set mimeType(value: string) { this._mimeType = value; } - - /** @inheritDoc */ - public get type(): PictureType { - if (this._type === PictureType.Other && !this._mimeType) { this.load(); } - return this._type; - } - /** @inheritDoc */ - public set type(value: PictureType) { this._type = value; } - - // #endregion - - // #region Methods - - /** @inheritDoc */ - public load(): void { - // Already loaded? - if (this._data) { - return; - } - - // Load the picture from the stream for the file - let stream; - try { - if (this._streamSize === 0) { - // Picture is 0 bytes, just use an empty byte vector for the data - this._data = ByteVector.empty(); - } else if (this._streamSize !== undefined) { - // Picture length was defined, read those bytes as the data - stream = this._file.readStream; - stream.seek(this._streamOffset, SeekOrigin.Begin); - - let count = 0; - let read = 0; - let needed = this._streamSize; - const buffer = new Uint8Array(needed); - - do { - count = stream.read(buffer, read, needed); - read += count; - needed -= count; - } while (needed > 0 && count !== 0); - - this._data = ByteVector.fromByteArray(buffer, read); - } else { - // Picture length was not defined, read entire stream as the data - stream = this._file.readStream; - stream.seek(this._streamOffset, SeekOrigin.Begin); - this._data = ByteVector.fromInternalStream(stream); - } - } finally { - // Free any open resources - if (stream && this._file) { - this._file.closeStream(stream); - } - this._file = undefined; - } - - // Retrieve remaining properties from data (if required) - if (!this._mimeType) { - const ext = Picture.getExtensionFromData(this._data); - this._mimeType = Picture.getMimeTypeFromFilename(ext); - if (ext) { - this._type = PictureType.FrontCover; - if (!this._filename) { - this._filename = `cover${ext}`; - this._description = this._filename; - } - } else { - this._type = PictureType.NotAPicture; - if (!this._filename) { - this._filename = "UnknownType"; - } - } - } - } - - // #endregion -} diff --git a/src/properties.ts b/src/properties.ts index b64d3f0b..b8360b03 100644 --- a/src/properties.ts +++ b/src/properties.ts @@ -1,7 +1,141 @@ -import {IAudioCodec, ICodec, ILosslessAudioCodec, IPhotoCodec, IVideoCodec, MediaTypes} from "./iCodec"; +import {NumberUtils} from "./utils"; +/** + * Indicates the types o media represented by a {@link ICodec} or {@link Properties}. These values + * can be combined to represent multiple media types. + */ +export enum MediaTypes { + /** + * No media is present + */ + None = 0, + + /** + * Audio is present + */ + Audio = 1, + + /** + * Video is present + */ + Video = 2, + + /** + * A photo is present + */ + Photo = 4, + + /** + * Text is present + */ + Text = 8, + + /** + * Lossless audio is present. This also implies audio is present. + */ + LosslessAudio = 17 +} + +/** + * Interface that provides basic information common to all media codecs + */ +export interface ICodec { + /** + * Gets a text description of the media represented by the current instance. + */ + description: string; + + /** + * Duration of the media in milliseconds represented by the current instance. + * @TODO Ensure milliseconds is the right way to interpret this field + */ + durationMilliseconds: number; + + /** + * Types of media represented by the current instance, bitwise combined. + */ + mediaTypes: MediaTypes; +} + +/** + * Interface that inherits the common codec information and adds audio-specific information. + * When dealing with an {@link ICodec}, if {@link ICodec.mediaTypes} contains + * {@link MediaTypes.Audio}, it is safe to assume that the object also inherits {@link IAudioCodec} + * and can be recast without issue. + */ +export interface IAudioCodec extends ICodec { + /** + * Bitrate of the audio in kilobits per second represented by the current instance. + */ + audioBitrate: number; + + /** + * Number of channels in the audio represented by the current instance. + */ + audioChannels: number; + + /** + * Sample rate of the audio represented by the current instance. + */ + audioSampleRate: number; +} + +/** + * This interface provides information specific to lossless audio codecs. + * When dealing with an {@link ICodec}, if {@link ICodec.mediaTypes} contains + * {@link MediaTypes.LosslessAudio}, it is safe to assume that the object also inherits + * {@link ILosslessAudioCodec} and can be recast without issue. + */ +export interface ILosslessAudioCodec extends IAudioCodec { + /** + * Number of bits per sample in the audio represented by the current instance. + */ + bitsPerSample: number; +} + +/** + * Interface that inherits the common codec information and adds video-specific information. + * When dealing with an {@link ICodec}, if {@link ICodec.mediaTypes} contains + * {@link MediaTypes.Video}, it is safe to assume that the object also inherits {@link IVideoCodec} + * and can be recast without issue. + */ +export interface IVideoCodec extends ICodec { + /** + * Height of the video in pixels represented by the current instance. + */ + videoHeight: number; + + /** + * Width of the video in pixels represented by the current instance. + */ + videoWidth: number; +} + +/** + * Interface that inherits the common codec information and adds photo-specific information. + * When dealing with an {@link ICodec}, if {@link ICodec.mediaTypes} contains + * {@link MediaTypes.Photo}, it is safe to assume that the object also inherits {@link IPhotoCodec} + * and can be recast without issue. + */ +export interface IPhotoCodec extends ICodec { + /** + * Height of the photo in pixels represented by the current instance. + */ + photoHeight: number; + + /** + * Format-specific quality indicator of the photo represented by the current instance. + * A value of `0` means there was no quality indicator for the format or file. + */ + photoQuality: number; + + /** + * Width of the photo in pixels represented by the current instance. + */ + photoWidth: number; +} -export default class Properties implements ILosslessAudioCodec, IVideoCodec, IPhotoCodec { +export class Properties implements ILosslessAudioCodec, IVideoCodec, IPhotoCodec { private readonly _codecs: ICodec[]; private readonly _duration: number; @@ -148,8 +282,10 @@ export default class Properties implements ILosslessAudioCodec, IVideoCodec, IPh property: (codec: TCodec) => number, defaultValue: number ): number { - const codec = this._codecs.find((e) => !!e && (e.mediaTypes & mediaType) !== 0); - return codec ? property( codec) : defaultValue; + const codec = this._codecs.find((e) => !!e && NumberUtils.hasFlag(e.mediaTypes, mediaType)); + return codec + ? property( codec) || defaultValue + : defaultValue; } // #endregion diff --git a/src/riff/avi/aviHeader.ts b/src/riff/avi/aviHeader.ts index c97efafa..23173e71 100644 --- a/src/riff/avi/aviHeader.ts +++ b/src/riff/avi/aviHeader.ts @@ -1,7 +1,7 @@ import RiffList from "../riffList"; import {AviStream} from "./aviStream"; import {CorruptFileError} from "../../errors"; -import {ICodec} from "../../iCodec"; +import {ICodec} from "../../properties"; import {Guards} from "../../utils"; /** @@ -11,12 +11,12 @@ export default class AviHeader { /** * ID of the chunk in the header list that contains the header data. */ - public static readonly headerChunkId = "avih"; + public static readonly HEADER_CHUNK_ID = "avih"; /** * Type of the list that stores an AVI header */ - public static readonly headerListType = "hdrl"; + public static readonly HEADER_LIST_TYPE = "hdrl"; private readonly _codecs: ICodec[]; private readonly _durationMilliseconds: number; @@ -37,12 +37,12 @@ export default class AviHeader { */ public constructor(list: RiffList) { Guards.truthy(list, "list"); - if (list.type !== AviHeader.headerListType) { - throw new CorruptFileError(`Expected ${AviHeader.headerListType} list but got ${list.type}`); + if (list.type !== AviHeader.HEADER_LIST_TYPE) { + throw new CorruptFileError(`Expected ${AviHeader.HEADER_LIST_TYPE} list but got ${list.type}`); } // Read the main header - const mainHeaderValues = list.getValues(AviHeader.headerChunkId); + const mainHeaderValues = list.getValues(AviHeader.HEADER_CHUNK_ID); if (mainHeaderValues.length === 0) { throw new CorruptFileError("Could not find AVI main header data"); } @@ -50,20 +50,20 @@ export default class AviHeader { if (mainHeaderData.length < 40) { throw new CorruptFileError("AVI header is an invalid length"); } - this._microsecondsPerFrame = mainHeaderData.mid(0, 4).toUInt(false); - this._maxBytesPerSecond = mainHeaderData.mid(4, 4).toUInt(false); - this._flags = mainHeaderData.mid(12, 4).toUInt(false); - this._totalFrames = mainHeaderData.mid(16, 4).toUInt(false); - this._initialFrames = mainHeaderData.mid(20, 4).toUInt(false); - this._streamCount = mainHeaderData.mid(24, 4).toUInt(false); - this._suggestedBufferSize = mainHeaderData.mid(28, 4).toUInt(false); - this._width = mainHeaderData.mid(32, 4).toUInt(false); - this._height = mainHeaderData.mid(36, 4).toUInt(false); + this._microsecondsPerFrame = mainHeaderData.subarray(0, 4).toUint(false); + this._maxBytesPerSecond = mainHeaderData.subarray(4, 4).toUint(false); + this._flags = mainHeaderData.subarray(12, 4).toUint(false); + this._totalFrames = mainHeaderData.subarray(16, 4).toUint(false); + this._initialFrames = mainHeaderData.subarray(20, 4).toUint(false); + this._streamCount = mainHeaderData.subarray(24, 4).toUint(false); + this._suggestedBufferSize = mainHeaderData.subarray(28, 4).toUint(false); + this._width = mainHeaderData.subarray(32, 4).toUint(false); + this._height = mainHeaderData.subarray(36, 4).toUint(false); this._durationMilliseconds = this._totalFrames * this._microsecondsPerFrame / 1000; // Read the streams in the file - const streamHeaderLists = list.getLists(AviStream.listType); + const streamHeaderLists = list.getLists(AviStream.LIST_TYPE); this._streams = streamHeaderLists.map((l) => new AviStream(l)); this._codecs = this._streams.map((s) => s.codec).filter((c) => !!c); } diff --git a/src/riff/avi/aviStream.ts b/src/riff/avi/aviStream.ts index 3981f5a6..c517201b 100644 --- a/src/riff/avi/aviStream.ts +++ b/src/riff/avi/aviStream.ts @@ -1,22 +1,22 @@ import RiffBitmapInfoHeader from "../riffBitmapInfoHeader"; import RiffList from "../riffList"; import RiffWaveFormatEx from "../riffWaveFormatEx"; -import {ICodec} from "../../iCodec"; import {CorruptFileError} from "../../errors"; +import {ICodec} from "../../properties"; import {Guards} from "../../utils"; export enum AviStreamType { /** Audio Stream */ - /* auds */ AUDIO_STREAM = 0x73647561, + /* auds */ AudioStream = 0x73647561, /** MIDI Stream */ - /* mids */ MIDI_STREAM = 0x7264696D, + /* mids */ MidiStream = 0x7264696D, /** Text stream */ - /* txts */ TEXT_STREAM = 0x73747874, + /* txts */ TextStream = 0x73747874, /** Video stream */ - /* vids */ VIDEO_STREAM = 0x73646976 + /* vids */ VideoStream = 0x73646976 } /** @@ -24,9 +24,9 @@ export enum AviStreamType { * stream list. */ export class AviStream { - public static readonly formatChunkId = "strf"; - public static readonly headerChunkId = "strh"; - public static readonly listType = "strl"; + public static readonly FORMAT_CHUNK_ID = "strf"; + public static readonly HEADER_CHUNK_ID = "strh"; + public static readonly LIST_TYPE = "strl"; private readonly _bottom: number; private readonly _codec: ICodec; @@ -53,12 +53,12 @@ export class AviStream { */ public constructor(list: RiffList) { Guards.truthy(list, "list"); - if (list.type !== AviStream.listType) { + if (list.type !== AviStream.LIST_TYPE) { throw new CorruptFileError("Stream header list does not have correct type"); } // Parse the stream header - const streamHeaderData = list.getValues(AviStream.headerChunkId); + const streamHeaderData = list.getValues(AviStream.HEADER_CHUNK_ID); if (streamHeaderData.length !== 1) { throw new CorruptFileError("Stream header list does not contain valid stream header chunks"); } @@ -67,38 +67,38 @@ export class AviStream { throw new CorruptFileError("Stream header does not contain correct number of bytes"); } - this._type = streamHeaderDatum.mid(0, 4).toUInt(false); - this._handler = streamHeaderDatum.mid(4, 4).toUInt(false); - this._flags = streamHeaderDatum.mid(8, 4).toUInt(false); - this._priority = streamHeaderDatum.mid(12, 2).toUShort(false); - this._language = streamHeaderDatum.mid(14, 2).toUShort(false); - this._initialFrames = streamHeaderDatum.mid(16, 4).toUInt(false); - this._scale = streamHeaderDatum.mid(20, 4).toUInt(false); - this._rate = streamHeaderDatum.mid(24, 4).toUInt(false); - this._start = streamHeaderDatum.mid(28, 4).toUInt(false); - this._length = streamHeaderDatum.mid(32, 4).toUInt(false); - this._suggestedBufferSize = streamHeaderDatum.mid(36, 4).toUInt(false); - this._quality = streamHeaderDatum.mid(40, 4).toUInt(false); - this._sampleSize = streamHeaderDatum.mid(44, 4).toUInt(false); - this._left = streamHeaderDatum.mid(48, 2).toUShort(false); - this._top = streamHeaderDatum.mid(50, 2).toUShort(false); - this._right = streamHeaderDatum.mid(52, 2).toUShort(false); - this._bottom = streamHeaderDatum.mid(54, 2).toUShort(false); + this._type = streamHeaderDatum.subarray(0, 4).toUint(false); + this._handler = streamHeaderDatum.subarray(4, 4).toUint(false); + this._flags = streamHeaderDatum.subarray(8, 4).toUint(false); + this._priority = streamHeaderDatum.subarray(12, 2).toUshort(false); + this._language = streamHeaderDatum.subarray(14, 2).toUshort(false); + this._initialFrames = streamHeaderDatum.subarray(16, 4).toUint(false); + this._scale = streamHeaderDatum.subarray(20, 4).toUint(false); + this._rate = streamHeaderDatum.subarray(24, 4).toUint(false); + this._start = streamHeaderDatum.subarray(28, 4).toUint(false); + this._length = streamHeaderDatum.subarray(32, 4).toUint(false); + this._suggestedBufferSize = streamHeaderDatum.subarray(36, 4).toUint(false); + this._quality = streamHeaderDatum.subarray(40, 4).toUint(false); + this._sampleSize = streamHeaderDatum.subarray(44, 4).toUint(false); + this._left = streamHeaderDatum.subarray(48, 2).toUshort(false); + this._top = streamHeaderDatum.subarray(50, 2).toUshort(false); + this._right = streamHeaderDatum.subarray(52, 2).toUshort(false); + this._bottom = streamHeaderDatum.subarray(54, 2).toUshort(false); // Parse the stream construct - const streamFormatData = list.getValues(AviStream.formatChunkId); + const streamFormatData = list.getValues(AviStream.FORMAT_CHUNK_ID); if (streamFormatData.length !== 1) { throw new CorruptFileError("Stream header list is missing stream format chunk"); } switch (this._type) { - case AviStreamType.VIDEO_STREAM: + case AviStreamType.VideoStream: this._codec = new RiffBitmapInfoHeader(streamFormatData[0], 0); break; - case AviStreamType.AUDIO_STREAM: + case AviStreamType.AudioStream: this._codec = new RiffWaveFormatEx(streamFormatData[0]); break; - case AviStreamType.MIDI_STREAM: - case AviStreamType.TEXT_STREAM: + case AviStreamType.MidiStream: + case AviStreamType.TextStream: // These types don't have codecs, but we still care about the headers, I think // If there's more information needed for these types, please open a issue break; diff --git a/src/riff/aviFileSettings.ts b/src/riff/aviFileSettings.ts index 7358e3de..9aafeae8 100644 --- a/src/riff/aviFileSettings.ts +++ b/src/riff/aviFileSettings.ts @@ -1,26 +1,32 @@ import {TagTypes} from "../tag"; import {NumberUtils} from "../utils"; +/** + * This class contains settings related to AVI file operations. Open files will need to be re-read + * in order for changes to take effect. + */ export default class AviFileSettings { - public static readonly supportedTagTypes = TagTypes.DivX | TagTypes.Id3v2 | TagTypes.RiffInfo | TagTypes.MovieId; + public static readonly SUPPORTED_TAG_TYPES = TagTypes.DivX | TagTypes.Id3v2 | TagTypes.RiffInfo | TagTypes.MovieId; - private static _defaultTagTypes = AviFileSettings.supportedTagTypes; + private static _defaultTagTypes = AviFileSettings.SUPPORTED_TAG_TYPES; /** - * Gets the default types of tags for an AAC file. When opening a file, if these tag types do + * Gets the default types of tags for an AVI file. When opening a file, if these tag types do * not exist on the file, they will be created. */ public static get defaultTagTypes(): TagTypes { return this._defaultTagTypes; } /** - * Sets the default types of tags for an AAC file. When opening a file, if these tag types do - * not exist on the file, they will be created. See {@link supportedTagTypes} for a list of tag - * types that are supported by node-taglib-sharp for AAC files. + * Sets the default types of tags for an AVI file. When opening a file, if these tag types do + * not exist on the file, they will be created. See {@link SUPPORTED_TAG_TYPES} for a list of tag + * types that are supported by node-taglib-sharp for AVI files. */ public static set defaultTagTypes(value: TagTypes) { - const unsupportedTagTypes = NumberUtils.uintAnd(value, ~this.supportedTagTypes); + const unsupportedTagTypes = NumberUtils.uintAnd(value, ~this.SUPPORTED_TAG_TYPES); if (unsupportedTagTypes !== 0) { - throw new Error(`Argument error: node-taglib-sharp does not support tag types ${unsupportedTagTypes} for AVI files`); + throw new Error( + `Argument error: node-taglib-sharp does not support tag types ${unsupportedTagTypes} for AVI files` + ); } this._defaultTagTypes = value; diff --git a/src/riff/divxTag.ts b/src/riff/divxTag.ts index 6af453cf..c467f6f8 100644 --- a/src/riff/divxTag.ts +++ b/src/riff/divxTag.ts @@ -16,7 +16,7 @@ export default class DivxTag extends Tag { /** * Identifier used to recognize DivX tags. */ - public static readonly FILE_IDENTIFIER = ByteVector.fromString("DIVXTAG", undefined, undefined, true); + public static readonly FILE_IDENTIFIER = ByteVector.fromString("DIVXTAG", StringType.Latin1).makeReadOnly(); /** * Size of a DivX tag in bytes. @@ -51,12 +51,12 @@ export default class DivxTag extends Tag { } const tag = new DivxTag(); - tag._title = data.toString(32, StringType.Latin1, 0).trim(); - tag._artist = data.toString(28, StringType.Latin1, 32).trim(); - tag._year = data.toString(4, StringType.Latin1, 60).trim(); - tag._comment = data.toString(48, StringType.Latin1, 64).trim(); - tag._genre = data.toString(3, StringType.Latin1, 112).trim(); - tag._extraData = data.mid(115, 6); + tag._title = data.subarray(0, 32).toString(StringType.Latin1).trim(); + tag._artist = data.subarray(32, 28).toString(StringType.Latin1).trim(); + tag._year = data.subarray(60, 4).toString(StringType.Latin1).trim(); + tag._comment = data.subarray(64, 48).toString(StringType.Latin1).trim(); + tag._genre = data.subarray(112, 3).toString(StringType.Latin1).trim(); + tag._extraData = data.subarray(115, 6); return tag; } @@ -95,7 +95,7 @@ export default class DivxTag extends Tag { /** * @inheritDoc - * @remarks Genre is stored as an numeric genre. This is translated into the human- + * @remarks Genre is stored as a numeric genre. This is translated into the human- * readable genre. */ public get genres(): string[] { @@ -104,7 +104,7 @@ export default class DivxTag extends Tag { } /** * @inheritDoc - * @remarks Genre is stored as an numeric genre, so only video genres are supported. Only + * @remarks Genre is stored as a numeric genre, so only video genres are supported. Only * one genre can be stored. */ public set genres(value: string[]) { @@ -131,7 +131,7 @@ export default class DivxTag extends Tag { // #region Methods /** @inheritDoc */ - public clear() { + public clear(): void { this._title = ""; this._artist = ""; this._genre = ""; @@ -145,11 +145,11 @@ export default class DivxTag extends Tag { */ public render(): ByteVector { return ByteVector.concatenate( - ByteVector.fromString(this._title, StringType.Latin1).resize(32, 0x20), - ByteVector.fromString(this._artist, StringType.Latin1).resize(28, 0x20), - ByteVector.fromString(this._year, StringType.Latin1).resize(4, 0x20), - ByteVector.fromString(this._comment, StringType.Latin1).resize(48, 0x20), - ByteVector.fromString(this._genre, StringType.Latin1).resize(3, 0x20), + ByteVector.fromString(this._title.padEnd(32, " ").substring(0, 32), StringType.Latin1), + ByteVector.fromString(this._artist.padEnd(28, " ").substring(0 , 28), StringType.Latin1), + ByteVector.fromString(this._year.padEnd(4, " ").substring(0, 4), StringType.Latin1), + ByteVector.fromString(this._comment.padEnd(48, " ").substring(0, 48), StringType.Latin1), + ByteVector.fromString(this._genre.padEnd(3, " ").substring(0, 3), StringType.Latin1), this._extraData, DivxTag.FILE_IDENTIFIER ); diff --git a/src/riff/infoTag.ts b/src/riff/infoTag.ts index c4a582e7..e046aa90 100644 --- a/src/riff/infoTag.ts +++ b/src/riff/infoTag.ts @@ -10,7 +10,7 @@ export default class InfoTag extends RiffListTag { /** * Type of the list that contains an info tag. */ - public static readonly listType = "INFO"; + public static readonly LIST_TYPE = "INFO"; // #region Constructors @@ -22,7 +22,7 @@ export default class InfoTag extends RiffListTag { * Constructs and initializes a new, empty instance. */ public static fromEmpty(): InfoTag { - return new InfoTag(RiffList.fromEmpty(InfoTag.listType)); + return new InfoTag(RiffList.fromEmpty(InfoTag.LIST_TYPE)); } /** diff --git a/src/riff/movieIdTag.ts b/src/riff/movieIdTag.ts index 80962628..a8a85069 100644 --- a/src/riff/movieIdTag.ts +++ b/src/riff/movieIdTag.ts @@ -7,7 +7,7 @@ import {Guards} from "../utils"; * Provides support for reading and writing MovieID tags. */ export default class MovieIdTag extends RiffListTag { - public static readonly listType = "MID "; + public static readonly LIST_TYPE = "MID "; // #region Constructors @@ -29,7 +29,7 @@ export default class MovieIdTag extends RiffListTag { * Constructs and initializes a new, empty instance. */ public static fromEmpty(): MovieIdTag { - return new MovieIdTag(RiffList.fromEmpty(MovieIdTag.listType)); + return new MovieIdTag(RiffList.fromEmpty(MovieIdTag.LIST_TYPE)); } // #endregion diff --git a/src/riff/riffBitmapInfoHeader.ts b/src/riff/riffBitmapInfoHeader.ts index 59398747..d448ebf0 100644 --- a/src/riff/riffBitmapInfoHeader.ts +++ b/src/riff/riffBitmapInfoHeader.ts @@ -1,6 +1,6 @@ import {ByteVector} from "../byteVector"; import {CorruptFileError} from "../errors"; -import {IVideoCodec, MediaTypes} from "../iCodec"; +import {IVideoCodec, MediaTypes} from "../properties"; import {Guards, NumberUtils} from "../utils"; /** @@ -16,664 +16,666 @@ export default class RiffBitmapInfoHeader implements IVideoCodec { // * http://abcavi.kibi.ru/fourcc.php // If any FOURCCs are missing or wrong, submit a PR and include a link to some source saying // this FOURCC exists. - public static readonly FOURCC_CODES: {[key: number]: string} = { - /* BI_RGB */ 0x00000000: "Windows Bitmap Format", - /* BI_RLE8 */ 0x00000001: "Run length encoded 8bpp RGB Format", - /* BI_RLE4 */ 0x00000002: "Run length encoded 4bpp RGB Format", - /* BI_BITFIELDS */ 0x00000003: "Raw RGB Format using Bitmasks", - /* 1978 */ 0x31393738: "A.M.Paredes predictor (LossLess)", - /* 26LT */ 0x32364C54: "Discreet UC YUV 4:2:2:4 10-bit", - /* 28DV */ 0x32384456: "Apple QuickTime DV (DVCPRO NTSC)", - /* 28SM */ 0x3238534D: "Apple Graphics (SMC) codec (256 color)", - /* 3IV0 */ 0x33495630: "MPEG4-based codec 3ivx", - /* 3IV1 */ 0x33495631: "MPEG4-based codec 3ivx", - /* 3IV2 */ 0x33495632: "MPEG4-based codec 3ivx", - /* 3IVD */ 0x33495644: "Microsoft MPEG-4 v3 / Doctored 3ivx DivX", - /* 3IVX */ 0x33495658: "MPEG4-based codec 3ivx", - /* 8BPS */ 0x38425053: "Apple QuickTime Planar RGB w/Alpha-channel", - /* AAS4 */ 0x41415334: "Autodesk Animator codec (RLE)", - /* AASC */ 0x41415343: "Autodesk Animator codec", - /* ABVB */ 0x41425642: "Avid ABVB / NuVista MJPEG w/Alpha-channel", - /* ABYR */ 0x41425952: "Kensington codec (low resolution, low frame rate (6fps) codec)", - /* ACTL */ 0x4143544C: "Streambox ACT-L2", - /* ADV1 */ 0x41445631: "Loronix WaveCodec", - /* ADVJ */ 0x4144564A: "Avid M-JPEG (aka AVRn)", - /* AEIK */ 0x4145494B: "Intel Indeo Video 3.2 (Vector Quantization)", - /* AEMI */ 0x41454D49: "Array VideoONE MPEG1-I capture", - /* AFLC */ 0x41464C43: "Autodesk Animator FLC (256 color)", - /* AFLI */ 0x41464C49: "Autodesk Animator FLI (256 color)", - /* AHDV */ 0x41484456: "CineForm 10-bit Visually Perfect HD (Wavelet)", - /* AJPG */ 0x414A5047: "22fps JPEG-based codec", - /* ALAC */ 0x414C4143: "Apple lossless audio", - /* ALPH */ 0x414C5048: "Ziracom Video", - /* AMPG */ 0x414D5047: "Array VideoONE MPEG w/Compression", - /* ANIM */ 0x414E494D: "Intel RDX", - /* AP41 */ 0x41503431: "AngelPotion Definitive / Hacked Microsoft MPEG-4 v3", - /* AP42 */ 0x41503432: "AngelPotion Definitive / Hacked Microsoft MPEG-4 v3", - /* ASLC */ 0x41534C43: "AlparySoft Lossless Codec", - /* ASV1 */ 0x41535631: "Asus Video V1", - /* ASV2 */ 0x41535632: "Asus Video V2", - /* ASVX */ 0x41535658: "Asus Video 2.0", - /* ATM4 */ 0x41544D34: "Ahead Nero Digital MPEG-4 Codec", - /* AUR2 */ 0x41555232: "AuraVision Aura 2", - /* AURA */ 0x41555241: "AuraVision Aura 1", - /* AUVX */ 0x41555658: "USH AUVX video codec", - /* AV1X */ 0x41563158: "Avid 1:1x (QuickTime)", - /* AVC1 */ 0x41564331: "H.264/MPEG-4 AVC", - /* AVD1 */ 0x31445641: "Avid DV (QuickTime)", - /* AVDJ */ 0x4A445641: "Avid Meridien JFIF w/Alpha-channel", - /* AVDN */ 0x4E445641: "Avid DNxHD (QuickTime)", - /* AVDV */ 0x56445641: "Avid DV", - /* AVI1 */ 0x31495641: "MainConcept Motion JPEG Codec", - /* AVI2 */ 0x32495641: "MainConcept Motion JPEG Codec", - /* AVID */ 0x44495641: "Avid Motion JPEG", - /* AVIS */ 0x53495641: "Alias for AviSynth", - /* AVMP */ 0x504D5641: "Avid IMX (QuickTime)", - /* AVRN */ 0x4E525641: "Avid Motion JPEG", - /* AVUI */ 0x49555641: "Avid Meridien Uncompressed w/Alpha-channel", - /* AVUP */ 0x50555641: "Avid 10-bit Packed (QuickTime)", - /* AYUV */ 0x56555941: "Packed YUV 4:4:4 Format", - /* AZPR */ 0x52505A41: "Apple QuickTime Video", - /* AZRP */ 0x50525A41: "Apple QuickTime Video", - /* BA81 */ 0x31384142: "Raw Bayer Format", - /* BHIV */ 0x56494842: "BeHere iVideo", - /* BINK */ 0x4B4E4942: "Bink Video (RAD Game Tools)", - /* BITM */ 0x4D544942: "Microsoft H.261", - /* BLOX */ 0x584F4C42: "Jan Jezabek BLOX MPEG Codec", - /* BLZ0 */ 0x305A4C42: "Blizzard Decoder Filter DivX", - /* BMV1 */ 0x31564D42: "MicroFirst Bitmap Video", - /* BT20 */ 0x30325442: "Conexant/Brooktree Prosumer MediaStream", - /* BTCV */ 0x56435442: "Conexant/Brooktree Composite Video", - /* BTVC */ 0x43565442: "Conexant Composite Video", - /* BW00 */ 0x30305742: "BergWave (Wavelet)", - /* BW10 */ 0x30315742: "Broadway MPEG Capture w/Compression", - /* BXBG */ 0x47425842: "BOXX BGR", - /* BXRG */ 0x47525842: "BOXX RGB", - /* BXY2 */ 0x32595842: "BOXX 10-bit YUV", - /* BXYV */ 0x56595842: "BOXX YUV", - /* BYR1 */ 0x31525942: "Raw Bayer Format", - /* BYR2 */ 0x32525942: "Raw Bayer Format", - /* CC12 */ 0x32314343: "Intel YUV12 / AuraVision Aura 2", - /* CDV5 */ 0x35564443: "Canopus SD50 / DVHD", - /* CDVC */ 0x43564443: "Canopus DV Codec", - /* CDVH */ 0x48564443: "Canopus SD50 / DVHD", - /* CFCC */ 0x43434643: "DPS Perception Motion JPEG", - /* CFHD */ 0x44484643: "CineForm 10-bit Visually Perfect HD (Wavelet)", - /* CGDI */ 0x49444743: "Microsoft Office 97 Camcorder Video", - /* CHAM */ 0x4D414843: "Winnov Caviara Champagne", - /* CJPG */ 0x47504A43: "Creative Video Blaster Webcam Go JPEG", - /* CLJR */ 0x524A4C43: "Cirrus Logic Packed YUV 4:1:1 Format", - /* CLLC */ 0x434C4C43: "Canopus LossLess", - /* CLPL */ 0x4C504C43: "Planer YUV Format", - /* CM10 */ 0x30314D43: "CyberLink MediaShow 1.0", - /* CMYK */ 0x4B594D43: "Common Data Format in Printing", - /* COL0 */ 0x304C4F43: "Microsoft MPEG-4 v3", - /* COL1 */ 0x314C4F43: "Microsoft MPEG-4 v3", - /* CPLA */ 0x414C5043: "Weitek 4:2:0 YUV planar", - /* CRAM */ 0x4D415243: "Microsoft Video 1", - /* CSCD */ 0x44435343: "CamStudio Lossless Codec", - /* CT10 */ 0x30315443: "CyberLink TalkingShow 1.0", - /* CTRX */ 0x58525443: "Citrix Scalable Video Codec", - /* CUVC */ 0x43565543: "Canopus HQ", - /* CVID */ 0x44495643: "Cinepak by SuperMac", - /* CWLT */ 0x544C5743: "Microsoft Color WLT DIB", - /* CXY1 */ 0x31595843: "Conexant Planer YUV 4:1:1 Format", - /* CXY2 */ 0x32595843: "Conexant Planar YUV 4:2:2 Format", - /* CYUV */ 0x56555943: "Creative Labs Packed YUV 4:2:2 Format", - /* CYUY */ 0x59555943: "ATI YUV", - /* D261 */ 0x31363244: "DEC H.261, 24-bit", - /* D263 */ 0x33363244: "DEC H.263, 24-bit", - /* DAVC */ 0x43564144: "Dicas MPEGable H.264 / MPEG-4 AVC", - /* DC25 */ 0x35324344: "MainConcept ProDV Codec", - /* DCAP */ 0x50414344: "Pinnacle DV25 Codec", - /* DCL1 */ 0x314C4344: "Data Connection Conferencing Codec", - /* DCL2 */ 0x324C4344: "Data Connection Conferencing Codec", - /* DCL3 */ 0x334C4344: "Data Connection Conferencing Codec", - /* DCL4 */ 0x344C4344: "Data Connection Conferencing Codec", - /* DCL5 */ 0x354C4344: "Data Connection Conferencing Codec", - /* DCT0 */ 0x30544344: "WniWni Codec", - /* DFSC */ 0x43534644: "DebugMode FrameServer VFW Codec", - /* DIV1 */ 0x31564944: "FFmpeg OpenDivX", - /* DIV2 */ 0x32564944: "Microsoft MPEG-4 v2", - /* DIV3 */ 0x33564944: "DivX 3 Low-Motion", - /* DIV4 */ 0x34564944: "DivX 3 Fast-Motion", - /* DIV5 */ 0x35564944: "DivX 5.0", - /* DIV6 */ 0x36564944: "DivX MPEG-4 / Microsoft MPEG-4 v3", - /* DIVX */ 0x58564944: "DivX 4.0+ / OpenDivX", - /* DJPG */ 0x47504A44: "Broadway 101 Motion JPEG codec", - /* DM4V */ 0x56344D44: "Dicas MPEGable MPEG-4", - /* DMB1 */ 0x31424D44: "Matrox Rainbow Runner Motion JPEG w/hardware compression", - /* DMB2 */ 0x32424D44: "Paradigm Motion JPEG", - /* DMK2 */ 0x324B4D44: "ViewSonic V36 PDA Video", - /* DP02 */ 0x32305044: "DynaPel MPEG-4", - /* DP16 */ 0x36315044: "YUV411 w/DPCM 6-bit compression", - /* DP18 */ 0x38315044: "YUV411 w/DPCM 8-bit compression", - /* DP26 */ 0x36325044: "YUV422 w/DPCM 6-bit compression", - /* DP28 */ 0x38325044: "YUV422 w/DPCM 8-bit compression", - /* DP96 */ 0x36395044: "YVU9 w/DPCM 6-bit compression", - /* DP98 */ 0x38395044: "YVU9 w/DPCM 8-bit compression", - /* DP9L */ 0x4C395044: "YVU9 w/DPCM 6-bit compression and thinned-out", - /* DPS0 */ 0x30535044: "DPS Reality Motion JPEG", - /* DPSC */ 0x43535044: "DPS PAR Motion JPEG", - /* DRWX */ 0x58575244: "Pinnacle DV25 Codec", - /* DSVD */ 0x44565344: "Microsoft DirectShow DV", - /* DTMT */ 0x544D5444: "Media-100 Codec", - /* DTNT */ 0x544E5444: "Media-100 Codec", - /* DUCK */ 0x4B435544: "Duck TrueMotion S", - /* DV10 */ 0x30315644: "BlueFish444 Lossless RGBA, YUV 10-bit", - /* DV25 */ 0x35325644: "Matrox DVCPRO codec", - /* DV50 */ 0x30355644: "Matrox DVCPRO50 codec", - /* DVAN */ 0x4E415644: "Pinnacle miroVideo DV300 SW-only codec", - /* DVCP */ 0x50435644: "Apple QuickTime DV (DVCPRO PAL)", - /* DVCS */ 0x53435644: "MainConcept DV Codec", - /* DVE2 */ 0x32455644: "Insoft DVE-2 Videoconferencing Codec", - /* DVH1 */ 0x31485644: "Pinnacle DVHD100", - /* DVHD */ 0x44485644: "DV 1125 lines at 30.00 Hz or 1250 lines at 25.00 Hz", - /* DVIS */ 0x53495644: "VSYNC DualMoon Iris DV codec", - /* DVLP */ 0x504C5644: "Radius SoftDV 16:9 PAL", - /* DVMA */ 0x414D5644: "Darim Vision DVMPEG", - /* DVNM */ 0x4D4E5644: "Matsushita/Panasonic Video", - /* DVOR */ 0x524F5644: "BlueFish444 Lossless RGBA, YUC 10-bit", - /* DVPN */ 0x4E505644: "Apple QuickTime DV NTSC", - /* DVPP */ 0x50505644: "Apple QuickTime DV PAL", - /* DVR1 */ 0x31525644: "TARGA2000 Codec", - /* DVRS */ 0x53525644: "VSYNC DualMoon Iris DV codec", - /* DVSD */ 0x44535644: "DV 525 lines at 29.97 Hz or 625 lines at 25.00 Hz", - /* DVSL */ 0x4C535644: "DV compressed in SD", - /* DVX1 */ 0x31585644: "Lucent DVX1000SP Video Decoder", - /* DVX2 */ 0x32585644: "Lucent DVX2000S Video Decoder", - /* DVX3 */ 0x33585644: "Lucent DVX3000S Video Decoder", - /* DX50 */ 0x30355844: "DivX 5.0", - /* DXGM */ 0x4D475844: "EA Game Video Codec / Lord of the Rings Game Movies", - /* DXSB */ 0x42535844: "DivX Subtitles Codec", - /* DXT1 */ 0x31545844: "DirectX Compressed Texture w/1-bit alpha-channel)", - /* DXT2 */ 0x32545844: "DirectX Compressed Texture", - /* DXT3 */ 0x33545844: "DirectX Compressed Texture w/4-bit alpha-channel)", - /* DXT4 */ 0x34545844: "DirectX Compressed Texture", - /* DXT5 */ 0x35545844: "DirectX Compressed Texture w/3-bit alpha channel and interpolation)", - /* DXTC */ 0x43545844: "DirectX Texture Compression", - /* DXTN */ 0x4E545844: "DirectX Compressed Texture (DXTn)", - /* EKQ0 */ 0x30514B45: "Elsa Graphics Card Quick Codec", - /* ELK0 */ 0x304B4C45: "Elsa Graphics Card Codec", - /* EM2V */ 0x56324D45: "Etymonix MPEG-2 I-frame", - /* EMWC */ 0x43574D45: "EverAd Marquee WMA codec", - /* EQK0 */ 0x304B5145: "Elsa graphics card quick codec", - /* ES07 */ 0x37305345: "Eyestream 7 Codec", - /* ESCP */ 0x50435345: "*|Escape|Eidos Technologies Escape codec", - /* ETV1 */ 0x31565445: "eTreppid Video Codec", - /* ETV2 */ 0x32565445: "eTreppid Video Codec", - /* ETVC */ 0x43565445: "eTreppid Video Codec", - /* FFDS */ 0x53444646: "FFDShow supported", - /* FFV1 */ 0x31564646: "FFDShow Lossless video Codec", - /* FFVH */ 0x48564646: "FFDShow FFVH Codec", - /* FLIC */ 0x43494C46: "Autodesk FLI / FLC Animation|Autodesk FLI/FLC Animation", - /* FLJP */ 0x504A4C46: "D-Vision Field Encoded Motion JPEG w/LSI", - /* FLV1 */ 0x31564C46: "FFDShow FLV1 codec", - /* FMJP */ 0x504A4D46: "D-Vision field-based ISO MJPEG", - /* FMP4 */ 0x34504D46: "FFMpeg MPEG-4", - /* FMVC */ 0x43564D46: "Fox Magic Software Screen Capture Codec", - /* FPS1 */ 0x31535046: "Fraps Codec", - /* FRLE */ 0x454C5246: "SoftLab-NSK Y16 + Alpha RLE", - /* FRWA */ 0x41575246: "SoftLab-NSK Vision Forward Motion JPEG w/alpha-channel", - /* FRWD */ 0x44575246: "SoftLab-NSK Vision Forward Motion JPEG", - /* FRWT */ 0x54575246: "SoftLab-NSK Vision Forward Motion JPEG w/alpha-channel", - /* FRWU */ 0x55575246: "SoftLab-NSK Vision Forward Uncompressed", - /* FVF1 */ 0x31465646: "Iterated Systems Fractal Video Frame", - /* FVFW */ 0x57465646: "XviD-based FFMpeg MPEG-4 codec", - /* FXT1 */ 0x31545846: "3dfx Video", - /* GEOX */ 0x584F4547: "GEOMEPG4", - /* GEPJ */ 0x4A504547: "White Pine/Paradigm Matrix Motion JPEG Codec", - /* GJPG */ 0x47504A47: "Grand Tech GT891x Codec", - /* GLCC */ 0x43434C47: "GigaLink AV Capture codec", - /* GLZW */ 0x575A4C47: "Motion LZW", - /* GPEG */ 0x47455047: "Motion JPEG w/Floating Point", - /* GPJM */ 0x4D4A5047: "Pinnacle ReelTime Motion JPEG Codec", - /* GREY */ 0x59455247: "Packed YUV Monochrome Format", - /* GWLT */ 0x544C5747: "Microsoft Greyscale WLT DIB", - /* H260 */ 0x30363248: "Intel ITU H.260", - /* H261 */ 0x31363248: "Intel ITU H.261", - /* H262 */ 0x32363248: "Intel ITU H.262", - /* H263 */ 0x33363248: "Intel ITU H.263", - /* H264 */ 0x34363248: "Intel ITU H.264", - /* H265 */ 0x35363248: "Intel ITU H.265", - /* H266 */ 0x36363248: "Intel ITU H.266", - /* H267 */ 0x37363248: "Intel ITU H.267", - /* H268 */ 0x38363248: "Intel ITU H.268", - /* H269 */ 0x39363248: "Intel ITU H.263 for POTS-based videoconferencing", - /* HD10 */ 0x30314448: "BlueFish444 Lossless RGBA, YUC 10-bit", - /* HDX4 */ 0x34584448: "Jomigo HDX4", - /* HDYC */ 0x43594448: "Packed YUV 4:2:2 Format", - /* HEVC */ 0x43564548: "H.265/HEVC", - /* HFYU */ 0x55594648: "Huffman Lossless Codec", - /* HMCR */ 0x52434D48: "Rendition Motion Compensation Format", - /* HMRR */ 0x52524D48: "Rendition Motion Compensation Format", - /* I263 */ 0x33363249: "Intel ITU H.263", - /* I420 */ 0x30323449: "Planar YUV Format", - /* ICLB */ 0x424C4349: "InSoft CellB Videoconferencing Codec", - /* IDM0 */ 0x304D4449: "IDM Motion Wavelets 2.0", - /* IF09 */ 0x39304649: "Planar YUV Format", - /* IGOR */ 0x524F4749: "CyberLink PowerDVD", - /* IJLV */ 0x564C4A49: "Intel JPEG Library Video Codec", - /* IJPG */ 0x47504A49: "Intergraph JPEG", - /* ILVC */ 0x43564C49: "Intel Layered Video", - /* ILVR */ 0x52564C49: "ITU H.263+ Codec", - /* IMAC */ 0x43414D49: "Intel Hardware Motion Compensation", - /* IMC1 */ 0x31434D49: "Planar YUV Format", - /* IMC2 */ 0x32434D49: "Planar YUV Format", - /* IMC3 */ 0x33434D49: "Planar YUV Format", - /* IMC4 */ 0x34434D49: "Planar YUV Format", - /* IMJG */ 0x474A4D49: "Accom SphereOUS Motion JPEG w/Alpha-channel", - /* IPDV */ 0x56445049: "Giga AVI DV Codec", - /* IPJ2 */ 0x324A5049: "ImagePower Motion JPEG2000", - /* IPMA */ 0x414D5049: "Imagination Pilots IPMA Codec", - /* IR21 */ 0x31325249: "Intel Indeo 2.1", - /* IRAW */ 0x57415249: "Intel Packed Uncompressed YUV Format", - /* ISME */ 0x454D5349: "Intel's next-generation video codec", - /* IUYV */ 0x56595549: "Lead Technologies Packed Interlaced YUV 4:2:2 Format", - /* IV30 */ 0x30335649: "Intel Indeo Video 3", - /* IV31 */ 0x31335649: "Intel Indeo Video 3.1", - /* IV32 */ 0x32335649: "Intel Indeo Video 3.2", - /* IV33 */ 0x33335649: "Intel Indeo Video 3.3", - /* IV34 */ 0x34335649: "Intel Indeo Video 3.4", - /* IV35 */ 0x35335649: "Intel Indeo Video 3.5", - /* IV36 */ 0x36335649: "Intel Indeo Video 3.6", - /* IV37 */ 0x37335649: "Intel Indeo Video 3.7", - /* IV38 */ 0x38335649: "Intel Indeo Video 3.8", - /* IV39 */ 0x39335649: "Intel Indeo Video 3.9", - /* IV40 */ 0x30345649: "Intel Indeo Video 4.0", - /* IV41 */ 0x31345649: "Intel Indeo Video 4.1", - /* IV42 */ 0x32345649: "Intel Indeo Video 4.2", - /* IV43 */ 0x33345649: "Intel Indeo Video 4.3", - /* IV44 */ 0x34345649: "Intel Indeo Video 4.4", - /* IV45 */ 0x35345649: "Intel Indeo Video 4.5", - /* IV46 */ 0x36345649: "Intel Indeo Video 4.6", - /* IV47 */ 0x37345649: "Intel Indeo Video 4.7", - /* IV48 */ 0x38345649: "Intel Indeo Video 4.8", - /* IV49 */ 0x39345649: "Intel Indeo Video 4.9", - /* IV50 */ 0x30355649: "Intel Indeo Video 5.0", - /* IY41 */ 0x31345949: "Lead Technologies Packed, Interlaced YUV 4:1:1", - /* IYU1 */ 0x31555949: "IEEE 1394 Digital Camera 1.04 Mode 2 Packed YUV 4:1:1 Format", - /* IYU2 */ 0x32555949: "IEEE 1394 Digital Camera 1.04 Mode 0 Packed YUV 4:4:4 Format", - /* IYUV */ 0x56555949: "Planar YUV Format", - /* JBYR */ 0x5259424A: "Kensington Video Codec", - /* JFIF */ 0x4649464A: "FFMpeg Motion JPEG", - /* JPEG */ 0x4745504A: "Microsoft Still Image JPEG DIB", - /* JPGL */ 0x4C47504A: "Pegasus Lossless Motion JPEG / DIVIO JPEG Light", - /* KMVC */ 0x43564D4B: "Karl Morton's Video Codec", - /* KPCD */ 0x4443504B: "Kodak Photo CD", - /* L261 */ 0x3136324C: "Lead Technologies H.261", - /* L263 */ 0x3336324C: "Lead Technologies H.263", - /* LAGS */ 0x5347414C: "Lagarith LossLess", - /* LBYR */ 0x5259424C: "Creative WebCam Codec", - /* LCMW */ 0x574D434C: "Lead Technologies Motion CMW Codec", - /* LCW2 */ 0x3257434C: "Lead Technologies Tools MCMW 9Motion Wavelet)", - /* LEAD */ 0x4441454C: "Lead Technologies Proprietary MCMP compression", - /* LGRY */ 0x5952474C: "Lead Technologies Grayscale Image", - /* LIA1 */ 0x3141494C: "Liafail", - /* LJ11 */ 0x31314A4C: "Lead Technologies Motion JPEG 4:1:1", - /* LJ22 */ 0x32324A4C: "Lead Technologies Motion JPEG 4:2:2", - /* LJ2K */ 0x4B324A4C: "Lead Technologies Motion JPEG2000", - /* LJ44 */ 0x34344A4C: "Lead Technologies Motion JPEG 4:4:4", - /* LJPG */ 0x47504A4C: "Lead Technologies Motion JPEG Codec", - /* LMP2 */ 0x32504D4C: "Lead Technologies MPEG-2", - /* LMP4 */ 0x34504D4C: "Lead Technologies MPEG-4", - /* LOCO */ 0x4F434F4C: "LOCO Lossless Codec", - /* LSCR */ 0x5243534C: "Lead Technologies Screen Capture", - /* LSV0 */ 0x3056534C: "Infinop Inc. Video", - /* LSVC */ 0x4356534C: "Infinop Lightning Strike CBR Video Codec", - /* LSVM */ 0x4D56534C: "Vianet Lighting Strike Vmail (Streaming)", - /* LSVW */ 0x5756534C: "Infinop Lightning Strike MBR Video Codec", - /* LSVX */ 0x5856534C: "Infinop Lightning Strike MBR Video Codec", - /* LZO1 */ 0x314F5A4C: "Lempel-Ziv-Oberhumer Codec", - /* M101 */ 0x3130314D: "Matrox Uncompressed field-based YUY2", - /* M261 */ 0x3136324D: "Microsoft H.261", - /* M263 */ 0x3336324D: "Microsoft H.263", - /* M4CC */ 0x4343344D: "ESS MPEG4 Divio codec", - /* M4S2 */ 0x3253344D: "Microsoft MPEG-4 Video v1.1", - /* MC12 */ 0x3231434D: "ATI Motion Compensation Format", - /* MC24 */ 0x3432434D: "MainConcept Motion JPEG Codec", - /* MCAM */ 0x4D41434D: "ATI Motion Compensation Format", - /* MCZM */ 0x4D5A434D: "Theory MicroCosm Lossless 64-bit RGB w/Alpha-channel", - /* MDVD */ 0x4456444D: "Alex MicroDVD Video", - /* MDVF */ 0x4656444D: "Pinnacle DV / DV50 / DVHD100", - /* MHFY */ 0x5946484D: "A.M.Paredes mhuffyYUV (LossLess)", - /* MJ2C */ 0x43324A4D: "Morgan Multimedia Motion JPEG2000 w/Compression", - /* MJPA */ 0x41504A4D: "Pinnacle ReelTime Motion JPEG Hardware Codec", - /* MJPB */ 0x42504A4D: "Motion JPEG Codec", - /* MJPG */ 0x47504A4D: "Motion JPEG DIB Format", - /* MJPX */ 0x58504A4D: "Pegasus PICVideo Motion JPEG", - /* MMES */ 0x53454D4D: "Matrox MPEG-2 I-frame", - /* MMIF */ 0x46494D4D: "Matrox MPEG-2 elementary I-frame-only video stream", - /* MNVD */ 0x44564E4D: "MindBend MindVid LossLess", - /* MP2A */ 0x4132504D: "*|Media Excel MPEG-2 Audio", - /* MP2T */ 0x5432504D: "*|Media Excel MPEG-2 Transport Stream", - /* MP2V */ 0x5632504D: "*|Media Excel MPEG-2 Video", - /* MP41 */ 0x3134504D: "Microsoft MPEG-4 Windows Media Video", - /* MP42 */ 0x3234504D: "Microsoft MPEG-4 Windows Media Video", - /* MP43 */ 0x3334504D: "Microsoft MPEG-4 Windows Media Video", - /* MP4A */ 0x4134504D: "Media Excel MPEG-4 Audio", - /* MP4S */ 0x5334504D: "Microsoft MPEG-4 Windows Media 7", - /* MP4T */ 0x5434504D: "Media Excel MPEG-4 Transport Stream", - /* MP4V */ 0x5634504D: "Apple QuickTime MPEG-4 / FFmpeg MPEG-4 / Media Excel MPEG-4", - /* MPEG */ 0x4745504D: "Chromatic Research MPEG-1", - /* MPG1 */ 0x3147504D: "MPEG-1", - /* MPG2 */ 0x3247504D: "MPEG-2", - /* MPG3 */ 0x3347504D: "Microsoft MPEG-4 v3", - /* MPG4 */ 0x3447504D: "Microsoft MPEG-4 v1", - /* MPGI */ 0x4947504D: "Sigma Design MPEG-1 I-frame", - /* MPNG */ 0x474E504D: "Motion PNG Codec", - /* MRCA */ 0x4143524D: "FAST Multimedia MR Codec", - /* MRLE */ 0x454C524D: "Microsoft Run Length Encoding", - /* MSS1 */ 0x3153534D: "Microsoft Windows Media Screen v7", - /* MSS2 */ 0x3253534D: "Microsoft Windows Media Screen v9", - /* MSUC */ 0x4355534D: "MSU LossLess", - /* MSV1 */ 0x3156534D: "Microsoft Video Codec v1", - /* MSVC */ 0x4356534D: "Microsoft Video 1", - /* MSZH */ 0x485A534D: "Lossless Codec Library w/ZIP Compression", - /* MTGA */ 0x4147544D: "Motion TGA images (24, 32 bpp)", - /* MTX1 */ 0x3158544D: "Matrox Motion-JPEG codec", - /* MTX2 */ 0x3258544D: "Matrox Motion-JPEG codec", - /* MTX3 */ 0x3358544D: "Matrox Motion-JPEG codec", - /* MTX4 */ 0x3458544D: "Matrox Motion-JPEG codec", - /* MTX5 */ 0x3558544D: "Matrox Motion-JPEG codec", - /* MTX6 */ 0x3658544D: "Matrox Motion-JPEG codec", - /* MTX7 */ 0x3758544D: "Matrox Motion-JPEG codec", - /* MTX8 */ 0x3858544D: "Matrox Motion-JPEG codec", - /* MTX9 */ 0x3958544D: "Matrox Motion-JPEG codec", - /* MV12 */ 0x3231564D: "Motion Pixels Codec", - /* MVC9 */ 0x3943564D: "Nokia MVC video codec", - /* MVI1 */ 0x3149564D: "Motion Pixels MVI", - /* MVI2 */ 0x3249564D: "Motion Pixels MVI", - /* MWV1 */ 0x3156574D: "Aware Motion Wavelets", - /* MYUV */ 0x5655594D: "Media-100 844/X Uncompressed", - /* NAVI */ 0x4956414E: "nAVI Video Codec", - /* NDIG */ 0x4749444E: "Ahead Nero Digital MPEG-4 Codec", - /* NDSC */ 0x4353444E: "Nero Digital Codec", - /* NDSM */ 0x4D53444E: "Nero Digital MPEG-4", - /* NDSP */ 0x5053444E: "Unknown MPEG-4 Codec", - /* NDSS */ 0x5353444E: "Nero Digital MPEG-4", - /* NDXC */ 0x4358444E: "Nero Digital H.264", - /* NDXH */ 0x4858444E: "Nero Digital H.264", - /* NDXP */ 0x5058444E: "Nero Digital H.264", - /* NDXS */ 0x5358444E: "Nero Digital H.264", - /* NHVU */ 0x5556484E: "NVidia GEForce 3 Texture Format", - /* NI24 */ 0x3432494E: "Harmonic/Omneon Spectrum Codec", - /* NO16 */ 0x36314F4E: "Theory None16 64-bit Uncompressed RAW", - /* NT00 */ 0x3030544E: "NewTek LightWave HDTV YUV w/Alpha-channel", - /* NTN1 */ 0x314E544E: "Nogatech Video Compression 1", - /* NTN2 */ 0x324E544E: "Nogatech Video Compression 2 / GrabBee Hardware Coder", - /* NTSC */ 0x4353544E: "Radius SoftDV 16:9 NTSC", - /* NUV1 */ 0x3156554E: "NuppelVideo", - /* NV12 */ 0x3231564E: "Planar YUV Format", - /* NV21 */ 0x3132564E: "Planar YUV Format", - /* NVDS */ 0x5344564E: "NVidia Texture Format", - /* NVHS */ 0x5348564E: "NVidia GEForce 3 Texture Format", - /* NVS0 */ 0x3053564E: "nVidia Texture Compression Format", - /* NVS1 */ 0x3153564E: "nVidia Texture Compression Format", - /* NVS2 */ 0x3253564E: "nVidia Texture Compression Format", - /* NVS3 */ 0x3353564E: "nVidia Texture Compression Format", - /* NVS4 */ 0x3453564E: "nVidia Texture Compression Format", - /* NVS5 */ 0x3553564E: "nVidia Texture Compression Format", - /* NVT0 */ 0x3054564E: "nVidia Texture Compression Format", - /* NVT1 */ 0x3154564E: "nVidia Texture Compression Format", - /* NVT2 */ 0x3254564E: "nVidia Texture Compression Format", - /* NVT3 */ 0x3354564E: "nVidia Texture Compression Format", - /* NVT4 */ 0x3454564E: "nVidia Texture Compression Format", - /* NVT5 */ 0x3554564E: "nVidia Texture Compression Format", - /* NY12 */ 0x3231594E: "Nogatech YUV 12-bpp format", - /* NYUV */ 0x5655594E: "Nogatech YUV 4:2:2 format", - /* PCL2 */ 0x324C4350: "Pinnacle RL video codec", - /* PCLE */ 0x454C4350: "Pinnacle Studio 400 video codec", - /* PDVC */ 0x43564450: "Panasonic DVC Codec", - /* PGVV */ 0x56564750: "Radius Video Vision Telecast", - /* PHMO */ 0x4F4D4850: "IBM Photomotion", - /* PIM1 */ 0x314D4950: "Pinnacle DC1000 MPEG-1 w/Compression", - /* PIM2 */ 0x324D4950: "Pegasus Imaging / Pinnacle DC1000", - /* PIMJ */ 0x4A4D4950: "Pegasus Lossless Motion JPEG", - /* PIXL */ 0x4C584950: "MiroVideo XL Motion JPEG", - /* PJPG */ 0x47504A50: "Non-standard Motion JPEG", - /* PNG1 */ 0x31474E50: "Corecodec.org CorePNG Codec", - /* PVEZ */ 0x5A455650: "Horizons Technology PowerEZ Codec", - /* PVMM */ 0x4D4D5650: "PacketVideo Corporation MPEG-4", - /* PVW2 */ 0x32575650: "Pegasus Wavelet2000 w/Compression", - /* PVWV */ 0x56575650: "Pegasus Wavelet2000", - /* PXLT */ 0x544C5850: "Apple Pixlet Codec", - /* QDGX */ 0x58474451: "Apple QuickDraw GX", - /* QPEG */ 0x47455051: "Q-Team QPEG v1.1", - /* QPEQ */ 0x51455051: "Q-Team QPEG v1.1", - /* R210 */ 0x30313252: "BlackMagic YUV (QuickTime)", - /* R411 */ 0x31313452: "Radius DV NTSC YUV", - /* R420 */ 0x30323452: "Radius DV PAL YUV", - /* RAVI */ 0x49564152: "GroupTRON ReferenceAVI Codec", - /* RGB1 */ 0x31424752: "Raw RGB 3:3:2", - /* RGB2 */ 0x32424752: "Windows Bitmap Format", - /* RGBA */ 0x41424752: "Raw RGB w/Alpha-channel", - /* RGBO */ 0x4F424752: "Raw RGB 5:5:5", - /* RGBP */ 0x50424752: "Raw RGB 5:6:5", - /* RGBQ */ 0x51424752: "Raw RGB 5:5:5 Big-endian", - /* RGBR */ 0x52424752: "Raw RGB 5:6:5 Big-endian", - /* RGBT */ 0x54424752: "Raw RGB w/Transparency", - /* RIVA */ 0x41564952: "NVidia Swizzled Texture Format", - /* RLE4 */ 0x34454C52: "Run length encoded 4bpp RGB Format", - /* RLE8 */ 0x38454C52: "Run length encoded 8bpp RGB Format", - /* RLND */ 0x444E4C52: "Roland Corporation Video", - /* RMP4 */ 0x34504D52: "REALmagic MPEG-4 Video Codec", - /* ROQV */ 0x56514F52: "Id RoQ File Video Decoder", - /* RPZA */ 0x415A5052: "Apple QuickTime Video 'Road Pizza'", - /* RT21 */ 0x31325452: "Intel Real Time Video", - /* RTV0 */ 0x30565452: "NewTek VideoToaster", - /* RUD0 */ 0x30445552: "Rududu Video Codec", - /* RV10 */ 0x30315652: "RealVideo Codec", - /* RV13 */ 0x33315652: "RealVideo Codec", - /* RV20 */ 0x30325652: "RealVideo G2", - /* RV30 */ 0x30335652: "RealVideo 8", - /* RV40 */ 0x30345652: "RealVideo 9", - /* S263 */ 0x33363253: "Sorenson Vision H.263", - /* S422 */ 0x32323453: "VideoCap C210 YUV 4:2:2", - /* SAN3 */ 0x334E4153: "DivX 3.11a)", - /* SCCD */ 0x44434353: "Luminositi SoftCam Codec", - /* SDCC */ 0x43434453: "Sun Digital Camera codec", - /* SEDG */ 0x47444553: "Samsung MPEG-4 codec", - /* SFMC */ 0x434D4653: "CrystalNet Surface Fitting Method Codec", - /* SHR0 */ 0x30524853: "BitJazz SheerVideo (realtime lossless)", - /* SHR1 */ 0x31524853: "BitJazz SheerVideo (realtime lossless)", - /* SHR2 */ 0x32524853: "BitJazz SheerVideo (realtime lossless)", - /* SHR3 */ 0x33524853: "BitJazz SheerVideo (realtime lossless)", - /* SHR4 */ 0x34524853: "BitJazz SheerVideo (realtime lossless)", - /* SHR5 */ 0x35524853: "BitJazz SheerVideo (realtime lossless)", - /* SHR6 */ 0x36524853: "BitJazz SheerVideo (realtime lossless)", - /* SHR7 */ 0x37524853: "BitJazz SheerVideo (realtime lossless)", - /* SJPG */ 0x47504A53: "CUseeMe Networks Codec", - /* SL25 */ 0x35324C53: "SoftLab-NSK DVCPRO", - /* SL50 */ 0x30354C53: "SoftLab-NSK DVCPRO50", - /* SLDV */ 0x56444C53: "SoftLab-NSK Forward DV Draw Codec", - /* SLIF */ 0x46494C53: "SoftLab-NSK MPEG2 I-frames", - /* SLMJ */ 0x4A4D4C53: "SoftLab-NSK Forward Motion JPEG", - /* SMK2 */ 0x324B4D53: "RAD Game Tools Smacker Video Codec", - /* SMKA */ 0x414B4D53: "RAD Game Tools Smacker Audio Codec", - /* SMP4 */ 0x34504D53: "Samsung VP-ms15 Digicam DivX Codec", - /* SMSC */ 0x43534D53: "Radius Proprietary Codec", - /* SMSD */ 0x44534D53: "Radius Proprietary Codec", - /* SMSV */ 0x56534D53: "WorldConnect VisualMail Wavelet Video", - /* SNOW */ 0x574F4E53: "SNOW Codec", - /* SP40 */ 0x30345053: "SunPlus YUV", - /* SP44 */ 0x34345053: "SunPlus Aiptek MegaCam Codec", - /* SP53 */ 0x33355053: "SunPlus Aiptek MegaCam Codec", - /* SP54 */ 0x34355053: "SunPlus Aiptek MegaCam Codec", - /* SP55 */ 0x35355053: "SunPlus Aiptek MegaCam Codec", - /* SP56 */ 0x36355053: "SunPlus Aiptek MegaCam Codec", - /* SP57 */ 0x37355053: "SunPlus Aiptek MegaCam Codec", - /* SP58 */ 0x38355053: "SunPlus Aiptek MegaCam Codec", - /* SPIG */ 0x47495053: "Radius Spigot", - /* SPLC */ 0x434C5053: "Splash Studios ACM Audio Codec", - /* SPRK */ 0x4B525053: "Sorenson Spark", - /* SQZ2 */ 0x325A5153: "Microsoft VXtreme Video Codec v2", - /* STVA */ 0x41565453: "ST CMOS Imager Data (Bayer)", - /* STVB */ 0x42565453: "ST CMOS Imager Data (Nudged Bayer)", - /* STVC */ 0x43565453: "ST CMOS Imager Data (Bunched)", - /* STVX */ 0x58565453: "ST CMOS Imager Data (Extended)", - /* STVY */ 0x59565453: "ST CMOS Imager Data (Extended w/Correction Data)", - /* SV10 */ 0x30315653: "Sorenson Media Video R1", - /* SV3M */ 0x4D335653: "Sorenson SV3 Module Decoder", - /* SVQ1 */ 0x31515653: "Sorenson Video", - /* SVQ3 */ 0x33515653: "Sorenson Video 3", - /* SWC1 */ 0x31435753: "MainConcept Motion JPEG Codec", - /* T420 */ 0x30323454: "Toshiba YUV 4:2:0", - /* THEO */ 0x4F454854: "FFVFW Supported Codec", - /* TIFF */ 0x46464954: "Apple TIFF w/Alpha-channel", - /* TIM2 */ 0x324D4954: "Pinnacle RAL DVI", - /* TLMS */ 0x534D4C54: "TeraLogic Motion Infraframe Codec A", - /* TLST */ 0x54534C54: "TeraLogic Motion Infraframe Codec B", - /* TM20 */ 0x30324D54: "Duck TrueMotion 2.0", - /* TM2A */ 0x41324D54: "Duck TrueMotion Archiver 2.0", - /* TM2X */ 0x58324D54: "Duck TrueMotion 2X", - /* TMIC */ 0x43494D54: "TeraLogic Motion Intraframe Codec 2", - /* TMOT */ 0x544F4D54: "Horizons Technology TrueMotion Video Compression", - /* TR20 */ 0x30325254: "Duck TrueMotion RT 2.0", - /* TRLE */ 0x454C5254: "Akula Alpha Pro Custom AVI (LossLess)", - /* TRON */ 0x4E4F5254: "GroupTRON ReferenceAVI Codec", - /* TSCC */ 0x43435354: "TechSmith Screen Capture Codec", - /* TV10 */ 0x30315654: "Tecomac Low-Bit Rate Codec", - /* TVJP */ 0x504A5654: "TrueVision Field Encoded Motion JPEG", - /* TVMJ */ 0x4A4D5654: "Truevision Targa Motion JPEG Hardware Codec", - /* TY0N */ 0x4E305954: "Tecomac Low-Bit Rate Codec", - /* TY2C */ 0x43325954: "Trident Decompression Driver", - /* TY2N */ 0x4E325954: "Trident Decompression Driver", - /* U263 */ 0x33363255: "UB Video StreamForce H.263", - /* UCOD */ 0x444F4355: "eMajix ClearVideo", - /* ULTI */ 0x49544C55: "IBM Ultimotion", - /* UMP4 */ 0x34504D55: "UB Video MPEG-4", - /* UYNV */ 0x564E5955: "NVidia Packed YUV 4:2:2 Format", - /* UYVP */ 0x50565955: "Packed YCbCr 4:2:2 Format", - /* UYVU */ 0x55565955: "SoftLab-NSK Forward YUV codec", - /* UYVY */ 0x59565955: "Packed YUV 4:2:2 Format", - /* V210 */ 0x30313256: "Packed YCrCb 4:2:2 Format", - /* V261 */ 0x31363256: "Lucent VX2000S Video Codec", - /* V422 */ 0x32323456: "Packed YUV 4:2:2 Format", - /* V655 */ 0x35353656: "Packed YUV 4:2:2 Format", - /* VBLE */ 0x454C4256: "MarcFD VBLE Lossless Codec", - /* VCR1 */ 0x31524356: "ATI VCR 1.0", - /* VCR2 */ 0x32524356: "ATI VCR 2.0", - /* VCR3 */ 0x33524356: "ATI VCR 3.0", - /* VCR4 */ 0x34524356: "ATI VCR 4.0", - /* VCR5 */ 0x35524356: "ATI VCR 5.0", - /* VCR6 */ 0x36524356: "ATI VCR 6.0", - /* VCR7 */ 0x37524356: "ATI VCR 7.0", - /* VCR8 */ 0x38524356: "ATI VCR 8.0", - /* VCR9 */ 0x39524356: "ATI VCR 9.0", - /* VCWV */ 0x56574356: "VideoCon wavelet", - /* VDCT */ 0x54434456: "VITEC Multimedia Video Maker Pro DIB", - /* VDOM */ 0x4D4F4456: "VDOnet VDOWave", - /* VDOW */ 0x574F4456: "VDOnet VDOLive H.263", - /* VDST */ 0x54534456: "VirtualDub Remote Frameclient ICM Driver", - /* VDTZ */ 0x5A544456: "Darim Vision VideoTizer YUV", - /* VGPX */ 0x58504756: "Alaris VideoGramPix Codec", - /* VIDM */ 0x4D444956: "DivX 5.0 Pro Supported Codec", - /* VIDS */ 0x53444956: "Vitec Multimedia YUV 4:2:2 Codec", - /* VIFP */ 0x50464956: "Virtual Frame API Codec", - /* VIV1 */ 0x31564956: "Vivo H.263", - /* VIV2 */ 0x32564956: "Vivo H.263", - /* VIVO */ 0x4F564956: "Vivo H.263", - /* VIXL */ 0x4C584956: "Miro MiroVideo XL Motion JPEG", - /* VJPG */ 0x47504A56: "Video Communication Systems", - /* VLV1 */ 0x31564C56: "VideoLogic Captivator Codec", - /* VP30 */ 0x30335056: "On2 VP3", - /* VP31 */ 0x31335056: "On2 VP3", - /* VP40 */ 0x30345056: "On2 TrueCast VP4", - /* VP50 */ 0x30355056: "On2 TrueCast VP5", - /* VP60 */ 0x30365056: "On2 TrueCast VP6", - /* VP61 */ 0x31365056: "On2 TrueCast VP6.1", - /* VP62 */ 0x32365056: "On2 TrueCast VP6.2", - /* VP70 */ 0x30375056: "On2 TrueMotion VP7", - /* VP80 */ 0x30385056: "On2 VP8", - /* VQC1 */ 0x31435156: "ViewQuest Codec 1", - /* VQC2 */ 0x32435156: "ViewQuest Codec 2", - /* VQJP */ 0x504A5156: "ViewQuest VQ630 Dual-Mode Digital Camera", - /* VQS4 */ 0x34535156: "ViewQuest VQ110 Digital Video Camera", - /* VR21 */ 0x31325256: "BlackMagic YUV", - /* VSSH */ 0x48535356: "Vanguard VSS H.264", - /* VSSV */ 0x56535356: "Vanguard VSS Codec Light", - /* VSSW */ 0x57535356: "VSS Wavelet Video Codec|Vanguard VSS H.264", - /* VTLP */ 0x504C5456: "Alaris VideoGramPixel Codec", - /* VX1K */ 0x4B315856: "Lucent VX1000S Video Codec", - /* VX2K */ 0x4B325856: "Lucent VX2000S Video Codec", - /* VXSP */ 0x50535856: "Lucent VX1000SP Video Codec", - /* VYU9 */ 0x39555956: "Planar YUV Format: 8-but Y plane followed by 8-bit 4x4 subsampled V and U planes", - /* VYUY */ 0x59555956: "ATI Packed YUV Format", - /* WBVC */ 0x43564257: "Winbond W9960 Codec", - /* WHAM */ 0x4D414857: "Microsoft Video 1", - /* WINX */ 0x584E4957: "Winnov Software Compression", - /* WJPG */ 0x47504A57: "Winbond Motion JPEG", - /* WMV1 */ 0x31564D57: "Microsoft Windows Media Video v7", - /* WMV2 */ 0x32564D57: "Microsoft Windows Media Video v8", - /* WMV3 */ 0x33564D57: "Microsoft Windows Media Video v9", - /* WMVA */ 0x41564D57: "Microsoft Windows Media Video v9 Advanced Profile", - /* WMVP */ 0x50564D57: "Microsoft Windows Media Video v9.1 Image", - /* WNIX */ 0x58494E57: "WniWni Codec", - /* WNV1 */ 0x31564E57: "Winnov Videum Hardware Compression", - /* WPY2 */ 0x32595057: "Winnov Video", - /* WRLE */ 0x454C5257: "Apple QuickTime BMP Codec", - /* WRPR */ 0x52505257: "VideoTools VideoServer Client Codec", - /* WVC1 */ 0x31435657: "Microsoft SMPTE VC1 Codec", - /* WVLT */ 0x544C5657: "IllusionHope Wavelet 9/7", - /* WZCD */ 0x44435A57: "CORE Co. Ltd. iScan", - /* WZDC */ 0x43445A57: "CORE Co. Ltd. iSnap", - /* X263 */ 0x33363258: "Xirlink H.263", - /* X264 */ 0x34363258: "XiWave GNU GPL H.264 Codec", - /* XJPG */ 0x47504A58: "Xirlink JPEG-like compressor", - /* XLV0 */ 0x30564C58: "NetXL XL Video Decoder", - /* XMPG */ 0x47504D58: "XING Editable MPEG", - /* XVID */ 0x44495658: "XviD MPEG-4 Codec", - /* XWV0 */ 0x30565758: "XiWave Video Codec", - /* XWV1 */ 0x31565758: "XiWave Video Codec", - /* XWV2 */ 0x32565758: "XiWave Video Codec", - /* XWV3 */ 0x33565758: "XiWave Xi-3 Video Codec", - /* XWV4 */ 0x34565758: "XiWave Video Codec", - /* XWV5 */ 0x35565758: "XiWave Video Codec", - /* XWV6 */ 0x36565758: "XiWave Video Codec", - /* XWV7 */ 0x37565758: "XiWave Video Codec", - /* XWV8 */ 0x38565758: "XiWave Video Codec", - /* XWV9 */ 0x39565758: "XiWave Video Codec", - /* XXAN */ 0x4E415858: "Origin Video Codec", - /* XYZP */ 0x505A5958: "Extended PAL Format XYZ Palette", - /* Y16 */ 0x58313620: "Packed YUV Greyscale Format", - /* Y211 */ 0x31313259: "Packed YUV Format", - /* Y216 */ 0x36313259: "Pinnacle TARGA CineWave YUV", - /* Y411 */ 0x31313459: "Packed YUV 4:1:1 Format", - /* Y41B */ 0x42313459: "Weitek Planar YUV 4:1:1 Format", - /* Y41P */ 0x50313459: "Packed YUV 4:1:1 Format", - /* Y41T */ 0x54313459: "Packed YUV 4:1:1 Format w/Transparency", - /* Y422 */ 0x32323459: "Packed YUV 4:2:2 Format", - /* Y42B */ 0x42323459: "Weitek Planar YUV 4:2:2 Format", - /* Y42T */ 0x54323459: "Packed YUV 4:2:2 Format w/Transparency", - /* Y444 */ 0x34343459: "IEEE 1394 24-bit YUV 4:4:4", - /* Y8 */ 0x59382020: "Packed/Planar YUV Monochrome Format", - /* Y800 */ 0x30303859: "Packed/Planar YUV Monochrome Format", - /* YC12 */ 0x32314359: "Intel YUV12 Codec", - /* YCCK */ 0x4B434359: "Uncompressed YCbCr Video w/Key Data", - /* YMPG */ 0x47504D59: "YMPEG Alpha", - /* YU12 */ 0x32315559: "ATI YV12 4:2:0 Planar", - /* YU92 */ 0x32395559: "Intel YUV Video", - /* YUNV */ 0x564E5559: "NVidia Packed YUV 4:2:2 Format", - /* YUV2 */ 0x32565559: "Packed YUV 4:2:2 Format", - /* YUV8 */ 0x38565559: "Winnov Caviar YUV8 Video", - /* YUV9 */ 0x39565559: "Intel Planar YUV Format", - /* YUVP */ 0x50565559: "Packed YCbCr 4:2:2 Extended Precision Format", - /* YUY2 */ 0x32595559: "Packed YUV 4:2:2 Format", - /* YUYP */ 0x50595559: "Evans & Sutherland YCbCr 4:2:2 Extended Precision Format", - /* YUYV */ 0x56595559: "Packed YUV 4:2:2 Format", - /* YV12 */ 0x32315659: "Planar YUV Format", - /* YV16 */ 0x36315659: "Planar YUV Format", - /* YV92 */ 0x32395659: "Intel Smart Video Recorder", - /* YVU9 */ 0x39555659: "Intel Planar YUV Format", - /* YVYU */ 0x55595659: "Packed YUV 4:2:2 Format", - /* ZLIB */ 0x42494C5A: "Lossless Codec Library w/zlib Compression", - /* ZMBV */ 0x56424D5A: "DoxBox Capture Codec", - /* ZPEG */ 0x4745505A: "Metheus Video Zipper", - /* ZPG4 */ 0x3447505A: "VoDeo Solutions Video", - /* ZYGO */ 0x4F47595A: "ZyGo Video Codec", - /* raw2 */ 0x32776173: "Raw, Uncompressed RGB Bitmap" - }; + public static readonly FOURCC_CODES: Map = new Map( + [ + /* BI_RGB */ [0x00000000, "Windows Bitmap Format"], + /* BI_RLE8 */ [0x00000001, "Run length encoded 8bpp RGB Format"], + /* BI_RLE4 */ [0x00000002, "Run length encoded 4bpp RGB Format"], + /* BI_BITFIELDS */ [0x00000003, "Raw RGB Format using Bitmasks"], + /* 1978 */ [0x31393738, "A.M.Paredes predictor (LossLess)"], + /* 26LT */ [0x32364C54, "Discreet UC YUV 4:2:2:4 10-bit"], + /* 28DV */ [0x32384456, "Apple QuickTime DV (DVCPRO NTSC)"], + /* 28SM */ [0x3238534D, "Apple Graphics (SMC) codec (256 color)"], + /* 3IV0 */ [0x33495630, "MPEG4-based codec 3ivx"], + /* 3IV1 */ [0x33495631, "MPEG4-based codec 3ivx"], + /* 3IV2 */ [0x33495632, "MPEG4-based codec 3ivx"], + /* 3IVD */ [0x33495644, "Microsoft MPEG-4 v3 / Doctored 3ivx DivX"], + /* 3IVX */ [0x33495658, "MPEG4-based codec 3ivx"], + /* 8BPS */ [0x38425053, "Apple QuickTime Planar RGB w/Alpha-channel"], + /* AAS4 */ [0x41415334, "Autodesk Animator codec (RLE)"], + /* AASC */ [0x41415343, "Autodesk Animator codec"], + /* ABVB */ [0x41425642, "Avid ABVB / NuVista MJPEG w/Alpha-channel"], + /* ABYR */ [0x41425952, "Kensington codec (low resolution, low frame rate (6fps) codec)"], + /* ACTL */ [0x4143544C, "Streambox ACT-L2"], + /* ADV1 */ [0x41445631, "Loronix WaveCodec"], + /* ADVJ */ [0x4144564A, "Avid M-JPEG (aka AVRn)"], + /* AEIK */ [0x4145494B, "Intel Indeo Video 3.2 (Vector Quantization)"], + /* AEMI */ [0x41454D49, "Array VideoONE MPEG1-I capture"], + /* AFLC */ [0x41464C43, "Autodesk Animator FLC (256 color)"], + /* AFLI */ [0x41464C49, "Autodesk Animator FLI (256 color)"], + /* AHDV */ [0x41484456, "CineForm 10-bit Visually Perfect HD (Wavelet)"], + /* AJPG */ [0x414A5047, "22fps JPEG-based codec"], + /* ALAC */ [0x414C4143, "Apple lossless audio"], + /* ALPH */ [0x414C5048, "Ziracom Video"], + /* AMPG */ [0x414D5047, "Array VideoONE MPEG w/Compression"], + /* ANIM */ [0x414E494D, "Intel RDX"], + /* AP41 */ [0x41503431, "AngelPotion Definitive / Hacked Microsoft MPEG-4 v3"], + /* AP42 */ [0x41503432, "AngelPotion Definitive / Hacked Microsoft MPEG-4 v3"], + /* ASLC */ [0x41534C43, "AlparySoft Lossless Codec"], + /* ASV1 */ [0x41535631, "Asus Video V1"], + /* ASV2 */ [0x41535632, "Asus Video V2"], + /* ASVX */ [0x41535658, "Asus Video 2.0"], + /* ATM4 */ [0x41544D34, "Ahead Nero Digital MPEG-4 Codec"], + /* AUR2 */ [0x41555232, "AuraVision Aura 2"], + /* AURA */ [0x41555241, "AuraVision Aura 1"], + /* AUVX */ [0x41555658, "USH AUVX video codec"], + /* AV1X */ [0x41563158, "Avid 1:1x (QuickTime)"], + /* AVC1 */ [0x41564331, "H.264/MPEG-4 AVC"], + /* AVD1 */ [0x31445641, "Avid DV (QuickTime)"], + /* AVDJ */ [0x4A445641, "Avid Meridien JFIF w/Alpha-channel"], + /* AVDN */ [0x4E445641, "Avid DNxHD (QuickTime)"], + /* AVDV */ [0x56445641, "Avid DV"], + /* AVI1 */ [0x31495641, "MainConcept Motion JPEG Codec"], + /* AVI2 */ [0x32495641, "MainConcept Motion JPEG Codec"], + /* AVID */ [0x44495641, "Avid Motion JPEG"], + /* AVIS */ [0x53495641, "Alias for AviSynth"], + /* AVMP */ [0x504D5641, "Avid IMX (QuickTime)"], + /* AVRN */ [0x4E525641, "Avid Motion JPEG"], + /* AVUI */ [0x49555641, "Avid Meridien Uncompressed w/Alpha-channel"], + /* AVUP */ [0x50555641, "Avid 10-bit Packed (QuickTime)"], + /* AYUV */ [0x56555941, "Packed YUV 4:4:4 Format"], + /* AZPR */ [0x52505A41, "Apple QuickTime Video"], + /* AZRP */ [0x50525A41, "Apple QuickTime Video"], + /* BA81 */ [0x31384142, "Raw Bayer Format"], + /* BHIV */ [0x56494842, "BeHere iVideo"], + /* BINK */ [0x4B4E4942, "Bink Video (RAD Game Tools)"], + /* BITM */ [0x4D544942, "Microsoft H.261"], + /* BLOX */ [0x584F4C42, "Jan Jezabek BLOX MPEG Codec"], + /* BLZ0 */ [0x305A4C42, "Blizzard Decoder Filter DivX"], + /* BMV1 */ [0x31564D42, "MicroFirst Bitmap Video"], + /* BT20 */ [0x30325442, "Conexant/Brooktree Prosumer MediaStream"], + /* BTCV */ [0x56435442, "Conexant/Brooktree Composite Video"], + /* BTVC */ [0x43565442, "Conexant Composite Video"], + /* BW00 */ [0x30305742, "BergWave (Wavelet)"], + /* BW10 */ [0x30315742, "Broadway MPEG Capture w/Compression"], + /* BXBG */ [0x47425842, "BOXX BGR"], + /* BXRG */ [0x47525842, "BOXX RGB"], + /* BXY2 */ [0x32595842, "BOXX 10-bit YUV"], + /* BXYV */ [0x56595842, "BOXX YUV"], + /* BYR1 */ [0x31525942, "Raw Bayer Format"], + /* BYR2 */ [0x32525942, "Raw Bayer Format"], + /* CC12 */ [0x32314343, "Intel YUV12 / AuraVision Aura 2"], + /* CDV5 */ [0x35564443, "Canopus SD50 / DVHD"], + /* CDVC */ [0x43564443, "Canopus DV Codec"], + /* CDVH */ [0x48564443, "Canopus SD50 / DVHD"], + /* CFCC */ [0x43434643, "DPS Perception Motion JPEG"], + /* CFHD */ [0x44484643, "CineForm 10-bit Visually Perfect HD (Wavelet)"], + /* CGDI */ [0x49444743, "Microsoft Office 97 Camcorder Video"], + /* CHAM */ [0x4D414843, "Winnov Caviara Champagne"], + /* CJPG */ [0x47504A43, "Creative Video Blaster Webcam Go JPEG"], + /* CLJR */ [0x524A4C43, "Cirrus Logic Packed YUV 4:1:1 Format"], + /* CLLC */ [0x434C4C43, "Canopus LossLess"], + /* CLPL */ [0x4C504C43, "Planer YUV Format"], + /* CM10 */ [0x30314D43, "CyberLink MediaShow 1.0"], + /* CMYK */ [0x4B594D43, "Common Data Format in Printing"], + /* COL0 */ [0x304C4F43, "Microsoft MPEG-4 v3"], + /* COL1 */ [0x314C4F43, "Microsoft MPEG-4 v3"], + /* CPLA */ [0x414C5043, "Weitek 4:2:0 YUV planar"], + /* CRAM */ [0x4D415243, "Microsoft Video 1"], + /* CSCD */ [0x44435343, "CamStudio Lossless Codec"], + /* CT10 */ [0x30315443, "CyberLink TalkingShow 1.0"], + /* CTRX */ [0x58525443, "Citrix Scalable Video Codec"], + /* CUVC */ [0x43565543, "Canopus HQ"], + /* CVID */ [0x44495643, "Cinepak by SuperMac"], + /* CWLT */ [0x544C5743, "Microsoft Color WLT DIB"], + /* CXY1 */ [0x31595843, "Conexant Planer YUV 4:1:1 Format"], + /* CXY2 */ [0x32595843, "Conexant Planar YUV 4:2:2 Format"], + /* CYUV */ [0x56555943, "Creative Labs Packed YUV 4:2:2 Format"], + /* CYUY */ [0x59555943, "ATI YUV"], + /* D261 */ [0x31363244, "DEC H.261, 24-bit"], + /* D263 */ [0x33363244, "DEC H.263, 24-bit"], + /* DAVC */ [0x43564144, "Dicas MPEGable H.264 / MPEG-4 AVC"], + /* DC25 */ [0x35324344, "MainConcept ProDV Codec"], + /* DCAP */ [0x50414344, "Pinnacle DV25 Codec"], + /* DCL1 */ [0x314C4344, "Data Connection Conferencing Codec"], + /* DCL2 */ [0x324C4344, "Data Connection Conferencing Codec"], + /* DCL3 */ [0x334C4344, "Data Connection Conferencing Codec"], + /* DCL4 */ [0x344C4344, "Data Connection Conferencing Codec"], + /* DCL5 */ [0x354C4344, "Data Connection Conferencing Codec"], + /* DCT0 */ [0x30544344, "WniWni Codec"], + /* DFSC */ [0x43534644, "DebugMode FrameServer VFW Codec"], + /* DIV1 */ [0x31564944, "FFmpeg OpenDivX"], + /* DIV2 */ [0x32564944, "Microsoft MPEG-4 v2"], + /* DIV3 */ [0x33564944, "DivX 3 Low-Motion"], + /* DIV4 */ [0x34564944, "DivX 3 Fast-Motion"], + /* DIV5 */ [0x35564944, "DivX 5.0"], + /* DIV6 */ [0x36564944, "DivX MPEG-4 / Microsoft MPEG-4 v3"], + /* DIVX */ [0x58564944, "DivX 4.0+ / OpenDivX"], + /* DJPG */ [0x47504A44, "Broadway 101 Motion JPEG codec"], + /* DM4V */ [0x56344D44, "Dicas MPEGable MPEG-4"], + /* DMB1 */ [0x31424D44, "Matrox Rainbow Runner Motion JPEG w/hardware compression"], + /* DMB2 */ [0x32424D44, "Paradigm Motion JPEG"], + /* DMK2 */ [0x324B4D44, "ViewSonic V36 PDA Video"], + /* DP02 */ [0x32305044, "DynaPel MPEG-4"], + /* DP16 */ [0x36315044, "YUV411 w/DPCM 6-bit compression"], + /* DP18 */ [0x38315044, "YUV411 w/DPCM 8-bit compression"], + /* DP26 */ [0x36325044, "YUV422 w/DPCM 6-bit compression"], + /* DP28 */ [0x38325044, "YUV422 w/DPCM 8-bit compression"], + /* DP96 */ [0x36395044, "YVU9 w/DPCM 6-bit compression"], + /* DP98 */ [0x38395044, "YVU9 w/DPCM 8-bit compression"], + /* DP9L */ [0x4C395044, "YVU9 w/DPCM 6-bit compression and thinned-out"], + /* DPS0 */ [0x30535044, "DPS Reality Motion JPEG"], + /* DPSC */ [0x43535044, "DPS PAR Motion JPEG"], + /* DRWX */ [0x58575244, "Pinnacle DV25 Codec"], + /* DSVD */ [0x44565344, "Microsoft DirectShow DV"], + /* DTMT */ [0x544D5444, "Media-100 Codec"], + /* DTNT */ [0x544E5444, "Media-100 Codec"], + /* DUCK */ [0x4B435544, "Duck TrueMotion S"], + /* DV10 */ [0x30315644, "BlueFish444 Lossless RGBA, YUV 10-bit"], + /* DV25 */ [0x35325644, "Matrox DVCPRO codec"], + /* DV50 */ [0x30355644, "Matrox DVCPRO50 codec"], + /* DVAN */ [0x4E415644, "Pinnacle miroVideo DV300 SW-only codec"], + /* DVCP */ [0x50435644, "Apple QuickTime DV (DVCPRO PAL)"], + /* DVCS */ [0x53435644, "MainConcept DV Codec"], + /* DVE2 */ [0x32455644, "Insoft DVE-2 Videoconferencing Codec"], + /* DVH1 */ [0x31485644, "Pinnacle DVHD100"], + /* DVHD */ [0x44485644, "DV 1125 lines at 30.00 Hz or 1250 lines at 25.00 Hz"], + /* DVIS */ [0x53495644, "VSYNC DualMoon Iris DV codec"], + /* DVLP */ [0x504C5644, "Radius SoftDV 16:9 PAL"], + /* DVMA */ [0x414D5644, "Darim Vision DVMPEG"], + /* DVNM */ [0x4D4E5644, "Matsushita/Panasonic Video"], + /* DVOR */ [0x524F5644, "BlueFish444 Lossless RGBA, YUC 10-bit"], + /* DVPN */ [0x4E505644, "Apple QuickTime DV NTSC"], + /* DVPP */ [0x50505644, "Apple QuickTime DV PAL"], + /* DVR1 */ [0x31525644, "TARGA2000 Codec"], + /* DVRS */ [0x53525644, "VSYNC DualMoon Iris DV codec"], + /* DVSD */ [0x44535644, "DV 525 lines at 29.97 Hz or 625 lines at 25.00 Hz"], + /* DVSL */ [0x4C535644, "DV compressed in SD"], + /* DVX1 */ [0x31585644, "Lucent DVX1000SP Video Decoder"], + /* DVX2 */ [0x32585644, "Lucent DVX2000S Video Decoder"], + /* DVX3 */ [0x33585644, "Lucent DVX3000S Video Decoder"], + /* DX50 */ [0x30355844, "DivX 5.0"], + /* DXGM */ [0x4D475844, "EA Game Video Codec / Lord of the Rings Game Movies"], + /* DXSB */ [0x42535844, "DivX Subtitles Codec"], + /* DXT1 */ [0x31545844, "DirectX Compressed Texture w/1-bit alpha-channel)"], + /* DXT2 */ [0x32545844, "DirectX Compressed Texture"], + /* DXT3 */ [0x33545844, "DirectX Compressed Texture w/4-bit alpha-channel)"], + /* DXT4 */ [0x34545844, "DirectX Compressed Texture"], + /* DXT5 */ [0x35545844, "DirectX Compressed Texture w/3-bit alpha channel and interpolation)"], + /* DXTC */ [0x43545844, "DirectX Texture Compression"], + /* DXTN */ [0x4E545844, "DirectX Compressed Texture (DXTn)"], + /* EKQ0 */ [0x30514B45, "Elsa Graphics Card Quick Codec"], + /* ELK0 */ [0x304B4C45, "Elsa Graphics Card Codec"], + /* EM2V */ [0x56324D45, "Etymonix MPEG-2 I-frame"], + /* EMWC */ [0x43574D45, "EverAd Marquee WMA codec"], + /* EQK0 */ [0x304B5145, "Elsa graphics card quick codec"], + /* ES07 */ [0x37305345, "Eyestream 7 Codec"], + /* ESCP */ [0x50435345, "*|Escape|Eidos Technologies Escape codec"], + /* ETV1 */ [0x31565445, "eTreppid Video Codec"], + /* ETV2 */ [0x32565445, "eTreppid Video Codec"], + /* ETVC */ [0x43565445, "eTreppid Video Codec"], + /* FFDS */ [0x53444646, "FFDShow supported"], + /* FFV1 */ [0x31564646, "FFDShow Lossless video Codec"], + /* FFVH */ [0x48564646, "FFDShow FFVH Codec"], + /* FLIC */ [0x43494C46, "Autodesk FLI / FLC Animation|Autodesk FLI/FLC Animation"], + /* FLJP */ [0x504A4C46, "D-Vision Field Encoded Motion JPEG w/LSI"], + /* FLV1 */ [0x31564C46, "FFDShow FLV1 codec"], + /* FMJP */ [0x504A4D46, "D-Vision field-based ISO MJPEG"], + /* FMP4 */ [0x34504D46, "FFMpeg MPEG-4"], + /* FMVC */ [0x43564D46, "Fox Magic Software Screen Capture Codec"], + /* FPS1 */ [0x31535046, "Fraps Codec"], + /* FRLE */ [0x454C5246, "SoftLab-NSK Y16 + Alpha RLE"], + /* FRWA */ [0x41575246, "SoftLab-NSK Vision Forward Motion JPEG w/alpha-channel"], + /* FRWD */ [0x44575246, "SoftLab-NSK Vision Forward Motion JPEG"], + /* FRWT */ [0x54575246, "SoftLab-NSK Vision Forward Motion JPEG w/alpha-channel"], + /* FRWU */ [0x55575246, "SoftLab-NSK Vision Forward Uncompressed"], + /* FVF1 */ [0x31465646, "Iterated Systems Fractal Video Frame"], + /* FVFW */ [0x57465646, "XviD-based FFMpeg MPEG-4 codec"], + /* FXT1 */ [0x31545846, "3dfx Video"], + /* GEOX */ [0x584F4547, "GEOMEPG4"], + /* GEPJ */ [0x4A504547, "White Pine/Paradigm Matrix Motion JPEG Codec"], + /* GJPG */ [0x47504A47, "Grand Tech GT891x Codec"], + /* GLCC */ [0x43434C47, "GigaLink AV Capture codec"], + /* GLZW */ [0x575A4C47, "Motion LZW"], + /* GPEG */ [0x47455047, "Motion JPEG w/Floating Point"], + /* GPJM */ [0x4D4A5047, "Pinnacle ReelTime Motion JPEG Codec"], + /* GREY */ [0x59455247, "Packed YUV Monochrome Format"], + /* GWLT */ [0x544C5747, "Microsoft Greyscale WLT DIB"], + /* H260 */ [0x30363248, "Intel ITU H.260"], + /* H261 */ [0x31363248, "Intel ITU H.261"], + /* H262 */ [0x32363248, "Intel ITU H.262"], + /* H263 */ [0x33363248, "Intel ITU H.263"], + /* H264 */ [0x34363248, "Intel ITU H.264"], + /* H265 */ [0x35363248, "Intel ITU H.265"], + /* H266 */ [0x36363248, "Intel ITU H.266"], + /* H267 */ [0x37363248, "Intel ITU H.267"], + /* H268 */ [0x38363248, "Intel ITU H.268"], + /* H269 */ [0x39363248, "Intel ITU H.263 for POTS-based videoconferencing"], + /* HD10 */ [0x30314448, "BlueFish444 Lossless RGBA, YUC 10-bit"], + /* HDX4 */ [0x34584448, "Jomigo HDX4"], + /* HDYC */ [0x43594448, "Packed YUV 4:2:2 Format"], + /* HEVC */ [0x43564548, "H.265/HEVC"], + /* HFYU */ [0x55594648, "Huffman Lossless Codec"], + /* HMCR */ [0x52434D48, "Rendition Motion Compensation Format"], + /* HMRR */ [0x52524D48, "Rendition Motion Compensation Format"], + /* I263 */ [0x33363249, "Intel ITU H.263"], + /* I420 */ [0x30323449, "Planar YUV Format"], + /* ICLB */ [0x424C4349, "InSoft CellB Videoconferencing Codec"], + /* IDM0 */ [0x304D4449, "IDM Motion Wavelets 2.0"], + /* IF09 */ [0x39304649, "Planar YUV Format"], + /* IGOR */ [0x524F4749, "CyberLink PowerDVD"], + /* IJLV */ [0x564C4A49, "Intel JPEG Library Video Codec"], + /* IJPG */ [0x47504A49, "Intergraph JPEG"], + /* ILVC */ [0x43564C49, "Intel Layered Video"], + /* ILVR */ [0x52564C49, "ITU H.263+ Codec"], + /* IMAC */ [0x43414D49, "Intel Hardware Motion Compensation"], + /* IMC1 */ [0x31434D49, "Planar YUV Format"], + /* IMC2 */ [0x32434D49, "Planar YUV Format"], + /* IMC3 */ [0x33434D49, "Planar YUV Format"], + /* IMC4 */ [0x34434D49, "Planar YUV Format"], + /* IMJG */ [0x474A4D49, "Accom SphereOUS Motion JPEG w/Alpha-channel"], + /* IPDV */ [0x56445049, "Giga AVI DV Codec"], + /* IPJ2 */ [0x324A5049, "ImagePower Motion JPEG2000"], + /* IPMA */ [0x414D5049, "Imagination Pilots IPMA Codec"], + /* IR21 */ [0x31325249, "Intel Indeo 2.1"], + /* IRAW */ [0x57415249, "Intel Packed Uncompressed YUV Format"], + /* ISME */ [0x454D5349, "Intel's next-generation video codec"], + /* IUYV */ [0x56595549, "Lead Technologies Packed Interlaced YUV 4:2:2 Format"], + /* IV30 */ [0x30335649, "Intel Indeo Video 3"], + /* IV31 */ [0x31335649, "Intel Indeo Video 3.1"], + /* IV32 */ [0x32335649, "Intel Indeo Video 3.2"], + /* IV33 */ [0x33335649, "Intel Indeo Video 3.3"], + /* IV34 */ [0x34335649, "Intel Indeo Video 3.4"], + /* IV35 */ [0x35335649, "Intel Indeo Video 3.5"], + /* IV36 */ [0x36335649, "Intel Indeo Video 3.6"], + /* IV37 */ [0x37335649, "Intel Indeo Video 3.7"], + /* IV38 */ [0x38335649, "Intel Indeo Video 3.8"], + /* IV39 */ [0x39335649, "Intel Indeo Video 3.9"], + /* IV40 */ [0x30345649, "Intel Indeo Video 4.0"], + /* IV41 */ [0x31345649, "Intel Indeo Video 4.1"], + /* IV42 */ [0x32345649, "Intel Indeo Video 4.2"], + /* IV43 */ [0x33345649, "Intel Indeo Video 4.3"], + /* IV44 */ [0x34345649, "Intel Indeo Video 4.4"], + /* IV45 */ [0x35345649, "Intel Indeo Video 4.5"], + /* IV46 */ [0x36345649, "Intel Indeo Video 4.6"], + /* IV47 */ [0x37345649, "Intel Indeo Video 4.7"], + /* IV48 */ [0x38345649, "Intel Indeo Video 4.8"], + /* IV49 */ [0x39345649, "Intel Indeo Video 4.9"], + /* IV50 */ [0x30355649, "Intel Indeo Video 5.0"], + /* IY41 */ [0x31345949, "Lead Technologies Packed, Interlaced YUV 4:1:1"], + /* IYU1 */ [0x31555949, "IEEE 1394 Digital Camera 1.04 Mode 2 Packed YUV 4:1:1 Format"], + /* IYU2 */ [0x32555949, "IEEE 1394 Digital Camera 1.04 Mode 0 Packed YUV 4:4:4 Format"], + /* IYUV */ [0x56555949, "Planar YUV Format"], + /* JBYR */ [0x5259424A, "Kensington Video Codec"], + /* JFIF */ [0x4649464A, "FFMpeg Motion JPEG"], + /* JPEG */ [0x4745504A, "Microsoft Still Image JPEG DIB"], + /* JPGL */ [0x4C47504A, "Pegasus Lossless Motion JPEG / DIVIO JPEG Light"], + /* KMVC */ [0x43564D4B, "Karl Morton's Video Codec"], + /* KPCD */ [0x4443504B, "Kodak Photo CD"], + /* L261 */ [0x3136324C, "Lead Technologies H.261"], + /* L263 */ [0x3336324C, "Lead Technologies H.263"], + /* LAGS */ [0x5347414C, "Lagarith LossLess"], + /* LBYR */ [0x5259424C, "Creative WebCam Codec"], + /* LCMW */ [0x574D434C, "Lead Technologies Motion CMW Codec"], + /* LCW2 */ [0x3257434C, "Lead Technologies Tools MCMW 9Motion Wavelet)"], + /* LEAD */ [0x4441454C, "Lead Technologies Proprietary MCMP compression"], + /* LGRY */ [0x5952474C, "Lead Technologies Grayscale Image"], + /* LIA1 */ [0x3141494C, "Liafail"], + /* LJ11 */ [0x31314A4C, "Lead Technologies Motion JPEG 4:1:1"], + /* LJ22 */ [0x32324A4C, "Lead Technologies Motion JPEG 4:2:2"], + /* LJ2K */ [0x4B324A4C, "Lead Technologies Motion JPEG2000"], + /* LJ44 */ [0x34344A4C, "Lead Technologies Motion JPEG 4:4:4"], + /* LJPG */ [0x47504A4C, "Lead Technologies Motion JPEG Codec"], + /* LMP2 */ [0x32504D4C, "Lead Technologies MPEG-2"], + /* LMP4 */ [0x34504D4C, "Lead Technologies MPEG-4"], + /* LOCO */ [0x4F434F4C, "LOCO Lossless Codec"], + /* LSCR */ [0x5243534C, "Lead Technologies Screen Capture"], + /* LSV0 */ [0x3056534C, "Infinop Inc. Video"], + /* LSVC */ [0x4356534C, "Infinop Lightning Strike CBR Video Codec"], + /* LSVM */ [0x4D56534C, "Vianet Lighting Strike Vmail (Streaming)"], + /* LSVW */ [0x5756534C, "Infinop Lightning Strike MBR Video Codec"], + /* LSVX */ [0x5856534C, "Infinop Lightning Strike MBR Video Codec"], + /* LZO1 */ [0x314F5A4C, "Lempel-Ziv-Oberhumer Codec"], + /* M101 */ [0x3130314D, "Matrox Uncompressed field-based YUY2"], + /* M261 */ [0x3136324D, "Microsoft H.261"], + /* M263 */ [0x3336324D, "Microsoft H.263"], + /* M4CC */ [0x4343344D, "ESS MPEG4 Divio codec"], + /* M4S2 */ [0x3253344D, "Microsoft MPEG-4 Video v1.1"], + /* MC12 */ [0x3231434D, "ATI Motion Compensation Format"], + /* MC24 */ [0x3432434D, "MainConcept Motion JPEG Codec"], + /* MCAM */ [0x4D41434D, "ATI Motion Compensation Format"], + /* MCZM */ [0x4D5A434D, "Theory MicroCosm Lossless 64-bit RGB w/Alpha-channel"], + /* MDVD */ [0x4456444D, "Alex MicroDVD Video"], + /* MDVF */ [0x4656444D, "Pinnacle DV / DV50 / DVHD100"], + /* MHFY */ [0x5946484D, "A.M.Paredes mhuffyYUV (LossLess)"], + /* MJ2C */ [0x43324A4D, "Morgan Multimedia Motion JPEG2000 w/Compression"], + /* MJPA */ [0x41504A4D, "Pinnacle ReelTime Motion JPEG Hardware Codec"], + /* MJPB */ [0x42504A4D, "Motion JPEG Codec"], + /* MJPG */ [0x47504A4D, "Motion JPEG DIB Format"], + /* MJPX */ [0x58504A4D, "Pegasus PICVideo Motion JPEG"], + /* MMES */ [0x53454D4D, "Matrox MPEG-2 I-frame"], + /* MMIF */ [0x46494D4D, "Matrox MPEG-2 elementary I-frame-only video stream"], + /* MNVD */ [0x44564E4D, "MindBend MindVid LossLess"], + /* MP2A */ [0x4132504D, "*|Media Excel MPEG-2 Audio"], + /* MP2T */ [0x5432504D, "*|Media Excel MPEG-2 Transport Stream"], + /* MP2V */ [0x5632504D, "*|Media Excel MPEG-2 Video"], + /* MP41 */ [0x3134504D, "Microsoft MPEG-4 Windows Media Video"], + /* MP42 */ [0x3234504D, "Microsoft MPEG-4 Windows Media Video"], + /* MP43 */ [0x3334504D, "Microsoft MPEG-4 Windows Media Video"], + /* MP4A */ [0x4134504D, "Media Excel MPEG-4 Audio"], + /* MP4S */ [0x5334504D, "Microsoft MPEG-4 Windows Media 7"], + /* MP4T */ [0x5434504D, "Media Excel MPEG-4 Transport Stream"], + /* MP4V */ [0x5634504D, "Apple QuickTime MPEG-4 / FFmpeg MPEG-4 / Media Excel MPEG-4"], + /* MPEG */ [0x4745504D, "Chromatic Research MPEG-1"], + /* MPG1 */ [0x3147504D, "MPEG-1"], + /* MPG2 */ [0x3247504D, "MPEG-2"], + /* MPG3 */ [0x3347504D, "Microsoft MPEG-4 v3"], + /* MPG4 */ [0x3447504D, "Microsoft MPEG-4 v1"], + /* MPGI */ [0x4947504D, "Sigma Design MPEG-1 I-frame"], + /* MPNG */ [0x474E504D, "Motion PNG Codec"], + /* MRCA */ [0x4143524D, "FAST Multimedia MR Codec"], + /* MRLE */ [0x454C524D, "Microsoft Run Length Encoding"], + /* MSS1 */ [0x3153534D, "Microsoft Windows Media Screen v7"], + /* MSS2 */ [0x3253534D, "Microsoft Windows Media Screen v9"], + /* MSUC */ [0x4355534D, "MSU LossLess"], + /* MSV1 */ [0x3156534D, "Microsoft Video Codec v1"], + /* MSVC */ [0x4356534D, "Microsoft Video 1"], + /* MSZH */ [0x485A534D, "Lossless Codec Library w/ZIP Compression"], + /* MTGA */ [0x4147544D, "Motion TGA images (24, 32 bpp)"], + /* MTX1 */ [0x3158544D, "Matrox Motion-JPEG codec"], + /* MTX2 */ [0x3258544D, "Matrox Motion-JPEG codec"], + /* MTX3 */ [0x3358544D, "Matrox Motion-JPEG codec"], + /* MTX4 */ [0x3458544D, "Matrox Motion-JPEG codec"], + /* MTX5 */ [0x3558544D, "Matrox Motion-JPEG codec"], + /* MTX6 */ [0x3658544D, "Matrox Motion-JPEG codec"], + /* MTX7 */ [0x3758544D, "Matrox Motion-JPEG codec"], + /* MTX8 */ [0x3858544D, "Matrox Motion-JPEG codec"], + /* MTX9 */ [0x3958544D, "Matrox Motion-JPEG codec"], + /* MV12 */ [0x3231564D, "Motion Pixels Codec"], + /* MVC9 */ [0x3943564D, "Nokia MVC video codec"], + /* MVI1 */ [0x3149564D, "Motion Pixels MVI"], + /* MVI2 */ [0x3249564D, "Motion Pixels MVI"], + /* MWV1 */ [0x3156574D, "Aware Motion Wavelets"], + /* MYUV */ [0x5655594D, "Media-100 844/X Uncompressed"], + /* NAVI */ [0x4956414E, "nAVI Video Codec"], + /* NDIG */ [0x4749444E, "Ahead Nero Digital MPEG-4 Codec"], + /* NDSC */ [0x4353444E, "Nero Digital Codec"], + /* NDSM */ [0x4D53444E, "Nero Digital MPEG-4"], + /* NDSP */ [0x5053444E, "Unknown MPEG-4 Codec"], + /* NDSS */ [0x5353444E, "Nero Digital MPEG-4"], + /* NDXC */ [0x4358444E, "Nero Digital H.264"], + /* NDXH */ [0x4858444E, "Nero Digital H.264"], + /* NDXP */ [0x5058444E, "Nero Digital H.264"], + /* NDXS */ [0x5358444E, "Nero Digital H.264"], + /* NHVU */ [0x5556484E, "NVidia GEForce 3 Texture Format"], + /* NI24 */ [0x3432494E, "Harmonic/Omneon Spectrum Codec"], + /* NO16 */ [0x36314F4E, "Theory None16 64-bit Uncompressed RAW"], + /* NT00 */ [0x3030544E, "NewTek LightWave HDTV YUV w/Alpha-channel"], + /* NTN1 */ [0x314E544E, "Nogatech Video Compression 1"], + /* NTN2 */ [0x324E544E, "Nogatech Video Compression 2 / GrabBee Hardware Coder"], + /* NTSC */ [0x4353544E, "Radius SoftDV 16:9 NTSC"], + /* NUV1 */ [0x3156554E, "NuppelVideo"], + /* NV12 */ [0x3231564E, "Planar YUV Format"], + /* NV21 */ [0x3132564E, "Planar YUV Format"], + /* NVDS */ [0x5344564E, "NVidia Texture Format"], + /* NVHS */ [0x5348564E, "NVidia GEForce 3 Texture Format"], + /* NVS0 */ [0x3053564E, "nVidia Texture Compression Format"], + /* NVS1 */ [0x3153564E, "nVidia Texture Compression Format"], + /* NVS2 */ [0x3253564E, "nVidia Texture Compression Format"], + /* NVS3 */ [0x3353564E, "nVidia Texture Compression Format"], + /* NVS4 */ [0x3453564E, "nVidia Texture Compression Format"], + /* NVS5 */ [0x3553564E, "nVidia Texture Compression Format"], + /* NVT0 */ [0x3054564E, "nVidia Texture Compression Format"], + /* NVT1 */ [0x3154564E, "nVidia Texture Compression Format"], + /* NVT2 */ [0x3254564E, "nVidia Texture Compression Format"], + /* NVT3 */ [0x3354564E, "nVidia Texture Compression Format"], + /* NVT4 */ [0x3454564E, "nVidia Texture Compression Format"], + /* NVT5 */ [0x3554564E, "nVidia Texture Compression Format"], + /* NY12 */ [0x3231594E, "Nogatech YUV 12-bpp format"], + /* NYUV */ [0x5655594E, "Nogatech YUV 4:2:2 format"], + /* PCL2 */ [0x324C4350, "Pinnacle RL video codec"], + /* PCLE */ [0x454C4350, "Pinnacle Studio 400 video codec"], + /* PDVC */ [0x43564450, "Panasonic DVC Codec"], + /* PGVV */ [0x56564750, "Radius Video Vision Telecast"], + /* PHMO */ [0x4F4D4850, "IBM Photomotion"], + /* PIM1 */ [0x314D4950, "Pinnacle DC1000 MPEG-1 w/Compression"], + /* PIM2 */ [0x324D4950, "Pegasus Imaging / Pinnacle DC1000"], + /* PIMJ */ [0x4A4D4950, "Pegasus Lossless Motion JPEG"], + /* PIXL */ [0x4C584950, "MiroVideo XL Motion JPEG"], + /* PJPG */ [0x47504A50, "Non-standard Motion JPEG"], + /* PNG1 */ [0x31474E50, "Corecodec.org CorePNG Codec"], + /* PVEZ */ [0x5A455650, "Horizons Technology PowerEZ Codec"], + /* PVMM */ [0x4D4D5650, "PacketVideo Corporation MPEG-4"], + /* PVW2 */ [0x32575650, "Pegasus Wavelet2000 w/Compression"], + /* PVWV */ [0x56575650, "Pegasus Wavelet2000"], + /* PXLT */ [0x544C5850, "Apple Pixlet Codec"], + /* QDGX */ [0x58474451, "Apple QuickDraw GX"], + /* QPEG */ [0x47455051, "Q-Team QPEG v1.1"], + /* QPEQ */ [0x51455051, "Q-Team QPEG v1.1"], + /* R210 */ [0x30313252, "BlackMagic YUV (QuickTime)"], + /* R411 */ [0x31313452, "Radius DV NTSC YUV"], + /* R420 */ [0x30323452, "Radius DV PAL YUV"], + /* RAVI */ [0x49564152, "GroupTRON ReferenceAVI Codec"], + /* RGB1 */ [0x31424752, "Raw RGB 3:3:2"], + /* RGB2 */ [0x32424752, "Windows Bitmap Format"], + /* RGBA */ [0x41424752, "Raw RGB w/Alpha-channel"], + /* RGBO */ [0x4F424752, "Raw RGB 5:5:5"], + /* RGBP */ [0x50424752, "Raw RGB 5:6:5"], + /* RGBQ */ [0x51424752, "Raw RGB 5:5:5 Big-endian"], + /* RGBR */ [0x52424752, "Raw RGB 5:6:5 Big-endian"], + /* RGBT */ [0x54424752, "Raw RGB w/Transparency"], + /* RIVA */ [0x41564952, "NVidia Swizzled Texture Format"], + /* RLE4 */ [0x34454C52, "Run length encoded 4bpp RGB Format"], + /* RLE8 */ [0x38454C52, "Run length encoded 8bpp RGB Format"], + /* RLND */ [0x444E4C52, "Roland Corporation Video"], + /* RMP4 */ [0x34504D52, "REALmagic MPEG-4 Video Codec"], + /* ROQV */ [0x56514F52, "Id RoQ File Video Decoder"], + /* RPZA */ [0x415A5052, "Apple QuickTime Video 'Road Pizza'"], + /* RT21 */ [0x31325452, "Intel Real Time Video"], + /* RTV0 */ [0x30565452, "NewTek VideoToaster"], + /* RUD0 */ [0x30445552, "Rududu Video Codec"], + /* RV10 */ [0x30315652, "RealVideo Codec"], + /* RV13 */ [0x33315652, "RealVideo Codec"], + /* RV20 */ [0x30325652, "RealVideo G2"], + /* RV30 */ [0x30335652, "RealVideo 8"], + /* RV40 */ [0x30345652, "RealVideo 9"], + /* S263 */ [0x33363253, "Sorenson Vision H.263"], + /* S422 */ [0x32323453, "VideoCap C210 YUV 4:2:2"], + /* SAN3 */ [0x334E4153, "DivX 3.11a)"], + /* SCCD */ [0x44434353, "Luminositi SoftCam Codec"], + /* SDCC */ [0x43434453, "Sun Digital Camera codec"], + /* SEDG */ [0x47444553, "Samsung MPEG-4 codec"], + /* SFMC */ [0x434D4653, "CrystalNet Surface Fitting Method Codec"], + /* SHR0 */ [0x30524853, "BitJazz SheerVideo (realtime lossless)"], + /* SHR1 */ [0x31524853, "BitJazz SheerVideo (realtime lossless)"], + /* SHR2 */ [0x32524853, "BitJazz SheerVideo (realtime lossless)"], + /* SHR3 */ [0x33524853, "BitJazz SheerVideo (realtime lossless)"], + /* SHR4 */ [0x34524853, "BitJazz SheerVideo (realtime lossless)"], + /* SHR5 */ [0x35524853, "BitJazz SheerVideo (realtime lossless)"], + /* SHR6 */ [0x36524853, "BitJazz SheerVideo (realtime lossless)"], + /* SHR7 */ [0x37524853, "BitJazz SheerVideo (realtime lossless)"], + /* SJPG */ [0x47504A53, "CUseeMe Networks Codec"], + /* SL25 */ [0x35324C53, "SoftLab-NSK DVCPRO"], + /* SL50 */ [0x30354C53, "SoftLab-NSK DVCPRO50"], + /* SLDV */ [0x56444C53, "SoftLab-NSK Forward DV Draw Codec"], + /* SLIF */ [0x46494C53, "SoftLab-NSK MPEG2 I-frames"], + /* SLMJ */ [0x4A4D4C53, "SoftLab-NSK Forward Motion JPEG"], + /* SMK2 */ [0x324B4D53, "RAD Game Tools Smacker Video Codec"], + /* SMKA */ [0x414B4D53, "RAD Game Tools Smacker Audio Codec"], + /* SMP4 */ [0x34504D53, "Samsung VP-ms15 Digicam DivX Codec"], + /* SMSC */ [0x43534D53, "Radius Proprietary Codec"], + /* SMSD */ [0x44534D53, "Radius Proprietary Codec"], + /* SMSV */ [0x56534D53, "WorldConnect VisualMail Wavelet Video"], + /* SNOW */ [0x574F4E53, "SNOW Codec"], + /* SP40 */ [0x30345053, "SunPlus YUV"], + /* SP44 */ [0x34345053, "SunPlus Aiptek MegaCam Codec"], + /* SP53 */ [0x33355053, "SunPlus Aiptek MegaCam Codec"], + /* SP54 */ [0x34355053, "SunPlus Aiptek MegaCam Codec"], + /* SP55 */ [0x35355053, "SunPlus Aiptek MegaCam Codec"], + /* SP56 */ [0x36355053, "SunPlus Aiptek MegaCam Codec"], + /* SP57 */ [0x37355053, "SunPlus Aiptek MegaCam Codec"], + /* SP58 */ [0x38355053, "SunPlus Aiptek MegaCam Codec"], + /* SPIG */ [0x47495053, "Radius Spigot"], + /* SPLC */ [0x434C5053, "Splash Studios ACM Audio Codec"], + /* SPRK */ [0x4B525053, "Sorenson Spark"], + /* SQZ2 */ [0x325A5153, "Microsoft VXtreme Video Codec v2"], + /* STVA */ [0x41565453, "ST CMOS Imager Data (Bayer)"], + /* STVB */ [0x42565453, "ST CMOS Imager Data (Nudged Bayer)"], + /* STVC */ [0x43565453, "ST CMOS Imager Data (Bunched)"], + /* STVX */ [0x58565453, "ST CMOS Imager Data (Extended)"], + /* STVY */ [0x59565453, "ST CMOS Imager Data (Extended w/Correction Data)"], + /* SV10 */ [0x30315653, "Sorenson Media Video R1"], + /* SV3M */ [0x4D335653, "Sorenson SV3 Module Decoder"], + /* SVQ1 */ [0x31515653, "Sorenson Video"], + /* SVQ3 */ [0x33515653, "Sorenson Video 3"], + /* SWC1 */ [0x31435753, "MainConcept Motion JPEG Codec"], + /* T420 */ [0x30323454, "Toshiba YUV 4:2:0"], + /* THEO */ [0x4F454854, "FFVFW Supported Codec"], + /* TIFF */ [0x46464954, "Apple TIFF w/Alpha-channel"], + /* TIM2 */ [0x324D4954, "Pinnacle RAL DVI"], + /* TLMS */ [0x534D4C54, "TeraLogic Motion Infraframe Codec A"], + /* TLST */ [0x54534C54, "TeraLogic Motion Infraframe Codec B"], + /* TM20 */ [0x30324D54, "Duck TrueMotion 2.0"], + /* TM2A */ [0x41324D54, "Duck TrueMotion Archiver 2.0"], + /* TM2X */ [0x58324D54, "Duck TrueMotion 2X"], + /* TMIC */ [0x43494D54, "TeraLogic Motion Intraframe Codec 2"], + /* TMOT */ [0x544F4D54, "Horizons Technology TrueMotion Video Compression"], + /* TR20 */ [0x30325254, "Duck TrueMotion RT 2.0"], + /* TRLE */ [0x454C5254, "Akula Alpha Pro Custom AVI (LossLess)"], + /* TRON */ [0x4E4F5254, "GroupTRON ReferenceAVI Codec"], + /* TSCC */ [0x43435354, "TechSmith Screen Capture Codec"], + /* TV10 */ [0x30315654, "Tecomac Low-Bit Rate Codec"], + /* TVJP */ [0x504A5654, "TrueVision Field Encoded Motion JPEG"], + /* TVMJ */ [0x4A4D5654, "Truevision Targa Motion JPEG Hardware Codec"], + /* TY0N */ [0x4E305954, "Tecomac Low-Bit Rate Codec"], + /* TY2C */ [0x43325954, "Trident Decompression Driver"], + /* TY2N */ [0x4E325954, "Trident Decompression Driver"], + /* U263 */ [0x33363255, "UB Video StreamForce H.263"], + /* UCOD */ [0x444F4355, "eMajix ClearVideo"], + /* ULTI */ [0x49544C55, "IBM Ultimotion"], + /* UMP4 */ [0x34504D55, "UB Video MPEG-4"], + /* UYNV */ [0x564E5955, "NVidia Packed YUV 4:2:2 Format"], + /* UYVP */ [0x50565955, "Packed YCbCr 4:2:2 Format"], + /* UYVU */ [0x55565955, "SoftLab-NSK Forward YUV codec"], + /* UYVY */ [0x59565955, "Packed YUV 4:2:2 Format"], + /* V210 */ [0x30313256, "Packed YCrCb 4:2:2 Format"], + /* V261 */ [0x31363256, "Lucent VX2000S Video Codec"], + /* V422 */ [0x32323456, "Packed YUV 4:2:2 Format"], + /* V655 */ [0x35353656, "Packed YUV 4:2:2 Format"], + /* VBLE */ [0x454C4256, "MarcFD VBLE Lossless Codec"], + /* VCR1 */ [0x31524356, "ATI VCR 1.0"], + /* VCR2 */ [0x32524356, "ATI VCR 2.0"], + /* VCR3 */ [0x33524356, "ATI VCR 3.0"], + /* VCR4 */ [0x34524356, "ATI VCR 4.0"], + /* VCR5 */ [0x35524356, "ATI VCR 5.0"], + /* VCR6 */ [0x36524356, "ATI VCR 6.0"], + /* VCR7 */ [0x37524356, "ATI VCR 7.0"], + /* VCR8 */ [0x38524356, "ATI VCR 8.0"], + /* VCR9 */ [0x39524356, "ATI VCR 9.0"], + /* VCWV */ [0x56574356, "VideoCon wavelet"], + /* VDCT */ [0x54434456, "VITEC Multimedia Video Maker Pro DIB"], + /* VDOM */ [0x4D4F4456, "VDOnet VDOWave"], + /* VDOW */ [0x574F4456, "VDOnet VDOLive H.263"], + /* VDST */ [0x54534456, "VirtualDub Remote Frameclient ICM Driver"], + /* VDTZ */ [0x5A544456, "Darim Vision VideoTizer YUV"], + /* VGPX */ [0x58504756, "Alaris VideoGramPix Codec"], + /* VIDM */ [0x4D444956, "DivX 5.0 Pro Supported Codec"], + /* VIDS */ [0x53444956, "Vitec Multimedia YUV 4:2:2 Codec"], + /* VIFP */ [0x50464956, "Virtual Frame API Codec"], + /* VIV1 */ [0x31564956, "Vivo H.263"], + /* VIV2 */ [0x32564956, "Vivo H.263"], + /* VIVO */ [0x4F564956, "Vivo H.263"], + /* VIXL */ [0x4C584956, "Miro MiroVideo XL Motion JPEG"], + /* VJPG */ [0x47504A56, "Video Communication Systems"], + /* VLV1 */ [0x31564C56, "VideoLogic Captivator Codec"], + /* VP30 */ [0x30335056, "On2 VP3"], + /* VP31 */ [0x31335056, "On2 VP3"], + /* VP40 */ [0x30345056, "On2 TrueCast VP4"], + /* VP50 */ [0x30355056, "On2 TrueCast VP5"], + /* VP60 */ [0x30365056, "On2 TrueCast VP6"], + /* VP61 */ [0x31365056, "On2 TrueCast VP6.1"], + /* VP62 */ [0x32365056, "On2 TrueCast VP6.2"], + /* VP70 */ [0x30375056, "On2 TrueMotion VP7"], + /* VP80 */ [0x30385056, "On2 VP8"], + /* VQC1 */ [0x31435156, "ViewQuest Codec 1"], + /* VQC2 */ [0x32435156, "ViewQuest Codec 2"], + /* VQJP */ [0x504A5156, "ViewQuest VQ630 Dual-Mode Digital Camera"], + /* VQS4 */ [0x34535156, "ViewQuest VQ110 Digital Video Camera"], + /* VR21 */ [0x31325256, "BlackMagic YUV"], + /* VSSH */ [0x48535356, "Vanguard VSS H.264"], + /* VSSV */ [0x56535356, "Vanguard VSS Codec Light"], + /* VSSW */ [0x57535356, "VSS Wavelet Video Codec|Vanguard VSS H.264"], + /* VTLP */ [0x504C5456, "Alaris VideoGramPixel Codec"], + /* VX1K */ [0x4B315856, "Lucent VX1000S Video Codec"], + /* VX2K */ [0x4B325856, "Lucent VX2000S Video Codec"], + /* VXSP */ [0x50535856, "Lucent VX1000SP Video Codec"], + /* VYU9 */ [0x39555956, "Planar YUV Format: 8-but Y plane followed by 8-bit 4x4 subsampled V and U planes"], + /* VYUY */ [0x59555956, "ATI Packed YUV Format"], + /* WBVC */ [0x43564257, "Winbond W9960 Codec"], + /* WHAM */ [0x4D414857, "Microsoft Video 1"], + /* WINX */ [0x584E4957, "Winnov Software Compression"], + /* WJPG */ [0x47504A57, "Winbond Motion JPEG"], + /* WMV1 */ [0x31564D57, "Microsoft Windows Media Video v7"], + /* WMV2 */ [0x32564D57, "Microsoft Windows Media Video v8"], + /* WMV3 */ [0x33564D57, "Microsoft Windows Media Video v9"], + /* WMVA */ [0x41564D57, "Microsoft Windows Media Video v9 Advanced Profile"], + /* WMVP */ [0x50564D57, "Microsoft Windows Media Video v9.1 Image"], + /* WNIX */ [0x58494E57, "WniWni Codec"], + /* WNV1 */ [0x31564E57, "Winnov Videum Hardware Compression"], + /* WPY2 */ [0x32595057, "Winnov Video"], + /* WRLE */ [0x454C5257, "Apple QuickTime BMP Codec"], + /* WRPR */ [0x52505257, "VideoTools VideoServer Client Codec"], + /* WVC1 */ [0x31435657, "Microsoft SMPTE VC1 Codec"], + /* WVLT */ [0x544C5657, "IllusionHope Wavelet 9/7"], + /* WZCD */ [0x44435A57, "CORE Co. Ltd. iScan"], + /* WZDC */ [0x43445A57, "CORE Co. Ltd. iSnap"], + /* X263 */ [0x33363258, "Xirlink H.263"], + /* X264 */ [0x34363258, "XiWave GNU GPL H.264 Codec"], + /* XJPG */ [0x47504A58, "Xirlink JPEG-like compressor"], + /* XLV0 */ [0x30564C58, "NetXL XL Video Decoder"], + /* XMPG */ [0x47504D58, "XING Editable MPEG"], + /* XVID */ [0x44495658, "XviD MPEG-4 Codec"], + /* XWV0 */ [0x30565758, "XiWave Video Codec"], + /* XWV1 */ [0x31565758, "XiWave Video Codec"], + /* XWV2 */ [0x32565758, "XiWave Video Codec"], + /* XWV3 */ [0x33565758, "XiWave Xi-3 Video Codec"], + /* XWV4 */ [0x34565758, "XiWave Video Codec"], + /* XWV5 */ [0x35565758, "XiWave Video Codec"], + /* XWV6 */ [0x36565758, "XiWave Video Codec"], + /* XWV7 */ [0x37565758, "XiWave Video Codec"], + /* XWV8 */ [0x38565758, "XiWave Video Codec"], + /* XWV9 */ [0x39565758, "XiWave Video Codec"], + /* XXAN */ [0x4E415858, "Origin Video Codec"], + /* XYZP */ [0x505A5958, "Extended PAL Format XYZ Palette"], + /* Y16 */ [0x58313620, "Packed YUV Greyscale Format"], + /* Y211 */ [0x31313259, "Packed YUV Format"], + /* Y216 */ [0x36313259, "Pinnacle TARGA CineWave YUV"], + /* Y411 */ [0x31313459, "Packed YUV 4:1:1 Format"], + /* Y41B */ [0x42313459, "Weitek Planar YUV 4:1:1 Format"], + /* Y41P */ [0x50313459, "Packed YUV 4:1:1 Format"], + /* Y41T */ [0x54313459, "Packed YUV 4:1:1 Format w/Transparency"], + /* Y422 */ [0x32323459, "Packed YUV 4:2:2 Format"], + /* Y42B */ [0x42323459, "Weitek Planar YUV 4:2:2 Format"], + /* Y42T */ [0x54323459, "Packed YUV 4:2:2 Format w/Transparency"], + /* Y444 */ [0x34343459, "IEEE 1394 24-bit YUV 4:4:4"], + /* Y8 */ [0x59382020, "Packed/Planar YUV Monochrome Format"], + /* Y800 */ [0x30303859, "Packed/Planar YUV Monochrome Format"], + /* YC12 */ [0x32314359, "Intel YUV12 Codec"], + /* YCCK */ [0x4B434359, "Uncompressed YCbCr Video w/Key Data"], + /* YMPG */ [0x47504D59, "YMPEG Alpha"], + /* YU12 */ [0x32315559, "ATI YV12 4:2:0 Planar"], + /* YU92 */ [0x32395559, "Intel YUV Video"], + /* YUNV */ [0x564E5559, "NVidia Packed YUV 4:2:2 Format"], + /* YUV2 */ [0x32565559, "Packed YUV 4:2:2 Format"], + /* YUV8 */ [0x38565559, "Winnov Caviar YUV8 Video"], + /* YUV9 */ [0x39565559, "Intel Planar YUV Format"], + /* YUVP */ [0x50565559, "Packed YCbCr 4:2:2 Extended Precision Format"], + /* YUY2 */ [0x32595559, "Packed YUV 4:2:2 Format"], + /* YUYP */ [0x50595559, "Evans & Sutherland YCbCr 4:2:2 Extended Precision Format"], + /* YUYV */ [0x56595559, "Packed YUV 4:2:2 Format"], + /* YV12 */ [0x32315659, "Planar YUV Format"], + /* YV16 */ [0x36315659, "Planar YUV Format"], + /* YV92 */ [0x32395659, "Intel Smart Video Recorder"], + /* YVU9 */ [0x39555659, "Intel Planar YUV Format"], + /* YVYU */ [0x55595659, "Packed YUV 4:2:2 Format"], + /* ZLIB */ [0x42494C5A, "Lossless Codec Library w/zlib Compression"], + /* ZMBV */ [0x56424D5A, "DoxBox Capture Codec"], + /* ZPEG */ [0x4745505A, "Metheus Video Zipper"], + /* ZPG4 */ [0x3447505A, "VoDeo Solutions Video"], + /* ZYGO */ [0x4F47595A, "ZyGo Video Codec"], + /* raw2 */ [0x32776173, "Raw, Uncompressed RGB Bitmap"] + ] + ); private readonly _bitCount: number; private readonly _colorsUsed: number; @@ -700,16 +702,16 @@ export default class RiffBitmapInfoHeader implements IVideoCodec { throw new CorruptFileError("Expected at least 40 bytes for bitmap info header"); } - this._width = data.mid(offset + 4, 4).toUInt(false); - this._height = data.mid(offset + 8, 4).toUInt(false); - this._planes = data.mid(offset + 12, 2).toUShort(false); - this._bitCount = data.mid(offset + 14, 2).toUShort(false); - this._compressionId = data.mid(offset + 16, 4).toUInt(false); - this._imageSize = data.mid(offset + 20, 4).toUInt(false); - this._xPixelsPerMeter = data.mid(offset + 24, 4).toUInt(false); - this._yPixelsPerMeter = data.mid(offset + 28, 4).toUInt(false); - this._colorsUsed = data.mid(offset + 32, 4).toUInt(false); - this._importantColors = data.mid(offset + 36, 4).toUInt(false); + this._width = data.subarray(offset + 4, 4).toUint(false); + this._height = data.subarray(offset + 8, 4).toUint(false); + this._planes = data.subarray(offset + 12, 2).toUshort(false); + this._bitCount = data.subarray(offset + 14, 2).toUshort(false); + this._compressionId = data.subarray(offset + 16, 4).toUint(false); + this._imageSize = data.subarray(offset + 20, 4).toUint(false); + this._xPixelsPerMeter = data.subarray(offset + 24, 4).toUint(false); + this._yPixelsPerMeter = data.subarray(offset + 28, 4).toUint(false); + this._colorsUsed = data.subarray(offset + 32, 4).toUint(false); + this._importantColors = data.subarray(offset + 36, 4).toUint(false); } // #region Properties @@ -752,9 +754,8 @@ export default class RiffBitmapInfoHeader implements IVideoCodec { NumberUtils.uintAnd(this._compressionId, 0xFF000000) >>> 24 ); - return RiffBitmapInfoHeader.FOURCC_CODES[this._compressionId] === undefined - ? `Unknown Video Format [${fourccString}]` - : `${RiffBitmapInfoHeader.FOURCC_CODES[this._compressionId]} [${fourccString}]`; + const compressionFormat = RiffBitmapInfoHeader.FOURCC_CODES.get(this._compressionId) || "Unknown Video Format"; + return `${compressionFormat} [${fourccString}]`; } /** diff --git a/src/riff/riffChunk.ts b/src/riff/riffChunk.ts index f4a622f6..d4afd205 100644 --- a/src/riff/riffChunk.ts +++ b/src/riff/riffChunk.ts @@ -1,7 +1,7 @@ -import ILazy from "../iLazy"; import IRiffChunk from "./iRiffChunk"; -import {ByteVector} from "../byteVector"; +import {ByteVector, StringType} from "../byteVector"; import {File} from "../file"; +import {ILazy} from "../interfaces"; import {Guards} from "../utils"; /** @@ -16,7 +16,7 @@ export default class RiffChunk implements IRiffChunk, ILazy { // #region Constructors - private constructor() {} + private constructor() { /* private to enforce construction via static methods */ } /** * Creates and initializes a new instance, lazily, from a position of a file. @@ -37,7 +37,7 @@ export default class RiffChunk implements IRiffChunk, ILazy { const chunk = new RiffChunk(); file.seek(position + 4); - chunk._originalDataSize = file.readBlock(4).toUInt(false); + chunk._originalDataSize = file.readBlock(4).toUint(false); chunk._file = file; chunk._fourcc = fourcc; chunk._chunkStart = position; @@ -49,7 +49,7 @@ export default class RiffChunk implements IRiffChunk, ILazy { * @param fourcc FOURCC code for the chunk * @param data Data to contain in the chunk, not includeing FOURCC or size */ - public static fromData(fourcc: string, data: ByteVector) { + public static fromData(fourcc: string, data: ByteVector): RiffChunk { Guards.truthy(fourcc, "fourcc"); if (fourcc.length !== 4) { throw new Error("Argument error: fourcc must be 4 characters"); @@ -57,7 +57,7 @@ export default class RiffChunk implements IRiffChunk, ILazy { Guards.truthy(data, "data"); const chunk = new RiffChunk(); - chunk._data = data; + chunk._data = data.toByteVector(); chunk._fourcc = fourcc; chunk._originalDataSize = data.length; return chunk; @@ -121,16 +121,12 @@ export default class RiffChunk implements IRiffChunk, ILazy { public render(): ByteVector { this.load(); - const data = ByteVector.concatenate( - ByteVector.fromString(this._fourcc), - ByteVector.fromUInt(this.data.length, false), - this._data + return ByteVector.concatenate( + ByteVector.fromString(this._fourcc, StringType.Latin1), + ByteVector.fromUint(this.data.length, false), + this._data, + ((this._data.length + 4 + 4) % 2 === 1) ? 0x00 : undefined ); - if ((data.length + 4) % 2 === 1) { - data.addByte(0x00); - } - - return data; } // #endregion diff --git a/src/riff/riffFile.ts b/src/riff/riffFile.ts index 65b0f83d..eb68d737 100644 --- a/src/riff/riffFile.ts +++ b/src/riff/riffFile.ts @@ -1,3 +1,4 @@ +import itiriri from "itiriri"; import AviFileSettings from "./aviFileSettings"; import AviHeader from "./avi/aviHeader"; import DivxTag from "./divxTag"; @@ -5,18 +6,19 @@ import Id3v2Tag from "../id3v2/id3v2Tag"; import InfoTag from "./infoTag"; import IRiffChunk from "./iRiffChunk"; import MovieIdTag from "./movieIdTag"; -import Properties from "../properties"; import RiffChunk from "./riffChunk"; import RiffList from "./riffList"; import RiffTags from "./riffTags"; import RiffWaveFormatEx from "./riffWaveFormatEx"; +import Settings from "../settings"; import WaveFileSettings from "./waveFileSettings"; -import {ByteVector} from "../byteVector"; +import {ByteVector, StringType} from "../byteVector"; import {CorruptFileError, UnsupportedFormatError} from "../errors"; import {File, FileAccessMode, ReadStyle} from "../file"; import {IFileAbstraction} from "../fileAbstraction"; -import {ICodec} from "../iCodec"; +import {ICodec, Properties} from "../properties"; import {Tag, TagTypes} from "../tag"; +import {NumberUtils} from "../utils"; /** * This class extends {@link File} to provide tagging and properties support for RIFF files. These @@ -28,7 +30,7 @@ export default class RiffFile extends File { /** * Identifier at the beginning of a RIFF file. */ - public static readonly fileIdentifier = ByteVector.fromString("RIFF", undefined, undefined, true); + public static readonly FILE_IDENTIFIER = ByteVector.fromString("RIFF", StringType.Latin1).makeReadOnly(); private _fileType: string; private _properties: Properties; @@ -69,12 +71,14 @@ export default class RiffFile extends File { // complete tag information. const allTagTypes = [TagTypes.Id3v2, TagTypes.DivX, TagTypes.RiffInfo, TagTypes.MovieId]; for (const tagType of allTagTypes) { - if ((defaultTags & tagType) === 0 || (this._tag.tagTypes & tagType) !== 0) { + const isDefault = NumberUtils.hasFlag(defaultTags, tagType); + const existsAlready = NumberUtils.hasFlag(this._tag.tagTypes, tagType); + if (!isDefault || existsAlready) { continue; } // Desired default tag does not exist, create it - this._tag.createTag(tagType, true); + this._tag.createTag(tagType, Settings.copyExistingTagsToNewDefaultTags); } } @@ -146,9 +150,10 @@ export default class RiffFile extends File { const renderedTagBytes = ByteVector.concatenate(... renderedTags); // Determine the boundaries of the tagging chunks - const taggingChunkIndexes = new Array(... this._taggingChunkIndexes.values()) + const taggingChunkIndexes = itiriri(this._taggingChunkIndexes.values()) .filter((i) => i >= 0) - .sort(); + .sort() + .toArray(); let taggingChunkStartIndex: number; let taggingChunkStart: number; @@ -178,10 +183,11 @@ export default class RiffFile extends File { // operation // Find any trailing JUNK chunks let lastChunkIndex = taggingChunkIndexes[taggingChunkIndexes.length - 1]; - let junkSize = 0; - while (lastChunkIndex + 1 < this._rawChunks.length && this._rawChunks[lastChunkIndex + 1].fourcc === "JUNK") { + while ( + lastChunkIndex + 1 < this._rawChunks.length && + this._rawChunks[lastChunkIndex + 1].fourcc === "JUNK" + ) { lastChunkIndex++; - junkSize += this._rawChunks[lastChunkIndex].originalTotalSize; } // Calculate tagging chunks start/length @@ -273,8 +279,8 @@ export default class RiffFile extends File { // Calculate new RIFF size this._riffSize = this.length - 8; - this.insert(ByteVector.fromUInt(this._riffSize, false), 4, 4); - this._tagTypesOnDisk = this.tagTypes; + this.insert(ByteVector.fromUint(this._riffSize, false), 4, 4); + this.tagTypesOnDisk = this.tagTypes; } finally { this.mode = FileAccessMode.Closed; } @@ -285,18 +291,19 @@ export default class RiffFile extends File { try { // Read the header of the file - if (!ByteVector.equal(this.readBlock(4), RiffFile.fileIdentifier)) { + const initialHeader = this.readBlock(12); + if (!initialHeader.startsWith(RiffFile.FILE_IDENTIFIER)) { throw new CorruptFileError("File does not begin with RIFF identifier"); } - this._riffSize = this.readBlock(4).toUInt(false); - this._fileType = this.readBlock(4).toString(); + this._riffSize = initialHeader.subarray(4, 4).toUint(false); + this._fileType = initialHeader.subarray(8, 4).toString(StringType.Latin1); // Read chunks until there are less than 8 bytes to read let position = this.position; while (position + 8 < this.length) { this.seek(position); - const fourcc = this.readBlock(4).toString(); - const chunk = fourcc === RiffList.identifierFourcc + const fourcc = this.readBlock(4).toString(StringType.Latin1); + const chunk = fourcc === RiffList.IDENTIFIER_FOURCC ? RiffList.fromFile(this, position) : RiffChunk.fromFile(this, fourcc, position); position += chunk.originalTotalSize; @@ -334,7 +341,7 @@ export default class RiffFile extends File { : undefined; this._tag = new RiffTags(divxTag, id3v2Tag, infoTag, moveIdTag); - this._tagTypesOnDisk = this.tagTypes; + this.tagTypesOnDisk = this.tagTypes; } finally { this.mode = FileAccessMode.Closed; @@ -342,7 +349,7 @@ export default class RiffFile extends File { } private readProperties(readStyle: ReadStyle): Properties { - if ((readStyle & ReadStyle.Average) === 0) { + if (!NumberUtils.hasFlag(readStyle, ReadStyle.Average)) { return; } @@ -373,8 +380,8 @@ export default class RiffFile extends File { case "AVI ": // This is an AVI file, search for the hdrl list const aviHeaderList = this._rawChunks.find((c) => { - return c.fourcc === RiffList.identifierFourcc - && ( c).type === AviHeader.headerListType; + return c.fourcc === RiffList.IDENTIFIER_FOURCC + && ( c).type === AviHeader.HEADER_LIST_TYPE; }); if (!aviHeaderList) { throw new CorruptFileError("AVI file is missing header list"); @@ -411,18 +418,18 @@ export default class RiffFile extends File { ); this._taggingChunkIndexes.set( TagTypes.RiffInfo, - this._rawChunks.findIndex((c) => RiffList.isChunkList(c) && ( c).type === InfoTag.listType) + this._rawChunks.findIndex((c) => RiffList.isChunkList(c) && ( c).type === InfoTag.LIST_TYPE) ); this._taggingChunkIndexes.set( TagTypes.MovieId, - this._rawChunks.findIndex((c) => RiffList.isChunkList(c) && ( c).type === MovieIdTag.listType) + this._rawChunks.findIndex((c) => RiffList.isChunkList(c) && ( c).type === MovieIdTag.LIST_TYPE) ); } // #endregion } -//////////////////////////////////////////////////////////////////////////// +// ///////////////////////////////////////////////////////////////////////// // Register the file type [ "taglib/avi", diff --git a/src/riff/riffList.ts b/src/riff/riffList.ts index 99e141bf..f0edf113 100644 --- a/src/riff/riffList.ts +++ b/src/riff/riffList.ts @@ -1,14 +1,14 @@ -import ILazy from "../iLazy"; import IRiffChunk from "./iRiffChunk"; -import {ByteVector} from "../byteVector"; +import {ByteVector, StringType} from "../byteVector"; import {File, FileAccessMode} from "../file"; +import {ILazy} from "../interfaces"; import {Guards} from "../utils"; export default class RiffList implements IRiffChunk, ILazy { /** * FOURCC code for a list chunk */ - public static readonly identifierFourcc = "LIST"; + public static readonly IDENTIFIER_FOURCC = "LIST"; private _chunkStart: number; private _file: File; @@ -20,7 +20,7 @@ export default class RiffList implements IRiffChunk, ILazy { // #region Constructors - private constructor() {} + private constructor() { /* private to enforce construction via static methods */ } /** * Constructs and initializes a new instance with no contents. @@ -47,16 +47,17 @@ export default class RiffList implements IRiffChunk, ILazy { } file.seek(position); - if (file.readBlock(4).toString() !== RiffList.identifierFourcc) { + const listHeader = file.readBlock(12); + if (listHeader.subarray(0, 4).toString(StringType.Latin1) !== RiffList.IDENTIFIER_FOURCC) { throw new Error("Cannot read RIFF list from non-list chunk"); } const list = new RiffList(); list._chunkStart = position; - list._originalDataSize = file.readBlock(4).toUInt(false); + list._originalDataSize = listHeader.subarray(4, 4).toUint(false); list._file = file; list._isLoaded = false; - list._type = file.readBlock(4).toString(); + list._type = listHeader.subarray(8, 4).toString(StringType.Latin1); return list; } @@ -74,7 +75,7 @@ export default class RiffList implements IRiffChunk, ILazy { } /** @inheritDoc */ - public get fourcc(): string { return RiffList.identifierFourcc; } + public get fourcc(): string { return RiffList.IDENTIFIER_FOURCC; } /** @inheritDoc */ public get isLoaded(): boolean { return this._isLoaded; } @@ -119,7 +120,7 @@ export default class RiffList implements IRiffChunk, ILazy { // #region Methods public static isChunkList(c: IRiffChunk): boolean { - return c.fourcc === RiffList.identifierFourcc; + return c.fourcc === RiffList.IDENTIFIER_FOURCC; } /** @@ -173,10 +174,10 @@ export default class RiffList implements IRiffChunk, ILazy { // Read the value this._file.seek(fileOffset); const headerBlock = this._file.readBlock(8); - const id = headerBlock.toString(4); - const length = headerBlock.mid(4, 4).toUInt(false); + const id = headerBlock.subarray(0, 4).toString(StringType.UTF8); + const length = headerBlock.subarray(4, 4).toUint(false); - if (id === RiffList.identifierFourcc) { + if (id === RiffList.IDENTIFIER_FOURCC) { // The element is a list, create a nested riff list from it const nestedList = RiffList.fromFile(this._file, fileOffset); if (this._lists.get(nestedList.type) === undefined) { @@ -240,19 +241,14 @@ export default class RiffList implements IRiffChunk, ILazy { this.load(); // Render all the values + // @TODO: I think we can do this with less concat calls const valueData = Array.from(this._values.entries(), ([key, value]) => { - const valuesBytes = value.map((v) => { - const valueBytes = ByteVector.concatenate( - ByteVector.fromString(key), - ByteVector.fromUInt(v.length, false), - v - ); - if (v.length % 2 === 1) { - valueBytes.addByte(0x00); - } - - return valueBytes; - }); + const valuesBytes = value.map((v) => ByteVector.concatenate( + ByteVector.fromString(key, StringType.UTF8), + ByteVector.fromUint(v.length, false), + v, + (v.length % 2 === 1) ? 0x00 : undefined + )); return ByteVector.concatenate(... valuesBytes); }); @@ -268,17 +264,13 @@ export default class RiffList implements IRiffChunk, ILazy { ... listData ); - const data = ByteVector.concatenate( - ByteVector.fromString(RiffList.identifierFourcc), - ByteVector.fromUInt(allData.length + 4, false), - ByteVector.fromString(this._type), - allData + return ByteVector.concatenate( + ByteVector.fromString(RiffList.IDENTIFIER_FOURCC, StringType.Latin1), + ByteVector.fromUint(allData.length + 4, false), + ByteVector.fromString(this._type, StringType.Latin1), + allData, + (allData.length % 2 === 1) ? 0x00 : undefined ); - if (allData.length + 4 % 2 === 1) { - data.addByte(0x00); - } - - return data; } // #endregion diff --git a/src/riff/riffListTag.ts b/src/riff/riffListTag.ts index face42be..7f4b3841 100644 --- a/src/riff/riffListTag.ts +++ b/src/riff/riffListTag.ts @@ -55,7 +55,7 @@ export default abstract class RiffListTag extends Tag { // #region Methods /** @inheritDoc */ - public clear() { + public clear(): void { this._list.clear(); } @@ -75,7 +75,7 @@ export default abstract class RiffListTag extends Tag { const values = this.getValues(id); return values.map((value) => { return value - ? value.toString(value.length, this._stringType) + ? value.toString(this._stringType) : ""; }); } @@ -129,7 +129,7 @@ export default abstract class RiffListTag extends Tag { */ public setValueFromUint(id: string, value: number): void { Guards.uint(value, "value"); - const byteValues = value ? [ByteVector.fromString(value.toString(10))] : undefined; + const byteValues = value ? [ByteVector.fromString(value.toString(10), StringType.Latin1)] : undefined; this._list.setValues(id, byteValues); } diff --git a/src/riff/riffTags.ts b/src/riff/riffTags.ts index 726a4a2b..dc134b87 100644 --- a/src/riff/riffTags.ts +++ b/src/riff/riffTags.ts @@ -8,10 +8,10 @@ import {Id3v2TagHeaderFlags} from ".."; import {UnsupportedFormatError} from "../errors"; export default class RiffTags extends CombinedTag { - public static readonly supportedTagTypes = TagTypes.DivX | TagTypes.Id3v2 | TagTypes.RiffInfo | TagTypes.MovieId; + public static readonly SUPPORTED_TAG_TYPES = TagTypes.DivX | TagTypes.Id3v2 | TagTypes.RiffInfo | TagTypes.MovieId; public constructor(divxTag: DivxTag, id3v2Tag: Id3v2Tag, infoTag: InfoTag, movieIdTag: MovieIdTag) { - super(RiffTags.supportedTagTypes); + super(RiffTags.SUPPORTED_TAG_TYPES, true); // NOTE: We're adding ID3 first because it is the most flexible tagging format. Divx is last // because it is the least flexible tagging format. diff --git a/src/riff/riffWaveFormatEx.ts b/src/riff/riffWaveFormatEx.ts index 0dbf4fe9..a255ae1d 100644 --- a/src/riff/riffWaveFormatEx.ts +++ b/src/riff/riffWaveFormatEx.ts @@ -1,6 +1,6 @@ import {ByteVector} from "../byteVector"; import {CorruptFileError} from "../errors"; -import {ILosslessAudioCodec, MediaTypes} from "../iCodec"; +import {ILosslessAudioCodec, MediaTypes} from "../properties"; import {Guards} from "../utils"; /** @@ -13,273 +13,273 @@ export default class RiffWaveFormatEx implements ILosslessAudioCodec { // This list was put together from the Windows 10 SDK mmreg.h header file // If any of these descriptions are wrong or out of date, please open a PR. - public static readonly WAVE_FORMAT_TAGS: {[key: number]: string} = { - 0x0000: "Unknown Wave Format", - 0x0001: "PCM Audio", - 0x0002: "Microsoft ADPCM", - 0x0003: "PCM Audio in IEEE Floating-Point Format", - 0x0004: "Compaq VSELP Audio", - 0x0005: "IBM CVSD Audio", - 0x0006: "Microsoft ALAW Audio", - 0x0007: "Microsoft MULAW Audio", - 0x0008: "Microsoft DTS Audio", - 0x0009: "Microsoft DRM Encrypted Audio", - 0x000A: "Microsoft Speech Ausio", - 0x000B: "Microsoft Windows Media RT Voice Audio", - 0x0010: "OKI ADPCM Audio", - 0x0011: "Intel ADPCM Audio", - 0x0012: "Videologic MediaSpace ADPCM Audio", - 0x0013: "Sierra ADPCM Audio", - 0x0014: "Antex G723 ADPCM Audio", - 0x0015: "DSP Solutions DIGISTD Audio", - 0x0016: "DSP Solutions DIGIFIX Audio", - 0x0017: "Dialogic OKI ADPCM Audio", - 0x0018: "Media Vision ADPCM Audio for Jazz 16", - 0x0019: "HP CU Audio", - 0x001A: "HP Dynamic Voice Audio", - 0x0020: "Yamaha ADPCM Audio", - 0x0021: "Speech Compression Sonarc Audio", - 0x0022: "DSP Group True Speech Audio ", - 0x0023: "Echo Speech Audio", - 0x0024: "Virtual Music Audiofile AF36 Audio", - 0x0025: "Audio Processing Technology APTX Audio", - 0x0026: "Virtual Music Audiofile AF10 Audio", - 0x0027: "Aculab Prosody 1612 Speech Card Audio", - 0x0028: "Merging Technologies LRC Audio", - 0x0030: "Dolby AC2 Audio", - 0x0031: "Microsoft Corporation GSM6.10 Audio", - 0x0032: "Microsoft Corporation MSN Audio", - 0x0033: "Antex ADPCME Audio", - 0x0034: "Control Resources VQLPC Audio", - 0x0035: "DSP Solutions Digireal Audio", - 0x0036: "DSP Solutions DigiADPCM Audio", - 0x0037: "Control Resources CR10 Audio", - 0x0038: "Natural MicroSystems VBXADPCM Audio", - 0x0039: "Crystal Semiconductor IMA ADPCM Audio", - 0x003A: "Echo Speech Corporation Proprietary Audio Compression Format", - 0x003B: "Rockwell ADPCM Audio", - 0x003C: "Rockwell DIGITALK Audio", - 0x003D: "Xebec Multimedia Solutions Proprietary Audio Compression Format", - 0x0040: "Antex G721 ADPCM Audio", - 0x0041: "Antex G728 CELP Audio", - 0x0042: "Microsoft MSG723 Audio", - 0x0043: "Intel G.723.1 Audio", - 0x0044: "Intel G.729 Audio", - 0x0045: "Sharp G.726 Audio", - 0x0050: "Microsoft Corporation MPEG Audio", - 0x0052: "InSoft RT24 Audio", - 0x0053: "InSoft PAC Audio", - 0x0055: "ISO/MPEG Layer 3 Audio", - 0x0059: "Lucent G.723", - 0x0060: "Cirrus Logic Audio", - 0x0061: "ESS Technology PCM Audio", - 0x0062: "Voxware Audio", - 0x0063: "Canopus ATRAC Audio", - 0x0064: "APICOM G.726 Audio", - 0x0065: "APICOM G.722 Audio", - 0x0066: "Microsoft DSAT Audio", - 0x0067: "Microsoft DSAT Display Audio", - 0x0069: "Voxware Byte Aligned Audio", - 0x0070: "Voxware AC8 Audio", - 0x0071: "Voxware AC10 Audio", - 0x0072: "Voxware AC16 Audio", - 0x0073: "Voxware AC20 Audio", - 0x0074: "Voxware RT24 Audio", - 0x0075: "Voxware RT29 Audio", - 0x0076: "Voxware RT29HW Audio", - 0x0077: "Voxware VR12 Audio", - 0x0078: "Voxware VR18 Audio", - 0x0079: "Voxware TQ40 Audio", - 0x007A: "Voxware SC3 Audio", - 0x007B: "Voxware SC3.1 Audio", - 0x0080: "Softsound Audio", - 0x0081: "Voxware TQ60 Audio", - 0x0082: "Microsoft RT24", - 0x0083: "AT&T G.729A Audio", - 0x0084: "Motion Pixels MVI2 Audio", - 0x0085: "DataFusion Systems G.726 Audio", - 0x0086: "DataFusion Systems GSM610 Audio", - 0x0088: "Iterated Systems Audio", - 0x0089: "OnLive! Audio", - 0x008A: "Multitude FT SX20 Audio", - 0x008B: "Infocom ITS G.721 Audio", - 0x008C: "Convedia G.729 Audio", - 0x008D: "Congruency Audio", - 0x0091: "Siemens Business Communications 24 Audio", - 0x0092: "Sonic Foundry Dolby AC3 Audio", - 0x0093: "MediaSonic G.723 Audio", - 0x0094: "Aculab Prosody CTI Speech Card Audio", - 0x0097: "ZyXEL ADPCM Audio", - 0x0098: "Philips Speech Processing LPCBB Audio", - 0x0099: "Studer Professional PACKED Audio", - 0x00A0: "Malden Electronics Phony Talk Audio", - 0x00A1: "Racal Recorders GSM Audio", - 0x00A2: "Racal Recorders G.720.a Audio", - 0x00A3: "Racal Recorders G.723.1 Audio", - 0x00A4: "Racal Recorders Tetra ACELP Audio", - 0x00B0: "NEC AAC Audio", - 0x00FF: "AAC1 Audio", - 0x0100: "Rhetorex ADPCM Audio", - 0x0101: "BeCubed IRAT Audio", - 0x0111: "Vivo G.723 Audio", - 0x0112: "Vivo Siren Audio", - 0x0120: "Philips Speech Processing CELP Audio", - 0x0121: "Philips Speech Processing Grundig Audio", - 0x0123: "DEC G.723 Audio", - 0x0125: "Sanyo LD-ADPCM Audio", - 0x0130: "Sipro Lab ACEPLNET Audio", - 0x0131: "Sipro Lab ACELP4800 Audio", - 0x0132: "Sipro Lab ACELP8v3 Audio", - 0x0133: "Sipro Lab G.729 Audio", - 0x0134: "Sipro Lab G.729.a Audio", - 0x0135: "Sipro Lab Kelvin Audio", - 0x0136: "VoiceAge AMR Audio", - 0x0140: "Dictaphone G.726 Audio", - 0x0141: "Dictaphone CELP68 Audio", - 0x0142: "Dictaphone CELP54 Audio", - 0x0150: "Qualcomm PureVoice Audio", - 0x0151: "Qualcomm Half Rate Audio", - 0x0155: "Ring Zero Systems TUBGSM Audio", - 0x0160: "Microsoft WMA1 Audio", - 0x0161: "Microsoft WMA2 Audio", - 0x0162: "Microsoft Multichannel WMA Audio", - 0x0163: "Microsoft Lossless WMA Audio", - 0x0164: "Microsoft WMA SPDIF Audio", - 0x0170: "Unisys NAP ADPCM Audio", - 0x0171: "Unisys NAP ULAW Audio", - 0x0172: "Unisys NAP ALAW Audio", - 0x0173: "Unisys NAP 16K Audio", - 0x0174: "SyCom ACM SYC008 Audio", - 0x0175: "SyCom ACM SYC701 G.726L Audio", - 0x0176: "SyCom ACM SYC701 CELP54 Audio", - 0x0177: "SyCom ACM SYC701 CELP68 Audio", - 0x0178: "Knowledge Adventure ADPCM Audio", - 0x0180: "Fraunhofer IIS MPEG-2/AAC Audio", - 0x0190: "Digital Theatre Systems DTS DS Audio", - 0x0200: "Creative Labs ADPCM Audio", - 0x0202: "Creative Labs FastSpeech8 Audio", - 0x0203: "Creative Labs FastSpeech10 Audio", - 0x0210: "UHER Informatic ADPCM Audio", - 0x0215: "Ulead Systems DV Audio", - 0x0216: "Ulead Systems DV Audio 1", - 0x0220: "Quarterdeck Audio", - 0x0230: "I-Link Worldwide VC Audio", - 0x0240: "Aureal Semiconductor Raw Sport Audio", - 0x0241: "ESS Technology AC3 Audio", - 0x0249: "Generic Passthru Audio", - 0x0250: "Interactive Products HSX Audio", - 0x0251: "Interactive Products RPELP Audio", - 0x0260: "Consistent Software CS2 Audio", - 0x0270: "Sony SCX Audio", - 0x0271: "Sony SCY Audio", - 0x0272: "Sony ATRAC3 Audio", - 0x0273: "Sony SPC Audio", - 0x0280: "Telum Audio", - 0x0281: "Telum IA Audio", - 0x0285: "Norcom Electronics ADPCM Audio", - 0x0300: "Fujitsu FM Towns Sound", - 0x0350: "Micronas Semiconductors Audio", - 0x0351: "Micronas Semiconductors CELP833 Audio", - 0x0400: "Brooktree BTV Digital Audio", - 0x0401: "Intel Music Coder", - 0x0402: "Ligos Indeo Audio", - 0x0450: "QDesign Music", - 0x0500: "On2 VP7 Audio", - 0x0501: "On2 VP6 Audio", - 0x0680: "AT&T Labs VMPCM Audio", - 0x0681: "AT&T TPC Audio", - 0x08AE: "Clearjump LightWave Lossless Audio", - 0x1000: "Ing. C. Olivetti & C. GSM Audio", - 0x1001: "Ing. C. Olivetti & C. PCM Audio", - 0x1002: "Ing. C. Olivetti & C. CELP Audio", - 0x1003: "Ing. C. Olivetti & C. SBC Audio", - 0x1004: "Ing. C. Olivetti & C. OPR Audio", - 0x1100: "Lernout & Hauspie Audio", - 0x1101: "Lernout & Hauspie CELP Audio", - 0x1102: "Lernout & Hauspie SBC8 Audio", - 0x1103: "Lernout & Hauspie SBC12 Audio", - 0x1104: "Lernout & Hauspie SBC16 Audio", - 0x1400: "Norris Audio", - 0x1401: "ISIAudio Audio 2", - 0x1500: "AT&T Soundspace Musiccompress Audio", - 0x1600: "Microsoft MPEG-2 ADTS AAC Audio", - 0x1601: "Microsoft MPEG-2 RAW AAC Audio", - 0x1602: "Microsoft MPEG-4 Transport Streams (LOAS/LATM) Audio", - 0x1608: "Microsoft Nokia MPEG-2 ADTS AAC Audio", - 0x1609: "Microsoft Nokia MPEG-2 Raw AAC Audio", - 0x160A: "Microsoft Vodafone MPEG-2 ADTS AAC Audio", - 0x160B: "Microsoft Vodafone MPEG-2 Raw AAC Audio", - 0x1610: "Microsoft MPEG-2 AAC or MPEG-4 HE-AAC", - 0x181C: "Voxware RT24 Speech Audio", - 0x1971: "Sonic Foundry Lossless Audio", - 0x1979: "Innings Telecom ADPCM Audio", - 0x1C07: "Lucent SX8300P Audio", - 0x1C0C: "Lucent SX5363S Audio", - 0x1F03: "CUSeeMe Audio", - 0x1FC4: "NTCSoft ALF2CM ACM Audio", - 0x2000: "FAST Multimedia DVM Audio", - 0x2001: "DTS2 Audio", - 0x3313: "MakeAVIs Audio", - 0x4143: "Divio MPEG-4 AAC Audio", - 0x4201: "Nokia Adaptive Multirate Audio", - 0x4243: "Divio G.726 Audio", - 0x434C: "LEAD Technologies Speech Audio", - 0x564C: "LEAD Technologies Vorbis Audio", - 0x5756: "xiph.org Wavpack Audio", - 0x6C61: "Apple Lossless Audio Codec", - 0x674F: "Ogg Vorbis Mode 1 Audio", - 0x6750: "Ogg Vorbis Mode 2 Audio", - 0x6751: "Ogg Vorbis Mode 3 Audio", - 0x676F: "Ogg Vorbis Mode 1+ Audio", - 0x6770: "Ogg Vorbis Mode 2+ Audio", - 0x6771: "Ogg Vorbis Mode 3+ Audio", - 0x7000: "3COM NBX Audio", - 0x704F: "Ogg Opus Audio", - 0x706D: "FAAD AAC Audio", - 0x7361: "AMR Narrowband Audio", - 0x7362: "AMR Wideband Audio", - 0x7363: "AMR Wideband Plus Audio", - 0x7A21: "GSMA/3GPP CBR Audio", - 0x7A22: "GSMA/3GPP VBR Audio", - 0xA100: "Comverse Infosys G.723.1 Audio", - 0xA101: "Comverse Infosys AVQSBC Audio", - 0xA102: "Comverse Infosys SBC Audio", - 0xA103: "Symbol Technologies G.729.a Audio", - 0xA104: "VoiceAge AMR Wideband Audio", - 0xA105: "Ingenient Technologies G.726 Audio", - 0xA106: "ISO/MPEG-4 AAC Audio", - 0xA107: "Encore Software G.726 Audio", - 0xA108: "ZOLL Medical ASAO Audio", - 0xA109: "xiph.org Speex Audio", - 0xA10A: "Vianix MASC Audio", - 0xA10B: "Microsoft Windows Media 9 Spectrum Analyzer Audio", - 0xA10C: "Microsoft Windows Media Foundation Spectrum Analyzer Audio", - 0xA10D: "GSM 610 Audio", - 0xA10E: "GSM 620 Audio", - 0xA10F: "GSM 660 Audio", - 0xA110: "GSM 690 Audio", - 0xA111: "GSM Adaptive Multirate Wideband Audio", - 0xA112: "Polycom G.722 Audio", - 0xA113: "Polycom G.728 Audio", - 0xA114: "Polycom G.729.a Audio", - 0xA115: "Polycom Siren Audio", - 0xA116: "Global IP ILBC Audio", - 0xA117: "RadioTime Time Shift Radio Audio", - 0xA118: "Nice Systems ACA Audio", - 0xA119: "Nice Systems ADPCM Audio", - 0xA11A: "Vocord Telecom G.721 Audio", - 0xA11B: "Vocord Telecom G.726 Audio", - 0xA11C: "Vocord Telecom G.722.1 Audio", - 0xA11D: "Vocord Telecom G.728 Audio", - 0xA11E: "Vocord Telecom G.729 Audio", - 0xA11F: "Vocord Telecom G.729.a Audio", - 0xA120: "Vocord Telecom G.723.1 Audio", - 0xA121: "Vocord Telecom LBC Audio", - 0xA122: "Nice Systems G.728 Audio", - 0xA123: "France Telecom G.729 Audio", - 0xA124: "CODIAN Audio", - 0xF1AC: "FLAC Audio", - }; + public static readonly WAVE_FORMAT_TAGS: Map = new Map([ + [0x0000, "Unknown Wave Format"], + [0x0001, "PCM Audio"], + [0x0002, "Microsoft ADPCM"], + [0x0003, "PCM Audio in IEEE Floating-Point Format"], + [0x0004, "Compaq VSELP Audio"], + [0x0005, "IBM CVSD Audio"], + [0x0006, "Microsoft ALAW Audio"], + [0x0007, "Microsoft MULAW Audio"], + [0x0008, "Microsoft DTS Audio"], + [0x0009, "Microsoft DRM Encrypted Audio"], + [0x000A, "Microsoft Speech Ausio"], + [0x000B, "Microsoft Windows Media RT Voice Audio"], + [0x0010, "OKI ADPCM Audio"], + [0x0011, "Intel ADPCM Audio"], + [0x0012, "Videologic MediaSpace ADPCM Audio"], + [0x0013, "Sierra ADPCM Audio"], + [0x0014, "Antex G723 ADPCM Audio"], + [0x0015, "DSP Solutions DIGISTD Audio"], + [0x0016, "DSP Solutions DIGIFIX Audio"], + [0x0017, "Dialogic OKI ADPCM Audio"], + [0x0018, "Media Vision ADPCM Audio for Jazz 16"], + [0x0019, "HP CU Audio"], + [0x001A, "HP Dynamic Voice Audio"], + [0x0020, "Yamaha ADPCM Audio"], + [0x0021, "Speech Compression Sonarc Audio"], + [0x0022, "DSP Group True Speech Audio "], + [0x0023, "Echo Speech Audio"], + [0x0024, "Virtual Music Audiofile AF36 Audio"], + [0x0025, "Audio Processing Technology APTX Audio"], + [0x0026, "Virtual Music Audiofile AF10 Audio"], + [0x0027, "Aculab Prosody 1612 Speech Card Audio"], + [0x0028, "Merging Technologies LRC Audio"], + [0x0030, "Dolby AC2 Audio"], + [0x0031, "Microsoft Corporation GSM6.10 Audio"], + [0x0032, "Microsoft Corporation MSN Audio"], + [0x0033, "Antex ADPCME Audio"], + [0x0034, "Control Resources VQLPC Audio"], + [0x0035, "DSP Solutions Digireal Audio"], + [0x0036, "DSP Solutions DigiADPCM Audio"], + [0x0037, "Control Resources CR10 Audio"], + [0x0038, "Natural MicroSystems VBXADPCM Audio"], + [0x0039, "Crystal Semiconductor IMA ADPCM Audio"], + [0x003A, "Echo Speech Corporation Proprietary Audio Compression Format"], + [0x003B, "Rockwell ADPCM Audio"], + [0x003C, "Rockwell DIGITALK Audio"], + [0x003D, "Xebec Multimedia Solutions Proprietary Audio Compression Format"], + [0x0040, "Antex G721 ADPCM Audio"], + [0x0041, "Antex G728 CELP Audio"], + [0x0042, "Microsoft MSG723 Audio"], + [0x0043, "Intel G.723.1 Audio"], + [0x0044, "Intel G.729 Audio"], + [0x0045, "Sharp G.726 Audio"], + [0x0050, "Microsoft Corporation MPEG Audio"], + [0x0052, "InSoft RT24 Audio"], + [0x0053, "InSoft PAC Audio"], + [0x0055, "ISO/MPEG Layer 3 Audio"], + [0x0059, "Lucent G.723"], + [0x0060, "Cirrus Logic Audio"], + [0x0061, "ESS Technology PCM Audio"], + [0x0062, "Voxware Audio"], + [0x0063, "Canopus ATRAC Audio"], + [0x0064, "APICOM G.726 Audio"], + [0x0065, "APICOM G.722 Audio"], + [0x0066, "Microsoft DSAT Audio"], + [0x0067, "Microsoft DSAT Display Audio"], + [0x0069, "Voxware Byte Aligned Audio"], + [0x0070, "Voxware AC8 Audio"], + [0x0071, "Voxware AC10 Audio"], + [0x0072, "Voxware AC16 Audio"], + [0x0073, "Voxware AC20 Audio"], + [0x0074, "Voxware RT24 Audio"], + [0x0075, "Voxware RT29 Audio"], + [0x0076, "Voxware RT29HW Audio"], + [0x0077, "Voxware VR12 Audio"], + [0x0078, "Voxware VR18 Audio"], + [0x0079, "Voxware TQ40 Audio"], + [0x007A, "Voxware SC3 Audio"], + [0x007B, "Voxware SC3.1 Audio"], + [0x0080, "Softsound Audio"], + [0x0081, "Voxware TQ60 Audio"], + [0x0082, "Microsoft RT24"], + [0x0083, "AT&T G.729A Audio"], + [0x0084, "Motion Pixels MVI2 Audio"], + [0x0085, "DataFusion Systems G.726 Audio"], + [0x0086, "DataFusion Systems GSM610 Audio"], + [0x0088, "Iterated Systems Audio"], + [0x0089, "OnLive! Audio"], + [0x008A, "Multitude FT SX20 Audio"], + [0x008B, "Infocom ITS G.721 Audio"], + [0x008C, "Convedia G.729 Audio"], + [0x008D, "Congruency Audio"], + [0x0091, "Siemens Business Communications 24 Audio"], + [0x0092, "Sonic Foundry Dolby AC3 Audio"], + [0x0093, "MediaSonic G.723 Audio"], + [0x0094, "Aculab Prosody CTI Speech Card Audio"], + [0x0097, "ZyXEL ADPCM Audio"], + [0x0098, "Philips Speech Processing LPCBB Audio"], + [0x0099, "Studer Professional PACKED Audio"], + [0x00A0, "Malden Electronics Phony Talk Audio"], + [0x00A1, "Racal Recorders GSM Audio"], + [0x00A2, "Racal Recorders G.720.a Audio"], + [0x00A3, "Racal Recorders G.723.1 Audio"], + [0x00A4, "Racal Recorders Tetra ACELP Audio"], + [0x00B0, "NEC AAC Audio"], + [0x00FF, "AAC1 Audio"], + [0x0100, "Rhetorex ADPCM Audio"], + [0x0101, "BeCubed IRAT Audio"], + [0x0111, "Vivo G.723 Audio"], + [0x0112, "Vivo Siren Audio"], + [0x0120, "Philips Speech Processing CELP Audio"], + [0x0121, "Philips Speech Processing Grundig Audio"], + [0x0123, "DEC G.723 Audio"], + [0x0125, "Sanyo LD-ADPCM Audio"], + [0x0130, "Sipro Lab ACEPLNET Audio"], + [0x0131, "Sipro Lab ACELP4800 Audio"], + [0x0132, "Sipro Lab ACELP8v3 Audio"], + [0x0133, "Sipro Lab G.729 Audio"], + [0x0134, "Sipro Lab G.729.a Audio"], + [0x0135, "Sipro Lab Kelvin Audio"], + [0x0136, "VoiceAge AMR Audio"], + [0x0140, "Dictaphone G.726 Audio"], + [0x0141, "Dictaphone CELP68 Audio"], + [0x0142, "Dictaphone CELP54 Audio"], + [0x0150, "Qualcomm PureVoice Audio"], + [0x0151, "Qualcomm Half Rate Audio"], + [0x0155, "Ring Zero Systems TUBGSM Audio"], + [0x0160, "Microsoft WMA1 Audio"], + [0x0161, "Microsoft WMA2 Audio"], + [0x0162, "Microsoft Multichannel WMA Audio"], + [0x0163, "Microsoft Lossless WMA Audio"], + [0x0164, "Microsoft WMA SPDIF Audio"], + [0x0170, "Unisys NAP ADPCM Audio"], + [0x0171, "Unisys NAP ULAW Audio"], + [0x0172, "Unisys NAP ALAW Audio"], + [0x0173, "Unisys NAP 16K Audio"], + [0x0174, "SyCom ACM SYC008 Audio"], + [0x0175, "SyCom ACM SYC701 G.726L Audio"], + [0x0176, "SyCom ACM SYC701 CELP54 Audio"], + [0x0177, "SyCom ACM SYC701 CELP68 Audio"], + [0x0178, "Knowledge Adventure ADPCM Audio"], + [0x0180, "Fraunhofer IIS MPEG-2/AAC Audio"], + [0x0190, "Digital Theatre Systems DTS DS Audio"], + [0x0200, "Creative Labs ADPCM Audio"], + [0x0202, "Creative Labs FastSpeech8 Audio"], + [0x0203, "Creative Labs FastSpeech10 Audio"], + [0x0210, "UHER Informatic ADPCM Audio"], + [0x0215, "Ulead Systems DV Audio"], + [0x0216, "Ulead Systems DV Audio 1"], + [0x0220, "Quarterdeck Audio"], + [0x0230, "I-Link Worldwide VC Audio"], + [0x0240, "Aureal Semiconductor Raw Sport Audio"], + [0x0241, "ESS Technology AC3 Audio"], + [0x0249, "Generic Passthru Audio"], + [0x0250, "Interactive Products HSX Audio"], + [0x0251, "Interactive Products RPELP Audio"], + [0x0260, "Consistent Software CS2 Audio"], + [0x0270, "Sony SCX Audio"], + [0x0271, "Sony SCY Audio"], + [0x0272, "Sony ATRAC3 Audio"], + [0x0273, "Sony SPC Audio"], + [0x0280, "Telum Audio"], + [0x0281, "Telum IA Audio"], + [0x0285, "Norcom Electronics ADPCM Audio"], + [0x0300, "Fujitsu FM Towns Sound"], + [0x0350, "Micronas Semiconductors Audio"], + [0x0351, "Micronas Semiconductors CELP833 Audio"], + [0x0400, "Brooktree BTV Digital Audio"], + [0x0401, "Intel Music Coder"], + [0x0402, "Ligos Indeo Audio"], + [0x0450, "QDesign Music"], + [0x0500, "On2 VP7 Audio"], + [0x0501, "On2 VP6 Audio"], + [0x0680, "AT&T Labs VMPCM Audio"], + [0x0681, "AT&T TPC Audio"], + [0x08AE, "Clearjump LightWave Lossless Audio"], + [0x1000, "Ing. C. Olivetti & C. GSM Audio"], + [0x1001, "Ing. C. Olivetti & C. PCM Audio"], + [0x1002, "Ing. C. Olivetti & C. CELP Audio"], + [0x1003, "Ing. C. Olivetti & C. SBC Audio"], + [0x1004, "Ing. C. Olivetti & C. OPR Audio"], + [0x1100, "Lernout & Hauspie Audio"], + [0x1101, "Lernout & Hauspie CELP Audio"], + [0x1102, "Lernout & Hauspie SBC8 Audio"], + [0x1103, "Lernout & Hauspie SBC12 Audio"], + [0x1104, "Lernout & Hauspie SBC16 Audio"], + [0x1400, "Norris Audio"], + [0x1401, "ISIAudio Audio 2"], + [0x1500, "AT&T Soundspace Musiccompress Audio"], + [0x1600, "Microsoft MPEG-2 ADTS AAC Audio"], + [0x1601, "Microsoft MPEG-2 RAW AAC Audio"], + [0x1602, "Microsoft MPEG-4 Transport Streams (LOAS/LATM) Audio"], + [0x1608, "Microsoft Nokia MPEG-2 ADTS AAC Audio"], + [0x1609, "Microsoft Nokia MPEG-2 Raw AAC Audio"], + [0x160A, "Microsoft Vodafone MPEG-2 ADTS AAC Audio"], + [0x160B, "Microsoft Vodafone MPEG-2 Raw AAC Audio"], + [0x1610, "Microsoft MPEG-2 AAC or MPEG-4 HE-AAC"], + [0x181C, "Voxware RT24 Speech Audio"], + [0x1971, "Sonic Foundry Lossless Audio"], + [0x1979, "Innings Telecom ADPCM Audio"], + [0x1C07, "Lucent SX8300P Audio"], + [0x1C0C, "Lucent SX5363S Audio"], + [0x1F03, "CUSeeMe Audio"], + [0x1FC4, "NTCSoft ALF2CM ACM Audio"], + [0x2000, "FAST Multimedia DVM Audio"], + [0x2001, "DTS2 Audio"], + [0x3313, "MakeAVIs Audio"], + [0x4143, "Divio MPEG-4 AAC Audio"], + [0x4201, "Nokia Adaptive Multirate Audio"], + [0x4243, "Divio G.726 Audio"], + [0x434C, "LEAD Technologies Speech Audio"], + [0x564C, "LEAD Technologies Vorbis Audio"], + [0x5756, "xiph.org Wavpack Audio"], + [0x6C61, "Apple Lossless Audio Codec"], + [0x674F, "Ogg Vorbis Mode 1 Audio"], + [0x6750, "Ogg Vorbis Mode 2 Audio"], + [0x6751, "Ogg Vorbis Mode 3 Audio"], + [0x676F, "Ogg Vorbis Mode 1+ Audio"], + [0x6770, "Ogg Vorbis Mode 2+ Audio"], + [0x6771, "Ogg Vorbis Mode 3+ Audio"], + [0x7000, "3COM NBX Audio"], + [0x704F, "Ogg Opus Audio"], + [0x706D, "FAAD AAC Audio"], + [0x7361, "AMR Narrowband Audio"], + [0x7362, "AMR Wideband Audio"], + [0x7363, "AMR Wideband Plus Audio"], + [0x7A21, "GSMA/3GPP CBR Audio"], + [0x7A22, "GSMA/3GPP VBR Audio"], + [0xA100, "Comverse Infosys G.723.1 Audio"], + [0xA101, "Comverse Infosys AVQSBC Audio"], + [0xA102, "Comverse Infosys SBC Audio"], + [0xA103, "Symbol Technologies G.729.a Audio"], + [0xA104, "VoiceAge AMR Wideband Audio"], + [0xA105, "Ingenient Technologies G.726 Audio"], + [0xA106, "ISO/MPEG-4 AAC Audio"], + [0xA107, "Encore Software G.726 Audio"], + [0xA108, "ZOLL Medical ASAO Audio"], + [0xA109, "xiph.org Speex Audio"], + [0xA10A, "Vianix MASC Audio"], + [0xA10B, "Microsoft Windows Media 9 Spectrum Analyzer Audio"], + [0xA10C, "Microsoft Windows Media Foundation Spectrum Analyzer Audio"], + [0xA10D, "GSM 610 Audio"], + [0xA10E, "GSM 620 Audio"], + [0xA10F, "GSM 660 Audio"], + [0xA110, "GSM 690 Audio"], + [0xA111, "GSM Adaptive Multirate Wideband Audio"], + [0xA112, "Polycom G.722 Audio"], + [0xA113, "Polycom G.728 Audio"], + [0xA114, "Polycom G.729.a Audio"], + [0xA115, "Polycom Siren Audio"], + [0xA116, "Global IP ILBC Audio"], + [0xA117, "RadioTime Time Shift Radio Audio"], + [0xA118, "Nice Systems ACA Audio"], + [0xA119, "Nice Systems ADPCM Audio"], + [0xA11A, "Vocord Telecom G.721 Audio"], + [0xA11B, "Vocord Telecom G.726 Audio"], + [0xA11C, "Vocord Telecom G.722.1 Audio"], + [0xA11D, "Vocord Telecom G.728 Audio"], + [0xA11E, "Vocord Telecom G.729 Audio"], + [0xA11F, "Vocord Telecom G.729.a Audio"], + [0xA120, "Vocord Telecom G.723.1 Audio"], + [0xA121, "Vocord Telecom LBC Audio"], + [0xA122, "Nice Systems G.728 Audio"], + [0xA123, "France Telecom G.729 Audio"], + [0xA124, "CODIAN Audio"], + [0xF1AC, "FLAC Audio"], + ]); private readonly _averageBytesPerSecond: number; private readonly _bitsPerSample: number; @@ -300,12 +300,12 @@ export default class RiffWaveFormatEx implements ILosslessAudioCodec { throw new CorruptFileError("WAVE format data is too short"); } - this._formatTag = data.mid(0, 2).toUShort(false); - this._channels = data.mid(2, 2).toUShort(false); - this._samplesPerSecond = data.mid(4, 4).toUInt(false); - this._averageBytesPerSecond = data.mid(8, 4).toUInt(false); - this._blockAlign = data.mid(12, 2).toUShort(false); - this._bitsPerSample = data.mid(14, 2).toUShort(false); + this._formatTag = data.subarray(0, 2).toUshort(false); + this._channels = data.subarray(2, 2).toUshort(false); + this._samplesPerSecond = data.subarray(4, 4).toUint(false); + this._averageBytesPerSecond = data.subarray(8, 4).toUint(false); + this._blockAlign = data.subarray(12, 2).toUshort(false); + this._bitsPerSample = data.subarray(14, 2).toUshort(false); } // #region Properties @@ -340,10 +340,9 @@ export default class RiffWaveFormatEx implements ILosslessAudioCodec { /** @inheritDoc */ public get description(): string { - const formatTagString = this._formatTag.toString(16).padStart(4, "0").toUpperCase(); - return RiffWaveFormatEx.WAVE_FORMAT_TAGS[this._formatTag] === undefined - ? `Unknown Audio Format [0x${formatTagString}]` - : `${RiffWaveFormatEx.WAVE_FORMAT_TAGS[this._formatTag]} [0x${formatTagString}]`; + const fourccString = this._formatTag.toString(16).padStart(4, "0").toUpperCase(); + const formatString = RiffWaveFormatEx.WAVE_FORMAT_TAGS.get(this._formatTag) || "Unknown Audio Format"; + return `${formatString} [0x${fourccString}]`; } /** diff --git a/src/riff/waveFileSettings.ts b/src/riff/waveFileSettings.ts index 971f9eda..3fbd98d2 100644 --- a/src/riff/waveFileSettings.ts +++ b/src/riff/waveFileSettings.ts @@ -1,26 +1,32 @@ import {TagTypes} from "../tag"; import {NumberUtils} from "../utils"; +/** + * This class contains settings related to WAV file operations. Open files will need to be re-read + * in order for changes to take effect. + */ export default class WaveFileSettings { - public static readonly supportedTagTypes = TagTypes.DivX | TagTypes.Id3v2 | TagTypes.RiffInfo | TagTypes.MovieId; + public static readonly SUPPORTED_TAG_TYPES = TagTypes.DivX | TagTypes.Id3v2 | TagTypes.RiffInfo | TagTypes.MovieId; - private static _defaultTagTypes = WaveFileSettings.supportedTagTypes; + private static _defaultTagTypes = WaveFileSettings.SUPPORTED_TAG_TYPES; /** - * Gets the default types of tags for an AAC file. When opening a file, if these tag types do + * Gets the default types of tags for an WAV file. When opening a file, if these tag types do * not exist on the file, they will be created. */ public static get defaultTagTypes(): TagTypes { return this._defaultTagTypes; } /** - * Sets the default types of tags for an AAC file. When opening a file, if these tag types do - * not exist on the file, they will be created. See {@link supportedTagTypes} for a list of tag - * types that are supported by node-taglib-sharp for AAC files. + * Sets the default types of tags for an WAV file. When opening a file, if these tag types do + * not exist on the file, they will be created. See {@link SUPPORTED_TAG_TYPES} for a list of tag + * types that are supported by node-taglib-sharp for WAV files. */ public static set defaultTagTypes(value: TagTypes) { - const unsupportedTagTypes = NumberUtils.uintAnd(value, ~this.supportedTagTypes); + const unsupportedTagTypes = NumberUtils.uintAnd(value, ~this.SUPPORTED_TAG_TYPES); if (unsupportedTagTypes !== 0) { - throw new Error(`Argument error: node-taglib-sharp does not support tag types ${unsupportedTagTypes} for AVI files`); + throw new Error( + `Argument error: node-taglib-sharp does not support tag types ${unsupportedTagTypes} for AVI files` + ); } this._defaultTagTypes = value; diff --git a/src/sandwich/endTag.ts b/src/sandwich/endTag.ts index af9ca5bf..4c75982a 100644 --- a/src/sandwich/endTag.ts +++ b/src/sandwich/endTag.ts @@ -20,7 +20,7 @@ import {Guards} from "../utils"; * but could be used by other classes. It currently supports ID3v1, ID3v2, and APE tags. */ export default class EndTag extends CombinedTag { - public static readonly supportedTagTypes: TagTypes = TagTypes.Ape | TagTypes.Id3v1 | TagTypes.Id3v2; + public static readonly SUPPORTED_TAG_TYPES: TagTypes = TagTypes.Ape | TagTypes.Id3v1 | TagTypes.Id3v2; /** * Constructs and initializes a new instance of an end tab by reading a file from the end until @@ -29,7 +29,7 @@ export default class EndTag extends CombinedTag { * @param readStyle */ public constructor(file: File, readStyle: ReadStyle) { - super(EndTag.supportedTagTypes); + super(EndTag.SUPPORTED_TAG_TYPES, true); Guards.truthy(file, "file"); this.read(file, readStyle); @@ -102,51 +102,50 @@ export default class EndTag extends CombinedTag { */ class EndTagParser extends TagParser { // Size of the block to read when looking for a tag footer, this must be large enough to - // contain the largest footer identifier (a the time of writing, this is ID3v1) - private static readonly readSize = Math.max( - ApeTagFooter.size, + // contain the largest footer identifier (at the time of writing, this is ID3v1) + private static readonly READ_SIZE = Math.max( + ApeTagFooter.SIZE, Id3v2Settings.footerSize, - Id3v1Tag.size + Id3v1Tag.TOTAL_SIZE ); - private static readonly identifierMappings = [ + private static readonly IDENTIFIER_MAPPINGS = [ { - action: (f: File, p: number, _rs: ReadStyle) => ApeTag.fromFile(f, p), - identifier: ApeTagFooter.fileIdentifier, - offset: ApeTagFooter.size, + action: (f: File, p: number) => ApeTag.fromFile(f, p), + identifier: ApeTagFooter.FILE_IDENTIFIER, + offset: ApeTagFooter.SIZE, }, { action: (f: File, p: number, rs: ReadStyle) => Id3v2Tag.fromFileEnd(f, p + Id3v2Settings.footerSize, rs), - identifier: Id3v2TagFooter.fileIdentifier, + identifier: Id3v2TagFooter.FILE_IDENTIFIER, offset: Id3v2Settings.footerSize }, { - action: (f: File, p: number, _rs: ReadStyle) => Id3v1Tag.fromFile(f, p), - identifier: Id3v1Tag.fileIdentifier, - offset: Id3v1Tag.size + action: (f: File, p: number) => Id3v1Tag.fromFile(f, p), + identifier: Id3v1Tag.FILE_IDENTIFIER, + offset: Id3v1Tag.TOTAL_SIZE } ]; public constructor(file: File, readStyle: ReadStyle) { - super(file, readStyle); - this._fileOffset = Math.max(this._file.length - EndTagParser.readSize, 0); + super(file, readStyle, Math.max(file.length - EndTagParser.READ_SIZE, 0)); } public read(): boolean { try { // This check lets us more gracefully handle files that have <128 bytes of media - let readSize = EndTagParser.readSize; - if (this._fileOffset < 0) { - const overflow = this._fileOffset * -1; - this._fileOffset = 0; + let readSize = EndTagParser.READ_SIZE; + if (this.fileOffset < 0) { + const overflow = this.fileOffset * -1; + this.fileOffset = 0; readSize -= overflow; } // Read a footer from the file - this._file.seek(this._fileOffset); - const tagFooterBlock = this._file.readBlock(readSize); + this.file.seek(this.fileOffset); + const tagFooterBlock = this.file.readBlock(readSize); // Check for any identifiers of a tag - for (const mapping of EndTagParser.identifierMappings) { + for (const mapping of EndTagParser.IDENTIFIER_MAPPINGS) { // If we don't have enough bytes to check for this mapping, skip it if (mapping.offset > tagFooterBlock.length) { continue; @@ -155,8 +154,8 @@ class EndTagParser extends TagParser { // Calculate how far from the end of the block to check const offset = tagFooterBlock.length - mapping.offset; if (tagFooterBlock.containsAt(mapping.identifier, offset)) { - this._currentTag = mapping.action(this._file, this._fileOffset + offset, this._readStyle); - this._fileOffset -= this._currentTag.sizeOnDisk; + this.currentTag = mapping.action(this.file, this.fileOffset + offset, this.readStyle); + this.fileOffset -= this.currentTag.sizeOnDisk; return true; } } diff --git a/src/sandwich/sandwichFile.ts b/src/sandwich/sandwichFile.ts index eb74428f..10b5763d 100644 --- a/src/sandwich/sandwichFile.ts +++ b/src/sandwich/sandwichFile.ts @@ -1,13 +1,25 @@ import EndTag from "./endTag"; import SandwichTag from "./sandwichTag"; -import Properties from "../properties"; +import Settings from "../settings"; import StartTag from "./startTag"; import {File, FileAccessMode, ReadStyle} from "../file"; import {IFileAbstraction} from "../fileAbstraction"; +import {Properties} from "../properties"; import {Tag, TagTypes} from "../tag"; +import {NumberUtils} from "../utils"; +/** + * Interface for a sandwich file. + */ export interface ISandwichFile { + /** + * Gets the position at which the media content of this file ends. + */ readonly mediaEndPosition: number; + + /** + * Gets the position at which the media content of this file starts. + */ readonly mediaStartPosition: number; } @@ -40,20 +52,22 @@ export default abstract class SandwichFile extends File implements ISandwichFile this._mediaStartPosition = this.startTag.sizeOnDisk; this._mediaEndPosition = this.length - this.endTag.sizeOnDisk; this._properties = this.readProperties(readStyle); - this._tagTypesOnDisk = this.tagTypes; + this.tagTypesOnDisk = this.tagTypes; } finally { this.mode = FileAccessMode.Closed; } // Create the default tags for (const tagType of defaultTagMappingTable.keys()) { - // Don't create tag if its not desired or already exists - if ((defaultTags & tagType) === 0 || (this._tag.tagTypes & tagType) !== 0) { + // Don't create tag if it's not desired or already exists + const isDefault = NumberUtils.hasFlag(defaultTags, tagType); + const existsAlready = NumberUtils.hasFlag(this._tag.tagTypes, tagType); + if (!isDefault || existsAlready) { continue; } // Tag is expected to exist - this._tag.createTag(tagType, true); + this._tag.createTag(tagType, Settings.copyExistingTagsToNewDefaultTags); } } @@ -69,16 +83,12 @@ export default abstract class SandwichFile extends File implements ISandwichFile */ protected get startTag(): StartTag { return this._tag.startTag; } - /** - * Gets the position at which the media content of this file ends. - */ + /** @inheritDoc */ get mediaEndPosition(): number { return this._mediaEndPosition; } - /** - * Gets the position at which the media content of this file starts. - */ + /** @inheritDoc */ get mediaStartPosition(): number { return this._mediaStartPosition; } @@ -132,7 +142,7 @@ export default abstract class SandwichFile extends File implements ISandwichFile // Calculate the new media start and end positions this._mediaStartPosition = startTagBytes.length; this._mediaEndPosition = this.length - endTagBytes.length; - this._tagTypesOnDisk = this.tagTypes; + this.tagTypesOnDisk = this.tagTypes; } finally { this.mode = FileAccessMode.Closed; } diff --git a/src/sandwich/sandwichTag.ts b/src/sandwich/sandwichTag.ts index 924d6d77..b6a8eec7 100644 --- a/src/sandwich/sandwichTag.ts +++ b/src/sandwich/sandwichTag.ts @@ -14,7 +14,7 @@ import {Guards} from "../utils"; * example, use this pattern. Therefore the name was changed to better represent the situation. */ export default class SandwichTag extends CombinedTag { - public static readonly supportedTagTypes = TagTypes.Ape | TagTypes.Id3v1 | TagTypes.Id3v2; + public static readonly SUPPORTED_TAG_TYPES = TagTypes.Ape | TagTypes.Id3v1 | TagTypes.Id3v2; private readonly _defaultTagMappingTable: Map boolean>; private readonly _endTag: EndTag; @@ -30,7 +30,7 @@ export default class SandwichTag extends CombinedTag { * whether a tag type goes into the end tag or start tag */ public constructor(file: File, readStyle: ReadStyle, defaultTagMappingTable: Map boolean>) { - super(SandwichTag.supportedTagTypes); + super(SandwichTag.SUPPORTED_TAG_TYPES, true); Guards.truthy(file, "file"); Guards.truthy(defaultTagMappingTable, "defaultTagMappingTable"); diff --git a/src/sandwich/startTag.ts b/src/sandwich/startTag.ts index 950d7a3f..a6f382b6 100644 --- a/src/sandwich/startTag.ts +++ b/src/sandwich/startTag.ts @@ -18,7 +18,7 @@ import {Guards} from "../utils"; * file but could be used by other classes. It currently supports ID3v2 and APE tags. */ export default class StartTag extends CombinedTag { - public static readonly supportedTagTypes: TagTypes = TagTypes.Ape | TagTypes.Id3v2; + public static readonly SUPPORTED_TAG_TYPES: TagTypes = TagTypes.Ape | TagTypes.Id3v2; /** * Constructs and initializes a new instance by reading tags from the beginning of the @@ -27,7 +27,7 @@ export default class StartTag extends CombinedTag { * @param readStyle How deeply to read the tag and its properties */ public constructor(file: File, readStyle: ReadStyle) { - super(StartTag.supportedTagTypes); + super(StartTag.SUPPORTED_TAG_TYPES, true); Guards.truthy(file, "file"); this.read(file, readStyle); } @@ -35,7 +35,7 @@ export default class StartTag extends CombinedTag { // #region Public Methods /** @inheritDoc */ - public createTag(type: TagTypes, copy: boolean) { + public createTag(type: TagTypes, copy: boolean): Tag { this.validateTagCreation(type); let tag: Tag; @@ -90,37 +90,36 @@ export default class StartTag extends CombinedTag { class StartTagParser extends TagParser { // Size of the block to read when looking for a tag header, this must be large to contain the // largest header identifier (at the time of writing, this is APE). - private static readonly readSize = Math.max( - ApeTagFooter.size, + private static readonly READ_SIZE = Math.max( + ApeTagFooter.SIZE, Id3v2Settings.headerSize ); - private static readonly identifierMappings = [ + private static readonly IDENTIFIER_MAPPINGS = [ { - action: (f: File, p: number, _rs: ReadStyle) => ApeTag.fromFile(f, p), - identifier: ApeTagFooter.fileIdentifier, + action: (f: File, p: number) => ApeTag.fromFile(f, p), + identifier: ApeTagFooter.FILE_IDENTIFIER, }, { action: (f: File, p: number, rs: ReadStyle) => Id3v2Tag.fromFileStart(f, p, rs), - identifier: Id3v2TagHeader.fileIdentifier + identifier: Id3v2TagHeader.FILE_IDENTIFIER } ]; public constructor(file: File, readStyle: ReadStyle) { - super(file, readStyle); - this._fileOffset = 0; + super(file, readStyle, 0); } public read(): boolean { try { // Read a header from the file - this._file.seek(this._fileOffset); - const tagHeaderBlock = this._file.readBlock(StartTagParser.readSize); + this.file.seek(this.fileOffset); + const tagHeaderBlock = this.file.readBlock(StartTagParser.READ_SIZE); // Check for any identifier of a tag - for (const mapping of StartTagParser.identifierMappings) { + for (const mapping of StartTagParser.IDENTIFIER_MAPPINGS) { if (tagHeaderBlock.startsWith(mapping.identifier)) { - this._currentTag = mapping.action(this._file, this._fileOffset, this._readStyle); - this._fileOffset += this._currentTag.sizeOnDisk; + this.currentTag = mapping.action(this.file, this.fileOffset, this.readStyle); + this.fileOffset += this.currentTag.sizeOnDisk; return true; } } diff --git a/src/sandwich/tagParsers.ts b/src/sandwich/tagParsers.ts index dff48dd4..c898853b 100644 --- a/src/sandwich/tagParsers.ts +++ b/src/sandwich/tagParsers.ts @@ -7,13 +7,15 @@ import {File, ReadStyle} from "../file"; * returns `true` the tag that was just read can be read from {@link currentTag}. */ export default abstract class TagParser { - protected _currentTag: Tag; - protected _file: File; - protected _fileOffset: number; - protected _readStyle: ReadStyle; + // @TODO: Don't allow access to member variables + private readonly _file: File; + private readonly _readStyle: ReadStyle; + private _currentTag: Tag; + private _fileOffset: number; - protected constructor(file: File, readStyle: ReadStyle) { + protected constructor(file: File, readStyle: ReadStyle, initialOffset: number) { this._file = file; + this._fileOffset = initialOffset; this._readStyle = readStyle; } @@ -22,6 +24,14 @@ export default abstract class TagParser { * The value is not guaranteed if {@link read} returns `false` */ public get currentTag(): Tag { return this._currentTag; } + protected set currentTag(value: Tag) { this._currentTag = value; } + + protected get file(): File { return this._file; } + + protected get fileOffset(): number { return this._fileOffset; } + protected set fileOffset(value: number) { this._fileOffset = value; } + + protected get readStyle(): ReadStyle { return this._readStyle; } /** * Reads the next tag from the file. diff --git a/src/settings.ts b/src/settings.ts new file mode 100644 index 00000000..9803275b --- /dev/null +++ b/src/settings.ts @@ -0,0 +1,22 @@ +/** + * General settings for the node-taglib-sharp libary. + */ +export default class Settings { + private static _copyExistingTagsToNewDefaultTags: boolean = true; + + /** + * Gets whether or not existing tags should be copied into newly created default tags. + * If `true`, tags that already exist in the file will be copied into any newly created default + * tags. If `false`, newly created default tags will be left empty. + */ + public static get copyExistingTagsToNewDefaultTags(): boolean { return this._copyExistingTagsToNewDefaultTags; } + + /** + * Sets whether or not existing tags should be copied into newly created default tags. + * If `true`, tags that already exist in the file will be copied into any newly created default + * tags. If `false`, newly created default tags will be left empty. + */ + public static set copyExistingTagsToNewDefaultTags(value: boolean) { + this._copyExistingTagsToNewDefaultTags = value; + } +} diff --git a/src/stream.ts b/src/stream.ts index 054403bb..781097ce 100644 --- a/src/stream.ts +++ b/src/stream.ts @@ -3,12 +3,30 @@ import * as fs from "fs"; import {Guards} from "./utils"; import {ByteVector} from "./byteVector"; +/** + * Indicates there the seek operation should begin. + */ export enum SeekOrigin { + /** + * Seek should begin at the start of the file. + */ Begin, + + /** + * Seek should begin at the current position in the file. + */ Current, + + /** + * Seek should begin at the end of the file. + */ End } +/** + * Interface for a stream, it wraps around a file descriptor to make reading and writing to files + * using node IO a lot easier. + */ export interface IStream { /** * Whether or not the stream can be written to @@ -131,7 +149,7 @@ export class Stream implements IStream { } /** @inheritDoc */ - public seek(offset: number, origin: SeekOrigin) { + public seek(offset: number, origin: SeekOrigin): void { Guards.safeInt(offset, "offset"); switch (origin) { case SeekOrigin.Begin: @@ -168,7 +186,7 @@ export class Stream implements IStream { public write(buffer: Uint8Array | ByteVector, bufferOffset: number, length: number): number { // Make sure we standardize on a Uint8Array if (buffer instanceof ByteVector) { - buffer = buffer.data; + buffer = buffer.toByteArray(); } if (!this._canWrite) { diff --git a/src/tag.ts b/src/tag.ts index 7f19a959..e4659001 100644 --- a/src/tag.ts +++ b/src/tag.ts @@ -1,4 +1,4 @@ -import {IPicture} from "./ipicture"; +import {IPicture} from "./picture"; import {Guards} from "./utils"; /** @@ -986,7 +986,18 @@ export abstract class Tag { public set pictures(value: IPicture[]) { /* no-op in abstract case */ } /** - * Gets the the first value contained in {@link albumArtists}. + * Gets whether or not the album described by the current instance is a compilation. + */ + public get isCompilation(): boolean { return false; } + + /** + * Gets whether or not the album described by the current instance is a compilation. + * @param value Whether or not the album described by the current instance is a compilation + */ + public set isCompilation(value: boolean) { /* no-op in abstract case */ } + + /** + * Gets the first value contained in {@link albumArtists}. */ public get firstAlbumArtist(): string { return Tag.firstInGroup(this.albumArtists); } @@ -1051,7 +1062,7 @@ export abstract class Tag { * may be extended by child classes to support other values. * @returns `true` if the current instance does not contain any values. `false` otherwise */ - public get isEmpty() { + public get isEmpty(): boolean { return Tag.isFalsyOrLikeEmpty(this.title) && Tag.isFalsyOrLikeEmpty(this.grouping) && Tag.isFalsyOrLikeEmpty(this.albumArtists) && @@ -1092,7 +1103,7 @@ export abstract class Tag { * `undefined` or empty * @protected */ - protected static firstInGroup(group: string[]) { + protected static firstInGroup(group: string[]): string { return !group || group.length === 0 ? undefined : group[0]; @@ -1105,7 +1116,7 @@ export abstract class Tag { * or undefined if the array is `undefined` or empty. * @protected */ - protected static joinGroup(group: string[]) { + protected static joinGroup(group: string[]): string { return !group || group.length === 0 ? undefined : group.join("; "); diff --git a/src/utils.ts b/src/utils.ts index 9faf3202..498f4476 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -6,6 +6,12 @@ export class Guards { private static readonly MAX_ULONG = BigInt("18446744073709551615"); private static readonly MIN_LONG = BigInt("-9223372036854775808"); + public static all(value: TElement[], guard: (val: TElement, name: string) => void, name: string): void { + for (const element of value) { + guard(element, `All elements in ${name}`); + } + } + public static betweenExclusive(value: number, minValue: number, maxValue: number, name: string): void { if (value <= minValue || value >= maxValue) { throw new Error(`Argument out of range: ${name} must satisfy ${maxValue} <= ${name} <= ${minValue}`); @@ -24,7 +30,7 @@ export class Guards { } } - public static greaterThanInclusive(value: number, lowerBound: number, name: string) { + public static greaterThanInclusive(value: number, lowerBound: number, name: string): void { if (value < lowerBound) { throw new Error(`Argument out of range: ${name} must greater than ${lowerBound}`); } @@ -36,19 +42,19 @@ export class Guards { } } - public static lessThanInclusive(value: number, upperBound: number, name: string) { + public static lessThanInclusive(value: number, upperBound: number, name: string): void { if (value > upperBound) { throw new Error(`Argument out of range: ${name} must be less than ${upperBound}`); } } - public static long(value: bigint, name: string) { + public static long(value: bigint, name: string): void { if (value > Guards.MAX_LONG || value < Guards.MIN_LONG) { throw new Error(`Argument out of range: ${name} must be a 64-bit integer`); } } - public static notNullOrUndefined(value: any, name: string): void { + public static notNullOrUndefined(value: unknown, name: string): void { if (value === undefined || value === null) { throw new Error(`Argument null: ${name} was not provided`); } @@ -117,19 +123,19 @@ export class Guards { } export class StringComparison { - public static CaseInsensitive(a: string, b: string): boolean { + public static caseInsensitive(a: string, b: string): boolean { Guards.notNullOrUndefined(a, "a"); Guards.notNullOrUndefined(b, "b"); return a.toUpperCase() === b.toUpperCase(); } - public static CaseSensitive(a: string, b: string): boolean { + public static caseSensitive(a: string, b: string): boolean { return a === b; } } export class FileUtils { - public static getExtension(name: string) { + public static getExtension(name: string): string { let ext = Path.extname(name); if (!ext) { ext = name.startsWith(".") ? name.substring(1) : name; @@ -170,6 +176,12 @@ export class NumberUtils { return result; } + public static hasFlag(haystack: number, needle: number, strict: boolean = false): boolean { + return strict + ? (haystack & needle) === needle + : (haystack & needle) !== 0; + } + /** * Performs the same operation as ldexp does in C/C++ * @param x Number to be multiplied by 2^y @@ -203,12 +215,21 @@ export class NumberUtils { /** * Provides way to do unsigned bitwise OR without all the mess of parenthesis. + * @param numbers Operands to bitwise or together + * @returns Number (x | y | ...) >>> 0 + */ + public static uintOr(... numbers: number[]): number { + return numbers.reduce((acc, cur) => (acc | cur) >>> 0, 0); + } + + /** + * Provides way to do unsigned bitwise XOR without all the mess of parenthesis. * @param x Left operand - * @param y Right operand - * @returns Number (x | y) >>> 0 + * @param y Right operant + * @returns Number (x ^ y) >>> 0 */ - public static uintOr(x: number, y: number): number { - return (x | y) >>> 0; + public static uintXor(x: number, y: number): number { + return (x ^ y) >>> 0; } /** @@ -273,7 +294,7 @@ export class NumberUtils { export class StringUtils { public static trimStart(toTrim: string, chars: string): string { while (toTrim.length > 0 && chars.indexOf(toTrim[0]) > -1) { - toTrim = toTrim.substr(0); + toTrim = toTrim.substring(0); } return toTrim; } diff --git a/src/uuidWrapper.ts b/src/uuidWrapper.ts index cb832070..4691e155 100644 --- a/src/uuidWrapper.ts +++ b/src/uuidWrapper.ts @@ -1,20 +1,21 @@ import * as Uuid from "uuid"; +import {ByteVector} from "./byteVector"; /** * Wrapper around the UUID package to make it easier to handle UUIDs. */ export default class UuidWrapper { private static readonly GUID_REGEX = - new RegExp(/([0-9A-F]{8})-?([0-9A-F]{4})-?([0-9A-F]{4})-?([0-9A-F]{4})-?([0-9A-F]{12})/i); + new RegExp(/([\dA-F]{8})-?([\dA-F]{4})-?([\dA-F]{4})-?([\dA-F]{4})-?([\dA-F]{12})/i); - private readonly _bytes: Uint8Array; + private readonly _bytes: ByteVector; /** * Constructs a instance using either the supplied UUID or generating a new, random one. * @param source If provided, it is used as the bytes of the instance. If a falsy value is * provided, a new v4 UUID will be generated. */ - public constructor(source?: Uint8Array | string) { + public constructor(source?: ByteVector | string) { // Temporary implementation - it's probably not perfect if (!source) { // Source wasn't provided, generate a new guid string @@ -41,10 +42,10 @@ export default class UuidWrapper { dv.setUint16(8, short3, false); for (let i = 0; i < 12; i += 2) { - bytes[10 + i / 2] = Number.parseInt(match[5].substr(i, 2), 16); + bytes[10 + i / 2] = Number.parseInt(match[5].substring(i, i + 2), 16); } - source = bytes; + source = ByteVector.fromByteArray(bytes); } if (source.length !== 16) { @@ -72,7 +73,7 @@ export default class UuidWrapper { public equals(b: UuidWrapper): boolean { if (!b || this._bytes.length !== b._bytes.length) { return false; } for (let i = 0; i < this._bytes.length; i++) { - if (this._bytes[i] !== b._bytes[i]) { + if (this._bytes.get(i) !== b._bytes.get(i)) { return false; } } @@ -83,21 +84,23 @@ export default class UuidWrapper { /** * Gets the bytes that make up the UUID. */ - public toBytes(): Uint8Array { return this._bytes.slice(); } + public toBytes(): ByteVector { return this._bytes.toByteVector(); } /** * Gets a string representation of the UUID. */ public toString(): string { - // Temporary implementation - it's probably not perfect - const dv = new DataView(this._bytes.buffer); - return `${dv.getUint32(0, true).toString(16)}-` + - `${dv.getUint16(4, true).toString(16)}-` + - `${dv.getUint16(6, true).toString(16)}-` + - `${dv.getUint16(8, false).toString(16)}-` + - `${this._bytes[10].toString(16).padStart(2, "0")}${this._bytes[11].toString(16).padStart(2, "0")}` + - `${this._bytes[12].toString(16).padStart(2, "0")}${this._bytes[13].toString(16).padStart(2, "0")}` + - `${this._bytes[14].toString(16).padStart(2, "0")}${this._bytes[15].toString(16).padStart(2, "0")}`; + const bytes1 = this._bytes.subarray(0, 4).toUint(false); + const bytes2 = this._bytes.subarray(4, 2).toUshort(false); + const bytes3 = this._bytes.subarray(6, 2).toUshort(false); + const bytes4 = this._bytes.subarray(8, 2).toUshort(true); + const bytes5 = this._bytes.subarray(10, 4).toUint(true); + const bytes6 = this._bytes.subarray(14, 2).toUshort(true); + return `${bytes1.toString(16)}-` + + `${bytes2.toString(16)}-` + + `${bytes3.toString(16)}-` + + `${bytes4.toString(16)}-` + + `${bytes5.toString(16).padStart(4, "0")}${bytes6.toString(16).padStart(2, "0")}`; // @TODO: This implementation is commented out b/c the uuid package doesn't appear to // follow RFC byte formatting of a GUID. See https://github.com/uuidjs/uuid/issues/503 diff --git a/src/xiph/xiphComment.ts b/src/xiph/xiphComment.ts index be58ae4b..8915ba3d 100644 --- a/src/xiph/xiphComment.ts +++ b/src/xiph/xiphComment.ts @@ -1,11 +1,10 @@ -import Picture from "../picture"; +import * as DateFormat from "dateformat"; import XiphPicture from "./xiphPicture"; import XiphSettings from "./xiphSettings"; -import {Tag, TagTypes} from "../tag"; -import {IPicture} from "../iPicture"; import {ByteVector, StringType} from "../byteVector"; +import {IPicture, Picture} from "../picture"; +import {Tag, TagTypes} from "../tag"; import {Guards} from "../utils"; -import * as DateFormat from "dateformat"; /** * Provides support for reading and writing Xiph comment-style tags. @@ -14,8 +13,8 @@ import * as DateFormat from "dateformat"; * each field can have multiple values. */ export default class XiphComment extends Tag { - private static readonly newPictureFiled = "METADATA_BLOCK_PICTURE"; - private static readonly oldPictureField = "COVERART"; + private static readonly NEW_PICTURE_FIELD = "METADATA_BLOCK_PICTURE"; + private static readonly OLD_PICTURE_FIELD = "COVERART"; private _fields: Map = new Map(); private _pictures: IPicture[] = []; @@ -32,8 +31,9 @@ export default class XiphComment extends Tag { * Constructs and initializes a new instance by reading the contents of a raw Xiph comment from * a {@link ByteVector} object. * @param data Object containing a raw Xiph comment, cannot be falsey + * @param lazyLoadPictures Whether or not to load pictures lazily */ - public static fromData(data: ByteVector): XiphComment { + public static fromData(data: ByteVector, lazyLoadPictures: boolean): XiphComment { Guards.truthy(data, "data"); const xiphComment = new XiphComment(); @@ -42,21 +42,21 @@ export default class XiphComment extends Tag { // The first thing in the comment data is the vendor ID length, followed by a UTF8 string // with the vendor ID. let pos = 0; - const vendorLength = data.mid(pos, 4).toUInt(false); + const vendorLength = data.subarray(pos, 4).toUint(false); pos += 4; - xiphComment._vendorId = data.toString(vendorLength, StringType.UTF8, pos); + xiphComment._vendorId = data.subarray(pos, vendorLength).toString(StringType.UTF8); pos += vendorLength; // Next, the number of fields in the comment vector - const commentFields = data.mid(pos, 4).toUInt(false); + const commentFields = data.subarray(pos, 4).toUint(false); pos += 4; for (let i = 0; i < commentFields; i++) { // Each comment field is in the format KEY=value in a UTF8 string and has a 32-bit uint // before it with the length. - const commentLength = data.mid(pos, 4).toUInt(false); + const commentLength = data.subarray(pos, 4).toUint(false); pos += 4; - const comment = data.toString(commentLength, StringType.UTF8, pos); + const comment = data.subarray(pos, commentLength).toString(StringType.UTF8); pos += commentLength; const commentSeparatorPosition = comment.indexOf("="); @@ -65,21 +65,22 @@ export default class XiphComment extends Tag { continue; } - const key = comment.substr(0, commentSeparatorPosition).toUpperCase(); - const value = comment.substr(commentSeparatorPosition + 1); + const key = comment.substring(0, commentSeparatorPosition).toUpperCase(); + const value = comment.substring(commentSeparatorPosition + 1); switch (key) { - case XiphComment.oldPictureField: + case XiphComment.OLD_PICTURE_FIELD: // Old picture fields are just base64 encoded picture bytes - const pictureBytes = ByteVector.fromByteArray(Buffer.from(value, "base64")); + // TODO: Allow picture to be lazily decoded + const pictureBytes = ByteVector.fromBase64String(value); const oldPicture = Picture.fromData(pictureBytes); xiphComment._pictures.push(oldPicture); break; - case XiphComment.newPictureFiled: + case XiphComment.NEW_PICTURE_FIELD: // New picture fields have details! // TODO: Allow read style to be passed in - const newPicture = XiphPicture.fromXiphComment(value, true); + const newPicture = XiphPicture.fromXiphComment(value, lazyLoadPictures); xiphComment._pictures.push(newPicture); break; @@ -137,6 +138,7 @@ export default class XiphComment extends Tag { public get tagTypes(): TagTypes { return TagTypes.Xiph; } /** @inheritDoc */ + // TODO: This value is never updated after a save!! public get sizeOnDisk(): number { return this._sizeOnDisk; } /** @@ -307,7 +309,7 @@ export default class XiphComment extends Tag { const text = this.getFieldFirstValue("DATE"); if (!text) { return 0; } - const parsedText = Number.parseInt(text.substr(0, 4), 10); + const parsedText = Number.parseInt(text.substring(0, 4), 10); return Number.isNaN(parsedText) ? 0 : parsedText; } /** @@ -846,7 +848,7 @@ export default class XiphComment extends Tag { const encodedField = `${k}=${v}`; const fieldDatum = ByteVector.fromString(encodedField, StringType.UTF8); return ByteVector.concatenate( - ByteVector.fromUInt(fieldDatum.length, false), + ByteVector.fromUint(fieldDatum.length, false), fieldDatum ); }); @@ -859,18 +861,18 @@ export default class XiphComment extends Tag { // @TODO: Allow configuration of which field to store pictures const pictureData = this._pictures.map((p) => { const xiphPicture = p instanceof XiphPicture ? p : XiphPicture.fromPicture(p); - const encodedPicture = `${XiphComment.newPictureFiled}=${xiphPicture.renderForXiphComment()}`; + const encodedPicture = `${XiphComment.NEW_PICTURE_FIELD}=${xiphPicture.renderForXiphComment()}`; return ByteVector.concatenate( - ByteVector.fromUInt(encodedPicture.length, false), + ByteVector.fromUint(encodedPicture.length, false), ByteVector.fromString(encodedPicture, StringType.UTF8) ); }); // Put it all together const result = ByteVector.concatenate( - ByteVector.fromUInt(vendor.length, false), + ByteVector.fromUint(vendor.length, false), vendor, - ByteVector.fromUInt(allFieldData.length + pictureData.length, false), + ByteVector.fromUint(allFieldData.length + pictureData.length, false), ... allFieldData, ... pictureData ); @@ -936,8 +938,8 @@ export default class XiphComment extends Tag { // #region Private Methods private static isPictureField(fieldName: string): boolean { - return fieldName === XiphComment.oldPictureField - || fieldName === XiphComment.newPictureFiled; + return fieldName === XiphComment.OLD_PICTURE_FIELD + || fieldName === XiphComment.NEW_PICTURE_FIELD; } // #endregion diff --git a/src/xiph/xiphPicture.ts b/src/xiph/xiphPicture.ts index e8ec8f13..e80cac41 100644 --- a/src/xiph/xiphPicture.ts +++ b/src/xiph/xiphPicture.ts @@ -1,8 +1,8 @@ -import ILazy from "../iLazy"; import {ByteVector, StringType} from "../byteVector"; import {CorruptFileError} from "../errors"; import {FlacBlock} from "../flac/flacBlock"; -import {IPicture, PictureType} from "../iPicture"; +import {ILazy} from "../interfaces"; +import {IPicture, PictureType} from "../picture"; import {Guards} from "../utils"; export default class XiphPicture implements IPicture, ILazy { @@ -19,7 +19,7 @@ export default class XiphPicture implements IPicture, ILazy { // #region Constructors - private constructor() {} + private constructor() { /* private to enforce construction via static methods */ } /** * Constructs and initializes a new instance by decoding and reading the contents of a raw Xiph @@ -35,7 +35,7 @@ export default class XiphPicture implements IPicture, ILazy { } const picture = new XiphPicture(); - picture._rawDataSource = () => ByteVector.fromByteArray(Buffer.from(data, "base64")); + picture._rawDataSource = () => ByteVector.fromBase64String(data); if (!isLazy) { picture.load(); } @@ -78,7 +78,7 @@ export default class XiphPicture implements IPicture, ILazy { instance._mimeType = picture.mimeType || ""; instance._filename = picture.filename; instance._description = picture.description || ""; - instance._data = picture.data; + instance._data = picture.data.toByteVector(); if (!(picture instanceof XiphPicture)) { return instance; @@ -255,52 +255,52 @@ export default class XiphPicture implements IPicture, ILazy { let position = 0; const rawData = this._rawDataSource(); - this._type = rawData.mid(position, 4).toUInt(); + this._type = rawData.subarray(position, 4).toUint(); position += 4; - const mimetypeLength = rawData.mid(position, 4).toUInt(); + const mimetypeLength = rawData.subarray(position, 4).toUint(); position += 4; - this._mimeType = rawData.mid(position, mimetypeLength).toString(undefined, StringType.Latin1); + this._mimeType = rawData.subarray(position, mimetypeLength).toString(StringType.Latin1); position += mimetypeLength; - const descriptionLength = rawData.mid(position, 4).toUInt(); + const descriptionLength = rawData.subarray(position, 4).toUint(); position += 4; - this._description = rawData.mid(position, descriptionLength).toString(undefined, StringType.UTF8); + this._description = rawData.subarray(position, descriptionLength).toString(StringType.UTF8); position += descriptionLength; - this._width = rawData.mid(position, 4).toUInt(); + this._width = rawData.subarray(position, 4).toUint(); position += 4; - this._height = rawData.mid(position, 4).toUInt(); + this._height = rawData.subarray(position, 4).toUint(); position += 4; - this._colorDepth = rawData.mid(position, 4).toUInt(); + this._colorDepth = rawData.subarray(position, 4).toUint(); position += 4; - this._indexedColors = rawData.mid(position, 4).toUInt(); + this._indexedColors = rawData.subarray(position, 4).toUint(); position += 4; - const dataLength = rawData.mid(position, 4).toUInt(); + const dataLength = rawData.subarray(position, 4).toUint(); position += 4; - this._data = rawData.mid(position, dataLength); + this._data = rawData.subarray(position, dataLength).toByteVector(); } /** * Renders the picture for use in a FLAC block. */ - public renderForFlacBlock() { + public renderForFlacBlock(): ByteVector { this.load(); const mimeType = ByteVector.fromString(this._mimeType, StringType.Latin1); const description = ByteVector.fromString(this._description, StringType.UTF8); return ByteVector.concatenate( - ByteVector.fromUInt(this._type), - ByteVector.fromUInt(mimeType.length), + ByteVector.fromUint(this._type), + ByteVector.fromUint(mimeType.length), mimeType, - ByteVector.fromUInt(description.length), + ByteVector.fromUint(description.length), description, - ByteVector.fromUInt(this._width), - ByteVector.fromUInt(this._height), - ByteVector.fromUInt(this._colorDepth), - ByteVector.fromUInt(this._indexedColors), - ByteVector.fromUInt(this._data.length), + ByteVector.fromUint(this._width), + ByteVector.fromUint(this._height), + ByteVector.fromUint(this._colorDepth), + ByteVector.fromUint(this._indexedColors), + ByteVector.fromUint(this._data.length), this._data ); } @@ -309,9 +309,8 @@ export default class XiphPicture implements IPicture, ILazy { * Renders the picture for use in a XIPH comment block (ie, the same structure as a FLAC block, * but base64 encoded). */ - public renderForXiphComment() { - const unencodedData = this.renderForFlacBlock(); - return Buffer.from(unencodedData.data.buffer).toString("base64"); + public renderForXiphComment(): string { + return this.renderForFlacBlock().toBase64String(); } // #endregion diff --git a/src/xiph/xiphSettings.ts b/src/xiph/xiphSettings.ts index df8727fc..b784b29c 100644 --- a/src/xiph/xiphSettings.ts +++ b/src/xiph/xiphSettings.ts @@ -9,7 +9,7 @@ export default class XiphSettings { /** * Private constructor to prevent inadvertent construction */ - private constructor() {} + private constructor() { /* private to prevent constructing instances */ } /** * Gets whether to use "TEMPO" field to store {@see XiphComment.bpm} property. If `true` diff --git a/test-integration/.eslintrc.js b/test-integration/.eslintrc.js new file mode 100644 index 00000000..b6181709 --- /dev/null +++ b/test-integration/.eslintrc.js @@ -0,0 +1,10 @@ +module.exports = { + "extends": ["../.eslintrc.js"], + "rules": { + "@typescript-eslint/dot-notation": "off", + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/naming-convention": "off", + "@typescript-eslint/no-unsafe-argument": "off", + "@typescript-eslint/no-unused-vars": "off" + } +}; diff --git a/test-integration/id3v1_fileTests.ts b/test-integration/id3v1_fileTests.ts deleted file mode 100644 index 116e632c..00000000 --- a/test-integration/id3v1_fileTests.ts +++ /dev/null @@ -1,56 +0,0 @@ -import * as Chai from "chai"; -import {suite, test} from "@testdeck/mocha"; - -import TestConstants from "./utilities/testConstants"; -import {File, ReadStyle} from "../src"; -import {StandardFileTests} from "./utilities/standardFileTests"; - -// Setup chai -const assert = Chai.assert; - -@suite class Id3v1_FileTests { - // NOTE: These tests are more integration level tests from the original .NET implementation - - private static readonly sampleFilePath = TestConstants.getSampleFilePath("sample_v1_only.mp3"); - private static readonly tmpFileName = "tmpwrite_v1_only.mp3"; - - private static file: File; - - public static before() { - Id3v1_FileTests.file = File.createFromPath(Id3v1_FileTests.sampleFilePath); - } - - public static after() { - Id3v1_FileTests.file.dispose(); - } - - @test - public readAudioProperties() { - assert.strictEqual(Id3v1_FileTests.file.properties.audioSampleRate, 44100); - assert.strictEqual(Id3v1_FileTests.file.properties.audioChannels, 1); - assert.strictEqual(Id3v1_FileTests.file.properties.audioBitrate, 64); - assert.strictEqual(Id3v1_FileTests.file.properties.durationMilliseconds, 1352); - } - - @test - public readTags() { - assert.strictEqual(Id3v1_FileTests.file.tag.album, "MP3 album"); - assert.strictEqual(Id3v1_FileTests.file.tag.firstPerformer, "MP3 artist"); - assert.strictEqual(Id3v1_FileTests.file.tag.comment, "MP3 comment"); - assert.strictEqual(Id3v1_FileTests.file.tag.firstGenre, "Acid Punk"); - assert.strictEqual(Id3v1_FileTests.file.tag.track, 6); - assert.strictEqual(Id3v1_FileTests.file.tag.year, 1234); - } - - @test - public writeStandardPictures() { - const tmpFilePath = TestConstants.getTempFilePath(Id3v1_FileTests.tmpFileName); - StandardFileTests.writeStandardPictures(Id3v1_FileTests.sampleFilePath, tmpFilePath, ReadStyle.None); - } - - @test - public writeStandardTags() { - const tmpFilePath = TestConstants.getTempFilePath(Id3v1_FileTests.tmpFileName); - StandardFileTests.writeStandardTags(Id3v1_FileTests.sampleFilePath, tmpFilePath); - } -} diff --git a/test-integration/mp3_id3v1_fileTests.ts b/test-integration/mp3_id3v1_fileTests.ts new file mode 100644 index 00000000..5c92810a --- /dev/null +++ b/test-integration/mp3_id3v1_fileTests.ts @@ -0,0 +1,56 @@ +import * as Chai from "chai"; +import {suite, test} from "@testdeck/mocha"; + +import TestConstants from "./utilities/testConstants"; +import {File, ReadStyle} from "../src"; +import {StandardFileTests} from "./utilities/standardFileTests"; + +// Setup chai +const assert = Chai.assert; + +@suite class Mp3_id3v1_fileTests { + // NOTE: These tests are more integration level tests from the original .NET implementation + + private static readonly sampleFilePath = TestConstants.getSampleFilePath("sample_v1_only.mp3"); + private static readonly tmpFileName = "tmpwrite_v1_only.mp3"; + + private static file: File; + + public static before() { + Mp3_id3v1_fileTests.file = File.createFromPath(Mp3_id3v1_fileTests.sampleFilePath); + } + + public static after() { + Mp3_id3v1_fileTests.file.dispose(); + } + + @test + public readAudioProperties() { + assert.strictEqual(Mp3_id3v1_fileTests.file.properties.audioSampleRate, 44100); + assert.strictEqual(Mp3_id3v1_fileTests.file.properties.audioChannels, 1); + assert.strictEqual(Mp3_id3v1_fileTests.file.properties.audioBitrate, 64); + assert.strictEqual(Mp3_id3v1_fileTests.file.properties.durationMilliseconds, 1352); + } + + @test + public readTags() { + assert.strictEqual(Mp3_id3v1_fileTests.file.tag.album, "MP3 album"); + assert.strictEqual(Mp3_id3v1_fileTests.file.tag.firstPerformer, "MP3 artist"); + assert.strictEqual(Mp3_id3v1_fileTests.file.tag.comment, "MP3 comment"); + assert.strictEqual(Mp3_id3v1_fileTests.file.tag.firstGenre, "Acid Punk"); + assert.strictEqual(Mp3_id3v1_fileTests.file.tag.track, 6); + assert.strictEqual(Mp3_id3v1_fileTests.file.tag.year, 1234); + } + + @test + public writeStandardPictures() { + const tmpFilePath = TestConstants.getTempFilePath(Mp3_id3v1_fileTests.tmpFileName); + StandardFileTests.writeStandardPictures(Mp3_id3v1_fileTests.sampleFilePath, tmpFilePath, ReadStyle.None); + } + + @test + public writeStandardTags() { + const tmpFilePath = TestConstants.getTempFilePath(Mp3_id3v1_fileTests.tmpFileName); + StandardFileTests.writeStandardTags(Mp3_id3v1_fileTests.sampleFilePath, tmpFilePath); + } +} diff --git a/test-integration/id3v24_fileTests.ts b/test-integration/mp3_id3v24_fileTests.ts similarity index 75% rename from test-integration/id3v24_fileTests.ts rename to test-integration/mp3_id3v24_fileTests.ts index 7081f7f3..4dbe4a3b 100644 --- a/test-integration/id3v24_fileTests.ts +++ b/test-integration/mp3_id3v24_fileTests.ts @@ -8,7 +8,7 @@ import {StandardFileTests, TestTagLevel} from "./utilities/standardFileTests"; // Setup chai const assert = Chai.assert; -@suite class Id3v24_FileTests { +@suite class Mp3_id3v24_fileTests { // NOTE: These tests are more integration level tests from the original .NET implementation private static readonly replayGainPath = TestConstants.getSampleFilePath("sample_replaygain.mp3"); @@ -19,48 +19,48 @@ const assert = Chai.assert; private static file: File; public static before() { - Id3v24_FileTests.file = File.createFromPath(Id3v24_FileTests.sampleFilePath); + Mp3_id3v24_fileTests.file = File.createFromPath(Mp3_id3v24_fileTests.sampleFilePath); } public static after() { - Id3v24_FileTests.file.dispose(); + Mp3_id3v24_fileTests.file.dispose(); } @test public readAudioProperties() { - assert.strictEqual(Id3v24_FileTests.file.properties.audioSampleRate, 44100); - assert.strictEqual(Id3v24_FileTests.file.properties.durationMilliseconds, 1352); - assert.strictEqual(Id3v24_FileTests.file.properties.audioChannels, 1); - assert.strictEqual(Id3v24_FileTests.file.properties.audioBitrate, 64); - assert.strictEqual(Id3v24_FileTests.file.properties.durationMilliseconds, 1352); + assert.strictEqual(Mp3_id3v24_fileTests.file.properties.audioSampleRate, 44100); + assert.strictEqual(Mp3_id3v24_fileTests.file.properties.durationMilliseconds, 1352); + assert.strictEqual(Mp3_id3v24_fileTests.file.properties.audioChannels, 1); + assert.strictEqual(Mp3_id3v24_fileTests.file.properties.audioBitrate, 64); + assert.strictEqual(Mp3_id3v24_fileTests.file.properties.durationMilliseconds, 1352); } @test public readTags() { - assert.strictEqual(Id3v24_FileTests.file.tag.album, "MP3 album"); - assert.isTrue(Id3v24_FileTests.file.tag.comment.startsWith("MP3 comment")); - assert.strictEqual(Id3v24_FileTests.file.tag.title, "MP3 title unicode (\u12a2\u1275\u12ee\u1335\u12eb)"); - assert.strictEqual(Id3v24_FileTests.file.tag.track, 6); - assert.strictEqual(Id3v24_FileTests.file.tag.trackCount, 7); - assert.strictEqual(Id3v24_FileTests.file.tag.year, 1234); + assert.strictEqual(Mp3_id3v24_fileTests.file.tag.album, "MP3 album"); + assert.isTrue(Mp3_id3v24_fileTests.file.tag.comment.startsWith("MP3 comment")); + assert.strictEqual(Mp3_id3v24_fileTests.file.tag.title, "MP3 title unicode (\u12a2\u1275\u12ee\u1335\u12eb)"); + assert.strictEqual(Mp3_id3v24_fileTests.file.tag.track, 6); + assert.strictEqual(Mp3_id3v24_fileTests.file.tag.trackCount, 7); + assert.strictEqual(Mp3_id3v24_fileTests.file.tag.year, 1234); assert.deepStrictEqual( - Id3v24_FileTests.file.tag.performers, + Mp3_id3v24_fileTests.file.tag.performers, ["MP3 artist unicode (\u1283\u12ed\u120c \u1308\u1265\u1228\u1225\u120b\u1234)"] ); assert.deepStrictEqual( - Id3v24_FileTests.file.tag.genres, + Mp3_id3v24_fileTests.file.tag.genres, ["Acid Punk"] ); assert.deepStrictEqual( - Id3v24_FileTests.file.tag.composers, + Mp3_id3v24_fileTests.file.tag.composers, ["MP3 composer"] ); } @test public replayGainTest() { - const tmpFilePath = TestConstants.getTempFilePath(Id3v24_FileTests.replayGainTmpFileName); + const tmpFilePath = TestConstants.getTempFilePath(Mp3_id3v24_fileTests.replayGainTmpFileName); const testToPerform = () => { let rgFile: File; @@ -111,19 +111,19 @@ const assert = Chai.assert; rgFile.dispose(); } }; - StandardFileTests.performTestWithTmpFile(Id3v24_FileTests.replayGainPath, tmpFilePath, testToPerform); + StandardFileTests.performTestWithTmpFile(Mp3_id3v24_fileTests.replayGainPath, tmpFilePath, testToPerform); } @test public writeStandardTags() { - const tmpFilePath = TestConstants.getTempFilePath(Id3v24_FileTests.sampleTmpFileName); - StandardFileTests.writeStandardTags(Id3v24_FileTests.sampleFilePath, tmpFilePath, TestTagLevel.Medium); + const tmpFilePath = TestConstants.getTempFilePath(Mp3_id3v24_fileTests.sampleTmpFileName); + StandardFileTests.writeStandardTags(Mp3_id3v24_fileTests.sampleFilePath, tmpFilePath, TestTagLevel.Medium); } @test public writeStandardPictures() { - const tmpFilePath = TestConstants.getTempFilePath(Id3v24_FileTests.sampleTmpFileName); - StandardFileTests.writeStandardPictures(Id3v24_FileTests.sampleFilePath, tmpFilePath, ReadStyle.None); + const tmpFilePath = TestConstants.getTempFilePath(Mp3_id3v24_fileTests.sampleTmpFileName); + StandardFileTests.writeStandardPictures(Mp3_id3v24_fileTests.sampleFilePath, tmpFilePath, ReadStyle.None); } // @test @@ -134,7 +134,7 @@ const assert = Chai.assert; @test public urlLinkFrameTest() { - const tempFilePath = TestConstants.getTempFilePath(Id3v24_FileTests.sampleTmpFileName); + const tempFilePath = TestConstants.getTempFilePath(Mp3_id3v24_fileTests.sampleTmpFileName); const testToPerform = () => { let urlLinkFile = File.createFromPath(tempFilePath); try { @@ -191,6 +191,6 @@ const assert = Chai.assert; urlLinkFile.dispose(); } }; - StandardFileTests.performTestWithTmpFile(Id3v24_FileTests.sampleFilePath, tempFilePath, testToPerform); + StandardFileTests.performTestWithTmpFile(Mp3_id3v24_fileTests.sampleFilePath, tempFilePath, testToPerform); } } diff --git a/test-integration/id3v2_fileTests.ts b/test-integration/mp3_id3v2_fileTests.ts similarity index 69% rename from test-integration/id3v2_fileTests.ts rename to test-integration/mp3_id3v2_fileTests.ts index fc8f66ce..839874d5 100644 --- a/test-integration/id3v2_fileTests.ts +++ b/test-integration/mp3_id3v2_fileTests.ts @@ -11,10 +11,10 @@ import {StandardFileTests} from "./utilities/standardFileTests"; // Setup chai const assert = Chai.assert; -@suite class Id3v2_FileTests { +@suite class Mp3_id3v2_fileTests { // NOTE: These tests are more integration level tests from the original .NET implementation - private static readonly corruptFilePath = TestConstants.getCorruptFilePath("null_title_v2.mp3"); + private static readonly corruptFilePath = TestConstants.getCorruptFilePath("corruptNullTitleId3v2.mp3"); private static readonly extHeaderFilePath = TestConstants.getSampleFilePath("sample_v2_3_ext_header.mp3"); private static readonly sampleFilePath = TestConstants.getSampleFilePath("sample.mp3"); private static readonly tmpFileName = "tmpwrite_v2_only.mp3"; @@ -23,16 +23,16 @@ const assert = Chai.assert; private static file: File; public static before() { - Id3v2_FileTests.file = File.createFromPath(Id3v2_FileTests.v2sampleFilePath); + Mp3_id3v2_fileTests.file = File.createFromPath(Mp3_id3v2_fileTests.v2sampleFilePath); } public static after() { - Id3v2_FileTests.file.dispose(); + Mp3_id3v2_fileTests.file.dispose(); } @test public multiGenresTest() { - const rgFile = File.createFromPath(Id3v2_FileTests.sampleFilePath); + const rgFile = File.createFromPath(Mp3_id3v2_fileTests.sampleFilePath); try { const tag = rgFile.tag; const genres = tag.genres; @@ -48,28 +48,28 @@ const assert = Chai.assert; @test public readAudioProperties() { - assert.strictEqual(Id3v2_FileTests.file.properties.audioSampleRate, 44100); - assert.strictEqual(Id3v2_FileTests.file.properties.durationMilliseconds, 1352); - assert.strictEqual(Id3v2_FileTests.file.properties.audioChannels, 1); - assert.strictEqual(Id3v2_FileTests.file.properties.audioBitrate, 64); - assert.strictEqual(Id3v2_FileTests.file.properties.durationMilliseconds, 1352); + assert.strictEqual(Mp3_id3v2_fileTests.file.properties.audioSampleRate, 44100); + assert.strictEqual(Mp3_id3v2_fileTests.file.properties.durationMilliseconds, 1352); + assert.strictEqual(Mp3_id3v2_fileTests.file.properties.audioChannels, 1); + assert.strictEqual(Mp3_id3v2_fileTests.file.properties.audioBitrate, 64); + assert.strictEqual(Mp3_id3v2_fileTests.file.properties.durationMilliseconds, 1352); } @test public readTags() { - assert.strictEqual(Id3v2_FileTests.file.tag.album, "MP3 album"); - assert.strictEqual(Id3v2_FileTests.file.tag.firstPerformer, "MP3 artist"); - assert.strictEqual(Id3v2_FileTests.file.tag.comment, "MP3 comment"); - assert.strictEqual(Id3v2_FileTests.file.tag.firstGenre, "Acid Punk"); - assert.strictEqual(Id3v2_FileTests.file.tag.title, "MP3 title"); - assert.strictEqual(Id3v2_FileTests.file.tag.track, 6); - assert.strictEqual(Id3v2_FileTests.file.tag.trackCount, 7); - assert.strictEqual(Id3v2_FileTests.file.tag.year, 1234); + assert.strictEqual(Mp3_id3v2_fileTests.file.tag.album, "MP3 album"); + assert.strictEqual(Mp3_id3v2_fileTests.file.tag.firstPerformer, "MP3 artist"); + assert.strictEqual(Mp3_id3v2_fileTests.file.tag.comment, "MP3 comment"); + assert.strictEqual(Mp3_id3v2_fileTests.file.tag.firstGenre, "Acid Punk"); + assert.strictEqual(Mp3_id3v2_fileTests.file.tag.title, "MP3 title"); + assert.strictEqual(Mp3_id3v2_fileTests.file.tag.track, 6); + assert.strictEqual(Mp3_id3v2_fileTests.file.tag.trackCount, 7); + assert.strictEqual(Mp3_id3v2_fileTests.file.tag.year, 1234); } @test public testExtendedHeaderSize() { - const file = File.createFromPath(Id3v2_FileTests.extHeaderFilePath); + const file = File.createFromPath(Mp3_id3v2_fileTests.extHeaderFilePath); try { assert.strictEqual(file.tag.title, "Title v2"); } finally { @@ -80,11 +80,11 @@ const assert = Chai.assert; @test public testTruncateOrFalsy() { // Arrange - const tmpFilePath = TestConstants.getTempFilePath(Id3v2_FileTests.tmpFileName); + const tmpFilePath = TestConstants.getTempFilePath(Mp3_id3v2_fileTests.tmpFileName); if (fs.existsSync(tmpFilePath)) { fs.unlinkSync(tmpFilePath); } - fs.copyFileSync(Id3v2_FileTests.corruptFilePath, tmpFilePath); + fs.copyFileSync(Mp3_id3v2_fileTests.corruptFilePath, tmpFilePath); try { // Act @@ -104,8 +104,8 @@ const assert = Chai.assert; @test public urlLinkFrameTest() { - const tempFilePath = TestConstants.getTempFilePath(Id3v2_FileTests.tmpFileName); - fs.copyFileSync(Id3v2_FileTests.sampleFilePath, tempFilePath); + const tempFilePath = TestConstants.getTempFilePath(Mp3_id3v2_fileTests.tmpFileName); + fs.copyFileSync(Mp3_id3v2_fileTests.sampleFilePath, tempFilePath); try { const urlLinkFile1 = File.createFromPath(tempFilePath); @@ -169,19 +169,19 @@ const assert = Chai.assert; @test public writeExtendedTags() { - const tmpFilePath = TestConstants.getTempFilePath(Id3v2_FileTests.tmpFileName); - ExtendedFileTests.writeExtendedTags(Id3v2_FileTests.sampleFilePath, tmpFilePath); + const tmpFilePath = TestConstants.getTempFilePath(Mp3_id3v2_fileTests.tmpFileName); + ExtendedFileTests.writeExtendedTags(Mp3_id3v2_fileTests.sampleFilePath, tmpFilePath); } @test public writeStandardPictures() { - const tmpFilePath = TestConstants.getTempFilePath(Id3v2_FileTests.tmpFileName); - StandardFileTests.writeStandardPictures(Id3v2_FileTests.sampleFilePath, tmpFilePath); + const tmpFilePath = TestConstants.getTempFilePath(Mp3_id3v2_fileTests.tmpFileName); + StandardFileTests.writeStandardPictures(Mp3_id3v2_fileTests.sampleFilePath, tmpFilePath); } @test public writeStandardTags() { - const tmpFilePath = TestConstants.getTempFilePath(Id3v2_FileTests.tmpFileName); - StandardFileTests.writeStandardTags(Id3v2_FileTests.sampleFilePath, tmpFilePath); + const tmpFilePath = TestConstants.getTempFilePath(Mp3_id3v2_fileTests.tmpFileName); + StandardFileTests.writeStandardTags(Mp3_id3v2_fileTests.sampleFilePath, tmpFilePath); } } diff --git a/test-integration/mpeg_fileTest.ts b/test-integration/mpeg_fileTest.ts index 26103f8e..476bd760 100644 --- a/test-integration/mpeg_fileTest.ts +++ b/test-integration/mpeg_fileTest.ts @@ -39,7 +39,8 @@ const assert = Chai.assert; @test public RemoveStandardTags() { - StandardFileTests.removeStandardTags(Mpeg_FileTests.sampleFilePath, Mpeg_FileTests.tmpFileName); + const tempFilePath = TestConstants.getTempFilePath(Mpeg_FileTests.tmpFileName); + StandardFileTests.removeStandardTags(Mpeg_FileTests.sampleFilePath, tempFilePath); } @test @@ -49,11 +50,8 @@ const assert = Chai.assert; @test public WriteStandardPictures() { - StandardFileTests.writeStandardPictures( - Mpeg_FileTests.sampleFilePath, - Mpeg_FileTests.tmpFileName, - ReadStyle.None - ); + const tempFilePath = TestConstants.getTempFilePath(Mpeg_FileTests.tmpFileName); + StandardFileTests.writeStandardPictures(Mpeg_FileTests.sampleFilePath, tempFilePath, ReadStyle.None); } // @test @@ -67,10 +65,7 @@ const assert = Chai.assert; @test public WriteStandardTags() { - StandardFileTests.writeStandardTags( - Mpeg_FileTests.sampleFilePath, - Mpeg_FileTests.tmpFileName, - TestTagLevel.Medium - ); + const tempFilePath = TestConstants.getTempFilePath(Mpeg_FileTests.tmpFileName); + StandardFileTests.writeStandardTags(Mpeg_FileTests.sampleFilePath, tempFilePath, TestTagLevel.Medium); } } diff --git a/test-integration/ogg_opus_fileTests.ts b/test-integration/ogg_opus_fileTests.ts new file mode 100644 index 00000000..eaf4905e --- /dev/null +++ b/test-integration/ogg_opus_fileTests.ts @@ -0,0 +1,62 @@ +import {assert} from "chai"; +import {suite, test} from "@testdeck/mocha"; + +import ExtendedFileTests from "./utilities/extendedFileTests"; +import TestConstants from "./utilities/testConstants"; +import {File} from "../src"; +import {StandardFileTests, TestTagLevel} from "./utilities/standardFileTests"; + +@suite class Ogg_Opus_FileTests { + private static readonly sampleFilePath = TestConstants.getSampleFilePath("sample.opus"); + private static readonly tmpFileName = "tmpwrite.opus"; + + private static file: File; + + public static before() { + Ogg_Opus_FileTests.file = File.createFromPath(Ogg_Opus_FileTests.sampleFilePath); + } + + public static after() { + if (Ogg_Opus_FileTests.file) { Ogg_Opus_FileTests.file.dispose(); } + } + + @test + public readAudioProperties() { + assert.strictEqual(Ogg_Opus_FileTests.file.properties.audioBitrate, 0); + assert.strictEqual(Ogg_Opus_FileTests.file.properties.audioChannels, 2); + assert.strictEqual(Ogg_Opus_FileTests.file.properties.audioSampleRate, 44100); + assert.strictEqual(Ogg_Opus_FileTests.file.properties.bitsPerSample, 0); + assert.approximately(Ogg_Opus_FileTests.file.properties.durationMilliseconds, 5232, 10); + // TODO: Figure out why we're off by around 10 + } + + @test + public readTags() { + assert.strictEqual(Ogg_Opus_FileTests.file.tag.album, "Opus album"); + assert.strictEqual(Ogg_Opus_FileTests.file.tag.firstPerformer, "Opus artist"); + assert.strictEqual(Ogg_Opus_FileTests.file.tag.description, "Opus comment"); + assert.strictEqual(Ogg_Opus_FileTests.file.tag.firstGenre, "Acid Punk"); + assert.strictEqual(Ogg_Opus_FileTests.file.tag.title, "Opus title"); + assert.strictEqual(Ogg_Opus_FileTests.file.tag.track, 6); + assert.strictEqual(Ogg_Opus_FileTests.file.tag.trackCount, 7); + assert.strictEqual(Ogg_Opus_FileTests.file.tag.year, 1234); + } + + @test + public writeStandardTags() { + const tmpFilePath = TestConstants.getTempFilePath(Ogg_Opus_FileTests.tmpFileName); + StandardFileTests.writeStandardTags(Ogg_Opus_FileTests.sampleFilePath, tmpFilePath, TestTagLevel.Medium); + } + + @test + public writeExtendedTags() { + const tmpFilePath = TestConstants.getTempFilePath(Ogg_Opus_FileTests.tmpFileName); + ExtendedFileTests.writeExtendedTags(Ogg_Opus_FileTests.sampleFilePath, tmpFilePath); + } + + @test + public writeStandardPictures() { + const tmpFilePath = TestConstants.getTempFilePath(Ogg_Opus_FileTests.tmpFileName); + StandardFileTests.writeStandardPictures(Ogg_Opus_FileTests.sampleFilePath, tmpFilePath); + } +} diff --git a/test-integration/ogg_theora_fileTests.ts b/test-integration/ogg_theora_fileTests.ts new file mode 100644 index 00000000..4732e9c4 --- /dev/null +++ b/test-integration/ogg_theora_fileTests.ts @@ -0,0 +1,63 @@ +import {assert} from "chai"; +import {suite, test} from "@testdeck/mocha"; + +import ExtendedFileTests from "./utilities/extendedFileTests"; +import TestConstants from "./utilities/testConstants"; +import {File, MediaTypes} from "../src"; +import {StandardFileTests, TestTagLevel} from "./utilities/standardFileTests"; + +@suite class Ogg_Theora_FileTests { + private static readonly sampleFilePath = TestConstants.getSampleFilePath("sample.ogv"); + private static readonly tmpFileName = "tmpwrite.ogv"; + + private static file: File; + + public static before() { + Ogg_Theora_FileTests.file = File.createFromPath(Ogg_Theora_FileTests.sampleFilePath); + } + + public static after() { + if (Ogg_Theora_FileTests.file) { Ogg_Theora_FileTests.file.dispose(); } + } + + @test + public readAudioProperties() { + assert.strictEqual(Ogg_Theora_FileTests.file.properties.mediaTypes, MediaTypes.Audio | MediaTypes.Video); + assert.strictEqual(Ogg_Theora_FileTests.file.properties.audioBitrate, 112); + assert.strictEqual(Ogg_Theora_FileTests.file.properties.audioChannels, 2); + assert.strictEqual(Ogg_Theora_FileTests.file.properties.audioSampleRate, 44100); + assert.strictEqual(Ogg_Theora_FileTests.file.properties.bitsPerSample, 0); + assert.approximately(Ogg_Theora_FileTests.file.properties.durationMilliseconds, 5930, 5); + assert.strictEqual(Ogg_Theora_FileTests.file.properties.videoHeight, 120); + assert.strictEqual(Ogg_Theora_FileTests.file.properties.videoWidth, 160); + } + + @test + public readTags() { + assert.strictEqual(Ogg_Theora_FileTests.file.tag.album, "Ogg album"); + assert.strictEqual(Ogg_Theora_FileTests.file.tag.firstAlbumArtist, "Ogg artist"); + assert.strictEqual(Ogg_Theora_FileTests.file.tag.firstPerformer, "Ogg artist"); + assert.strictEqual(Ogg_Theora_FileTests.file.tag.comment, "Ogg comment"); + assert.strictEqual(Ogg_Theora_FileTests.file.tag.firstGenre, "Brit Pop"); + assert.strictEqual(Ogg_Theora_FileTests.file.tag.track, 5); + assert.strictEqual(Ogg_Theora_FileTests.file.tag.year, 2005); + } + + @test + public writeStandardTags() { + const tmpFilePath = TestConstants.getTempFilePath(Ogg_Theora_FileTests.tmpFileName); + StandardFileTests.writeStandardTags(Ogg_Theora_FileTests.sampleFilePath, tmpFilePath, TestTagLevel.Medium); + } + + @test + public writeExtendedTags() { + const tmpFilePath = TestConstants.getTempFilePath(Ogg_Theora_FileTests.tmpFileName); + ExtendedFileTests.writeExtendedTags(Ogg_Theora_FileTests.sampleFilePath, tmpFilePath); + } + + @test + public writeStandardPictures() { + const tmpFilePath = TestConstants.getTempFilePath(Ogg_Theora_FileTests.tmpFileName); + StandardFileTests.writeStandardPictures(Ogg_Theora_FileTests.sampleFilePath, tmpFilePath); + } +} diff --git a/test-integration/ogg_vorbis_fileTests.ts b/test-integration/ogg_vorbis_fileTests.ts new file mode 100644 index 00000000..ddeb8bc4 --- /dev/null +++ b/test-integration/ogg_vorbis_fileTests.ts @@ -0,0 +1,67 @@ +import {assert} from "chai"; +import {suite, test} from "@testdeck/mocha"; + +import ExtendedFileTests from "./utilities/extendedFileTests"; +import TestConstants from "./utilities/testConstants"; +import {File} from "../src"; +import {StandardFileTests, TestTagLevel} from "./utilities/standardFileTests"; + +@suite class Ogg_Vorbis_FileTests { + private static readonly sampleFilePath = TestConstants.getSampleFilePath("sample.ogg"); + private static readonly tmpFileName = "tmpwrite.ogg"; + + private static file: File; + + public static before() { + Ogg_Vorbis_FileTests.file = File.createFromPath(Ogg_Vorbis_FileTests.sampleFilePath); + } + + public static after() { + if (Ogg_Vorbis_FileTests.file) { Ogg_Vorbis_FileTests.file.dispose(); } + } + + @test + public readAudioProperties() { + assert.strictEqual(Ogg_Vorbis_FileTests.file.properties.audioBitrate, 48); + assert.strictEqual(Ogg_Vorbis_FileTests.file.properties.audioChannels, 1); + assert.strictEqual(Ogg_Vorbis_FileTests.file.properties.audioSampleRate, 44100); + assert.strictEqual(Ogg_Vorbis_FileTests.file.properties.bitsPerSample, 0); + assert.approximately(Ogg_Vorbis_FileTests.file.properties.durationMilliseconds, 5232, 1); + } + + @test + public readTags() { + assert.strictEqual(Ogg_Vorbis_FileTests.file.tag.album, "OGG album"); + assert.strictEqual(Ogg_Vorbis_FileTests.file.tag.firstPerformer, "OGG artist"); + assert.strictEqual(Ogg_Vorbis_FileTests.file.tag.comment, "OGG comment"); + assert.strictEqual(Ogg_Vorbis_FileTests.file.tag.firstGenre, "Acid Punk"); + assert.strictEqual(Ogg_Vorbis_FileTests.file.tag.title, "OGG title"); + assert.strictEqual(Ogg_Vorbis_FileTests.file.tag.track, 6); + assert.strictEqual(Ogg_Vorbis_FileTests.file.tag.trackCount, 7); + assert.strictEqual(Ogg_Vorbis_FileTests.file.tag.year, 1234); + } + + @test + public testCorruptionResistance() { + StandardFileTests.testCorruptionResistance(TestConstants.getCorruptFilePath("corrupt.ogg")); + StandardFileTests.testCorruptionResistance(TestConstants.getCorruptFilePath("corruptMissingFlag.ogg")); + } + + @test + public writeStandardTags() { + const tmpFilePath = TestConstants.getTempFilePath(Ogg_Vorbis_FileTests.tmpFileName); + StandardFileTests.writeStandardTags(Ogg_Vorbis_FileTests.sampleFilePath, tmpFilePath, TestTagLevel.Medium); + } + + @test + public writeExtendedTags() { + const tmpFilePath = TestConstants.getTempFilePath(Ogg_Vorbis_FileTests.tmpFileName); + ExtendedFileTests.writeExtendedTags(Ogg_Vorbis_FileTests.sampleFilePath, tmpFilePath); + } + + @test + public writeStandardPictures() { + const tmpFilePath = TestConstants.getTempFilePath(Ogg_Vorbis_FileTests.tmpFileName); + StandardFileTests.writeStandardPictures(Ogg_Vorbis_FileTests.sampleFilePath, tmpFilePath); + } +} diff --git a/test-integration/resources/corruptSamples/corrupt.ogg b/test-integration/resources/corruptSamples/corrupt.ogg new file mode 100644 index 00000000..e69de29b diff --git a/test-integration/resources/corruptSamples/corruptMissingFlag.ogg b/test-integration/resources/corruptSamples/corruptMissingFlag.ogg new file mode 100644 index 00000000..4a720d19 Binary files /dev/null and b/test-integration/resources/corruptSamples/corruptMissingFlag.ogg differ diff --git a/test-integration/resources/corruptSamples/null_title_v2.mp3 b/test-integration/resources/corruptSamples/corruptNullTitleId3v2.mp3 similarity index 100% rename from test-integration/resources/corruptSamples/null_title_v2.mp3 rename to test-integration/resources/corruptSamples/corruptNullTitleId3v2.mp3 diff --git a/test-integration/resources/samples/sample.ogg b/test-integration/resources/samples/sample.ogg new file mode 100644 index 00000000..99b19094 Binary files /dev/null and b/test-integration/resources/samples/sample.ogg differ diff --git a/test-integration/resources/samples/sample.ogv b/test-integration/resources/samples/sample.ogv new file mode 100644 index 00000000..aad8002a Binary files /dev/null and b/test-integration/resources/samples/sample.ogv differ diff --git a/test-integration/resources/samples/sample.opus b/test-integration/resources/samples/sample.opus new file mode 100644 index 00000000..7bb72829 Binary files /dev/null and b/test-integration/resources/samples/sample.opus differ diff --git a/test-integration/tsconfig.json b/test-integration/tsconfig.json new file mode 100644 index 00000000..b7d15a6d --- /dev/null +++ b/test-integration/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "declaration": true, + "experimentalDecorators": true, + "inlineSources": true, + "module": "commonjs", + "noImplicitAny": true, + "outDir": "./dist", + "sourceMap": true, + "baseUrl": ".", + "paths": { + "*": ["node_modules/*"] + }, + "target": "es6" + }, + "include": [ "./**/*" ] +} diff --git a/test-integration/tslint.json b/test-integration/tslint.json deleted file mode 100644 index d8f5946f..00000000 --- a/test-integration/tslint.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "../tslint.json", - "rules": { - "class-name": false - } -} \ No newline at end of file diff --git a/test-integration/utilities/standardFileTests.ts b/test-integration/utilities/standardFileTests.ts index aca6c75f..4c33caf2 100644 --- a/test-integration/utilities/standardFileTests.ts +++ b/test-integration/utilities/standardFileTests.ts @@ -1,9 +1,9 @@ import * as fs from "fs"; import {assert} from "chai"; -import ILazy from "../../src/iLazy"; import TestConstants from "./testConstants"; import Utilities from "./utilities"; +import {ILazy} from "../../src/interfaces"; import { ByteVector, File, @@ -14,6 +14,7 @@ import { Tag, TagTypes } from "../../src"; +import {NumberUtils} from "../../src/utils"; export enum TestTagLevel { Normal, @@ -101,7 +102,7 @@ export class StandardFileTests { const raws = new Array(3); // Insert new picture - pics = [...pics, ...Array(Math.max(3 - pics.length, 0)).fill(undefined)]; + pics = [...pics, ...Array(Math.max(3 - pics.length, 0)).fill(undefined)]; raws[0] = ByteVector.fromPath(StandardFileTests.samplePicture); pics[0] = Picture.fromPath(StandardFileTests.samplePicture); pics[0].type = PictureType.BackCover; @@ -128,7 +129,7 @@ export class StandardFileTests { assert.strictEqual(pics.length, 3); // Lazy picture check - const isLazyTest = (readStyle & ReadStyle.PictureLazy) !== 0; + const isLazyTest = NumberUtils.hasFlag(readStyle, ReadStyle.PictureLazy); for (let i = 0; i < 3; i++) { if (isLazyTest) { assert.isFalse(( pics[i]).isLoaded); @@ -142,16 +143,16 @@ export class StandardFileTests { assert.strictEqual(pics[0].description, "TEST description 1"); assert.strictEqual(pics[0].mimeType, "image/gif"); assert.strictEqual(pics[0].data.length, fs.statSync(this.samplePicture).size); - assert.isTrue(ByteVector.equal(pics[0].data, raws[0])); + assert.isTrue(ByteVector.equals(pics[0].data, raws[0])); assert.strictEqual(pics[1].description, "TEST description 2"); assert.strictEqual(pics[1].data.length, fs.statSync(this.sampleOther).size); - assert.isTrue(ByteVector.equal(pics[1].data, raws[1])); + assert.isTrue(ByteVector.equals(pics[1].data, raws[1])); assert.strictEqual(pics[2].description, "TEST description 3"); assert.strictEqual(pics[2].mimeType, "image/gif"); assert.strictEqual(pics[2].data.length, fs.statSync(this.samplePicture).size); - assert.isTrue(ByteVector.equal(pics[2].data, raws[2])); + assert.isTrue(ByteVector.equals(pics[2].data, raws[2])); // Types and mimetypes assumed to be properly supported at Medium level test if (level >= TestTagLevel.Medium) { @@ -234,11 +235,11 @@ export class StandardFileTests { if (level >= TestTagLevel.Medium) { assert.strictEqual(tag.titleSort, "title sort, TEST"); assert.strictEqual(tag.albumSort, "album sort, TEST"); - assert.strictEqual(tag.joinedPerformersSort, "performer sort 1, TEST; performer sort 2, TEST"); - assert.strictEqual(tag.composersSort.join("; "), "composer sort 1, TEST; composer sort 2, TEST"); - assert.strictEqual(tag.albumArtistsSort.join("; "), "album artist sort 1, TEST; album artist sort 2, TEST"); + assert.sameOrderedMembers(tag.performersSort, ["performer sort 1, TEST", "performer sort 2, TEST"]); + assert.sameOrderedMembers(tag.composersSort, ["composer sort 1, TEST", "composer sort 2, TEST"]); + assert.sameOrderedMembers(tag.albumArtistsSort, ["album artist sort 1, TEST", "album artist sort 2, TEST"]); + assert.sameOrderedMembers(tag.performersRole, ["TEST role 1a; TEST role 1b", "TEST role 2"]); assert.strictEqual(tag.beatsPerMinute, 120); - assert.strictEqual(tag.performersRole.join("\n"), "TEST role 1a;TEST role 1b\nTEST role 2"); const dateTagged = (new Date(2017, 8, 12, 22, 47, 42)).getTime(); assert.strictEqual(tag.dateTagged.getTime(), dateTagged); @@ -281,17 +282,8 @@ export class StandardFileTests { } private static setTags(tag: Tag, level: TestTagLevel) { - if (level >= TestTagLevel.Medium) { - tag.titleSort = "title sort, TEST"; - tag.albumSort = "album sort, TEST"; - tag.performersSort = ["performer sort 1, TEST", "performer sort 2, TEST"]; - tag.composersSort = ["composer sort 1, TEST", "composer sort 2, TEST"]; - tag.albumArtistsSort = ["album artist sort 1, TEST", "album artist sort 2, TEST"]; - } - tag.album = "TEST album"; tag.albumArtists = ["TEST artist 1", "TEST artist 2"]; - tag.beatsPerMinute = 120; tag.comment = "TEST comment"; tag.composers = ["TEST composer 1", "TEST composer 2"]; tag.conductor = "TEST conductor"; @@ -303,12 +295,21 @@ export class StandardFileTests { tag.grouping = "TEST grouping"; tag.lyrics = "TEST lyrics 1\r\nTEST lyrics 2"; tag.performers = ["TEST performer 1", "TEST performer 2"]; - tag.performersRole = ["TEST role 1a; TEST role 1b", "TEST role 2"]; tag.title = "TEST title"; tag.subtitle = "TEST subtitle"; tag.description = "TEST description"; tag.track = 98; tag.trackCount = 99; tag.year = 1999; + + if (level >= TestTagLevel.Medium) { + tag.titleSort = "title sort, TEST"; + tag.albumSort = "album sort, TEST"; + tag.performersSort = ["performer sort 1, TEST", "performer sort 2, TEST"]; + tag.composersSort = ["composer sort 1, TEST", "composer sort 2, TEST"]; + tag.albumArtistsSort = ["album artist sort 1, TEST", "album artist sort 2, TEST"]; + tag.performersRole = ["TEST role 1a; TEST role 1b", "TEST role 2"]; + tag.beatsPerMinute = 120; + } } } diff --git a/test-unit/.eslintrc.js b/test-unit/.eslintrc.js new file mode 100644 index 00000000..b6181709 --- /dev/null +++ b/test-unit/.eslintrc.js @@ -0,0 +1,10 @@ +module.exports = { + "extends": ["../.eslintrc.js"], + "rules": { + "@typescript-eslint/dot-notation": "off", + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/naming-convention": "off", + "@typescript-eslint/no-unsafe-argument": "off", + "@typescript-eslint/no-unused-vars": "off" + } +}; diff --git a/test-unit/aac/aacAudioHeaderTests.ts b/test-unit/aac/aacAudioHeaderTests.ts index 9433db38..a33851e2 100644 --- a/test-unit/aac/aacAudioHeaderTests.ts +++ b/test-unit/aac/aacAudioHeaderTests.ts @@ -1,20 +1,15 @@ -import * as Chai from "chai"; -import * as ChaiAsPromised from "chai-as-promised"; import * as TypeMoq from "typemoq"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import AacAudioHeader from "../../src/aac/aacAudioHeader"; import Mpeg4AudioTypes from "../../src/mpeg4/mpeg4AudioTypes"; import TestFile from "../utilities/testFile"; import {ByteVector} from "../../src/byteVector"; import {File} from "../../src/file"; -import {MediaTypes} from "../../src/iCodec"; +import {MediaTypes} from "../../src/properties"; import {Testers} from "../utilities/testers"; -// Setup Chai -Chai.use(ChaiAsPromised); -const assert = Chai.assert; - // Test constants const sampleHeaderBytes = ByteVector.fromByteArray(new Uint8Array([0xFF, 0xF5, 0x55, 0x55, 0x55, 0x55, 0x55])); diff --git a/test-unit/aac/aacFileTests.ts b/test-unit/aac/aacFileTests.ts index 7bed8209..9c6aaf4c 100644 --- a/test-unit/aac/aacFileTests.ts +++ b/test-unit/aac/aacFileTests.ts @@ -55,7 +55,7 @@ import {TagTypes} from "../../src/tag"; assert.strictEqual(file.tag.startTag.tags.length, 2); assert.strictEqual(file.tag.startTag.tagTypes, TagTypes.Id3v2 | TagTypes.Ape); assert.strictEqual(file.tag.endTag.tags.length, 0); - assert.strictEqual(file.tag.endTag.tagTypes, TagTypes.None) + assert.strictEqual(file.tag.endTag.tagTypes, TagTypes.None); assert.isUndefined(file.properties); diff --git a/test-unit/aiff/aiffStreamHeaderTests.ts b/test-unit/aiff/aiffStreamHeaderTests.ts index 6a9a0f6b..312eef71 100644 --- a/test-unit/aiff/aiffStreamHeaderTests.ts +++ b/test-unit/aiff/aiffStreamHeaderTests.ts @@ -1,13 +1,10 @@ -import * as Chai from "chai"; +import {assert} from "chai"; import {suite, test} from "@testdeck/mocha"; import {Testers} from "../utilities/testers"; import AiffStreamHeader from "../../src/aiff/aiffStreamHeader"; -import {ByteVector} from "../../src/byteVector"; -import {MediaTypes} from "../../src/iCodec"; - -// Setup Chai -const assert = Chai.assert; +import {ByteVector, StringType} from "../../src/byteVector"; +import {MediaTypes} from "../../src/properties"; @suite class Aiff_StreamHeaderTests { @test @@ -30,11 +27,11 @@ const assert = Chai.assert; public constructor_validData() { // Arrange const data = ByteVector.concatenate( - ByteVector.fromString("COMM"), // Chunk identifier - ByteVector.fromUInt(18), // Chunk size - ByteVector.fromUShort(1234), // Channels - ByteVector.fromUInt(2345), // Total frames - ByteVector.fromUShort(3456), // Bits per sample + ByteVector.fromString("COMM", StringType.Latin1), // Chunk identifier + ByteVector.fromUint(18), // Chunk size + ByteVector.fromUshort(1234), // Channels + ByteVector.fromUint(2345), // Total frames + ByteVector.fromUshort(3456), // Bits per sample // Sample rate (2345678) ByteVector.fromByteArray(new Uint8Array([0x40, 0x14, 0x8F, 0x2B, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00])) ); @@ -58,11 +55,11 @@ const assert = Chai.assert; public constructor_zeroSampleRate() { // Arrange const data = ByteVector.concatenate( - ByteVector.fromString("COMM"), // Chunk identifier - ByteVector.fromUInt(18), // Chunk size - ByteVector.fromUShort(1234), // Channels - ByteVector.fromUInt(2345), // Total frames - ByteVector.fromUShort(3456), // Bits per sample + ByteVector.fromString("COMM", StringType.Latin1), // Chunk identifier + ByteVector.fromUint(18), // Chunk size + ByteVector.fromUshort(1234), // Channels + ByteVector.fromUint(2345), // Total frames + ByteVector.fromUshort(3456), // Bits per sample // Sample rate (0) ByteVector.fromByteArray(new Uint8Array([0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])) ); @@ -86,11 +83,11 @@ const assert = Chai.assert; public constructor_zeroTotalFrames() { // Arrange const data = ByteVector.concatenate( - ByteVector.fromString("COMM"), // Chunk identifier - ByteVector.fromUInt(18), // Chunk size - ByteVector.fromUShort(1234), // Channels - ByteVector.fromUInt(0), // Total frames - ByteVector.fromUShort(3456), // Bits per sample + ByteVector.fromString("COMM", StringType.Latin1), // Chunk identifier + ByteVector.fromUint(18), // Chunk size + ByteVector.fromUshort(1234), // Channels + ByteVector.fromUint(0), // Total frames + ByteVector.fromUshort(3456), // Bits per sample // Sample rate ByteVector.fromByteArray(new Uint8Array([0x40, 0x14, 0x8F, 0x2B, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00])) ); diff --git a/test-unit/ape/apeFileTests.ts b/test-unit/ape/apeFileTests.ts index 4d0ca1ec..6791c02d 100644 --- a/test-unit/ape/apeFileTests.ts +++ b/test-unit/ape/apeFileTests.ts @@ -55,7 +55,7 @@ import {TagTypes} from "../../src/tag"; assert.strictEqual(file.tag.startTag.tags.length, 2); assert.strictEqual(file.tag.startTag.tagTypes, TagTypes.Id3v2 | TagTypes.Ape); assert.strictEqual(file.tag.endTag.tags.length, 0); - assert.strictEqual(file.tag.endTag.tagTypes, TagTypes.None) + assert.strictEqual(file.tag.endTag.tagTypes, TagTypes.None); assert.isUndefined(file.properties); diff --git a/test-unit/ape/apeStreamHeaderTests.ts b/test-unit/ape/apeStreamHeaderTests.ts index 1038d499..233b3c01 100644 --- a/test-unit/ape/apeStreamHeaderTests.ts +++ b/test-unit/ape/apeStreamHeaderTests.ts @@ -1,14 +1,11 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import {ApeCompressionLevel, ApeStreamHeader} from "../../src/ape/apeStreamHeader"; -import {ByteVector} from "../../src/byteVector"; -import {MediaTypes} from "../../src/iCodec"; +import {ByteVector, StringType} from "../../src/byteVector"; +import {MediaTypes} from "../../src/properties"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - @suite class Ape_StreamHeaderTests { @test public constructor_invalidData() { @@ -24,7 +21,7 @@ const assert = Chai.assert; public constructor_wrongIdentifier() { // Arrange const data = ByteVector.concatenate( - ByteVector.fromString("ID3"), + ByteVector.fromString("ID3", StringType.Latin1), ByteVector.fromSize(73) ); @@ -36,7 +33,7 @@ const assert = Chai.assert; public constructor_tooShort() { // Arrange const data = ByteVector.concatenate( - ByteVector.fromString("MAC "), + ByteVector.fromString("MAC ", StringType.Latin1), ByteVector.fromSize(10) ); @@ -48,17 +45,17 @@ const assert = Chai.assert; public constructor_validData() { // Arrange const data = ByteVector.concatenate( - ByteVector.fromString("MAC "), - ByteVector.fromUShort(9123, false), // Version + ByteVector.fromString("MAC ", StringType.Latin1), + ByteVector.fromUshort(9123, false), // Version ByteVector.fromSize(46), - ByteVector.fromUShort(ApeCompressionLevel.Insane, false), // Compression level (duh) + ByteVector.fromUshort(ApeCompressionLevel.Insane, false), // Compression level (duh) ByteVector.fromSize(2), - ByteVector.fromUInt(234, false), // Blocks per frame - ByteVector.fromUInt(345, false), // Final frame blocks - ByteVector.fromUInt(456, false), // Total frames - ByteVector.fromUShort(567, false), // Bits per sample - ByteVector.fromUShort(3, false), // Channels - ByteVector.fromUInt(678, false), // Sample rate + ByteVector.fromUint(234, false), // Blocks per frame + ByteVector.fromUint(345, false), // Final frame blocks + ByteVector.fromUint(456, false), // Total frames + ByteVector.fromUshort(567, false), // Bits per sample + ByteVector.fromUshort(3, false), // Channels + ByteVector.fromUint(678, false), // Sample rate ); // Act @@ -80,17 +77,17 @@ const assert = Chai.assert; public constructor_zeroDuration() { // Arrange const data = ByteVector.concatenate( - ByteVector.fromString("MAC "), - ByteVector.fromUShort(9123, false), // Version + ByteVector.fromString("MAC ", StringType.Latin1), + ByteVector.fromUshort(9123, false), // Version ByteVector.fromSize(46), - ByteVector.fromUShort(ApeCompressionLevel.Insane, false), // Compression level (duh) + ByteVector.fromUshort(ApeCompressionLevel.Insane, false), // Compression level (duh) ByteVector.fromSize(2), - ByteVector.fromUInt(0, false), // Blocks per frame - ByteVector.fromUInt(0, false), // Final frame blocks - ByteVector.fromUInt(1, false), // Total frames - ByteVector.fromUShort(567, false), // Bits per sample - ByteVector.fromUShort(3, false), // Channels - ByteVector.fromUInt(678, false), // Sample rate + ByteVector.fromUint(0, false), // Blocks per frame + ByteVector.fromUint(0, false), // Final frame blocks + ByteVector.fromUint(1, false), // Total frames + ByteVector.fromUshort(567, false), // Bits per sample + ByteVector.fromUshort(3, false), // Channels + ByteVector.fromUint(678, false), // Sample rate ); // Act diff --git a/test-unit/ape/apeTagFooterTests.ts b/test-unit/ape/apeTagFooterTests.ts index aeb0243b..b390ad04 100644 --- a/test-unit/ape/apeTagFooterTests.ts +++ b/test-unit/ape/apeTagFooterTests.ts @@ -1,20 +1,17 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import PropertyTests from "../utilities/propertyTests"; import {ApeTagFooter, ApeTagFooterFlags} from "../../src/ape/apeTagFooter"; import {ByteVector, StringType} from "../../src/byteVector"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - const _sampleData = ByteVector.concatenate( ByteVector.fromString("APETAGEX", StringType.Latin1), // File Identifier - ByteVector.fromUInt(1234, false), // Version - ByteVector.fromUInt(2345, false), // Tag Size - ByteVector.fromUInt(3456, false), // Item count - ByteVector.fromUInt(ApeTagFooterFlags.IsHeader, false), // Flags + ByteVector.fromUint(1234, false), // Version + ByteVector.fromUint(2345, false), // Tag Size + ByteVector.fromUint(3456, false), // Item count + ByteVector.fromUint(ApeTagFooterFlags.IsHeader, false), // Flags ByteVector.fromSize(12) ); @@ -32,10 +29,10 @@ const _sampleData = ByteVector.concatenate( // Arrange const data = ByteVector.concatenate( ByteVector.fromString("APETAGEX", StringType.Latin1), // File Identifier - ByteVector.fromUInt(1234, false), // Version - ByteVector.fromUInt(10, false), // Tag Size - ByteVector.fromUInt(3456, false), // Item count - ByteVector.fromUInt(ApeTagFooterFlags.IsHeader, false), // Flags + ByteVector.fromUint(1234, false), // Version + ByteVector.fromUint(10, false), // Tag Size + ByteVector.fromUint(3456, false), // Item count + ByteVector.fromUint(ApeTagFooterFlags.IsHeader, false), // Flags ByteVector.fromSize(12) ); @@ -48,10 +45,10 @@ const _sampleData = ByteVector.concatenate( // Arrange const data = ByteVector.concatenate( ByteVector.fromString("APETAGEX", StringType.Latin1), // File Identifier - ByteVector.fromUInt(1234, false), // Version - ByteVector.fromUInt(2345, false), // Tag Size - ByteVector.fromUInt(3456, false), // Item count - ByteVector.fromUInt(ApeTagFooterFlags.IsHeader, false), // Flags + ByteVector.fromUint(1234, false), // Version + ByteVector.fromUint(2345, false), // Tag Size + ByteVector.fromUint(3456, false), // Item count + ByteVector.fromUint(ApeTagFooterFlags.IsHeader, false), // Flags ByteVector.fromSize(12) ); @@ -62,7 +59,7 @@ const _sampleData = ByteVector.concatenate( assert.isOk(footer); assert.strictEqual(footer.flags, ApeTagFooterFlags.IsHeader); assert.strictEqual(footer.itemCount, 3456); - assert.strictEqual(footer.itemSize, 2345 - ApeTagFooter.size); + assert.strictEqual(footer.itemSize, 2345 - ApeTagFooter.SIZE); assert.strictEqual(footer.tagSize, 2345); assert.strictEqual(footer.version, 1234); } @@ -72,10 +69,10 @@ const _sampleData = ByteVector.concatenate( // Arrange const data = ByteVector.concatenate( ByteVector.fromString("APETAGEX", StringType.Latin1), // File Identifier - ByteVector.fromUInt(0, false), // Version - ByteVector.fromUInt(2345, false), // Tag Size - ByteVector.fromUInt(3456, false), // Item count - ByteVector.fromUInt(ApeTagFooterFlags.HeaderPresent, false), // Flags + ByteVector.fromUint(0, false), // Version + ByteVector.fromUint(2345, false), // Tag Size + ByteVector.fromUint(3456, false), // Item count + ByteVector.fromUint(ApeTagFooterFlags.HeaderPresent, false), // Flags ByteVector.fromSize(12) ); @@ -86,8 +83,8 @@ const _sampleData = ByteVector.concatenate( assert.isOk(footer); assert.strictEqual(footer.flags, ApeTagFooterFlags.HeaderPresent); assert.strictEqual(footer.itemCount, 3456); - assert.strictEqual(footer.itemSize, 2345 - ApeTagFooter.size); - assert.strictEqual(footer.tagSize, 2345 + ApeTagFooter.size); + assert.strictEqual(footer.itemSize, 2345 - ApeTagFooter.SIZE); + assert.strictEqual(footer.tagSize, 2345 + ApeTagFooter.SIZE); assert.strictEqual(footer.version, 2000); } @@ -100,7 +97,7 @@ const _sampleData = ByteVector.concatenate( assert.isOk(footer); assert.strictEqual(footer.flags, 0); assert.strictEqual(footer.itemCount, 0); - assert.strictEqual(footer.tagSize, ApeTagFooter.size); + assert.strictEqual(footer.tagSize, ApeTagFooter.SIZE); assert.strictEqual(footer.version, 2000); } } @@ -182,10 +179,10 @@ const _sampleData = ByteVector.concatenate( // Assert const expected = ByteVector.concatenate( ByteVector.fromString("APETAGEX", StringType.Latin1), // File Identifier - ByteVector.fromUInt(2000, false), // Version - ByteVector.fromUInt(2345, false), // Tag Size - ByteVector.fromUInt(3456, false), // Item count - ByteVector.fromUInt(ApeTagFooterFlags.HeaderPresent, false), // Flags + ByteVector.fromUint(2000, false), // Version + ByteVector.fromUint(2345, false), // Tag Size + ByteVector.fromUint(3456, false), // Item count + ByteVector.fromUint(ApeTagFooterFlags.HeaderPresent, false), // Flags ByteVector.fromSize(8) ); Testers.bvEqual(output, expected); @@ -203,10 +200,10 @@ const _sampleData = ByteVector.concatenate( // Assert const expected = ByteVector.concatenate( ByteVector.fromString("APETAGEX", StringType.Latin1), // File Identifier - ByteVector.fromUInt(2000, false), // Version - ByteVector.fromUInt(2345, false), // Tag Size - ByteVector.fromUInt(3456, false), // Item count - ByteVector.fromUInt(0, false), // Flags + ByteVector.fromUint(2000, false), // Version + ByteVector.fromUint(2345, false), // Tag Size + ByteVector.fromUint(3456, false), // Item count + ByteVector.fromUint(0, false), // Flags ByteVector.fromSize(8) ); Testers.bvEqual(output, expected); @@ -223,10 +220,10 @@ const _sampleData = ByteVector.concatenate( // Assert const expected = ByteVector.concatenate( ByteVector.fromString("APETAGEX", StringType.Latin1), // File Identifier - ByteVector.fromUInt(2000, false), // Version - ByteVector.fromUInt(2345, false), // Tag Size - ByteVector.fromUInt(3456, false), // Item count - ByteVector.fromUInt(0, false), // Flags + ByteVector.fromUint(2000, false), // Version + ByteVector.fromUint(2345, false), // Tag Size + ByteVector.fromUint(3456, false), // Item count + ByteVector.fromUint(0, false), // Flags ByteVector.fromSize(8) ); Testers.bvEqual(output, expected); @@ -245,10 +242,10 @@ const _sampleData = ByteVector.concatenate( const expectedFlags = (ApeTagFooterFlags.HeaderPresent | ApeTagFooterFlags.IsHeader) >>> 0; const expected = ByteVector.concatenate( ByteVector.fromString("APETAGEX", StringType.Latin1), // File Identifier - ByteVector.fromUInt(2000, false), // Version - ByteVector.fromUInt(2345, false), // Tag Size - ByteVector.fromUInt(3456, false), // Item count - ByteVector.fromUInt(expectedFlags, false), // Flags + ByteVector.fromUint(2000, false), // Version + ByteVector.fromUint(2345, false), // Tag Size + ByteVector.fromUint(3456, false), // Item count + ByteVector.fromUint(expectedFlags, false), // Flags ByteVector.fromSize(8) ); Testers.bvEqual(output, expected); @@ -280,10 +277,10 @@ const _sampleData = ByteVector.concatenate( const expectedFlags = (ApeTagFooterFlags.HeaderPresent | ApeTagFooterFlags.IsHeader) >>> 0; const expected = ByteVector.concatenate( ByteVector.fromString("APETAGEX", StringType.Latin1), // File Identifier - ByteVector.fromUInt(2000, false), // Version - ByteVector.fromUInt(2345, false), // Tag Size - ByteVector.fromUInt(3456, false), // Item count - ByteVector.fromUInt(expectedFlags, false), // Flags + ByteVector.fromUint(2000, false), // Version + ByteVector.fromUint(2345, false), // Tag Size + ByteVector.fromUint(3456, false), // Item count + ByteVector.fromUint(expectedFlags, false), // Flags ByteVector.fromSize(8) ); Testers.bvEqual(output, expected); diff --git a/test-unit/ape/apeTagItemTests.ts b/test-unit/ape/apeTagItemTests.ts index fe373303..84a86680 100644 --- a/test-unit/ape/apeTagItemTests.ts +++ b/test-unit/ape/apeTagItemTests.ts @@ -1,13 +1,10 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import {ApeTagItem, ApeTagItemType} from "../../src/ape/apeTagItem"; import {ByteVector, StringType} from "../../src/byteVector"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - @suite class Ape_TagItemTest_ConstructorTests { @test public fromBinaryValue_invalidValues() { @@ -20,7 +17,7 @@ const assert = Chai.assert; } @test - public fromBinaryValue_notReadOnly() { + public fromBinaryValue() { // Arrange const key = "key"; const data = ByteVector.fromSize(10); @@ -28,28 +25,6 @@ const assert = Chai.assert; // Act const item = ApeTagItem.fromBinaryValue(key, data); - // Assert - assert.isOk(item); - assert.isFalse(item.isEmpty); - assert.isFalse(item.isReadOnly); - assert.strictEqual(item.key, key); - assert.strictEqual(item.size, 0); - assert.deepStrictEqual(item.text, []); - assert.strictEqual(item.type, ApeTagItemType.Binary); - assert.notStrictEqual(item.value, data); - Testers.bvEqual(item.value, data); - assert.isTrue(item.value.isReadOnly); - } - - @test - public fromBinaryValue_isReadOnly() { - // Arrange - const key = "key"; - const data = ByteVector.fromSize(10, 0x00, true); - - // Act - const item = ApeTagItem.fromBinaryValue(key, data); - // Assert assert.isOk(item); assert.isFalse(item.isEmpty); @@ -98,7 +73,7 @@ const assert = Chai.assert; // Arrange const data = ByteVector.concatenate( 0x00, // Offset - ByteVector.fromUInt(12, false), // Size, + ByteVector.fromUint(12, false), // Size, 0x00, 0x00, 0x00, 0x00, // Flags ByteVector.fromString("foo", StringType.UTF8), // Key ByteVector.getTextDelimiter(StringType.UTF8), // End of key @@ -112,10 +87,10 @@ const assert = Chai.assert; @test public fromData_binary() { // Arrange - const value = ByteVector.fromString("foobarbaz"); + const value = ByteVector.fromString("foobarbaz", StringType.Latin1); const data = ByteVector.concatenate( 0x00, // Offset - ByteVector.fromUInt(value.length, false), // Size, + ByteVector.fromUint(value.length, false), // Size, 0x03, 0x00, 0x00, 0x00, // Flags ByteVector.fromString("foo", StringType.UTF8), // Key ByteVector.getTextDelimiter(StringType.UTF8), // End of key @@ -141,7 +116,7 @@ const assert = Chai.assert; // Arrange const data = ByteVector.concatenate( 0x00, // Offset - ByteVector.fromUInt(11, false), // Size, + ByteVector.fromUint(11, false), // Size, 0x00, 0x00, 0x00, 0x00, // Flags ByteVector.fromString("foo", StringType.UTF8), // Key ByteVector.getTextDelimiter(StringType.UTF8), // End of key @@ -211,7 +186,7 @@ const assert = Chai.assert; public clone_binary() { // Arrange const key = "key"; - const data = ByteVector.fromSize(10, 0x00, true); + const data = ByteVector.fromSize(10, 0x00); const item = ApeTagItem.fromBinaryValue(key, data); // Act @@ -269,9 +244,9 @@ const assert = Chai.assert; @test public render_binary() { // Arrange - const value = ByteVector.fromString("foobarbaz"); + const value = ByteVector.fromString("foobarbaz", StringType.Latin1); const data = ByteVector.concatenate( - ByteVector.fromUInt(value.length, false), // Size, + ByteVector.fromUint(value.length, false), // Size, 0x03, 0x00, 0x00, 0x00, // Flags ByteVector.fromString("foo", StringType.UTF8), // Key ByteVector.getTextDelimiter(StringType.UTF8), // End of key @@ -291,7 +266,7 @@ const assert = Chai.assert; public render_text() { // Arrange const data = ByteVector.concatenate( - ByteVector.fromUInt(11, false), // Size, + ByteVector.fromUint(11, false), // Size, 0x00, 0x00, 0x00, 0x00, // Flags ByteVector.fromString("foo", StringType.UTF8), // Key ByteVector.getTextDelimiter(StringType.UTF8), // End of key diff --git a/test-unit/ape/apeTagTests.ts b/test-unit/ape/apeTagTests.ts index b81cae15..09615a19 100644 --- a/test-unit/ape/apeTagTests.ts +++ b/test-unit/ape/apeTagTests.ts @@ -1,28 +1,25 @@ -import * as Chai from "chai"; import * as TypeMoq from "typemoq"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import ApeTag from "../../src/ape/apeTag"; import PropertyTests from "../utilities/propertyTests"; import TestFile from "../utilities/testFile"; import {ApeTagFooter, ApeTagFooterFlags} from "../../src/ape/apeTagFooter"; import {ApeTagItem, ApeTagItemType} from "../../src/ape/apeTagItem"; -import {ByteVector} from "../../src/byteVector"; +import {ByteVector, StringType} from "../../src/byteVector"; import {File} from "../../src/file"; -import {IPicture, PictureType} from "../../src/iPicture"; +import {IPicture, PictureType} from "../../src/picture"; import {TagTypes} from "../../src/tag"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - -function getTestTagFooter(flags: ApeTagFooterFlags, itemCount: number, itemPlusFooter: number): ByteVector { +const getTestTagFooter = (flags: ApeTagFooterFlags, itemCount: number, itemPlusFooter: number): ByteVector => { return ByteVector.concatenate( - ApeTagFooter.fileIdentifier, - ByteVector.fromUInt(2000, false), - ByteVector.fromUInt(itemPlusFooter, false), - ByteVector.fromUInt(itemCount, false), - ByteVector.fromUInt(flags, false), + ApeTagFooter.FILE_IDENTIFIER, + ByteVector.fromUint(2000, false), + ByteVector.fromUint(itemPlusFooter, false), + ByteVector.fromUint(itemCount, false), + ByteVector.fromUint(flags, false), ByteVector.fromSize(8) ); } @@ -64,7 +61,7 @@ function getTestTagFooter(flags: ApeTagFooterFlags, itemCount: number, itemPlusF @test public fromData_emptyTag() { // Arrange - const data = getTestTagFooter(ApeTagFooterFlags.HeaderPresent, 0, ApeTagFooter.size); + const data = getTestTagFooter(ApeTagFooterFlags.HeaderPresent, 0, ApeTagFooter.SIZE); // Act const tag = ApeTag.fromData(data); @@ -85,7 +82,7 @@ function getTestTagFooter(flags: ApeTagFooterFlags, itemCount: number, itemPlusF const data = ByteVector.concatenate( item1, item2, - getTestTagFooter(0, 3, item1.length + item2.length + ApeTagFooter.size) + getTestTagFooter(0, 3, item1.length + item2.length + ApeTagFooter.SIZE) ); // Act @@ -147,8 +144,10 @@ function getTestTagFooter(flags: ApeTagFooterFlags, itemCount: number, itemPlusF @test public fromFile_emptyTag() { // Arrange - const data = getTestTagFooter(ApeTagFooterFlags.HeaderPresent, 0, ApeTagFooter.size); - data.insertByteVector(0, ByteVector.fromSize(10)); + const data = ByteVector.concatenate( + ByteVector.fromSize(10), + getTestTagFooter(ApeTagFooterFlags.HeaderPresent, 0, ApeTagFooter.SIZE) + ); const file = TestFile.getFile(data); // Act @@ -167,11 +166,11 @@ function getTestTagFooter(flags: ApeTagFooterFlags, itemCount: number, itemPlusF const item1 = ApeTagItem.fromTextValues("key1", "value1").render(); const item2 = ApeTagItem.fromTextValues("key2", "value2").render(); const data = ByteVector.concatenate( + ByteVector.fromSize(10), item1, item2, - getTestTagFooter(0, 3, item1.length + item2.length + ApeTagFooter.size) + getTestTagFooter(0, 3, item1.length + item2.length + ApeTagFooter.SIZE) ); - data.insertByteVector(0, ByteVector.fromSize(10)); const footerPosition = item1.length + item2.length + 10; const file = TestFile.getFile(data); @@ -210,8 +209,8 @@ function getTestTagFooter(flags: ApeTagFooterFlags, itemCount: number, itemPlusF public fromFile_positionIsAtHeader() { // Arrange const flags = (ApeTagFooterFlags.IsHeader | ApeTagFooterFlags.HeaderPresent) >>> 0; - const header = getTestTagFooter(flags, 0, ApeTagFooter.size); - const footer = getTestTagFooter(ApeTagFooterFlags.HeaderPresent, 0, ApeTagFooter.size); + const header = getTestTagFooter(flags, 0, ApeTagFooter.SIZE); + const footer = getTestTagFooter(ApeTagFooterFlags.HeaderPresent, 0, ApeTagFooter.SIZE); const data = ByteVector.concatenate( ByteVector.fromSize(10), header, @@ -662,11 +661,11 @@ function getTestTagFooter(flags: ApeTagFooterFlags, itemCount: number, itemPlusF const mockPicture1 = TypeMoq.Mock.ofType(); mockPicture1.setup((p) => p.description).returns(() => "foo"); mockPicture1.setup((p) => p.type).returns(() => PictureType.ColoredFish); - mockPicture1.setup((p) => p.data).returns(() => ByteVector.fromString("bar")); + mockPicture1.setup((p) => p.data).returns(() => ByteVector.fromString("bar", StringType.UTF8)); const mockPicture2 = TypeMoq.Mock.ofType(); mockPicture2.setup((p) => p.description).returns(() => "fux"); mockPicture2.setup((p) => p.type).returns(() => PictureType.NotAPicture); - mockPicture2.setup((p) => p.data).returns(() => ByteVector.fromString("bux")); + mockPicture2.setup((p) => p.data).returns(() => ByteVector.fromString("bux", StringType.UTF8)); // Act / Assert assert.ok(tag.pictures); @@ -683,10 +682,10 @@ function getTestTagFooter(flags: ApeTagFooterFlags, itemCount: number, itemPlusF assert.strictEqual(pictures.length, 2); assert.strictEqual(pictures[0].description, "foo"); assert.strictEqual(pictures[0].type, PictureType.ColoredFish); - Testers.bvEqual(pictures[0].data, ByteVector.fromString("bar")); + Testers.bvEqual(pictures[0].data, ByteVector.fromString("bar", StringType.UTF8)); assert.strictEqual(pictures[1].description, "fux"); assert.strictEqual(pictures[1].type, PictureType.NotAPicture); - Testers.bvEqual(pictures[1].data, ByteVector.fromString("bux")); + Testers.bvEqual(pictures[1].data, ByteVector.fromString("bux", StringType.UTF8)); tag.pictures = undefined; assert.strictEqual(tag.items.length, 0); @@ -1220,8 +1219,8 @@ function getTestTagFooter(flags: ApeTagFooterFlags, itemCount: number, itemPlusF public render() { // Arrange const flags = (ApeTagFooterFlags.IsHeader | ApeTagFooterFlags.HeaderPresent) >>> 0; - let header = getTestTagFooter(flags, 0, ApeTagFooter.size); - let footer = getTestTagFooter(ApeTagFooterFlags.HeaderPresent, 0, ApeTagFooter.size); + let header = getTestTagFooter(flags, 0, ApeTagFooter.SIZE); + let footer = getTestTagFooter(ApeTagFooterFlags.HeaderPresent, 0, ApeTagFooter.SIZE); const data = ByteVector.concatenate( ByteVector.fromSize(10), header, @@ -1240,7 +1239,7 @@ function getTestTagFooter(flags: ApeTagFooterFlags, itemCount: number, itemPlusF // Assert const item1Render = item1.render(); const item2Render = item2.render(); - const tagSize = ApeTagFooter.size + item1Render.length + item2Render.length; + const tagSize = ApeTagFooter.SIZE + item1Render.length + item2Render.length; header = getTestTagFooter(flags, 2, tagSize); footer = getTestTagFooter(ApeTagFooterFlags.HeaderPresent, 2, tagSize); const expected = ByteVector.concatenate( diff --git a/test-unit/asf/asfTagTests.ts b/test-unit/asf/asfTagTests.ts index 771833f0..daa0c6b1 100644 --- a/test-unit/asf/asfTagTests.ts +++ b/test-unit/asf/asfTagTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import {Mock} from "typemoq"; import AsfTag from "../../src/asf/AsfTag"; @@ -10,26 +10,23 @@ import PropertyTests from "../utilities/propertyTests"; import TestFile from "../utilities/testFile"; import {ByteVector, StringType} from "../../src/byteVector"; import {Guids} from "../../src/asf/constants"; -import {DataType, DescriptorBase} from "../../src/asf/objects/descriptorBase"; +import {DataType, DescriptorBase, DescriptorValue} from "../../src/asf/objects/descriptorBase"; import { ContentDescriptor, ExtendedContentDescriptionObject } from "../../src/asf/objects/extendedContentDescriptionObject"; import HeaderExtensionObject from "../../src/asf/objects/headerExtensionObject"; -import {IPicture, PictureType} from "../../src/iPicture"; +import {IPicture, PictureType} from "../../src/picture"; import {MetadataDescriptor, MetadataLibraryObject} from "../../src/asf/objects/metadataLibraryObject"; import {TagTypes} from "../../src/tag"; import {TagTesters, Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - const getHeaderObject: (children: BaseObject[]) => HeaderObject = (children: BaseObject[]) => { const childrenBytes = ByteVector.concatenate(... children.map((o) => o.render())); const headerBytes = ByteVector.concatenate( - Guids.AsfHeaderObject.toBytes(), // Object ID - ByteVector.fromULong(30 + childrenBytes.length, false), // Object size - ByteVector.fromUInt(children.length, false), // Child objects + Guids.ASF_HEADER_OBJECT.toBytes(), // Object ID + ByteVector.fromUlong(30 + childrenBytes.length, false), // Object size + ByteVector.fromUint(children.length, false), // Child objects 0x01, 0x02, // Reserved bytes childrenBytes ); @@ -40,19 +37,23 @@ const getHeaderObject: (children: BaseObject[]) => HeaderObject = (children: Bas const getHeaderExtensionObject: (children: BaseObject[]) => HeaderExtensionObject = (children: BaseObject[]) => { const childrenBytes = ByteVector.concatenate(... children.map((o) => o.render())); const headerExtBytes = ByteVector.concatenate( - Guids.AsfHeaderExtensionObject.toBytes(), // Object ID - ByteVector.fromULong(46 + childrenBytes.length, false), // Object size - Guids.AsfReserved1.toBytes(), // Reserved field 1 - ByteVector.fromUShort(6, false), // Reserved field 2 - ByteVector.fromUInt(childrenBytes.length, false), // Header extension data length + Guids.ASF_HEADER_EXTENSION_OBJECT.toBytes(), // Object ID + ByteVector.fromUlong(46 + childrenBytes.length, false), // Object size + Guids.ASF_RESERVED.toBytes(), // Reserved field 1 + ByteVector.fromUshort(6, false), // Reserved field 2 + ByteVector.fromUint(childrenBytes.length, false), // Header extension data length childrenBytes ); const headerExtFile = TestFile.getFile(headerExtBytes); return HeaderExtensionObject.fromFile(headerExtFile, 0); }; -const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: DataType, descriptorValue: any) => AsfTag - = (descriptorName: string, descriptorType: DataType, descriptorValue: any) => { +const getTagWithExtensionDescriptor: ( + descriptorName: string, + descriptorType: DataType, + descriptorValue: DescriptorValue +) => AsfTag + = (descriptorName: string, descriptorType: DataType, descriptorValue: DescriptorValue) => { const descriptor = new ContentDescriptor(descriptorName, descriptorType, descriptorValue); const ecdo = ExtendedContentDescriptionObject.fromEmpty(); ecdo.addDescriptor(descriptor); @@ -299,7 +300,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da assert.strictEqual(tag.extendedContentDescriptionObject.descriptors.length, 1); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].name, "WM/Year"); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].type, DataType.Unicode); - assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].getString(), "1234"); + assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].stringValue, "1234"); } @test @@ -309,7 +310,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da (t) => t.track, "WM/TrackNumber", DataType.Unicode, - (d) => d.getString(), + (d) => d.stringValue, "1234" ); } @@ -321,7 +322,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da (t) => t.trackCount, "TrackTotal", DataType.DWord, - (d) => d.getUint(), + (d) => d.uintValue, 1234 ); } @@ -413,7 +414,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da assert.strictEqual(tag.extendedContentDescriptionObject.descriptors.length, 1); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].name, "WM/PartOfSet"); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].type, DataType.Unicode); - assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].getString(), "123"); + assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].stringValue, "123"); } @test @@ -430,7 +431,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da assert.strictEqual(tag.extendedContentDescriptionObject.descriptors.length, 1); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].name, "WM/PartOfSet"); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].type, DataType.Unicode); - assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].getString(), "123/234"); + assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].stringValue, "123/234"); } @test @@ -518,7 +519,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da assert.strictEqual(tag.extendedContentDescriptionObject.descriptors.length, 1); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].name, "WM/PartOfSet"); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].type, DataType.Unicode); - assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].getString(), "0/123"); + assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].stringValue, "0/123"); } @test @@ -535,7 +536,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da assert.strictEqual(tag.extendedContentDescriptionObject.descriptors.length, 1); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].name, "WM/PartOfSet"); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].type, DataType.Unicode); - assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].getString(), "123/234"); + assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].stringValue, "123/234"); } @test @@ -552,7 +553,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da assert.strictEqual(tag.extendedContentDescriptionObject.descriptors.length, 1); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].name, "WM/PartOfSet"); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].type, DataType.Unicode); - assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].getString(), "123/234"); + assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].stringValue, "123/234"); } @test @@ -580,7 +581,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da (t) => t.beatsPerMinute, "WM/BeatsPerMinute", DataType.Unicode, - (d) => d.getString(), + (d) => d.stringValue, "1234" ); } @@ -788,7 +789,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da assert.strictEqual(tag.extendedContentDescriptionObject.descriptors.length, 1); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].name, "ReplayGain/Track"); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].type, DataType.Unicode); - assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].getString(), "1.23 dB"); + assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].stringValue, "1.23 dB"); } @test @@ -862,7 +863,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da assert.strictEqual(tag.extendedContentDescriptionObject.descriptors.length, 1); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].name, "ReplayGain/Track Peak"); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].type, DataType.Unicode); - assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].getString(), "1.234568"); + assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].stringValue, "1.234568"); } @test @@ -960,7 +961,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da assert.strictEqual(tag.extendedContentDescriptionObject.descriptors.length, 1); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].name, "ReplayGain/Album"); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].type, DataType.Unicode); - assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].getString(), "1.23 dB"); + assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].stringValue, "1.23 dB"); } @test @@ -1034,7 +1035,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da assert.strictEqual(tag.extendedContentDescriptionObject.descriptors.length, 1); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].name, "ReplayGain/Album Peak"); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].type, DataType.Unicode); - assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].getString(), "1.234568"); + assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].stringValue, "1.234568"); } @test @@ -1061,7 +1062,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da const pic2PictureData = ByteVector.fromSize(10, 0x08); const pic2Data = ByteVector.concatenate( PictureType.ColoredFish, - ByteVector.fromUInt(pic2PictureData.length, false), + ByteVector.fromUint(pic2PictureData.length, false), ByteVector.fromString("Ha! Ha!", StringType.UTF16LE), ByteVector.getTextDelimiter(StringType.UTF16LE), ByteVector.fromString("I'm using the internet!", StringType.UTF16LE), @@ -1256,7 +1257,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da assert.strictEqual(tag.extendedContentDescriptionObject.descriptors.length, 1); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].name, descriptorName[0]); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].type, DataType.Unicode); - assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].getString(), "foo; bar; baz"); + assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].stringValue, "foo; bar; baz"); // End test cases if there's only one descriptor name if (descriptorName.length === 1) { @@ -1284,7 +1285,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da assert.strictEqual(tag2.extendedContentDescriptionObject.descriptors.length, 1); assert.strictEqual(tag2.extendedContentDescriptionObject.descriptors[0].name, descriptorName[0]); assert.strictEqual(tag2.extendedContentDescriptionObject.descriptors[0].type, DataType.Unicode); - assert.strictEqual(tag2.extendedContentDescriptionObject.descriptors[0].getString(), "fux; bux; qux"); + assert.strictEqual(tag2.extendedContentDescriptionObject.descriptors[0].stringValue, "fux; bux; qux"); } } @@ -1306,7 +1307,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da assert.strictEqual(tag.extendedContentDescriptionObject.descriptors.length, 1); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].name, descriptorName[0]); assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].type, DataType.Unicode); - assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].getString(), "foo"); + assert.strictEqual(tag.extendedContentDescriptionObject.descriptors[0].stringValue, "foo"); // End test cases if there's only one descriptor name if (descriptorName.length === 1) { @@ -1334,7 +1335,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da assert.strictEqual(tag2.extendedContentDescriptionObject.descriptors.length, 1); assert.strictEqual(tag2.extendedContentDescriptionObject.descriptors[0].name, descriptorName[0]); assert.strictEqual(tag2.extendedContentDescriptionObject.descriptors[0].type, DataType.Unicode); - assert.strictEqual(tag2.extendedContentDescriptionObject.descriptors[0].getString(), "fux"); + assert.strictEqual(tag2.extendedContentDescriptionObject.descriptors[0].stringValue, "fux"); } } @@ -1343,8 +1344,8 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da get: (t: AsfTag) => number, descriptorName: string, expectedDescriptorType: DataType, - expectedDescriptorReader: (d: DescriptorBase) => any, - expectedDescriptorValue: any + expectedDescriptorReader: (d: DescriptorBase) => DescriptorValue, + expectedDescriptorValue: DescriptorValue ) { // CASE 1: Default behavior ---------------------------------------- // Arrange @@ -1406,7 +1407,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da public pictureFromData_missingMimeTypeDelimiter() { // Arrange const data = ByteVector.concatenate( - ByteVector.fromUInt(1234, false), + ByteVector.fromUint(1234, false), ByteVector.fromSize(10, 0x01) ); @@ -1421,7 +1422,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da public pictureFromData_missingMimeTypeDelimiterWithZeroes() { // Arrange const data = ByteVector.concatenate( - ByteVector.fromUInt(1234, false), + ByteVector.fromUint(1234, false), ByteVector.fromSize(10, 0x00) ); @@ -1436,7 +1437,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da public pictureFromData_missingDescriptionDelimiter() { // Arrange const data = ByteVector.concatenate( - ByteVector.fromUInt(1234, false), + ByteVector.fromUint(1234, false), ByteVector.fromString("Ha! Ha!", StringType.UTF16LE), ByteVector.getTextDelimiter(StringType.UTF16LE), ByteVector.fromSize(10, 0x01) @@ -1453,7 +1454,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da public pictureFromData_missingDescriptionDelimiterWithZeroes() { // Arrange const data = ByteVector.concatenate( - ByteVector.fromUInt(1234, false), + ByteVector.fromUint(1234, false), ByteVector.fromString("Ha! Ha!", StringType.UTF16LE), ByteVector.getTextDelimiter(StringType.UTF16LE), ByteVector.fromSize(10, 0x00) @@ -1472,7 +1473,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da const pictureData = ByteVector.fromSize(22, 0x08); const data = ByteVector.concatenate( PictureType.ColoredFish, - ByteVector.fromUInt(pictureData.length, false), + ByteVector.fromUint(pictureData.length, false), ByteVector.fromString("Ha! Ha!", StringType.UTF16LE), ByteVector.getTextDelimiter(StringType.UTF16LE), ByteVector.fromString("I'm using the internet!", StringType.UTF16LE), @@ -1509,7 +1510,7 @@ const getTagWithExtensionDescriptor: (descriptorName: string, descriptorType: Da // Assert const expected = ByteVector.concatenate( PictureType.ColoredFish, - ByteVector.fromUInt(pictureData.length, false), + ByteVector.fromUint(pictureData.length, false), ByteVector.fromString("Ha! Ha!", StringType.UTF16LE), ByteVector.getTextDelimiter(StringType.UTF16LE), ByteVector.fromString("I'm using the internet!", StringType.UTF16LE), diff --git a/test-unit/asf/contentDescriptionObjectTests.ts b/test-unit/asf/contentDescriptionObjectTests.ts index 929b5d69..44cc8d8b 100644 --- a/test-unit/asf/contentDescriptionObjectTests.ts +++ b/test-unit/asf/contentDescriptionObjectTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import ContentDescriptionObject from "../../src/asf/objects/contentDescriptionObject"; import ObjectTests from "./objectTests"; @@ -11,15 +11,12 @@ import {Guids, ObjectType} from "../../src/asf/constants"; import {File} from "../../src/file"; import {Testers} from "../utilities/testers"; -// Setup Chai -const assert = Chai.assert; - @suite class Asf_ContentDescriptionObjectTests extends ObjectTests { protected get fromFileConstructor(): (f: File, p: number) => ContentDescriptionObject { return ContentDescriptionObject.fromFile; } protected get minSize(): number { return 34; } - protected get objectGuid(): UuidWrapper { return Guids.AsfContentDescriptionObject; } + protected get objectGuid(): UuidWrapper { return Guids.ASF_CONTENT_DESCRIPTION_OBJECT; } @test public fromEmpty() { @@ -30,7 +27,7 @@ const assert = Chai.assert; assert.isOk(object); assert.strictEqual(object.originalSize, 0); assert.strictEqual(object.objectType, ObjectType.ContentDescriptionObject); - assert.isTrue(object.guid.equals(Guids.AsfContentDescriptionObject)); + assert.isTrue(object.guid.equals(Guids.ASF_CONTENT_DESCRIPTION_OBJECT)); assert.isUndefined(object.author); assert.isUndefined(object.copyright); assert.isUndefined(object.description); @@ -44,13 +41,13 @@ const assert = Chai.assert; // Arrange const data = ByteVector.concatenate( ByteVector.fromSize(10), // Offset - Guids.AsfContentDescriptionObject.toBytes(), // Object ID - ByteVector.fromULong(94, false), // Object size - ByteVector.fromUShort(8, false), // Title size - ByteVector.fromUShort(10, false), // Author length - ByteVector.fromUShort(12, false), // Copyright length - ByteVector.fromUShort(14, false), // Description length - ByteVector.fromUShort(16, false), // Rating length + Guids.ASF_CONTENT_DESCRIPTION_OBJECT.toBytes(), // Object ID + ByteVector.fromUlong(94, false), // Object size + ByteVector.fromUshort(8, false), // Title size + ByteVector.fromUshort(10, false), // Author length + ByteVector.fromUshort(12, false), // Copyright length + ByteVector.fromUshort(14, false), // Description length + ByteVector.fromUshort(16, false), // Rating length ByteVector.fromString("foo\0", StringType.UTF16LE), // Title ByteVector.fromString("bar0\0", StringType.UTF16LE), // Author ByteVector.fromString("baz00\0", StringType.UTF16LE), // Copyright @@ -66,7 +63,7 @@ const assert = Chai.assert; assert.isOk(object); assert.strictEqual(object.originalSize, 94); assert.strictEqual(object.objectType, ObjectType.ContentDescriptionObject); - assert.isTrue(object.guid.equals(Guids.AsfContentDescriptionObject)); + assert.isTrue(object.guid.equals(Guids.ASF_CONTENT_DESCRIPTION_OBJECT)); assert.strictEqual(object.author, "bar0"); assert.strictEqual(object.copyright, "baz00"); assert.strictEqual(object.description, "fux000"); @@ -150,13 +147,13 @@ const assert = Chai.assert; // Arrange const data = ByteVector.concatenate( ByteVector.fromSize(10), // Offset - Guids.AsfContentDescriptionObject.toBytes(), // Object ID - ByteVector.fromULong(94, false), - ByteVector.fromUShort(8, false), - ByteVector.fromUShort(10, false), - ByteVector.fromUShort(12, false), - ByteVector.fromUShort(14, false), - ByteVector.fromUShort(16, false), + Guids.ASF_CONTENT_DESCRIPTION_OBJECT.toBytes(), // Object ID + ByteVector.fromUlong(94, false), + ByteVector.fromUshort(8, false), + ByteVector.fromUshort(10, false), + ByteVector.fromUshort(12, false), + ByteVector.fromUshort(14, false), + ByteVector.fromUshort(16, false), ByteVector.fromString("foo\0", StringType.UTF16LE), ByteVector.fromString("bar0\0", StringType.UTF16LE), ByteVector.fromString("baz00\0", StringType.UTF16LE), @@ -171,6 +168,6 @@ const assert = Chai.assert; // Assert assert.isOk(object); - Testers.bvEqual(output, data.mid(10)); + Testers.bvEqual(output, data.subarray(10)); } } diff --git a/test-unit/asf/descriptorBaseTests.ts b/test-unit/asf/descriptorBaseTests.ts index acb7ea41..4f6821b8 100644 --- a/test-unit/asf/descriptorBaseTests.ts +++ b/test-unit/asf/descriptorBaseTests.ts @@ -1,14 +1,11 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import UuidWrapper from "../../src/uuidWrapper"; -import {ByteVector} from "../../src/byteVector"; +import {ByteVector, StringType} from "../../src/byteVector"; import {DataType, DescriptorBase, DescriptorValue} from "../../src/asf/objects/descriptorBase"; import {Testers} from "../utilities/testers"; -// Setup Chai -const assert = Chai.assert; - class TestDescriptor extends DescriptorBase { public constructor(name: string, type: DataType, value: DescriptorValue) { super(name, type, value); @@ -43,13 +40,13 @@ class TestDescriptor extends DescriptorBase { // Assert assert.strictEqual(d.name, "foo"); assert.strictEqual(d.type, DataType.Word); - assert.isUndefined(d.getBool()); - assert.isUndefined(d.getBytes()); - assert.isUndefined(d.getGuid()); - assert.isUndefined(d.getString()); - assert.isUndefined(d.getUint()); - assert.isUndefined(d.getUlong()); - assert.strictEqual(d.getUshort(), 1234); + assert.isUndefined(d.boolValue); + assert.isUndefined(d.byteValue); + assert.isUndefined(d.guidValue); + assert.isUndefined(d.stringValue); + assert.isUndefined(d.uintValue); + assert.isUndefined(d.ulongValue); + assert.strictEqual(d.ushortValue, 1234); } @test @@ -71,13 +68,13 @@ class TestDescriptor extends DescriptorBase { // Assert assert.strictEqual(d.name, "foo"); assert.strictEqual(d.type, DataType.DWord); - assert.isUndefined(d.getBool()); - assert.isUndefined(d.getBytes()); - assert.isUndefined(d.getGuid()); - assert.isUndefined(d.getString()); - assert.strictEqual(d.getUint(), 1234); - assert.isUndefined(d.getUlong()); - assert.isUndefined(d.getUshort()); + assert.isUndefined(d.boolValue); + assert.isUndefined(d.byteValue); + assert.isUndefined(d.guidValue); + assert.isUndefined(d.stringValue); + assert.strictEqual(d.uintValue, 1234); + assert.isUndefined(d.ulongValue); + assert.isUndefined(d.ushortValue); } @test @@ -99,13 +96,13 @@ class TestDescriptor extends DescriptorBase { // Assert assert.strictEqual(d.name, "foo"); assert.strictEqual(d.type, DataType.QWord); - assert.isUndefined(d.getBool()); - assert.isUndefined(d.getBytes()); - assert.isUndefined(d.getGuid()); - assert.isUndefined(d.getString()); - assert.isUndefined(d.getUint()); - assert.strictEqual(d.getUlong(), BigInt(1234)); - assert.isUndefined(d.getUshort()); + assert.isUndefined(d.boolValue); + assert.isUndefined(d.byteValue); + assert.isUndefined(d.guidValue); + assert.isUndefined(d.stringValue); + assert.isUndefined(d.uintValue); + assert.strictEqual(d.ulongValue, BigInt(1234)); + assert.isUndefined(d.ushortValue); } @test @@ -128,13 +125,13 @@ class TestDescriptor extends DescriptorBase { // Assert assert.strictEqual(d.name, "foo"); assert.strictEqual(d.type, DataType.Bool); - assert.strictEqual(d.getBool(), true); - assert.isUndefined(d.getBytes()); - assert.isUndefined(d.getGuid()); - assert.isUndefined(d.getString()); - assert.isUndefined(d.getUint()); - assert.isUndefined(d.getUlong()); - assert.isUndefined(d.getUshort()); + assert.strictEqual(d.boolValue, true); + assert.isUndefined(d.byteValue); + assert.isUndefined(d.guidValue); + assert.isUndefined(d.stringValue); + assert.isUndefined(d.uintValue); + assert.isUndefined(d.ulongValue); + assert.isUndefined(d.ushortValue); } @test @@ -157,13 +154,13 @@ class TestDescriptor extends DescriptorBase { // Assert assert.strictEqual(d.name, "foo"); assert.strictEqual(d.type, DataType.Unicode); - assert.isUndefined(d.getBool()); - assert.isUndefined(d.getBytes()); - assert.isUndefined(d.getGuid()); - assert.strictEqual(d.getString(), "bar"); - assert.isUndefined(d.getUint()); - assert.isUndefined(d.getUlong()); - assert.isUndefined(d.getUshort()); + assert.isUndefined(d.boolValue); + assert.isUndefined(d.byteValue); + assert.isUndefined(d.guidValue); + assert.strictEqual(d.stringValue, "bar"); + assert.isUndefined(d.uintValue); + assert.isUndefined(d.ulongValue); + assert.isUndefined(d.ushortValue); } @test @@ -181,7 +178,7 @@ class TestDescriptor extends DescriptorBase { @test public bytes_valid() { // Arrange - const bytes = ByteVector.fromString("fuxbuxquxx"); + const bytes = ByteVector.fromString("fuxbuxquxx", StringType.UTF8); // Act const d = new TestDescriptor("foo", DataType.Bytes, bytes); @@ -189,13 +186,13 @@ class TestDescriptor extends DescriptorBase { // Assert assert.strictEqual(d.name, "foo"); assert.strictEqual(d.type, DataType.Bytes); - assert.isUndefined(d.getBool()); - Testers.bvEqual(d.getBytes(), bytes); - assert.isUndefined(d.getGuid()); - assert.isUndefined(d.getString()); - assert.isUndefined(d.getUint()); - assert.isUndefined(d.getUlong()); - assert.isUndefined(d.getUshort()); + assert.isUndefined(d.boolValue); + Testers.bvEqual(d.byteValue, bytes); + assert.isUndefined(d.guidValue); + assert.isUndefined(d.stringValue); + assert.isUndefined(d.uintValue); + assert.isUndefined(d.ulongValue); + assert.isUndefined(d.ushortValue); } @test @@ -221,12 +218,12 @@ class TestDescriptor extends DescriptorBase { // Assert assert.strictEqual(d.name, "foo"); assert.strictEqual(d.type, DataType.Guid); - assert.isUndefined(d.getBool()); - assert.isUndefined(d.getBytes()); - assert.isTrue(d.getGuid().equals(guid)); - assert.isUndefined(d.getString()); - assert.isUndefined(d.getUint()); - assert.isUndefined(d.getUlong()); - assert.isUndefined(d.getUshort()); + assert.isUndefined(d.boolValue); + assert.isUndefined(d.byteValue); + assert.isTrue(d.guidValue.equals(guid)); + assert.isUndefined(d.stringValue); + assert.isUndefined(d.uintValue); + assert.isUndefined(d.ulongValue); + assert.isUndefined(d.ushortValue); } } diff --git a/test-unit/asf/extendedContentDescriptionObjectTests.ts b/test-unit/asf/extendedContentDescriptionObjectTests.ts index 75dd95a8..ba627824 100644 --- a/test-unit/asf/extendedContentDescriptionObjectTests.ts +++ b/test-unit/asf/extendedContentDescriptionObjectTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import ObjectTests from "./objectTests"; import UuidWrapper from "../../src/uuidWrapper"; @@ -14,9 +14,6 @@ import { ExtendedContentDescriptionObject } from "../../src/asf/objects/extendedContentDescriptionObject"; -// Setup Chai -const assert = Chai.assert; - @suite class Asf_ContentDescriptorTests { // NOTE: We'll use the constructor tests to make sure the render method does what it's supposed to @@ -28,14 +25,14 @@ const assert = Chai.assert; // Assert assert.strictEqual(object.name, "foo"); assert.strictEqual(object.type, DataType.Word); - assert.strictEqual(object.getUshort(), 1234); + assert.strictEqual(object.ushortValue, 1234); const expectedBytes = ByteVector.concatenate( - ByteVector.fromUShort(8, false), + ByteVector.fromUshort(8, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromUShort(DataType.Word, false), - ByteVector.fromUShort(2, false), - ByteVector.fromUShort(1234, false) + ByteVector.fromUshort(DataType.Word, false), + ByteVector.fromUshort(2, false), + ByteVector.fromUshort(1234, false) ); Testers.bvEqual(object.render(), expectedBytes); } @@ -44,11 +41,11 @@ const assert = Chai.assert; public fromFile_word() { // Arrange const bytes = ByteVector.concatenate( - ByteVector.fromUShort(8, false), + ByteVector.fromUshort(8, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromUShort(DataType.Word, false), - ByteVector.fromUShort(2, false), - ByteVector.fromUShort(1234, false) + ByteVector.fromUshort(DataType.Word, false), + ByteVector.fromUshort(2, false), + ByteVector.fromUshort(1234, false) ); const file = TestFile.getFile(bytes); @@ -58,7 +55,7 @@ const assert = Chai.assert; // Assert assert.strictEqual(object.name, "foo"); assert.strictEqual(object.type, DataType.Word); - assert.strictEqual(object.getUshort(), 1234); + assert.strictEqual(object.ushortValue, 1234); } @test @@ -69,14 +66,14 @@ const assert = Chai.assert; // Assert assert.strictEqual(object.name, "foo"); assert.strictEqual(object.type, DataType.Bool); - assert.strictEqual(object.getBool(), true); + assert.strictEqual(object.boolValue, true); const expectedBytes = ByteVector.concatenate( - ByteVector.fromUShort(8, false), + ByteVector.fromUshort(8, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromUShort(DataType.Bool, false), - ByteVector.fromUShort(4, false), - ByteVector.fromUInt(1, false) + ByteVector.fromUshort(DataType.Bool, false), + ByteVector.fromUshort(4, false), + ByteVector.fromUint(1, false) ); Testers.bvEqual(object.render(), expectedBytes); } @@ -85,11 +82,11 @@ const assert = Chai.assert; public fromFile_bool() { // Arrange const bytes = ByteVector.concatenate( - ByteVector.fromUShort(8, false), + ByteVector.fromUshort(8, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromUShort(DataType.Bool, false), - ByteVector.fromUShort(4, false), - ByteVector.fromUInt(1, false) + ByteVector.fromUshort(DataType.Bool, false), + ByteVector.fromUshort(4, false), + ByteVector.fromUint(1, false) ); const file = TestFile.getFile(bytes); @@ -99,7 +96,7 @@ const assert = Chai.assert; // Assert assert.strictEqual(object.name, "foo"); assert.strictEqual(object.type, DataType.Bool); - assert.strictEqual(object.getBool(), true); + assert.strictEqual(object.boolValue, true); } @test @@ -110,14 +107,14 @@ const assert = Chai.assert; // Assert assert.strictEqual(object.name, "foo"); assert.strictEqual(object.type, DataType.DWord); - assert.strictEqual(object.getUint(), 1234); + assert.strictEqual(object.uintValue, 1234); const expectedBytes = ByteVector.concatenate( - ByteVector.fromUShort(8, false), + ByteVector.fromUshort(8, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromUShort(DataType.DWord, false), - ByteVector.fromUShort(4, false), - ByteVector.fromUInt(1234, false) + ByteVector.fromUshort(DataType.DWord, false), + ByteVector.fromUshort(4, false), + ByteVector.fromUint(1234, false) ); Testers.bvEqual(object.render(), expectedBytes); } @@ -126,11 +123,11 @@ const assert = Chai.assert; public fromFile_dword() { // Arrange const bytes = ByteVector.concatenate( - ByteVector.fromUShort(8, false), + ByteVector.fromUshort(8, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromUShort(DataType.DWord, false), - ByteVector.fromUShort(4, false), - ByteVector.fromUInt(1234, false) + ByteVector.fromUshort(DataType.DWord, false), + ByteVector.fromUshort(4, false), + ByteVector.fromUint(1234, false) ); const file = TestFile.getFile(bytes); @@ -140,7 +137,7 @@ const assert = Chai.assert; // Assert assert.strictEqual(object.name, "foo"); assert.strictEqual(object.type, DataType.DWord); - assert.strictEqual(object.getUint(), 1234); + assert.strictEqual(object.uintValue, 1234); } @test @@ -151,14 +148,14 @@ const assert = Chai.assert; // Assert assert.strictEqual(object.name, "foo"); assert.strictEqual(object.type, DataType.QWord); - assert.strictEqual(object.getUlong(), BigInt(1234)); + assert.strictEqual(object.ulongValue, BigInt(1234)); const expectedBytes = ByteVector.concatenate( - ByteVector.fromUShort(8, false), + ByteVector.fromUshort(8, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromUShort(DataType.QWord, false), - ByteVector.fromUShort(8, false), - ByteVector.fromULong(1234, false) + ByteVector.fromUshort(DataType.QWord, false), + ByteVector.fromUshort(8, false), + ByteVector.fromUlong(1234, false) ); Testers.bvEqual(object.render(), expectedBytes); } @@ -167,11 +164,11 @@ const assert = Chai.assert; public fromFile_qword() { // Arrange const bytes = ByteVector.concatenate( - ByteVector.fromUShort(8, false), + ByteVector.fromUshort(8, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromUShort(DataType.QWord, false), - ByteVector.fromUShort(8, false), - ByteVector.fromULong(1234, false) + ByteVector.fromUshort(DataType.QWord, false), + ByteVector.fromUshort(8, false), + ByteVector.fromUlong(1234, false) ); const file = TestFile.getFile(bytes); @@ -181,7 +178,7 @@ const assert = Chai.assert; // Assert assert.strictEqual(object.name, "foo"); assert.strictEqual(object.type, DataType.QWord); - assert.strictEqual(object.getUlong(), BigInt(1234)); + assert.strictEqual(object.ulongValue, BigInt(1234)); } @test @@ -192,13 +189,13 @@ const assert = Chai.assert; // Assert assert.strictEqual(object.name, "foo"); assert.strictEqual(object.type, DataType.Unicode); - assert.strictEqual(object.getString(), "foobarbaz"); + assert.strictEqual(object.stringValue, "foobarbaz"); const expectedBytes = ByteVector.concatenate( - ByteVector.fromUShort(8, false), + ByteVector.fromUshort(8, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromUShort(DataType.Unicode, false), - ByteVector.fromUShort(20, false), + ByteVector.fromUshort(DataType.Unicode, false), + ByteVector.fromUshort(20, false), ByteVector.fromString("foobarbaz\0", StringType.UTF16LE) ); Testers.bvEqual(object.render(), expectedBytes); @@ -208,10 +205,10 @@ const assert = Chai.assert; public fromFile_unicode() { // Arrange const bytes = ByteVector.concatenate( - ByteVector.fromUShort(8, false), + ByteVector.fromUshort(8, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromUShort(DataType.Unicode, false), - ByteVector.fromUShort(20, false), + ByteVector.fromUshort(DataType.Unicode, false), + ByteVector.fromUshort(20, false), ByteVector.fromString("foobarbaz\0", StringType.UTF16LE) ); const file = TestFile.getFile(bytes); @@ -222,13 +219,13 @@ const assert = Chai.assert; // Assert assert.strictEqual(object.name, "foo"); assert.strictEqual(object.type, DataType.Unicode); - assert.strictEqual(object.getString(), "foobarbaz"); + assert.strictEqual(object.stringValue, "foobarbaz"); } @test public constructor_bytes() { // Arrange - const bytes = ByteVector.fromString("abcdef"); + const bytes = ByteVector.fromString("abcdef", StringType.UTF8); // Act const object = new ContentDescriptor("foo", DataType.Bytes, bytes); @@ -236,13 +233,13 @@ const assert = Chai.assert; // Assert assert.strictEqual(object.name, "foo"); assert.strictEqual(object.type, DataType.Bytes); - Testers.bvEqual(object.getBytes(), bytes); + Testers.bvEqual(object.byteValue, bytes); const expectedBytes = ByteVector.concatenate( - ByteVector.fromUShort(8, false), + ByteVector.fromUshort(8, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromUShort(DataType.Bytes, false), - ByteVector.fromUShort(6, false), + ByteVector.fromUshort(DataType.Bytes, false), + ByteVector.fromUshort(6, false), bytes ); Testers.bvEqual(object.render(), expectedBytes); @@ -251,14 +248,14 @@ const assert = Chai.assert; @test public fromFile_bytes() { // Arrange - const bytes = ByteVector.fromString("abcdef"); + const bytes = ByteVector.fromString("abcdef", StringType.UTF8); // Arrange const data = ByteVector.concatenate( - ByteVector.fromUShort(8, false), + ByteVector.fromUshort(8, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromUShort(DataType.Bytes, false), - ByteVector.fromUShort(6, false), + ByteVector.fromUshort(DataType.Bytes, false), + ByteVector.fromUshort(6, false), bytes ); const file = TestFile.getFile(data); @@ -269,7 +266,7 @@ const assert = Chai.assert; // Assert assert.strictEqual(object.name, "foo"); assert.strictEqual(object.type, DataType.Bytes); - Testers.bvEqual(object.getBytes(), bytes); + Testers.bvEqual(object.byteValue, bytes); } @test @@ -283,13 +280,13 @@ const assert = Chai.assert; // Assert assert.strictEqual(object.name, "foo"); assert.strictEqual(object.type, DataType.Guid); - assert.isTrue(object.getGuid().equals(guid)); + assert.isTrue(object.guidValue.equals(guid)); const expectedBytes = ByteVector.concatenate( - ByteVector.fromUShort(8, false), + ByteVector.fromUshort(8, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromUShort(DataType.Guid, false), - ByteVector.fromUShort(16, false), + ByteVector.fromUshort(DataType.Guid, false), + ByteVector.fromUshort(16, false), guid.toBytes() ); Testers.bvEqual(object.render(), expectedBytes); @@ -302,10 +299,10 @@ const assert = Chai.assert; // Arrange const data = ByteVector.concatenate( - ByteVector.fromUShort(8, false), + ByteVector.fromUshort(8, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromUShort(DataType.Guid, false), - ByteVector.fromUShort(16, false), + ByteVector.fromUshort(DataType.Guid, false), + ByteVector.fromUshort(16, false), guid.toBytes() ); const file = TestFile.getFile(data); @@ -316,7 +313,7 @@ const assert = Chai.assert; // Assert assert.strictEqual(object.name, "foo"); assert.strictEqual(object.type, DataType.Guid); - assert.isTrue(object.getGuid().equals(guid)); + assert.isTrue(object.guidValue.equals(guid)); } } @@ -325,7 +322,7 @@ const assert = Chai.assert; return ExtendedContentDescriptionObject.fromFile; } protected get minSize(): number { return 26; } - protected get objectGuid(): UuidWrapper { return Guids.AsfMetadataLibraryObject; } + protected get objectGuid(): UuidWrapper { return Guids.ASF_METADATA_LIBRARY_OBJECT; } @test public fromEmpty() { @@ -334,7 +331,7 @@ const assert = Chai.assert; // Assert assert.isOk(object); - assert.isTrue(object.guid.equals(Guids.AsfExtendedContentDescriptionObject)); + assert.isTrue(object.guid.equals(Guids.ASF_EXTENDED_CONTENT_DESCRIPTION_OBJECT)); assert.strictEqual(object.objectType, ObjectType.ExtendedContentDescriptionObject); assert.strictEqual(object.originalSize, 0); assert.isTrue(object.isEmpty); @@ -350,9 +347,9 @@ const assert = Chai.assert; const record2Bytes = record2.render(); const bytes = ByteVector.concatenate( ByteVector.fromSize(10), // Offset - Guids.AsfExtendedContentDescriptionObject.toBytes(), - ByteVector.fromULong(16 + 8 + 2 + record1Bytes.length + record2Bytes.length, false), - ByteVector.fromUShort(2, false), + Guids.ASF_EXTENDED_CONTENT_DESCRIPTION_OBJECT.toBytes(), + ByteVector.fromUlong(16 + 8 + 2 + record1Bytes.length + record2Bytes.length, false), + ByteVector.fromUshort(2, false), record1Bytes, record2Bytes ); @@ -363,7 +360,7 @@ const assert = Chai.assert; // Assert assert.isOk(object); - assert.isTrue(object.guid.equals(Guids.AsfExtendedContentDescriptionObject)); + assert.isTrue(object.guid.equals(Guids.ASF_EXTENDED_CONTENT_DESCRIPTION_OBJECT)); assert.strictEqual(object.objectType, ObjectType.ExtendedContentDescriptionObject); assert.strictEqual(object.originalSize, bytes.length - 10); assert.isFalse(object.isEmpty); @@ -539,9 +536,9 @@ const assert = Chai.assert; const record2Bytes = record2.render(); const bytes = ByteVector.concatenate( ByteVector.fromSize(10), // Offset - Guids.AsfExtendedContentDescriptionObject.toBytes(), - ByteVector.fromULong(16 + 8 + 2 + record1Bytes.length + record2Bytes.length, false), - ByteVector.fromUShort(2, false), + Guids.ASF_EXTENDED_CONTENT_DESCRIPTION_OBJECT.toBytes(), + ByteVector.fromUlong(16 + 8 + 2 + record1Bytes.length + record2Bytes.length, false), + ByteVector.fromUshort(2, false), record1Bytes, record2Bytes ); @@ -552,7 +549,7 @@ const assert = Chai.assert; const output = object.render(); // Assert - Testers.bvEqual(output, bytes.mid(10)); + Testers.bvEqual(output, bytes.subarray(10)); } @test diff --git a/test-unit/asf/filePropertiesObjectTests.ts b/test-unit/asf/filePropertiesObjectTests.ts index 5a31a4a2..8c2853ab 100644 --- a/test-unit/asf/filePropertiesObjectTests.ts +++ b/test-unit/asf/filePropertiesObjectTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import FilePropertiesObject from "../../src/asf/objects/filePropertiesObject"; import ObjectTests from "./objectTests"; @@ -10,16 +10,13 @@ import {Guids, ObjectType} from "../../src/asf/constants"; import {File} from "../../src/file"; import {Testers} from "../utilities/testers"; -// Setup Chai -const assert = Chai.assert; - @suite class Asf_FilePropertiesObjectTests extends ObjectTests { protected get fromFileConstructor(): (f: File, p: number) => FilePropertiesObject { return FilePropertiesObject.fromFile; } protected get minSize(): number { return 104; } - protected get objectGuid(): UuidWrapper { return Guids.AsfFilePropertiesObject; } + protected get objectGuid(): UuidWrapper { return Guids.ASF_FILE_PROPERTIES_OBJECT; } @test public fromFile_validParameters() { @@ -27,19 +24,19 @@ class Asf_FilePropertiesObjectTests extends ObjectTests { const fileId = new UuidWrapper(); const data = ByteVector.concatenate( ByteVector.fromSize(10), // Offset - Guids.AsfFilePropertiesObject.toBytes(), // Object ID - ByteVector.fromULong(104, false), // Object size + Guids.ASF_FILE_PROPERTIES_OBJECT.toBytes(), // Object ID + ByteVector.fromUlong(104, false), // Object size fileId.toBytes(), // File ID - ByteVector.fromULong(1234, false), // File Size - ByteVector.fromULong(BigInt(116559432000000000), false), // Creation date - ByteVector.fromULong(2345, false), // Data packets count - ByteVector.fromULong(345600, false), // Play duration - ByteVector.fromULong(456700, false), // Send duration - ByteVector.fromULong(5678, false), // Preroll - ByteVector.fromUInt(123, false), // Flags - ByteVector.fromUInt(234, false), // Minimum data packet size - ByteVector.fromUInt(345, false), // Maximum data packet size - ByteVector.fromUInt(456, false) // Maximum bitrate + ByteVector.fromUlong(1234, false), // File Size + ByteVector.fromUlong(BigInt(116559432000000000), false), // Creation date + ByteVector.fromUlong(2345, false), // Data packets count + ByteVector.fromUlong(345600, false), // Play duration + ByteVector.fromUlong(456700, false), // Send duration + ByteVector.fromUlong(5678, false), // Preroll + ByteVector.fromUint(123, false), // Flags + ByteVector.fromUint(234, false), // Minimum data packet size + ByteVector.fromUint(345, false), // Maximum data packet size + ByteVector.fromUint(456, false) // Maximum bitrate ); const file = TestFile.getFile(data); @@ -48,7 +45,7 @@ class Asf_FilePropertiesObjectTests extends ObjectTests { // Assert assert.isOk(object); - assert.isTrue(object.guid.equals(Guids.AsfFilePropertiesObject)); + assert.isTrue(object.guid.equals(Guids.ASF_FILE_PROPERTIES_OBJECT)); assert.strictEqual(object.objectType, ObjectType.FilePropertiesObject); assert.strictEqual(object.originalSize, 104); assert.deepEqual(object.creationDate, new Date(Date.UTC(1970, 4, 13, 18, 0, 0))); @@ -70,19 +67,19 @@ class Asf_FilePropertiesObjectTests extends ObjectTests { const fileId = new UuidWrapper(); const data = ByteVector.concatenate( ByteVector.fromSize(10), // Offset - Guids.AsfFilePropertiesObject.toBytes(), // Object ID - ByteVector.fromULong(104, false), // Object size + Guids.ASF_FILE_PROPERTIES_OBJECT.toBytes(), // Object ID + ByteVector.fromUlong(104, false), // Object size fileId.toBytes(), // File ID - ByteVector.fromULong(1234, false), // File Size - ByteVector.fromULong(BigInt(116559432000000000), false), // Creation date - ByteVector.fromULong(2345, false), // Data packets count - ByteVector.fromULong(345600, false), // Play duration - ByteVector.fromULong(456700, false), // Send duration - ByteVector.fromULong(567800, false), // Preroll - ByteVector.fromUInt(123, false), // Flags - ByteVector.fromUInt(234, false), // Minimum data packet size - ByteVector.fromUInt(345, false), // Maximum data packet size - ByteVector.fromUInt(456, false) // Maximum bitrate + ByteVector.fromUlong(1234, false), // File Size + ByteVector.fromUlong(BigInt(116559432000000000), false), // Creation date + ByteVector.fromUlong(2345, false), // Data packets count + ByteVector.fromUlong(345600, false), // Play duration + ByteVector.fromUlong(456700, false), // Send duration + ByteVector.fromUlong(567800, false), // Preroll + ByteVector.fromUint(123, false), // Flags + ByteVector.fromUint(234, false), // Minimum data packet size + ByteVector.fromUint(345, false), // Maximum data packet size + ByteVector.fromUint(456, false) // Maximum bitrate ); const file = TestFile.getFile(data); const object = FilePropertiesObject.fromFile(file, 10); @@ -92,6 +89,6 @@ class Asf_FilePropertiesObjectTests extends ObjectTests { // Assert assert.isOk(output); - Testers.bvEqual(output, data.mid(10)); + Testers.bvEqual(output, data.subarray(10)); } } diff --git a/test-unit/asf/headerExtensionObjectTests.ts b/test-unit/asf/headerExtensionObjectTests.ts index 423c42c7..fd7653d0 100644 --- a/test-unit/asf/headerExtensionObjectTests.ts +++ b/test-unit/asf/headerExtensionObjectTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import BaseObject from "../../src/asf/objects/baseObject"; import ContentDescriptionObject from "../../src/asf/objects/contentDescriptionObject"; @@ -14,26 +14,23 @@ import {File} from "../../src/file"; import {MetadataLibraryObject} from "../../src/asf/objects/metadataLibraryObject"; import {Testers} from "../utilities/testers"; -// Setup Chai -const assert = Chai.assert; - @suite class Asf_HeaderExtensionObjectTests extends ObjectTests { protected get fromFileConstructor(): (f: File, p: number) => HeaderExtensionObject { return HeaderExtensionObject.fromFile; } protected get minSize(): number { return undefined; } - protected get objectGuid(): UuidWrapper { return Guids.AsfHeaderExtensionObject; } + protected get objectGuid(): UuidWrapper { return Guids.ASF_HEADER_EXTENSION_OBJECT; } @test public fromFile_missingReservedField1() { // Arrange const data = ByteVector.concatenate( ByteVector.fromSize(10), // Offset - Guids.AsfHeaderExtensionObject.toBytes(), // Object ID - ByteVector.fromULong(56, false), // Object size + Guids.ASF_HEADER_EXTENSION_OBJECT.toBytes(), // Object ID + ByteVector.fromUlong(56, false), // Object size new UuidWrapper().toBytes(), // Invalid reserved field 1 - ByteVector.fromUShort(6, false), // Reserved field 2 - ByteVector.fromUInt(10, false), // Header extension data length + ByteVector.fromUshort(6, false), // Reserved field 2 + ByteVector.fromUint(10, false), // Header extension data length ByteVector.fromSize(10), // Header extension data ); const file = TestFile.getFile(data); @@ -47,11 +44,11 @@ const assert = Chai.assert; // Arrange const data = ByteVector.concatenate( ByteVector.fromSize(10), // Offset - Guids.AsfHeaderExtensionObject.toBytes(), // Object ID - ByteVector.fromULong(56, false), // Object size - Guids.AsfReserved1.toBytes(), // Reserved field 1 - ByteVector.fromUShort(8888, false), // Invalid reserved field 2 - ByteVector.fromUInt(10, false), // Header extension data length + Guids.ASF_HEADER_EXTENSION_OBJECT.toBytes(), // Object ID + ByteVector.fromUlong(56, false), // Object size + Guids.ASF_RESERVED.toBytes(), // Reserved field 1 + ByteVector.fromUshort(8888, false), // Invalid reserved field 2 + ByteVector.fromUint(10, false), // Header extension data length ByteVector.fromSize(10), // Header extension data ); const file = TestFile.getFile(data); @@ -75,12 +72,12 @@ const assert = Chai.assert; assert.isOk(output); assert.strictEqual(output.objectType, ObjectType.HeaderExtensionObject); assert.strictEqual(output.originalSize, data.length); - assert.isTrue(output.guid.equals(Guids.AsfHeaderExtensionObject)); + assert.isTrue(output.guid.equals(Guids.ASF_HEADER_EXTENSION_OBJECT)); const children = output.children; assert.strictEqual(children.length, 2); - assert.isTrue(children[0].guid.equals(Guids.AsfMetadataLibraryObject)); - assert.isTrue(children[1].guid.equals(Guids.AsfContentDescriptionObject)); + assert.isTrue(children[0].guid.equals(Guids.ASF_METADATA_LIBRARY_OBJECT)); + assert.isTrue(children[1].guid.equals(Guids.ASF_CONTENT_DESCRIPTION_OBJECT)); } @test @@ -164,11 +161,11 @@ const assert = Chai.assert; private static getObjectBytes(children: BaseObject[]) { const childrenBytes = ByteVector.concatenate(... children.map((o) => o.render())); return ByteVector.concatenate( - Guids.AsfHeaderExtensionObject.toBytes(), // Object ID - ByteVector.fromULong(46 + childrenBytes.length, false), // Object size - Guids.AsfReserved1.toBytes(), // Reserved field 1 - ByteVector.fromUShort(6, false), // Reserved field 2 - ByteVector.fromUInt(childrenBytes.length, false), // Header extension data length + Guids.ASF_HEADER_EXTENSION_OBJECT.toBytes(), // Object ID + ByteVector.fromUlong(46 + childrenBytes.length, false), // Object size + Guids.ASF_RESERVED.toBytes(), // Reserved field 1 + ByteVector.fromUshort(6, false), // Reserved field 2 + ByteVector.fromUint(childrenBytes.length, false), // Header extension data length childrenBytes ); } diff --git a/test-unit/asf/headerObjectTests.ts b/test-unit/asf/headerObjectTests.ts index 298ab41d..33f4ba54 100644 --- a/test-unit/asf/headerObjectTests.ts +++ b/test-unit/asf/headerObjectTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import BaseObject from "../../src/asf/objects/baseObject"; import ContentDescriptionObject from "../../src/asf/objects/contentDescriptionObject"; @@ -17,22 +17,19 @@ import {File} from "../../src/file"; import {MetadataLibraryObject} from "../../src/asf/objects/metadataLibraryObject"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - @suite class Asf_HeaderObjectTests extends ObjectTests { protected get fromFileConstructor(): (f: File, p: number) => HeaderObject { return HeaderObject.fromFile; } protected get minSize(): number { return 26; } - protected get objectGuid(): UuidWrapper { return Guids.AsfHeaderObject; } + protected get objectGuid(): UuidWrapper { return Guids.ASF_HEADER_OBJECT; } @test public fromFile_missingFirstReservedByte() { // Arrange const bytes = ByteVector.concatenate( ByteVector.fromSize(10), // Offset - Guids.AsfHeaderObject.toBytes(), // Object ID - ByteVector.fromULong(30, false), // Object size - ByteVector.fromUInt(0, false), // Child objects + Guids.ASF_HEADER_OBJECT.toBytes(), // Object ID + ByteVector.fromUlong(30, false), // Object size + ByteVector.fromUint(0, false), // Child objects 0x12, 0x02 // Invalid reserved ); const file = TestFile.getFile(bytes); @@ -46,9 +43,9 @@ const assert = Chai.assert; // Arrange const bytes = ByteVector.concatenate( ByteVector.fromSize(10), // Offset - Guids.AsfHeaderObject.toBytes(), // Object ID - ByteVector.fromULong(30, false), // Object size - ByteVector.fromUInt(0, false), // Child objects + Guids.ASF_HEADER_OBJECT.toBytes(), // Object ID + ByteVector.fromUlong(30, false), // Object size + ByteVector.fromUint(0, false), // Child objects 0x01, 0x23 // Invalid reserved ); const file = TestFile.getFile(bytes); @@ -70,7 +67,7 @@ const assert = Chai.assert; // Assert assert.isOk(object); - assert.isTrue(object.guid.equals(Guids.AsfHeaderObject)); + assert.isTrue(object.guid.equals(Guids.ASF_HEADER_OBJECT)); assert.strictEqual(object.objectType, ObjectType.HeaderObject); assert.strictEqual(object.originalSize, bytes.length - 10); @@ -91,11 +88,11 @@ const assert = Chai.assert; public extension_hasExtension() { // Arrange const headerExtensionBytes = ByteVector.concatenate( - Guids.AsfHeaderExtensionObject.toBytes(), // Object ID - ByteVector.fromULong(46, false), // Object size - Guids.AsfReserved1.toBytes(), // Reserved field 1 - ByteVector.fromUShort(6, false), // Reserved field 2 - ByteVector.fromUInt(0, false), // Header extension data length + Guids.ASF_HEADER_EXTENSION_OBJECT.toBytes(), // Object ID + ByteVector.fromUlong(46, false), // Object size + Guids.ASF_RESERVED.toBytes(), // Reserved field 1 + ByteVector.fromUshort(6, false), // Reserved field 2 + ByteVector.fromUint(0, false), // Header extension data length ); const headerBytes = Asf_HeaderObjectTests.getObjectBytesFromBytes(headerExtensionBytes, 1); @@ -160,38 +157,38 @@ const assert = Chai.assert; public properties_hasPropertiesObjects() { // Arrange const filePropertiesBytes = ByteVector.concatenate( - Guids.AsfFilePropertiesObject.toBytes(), // Object ID - ByteVector.fromULong(104, false), // Object size + Guids.ASF_FILE_PROPERTIES_OBJECT.toBytes(), // Object ID + ByteVector.fromUlong(104, false), // Object size new UuidWrapper().toBytes(), // File ID - ByteVector.fromULong(1234, false), // File Size - ByteVector.fromULong(BigInt(116559432000000000), false), // Creation date - ByteVector.fromULong(2345, false), // Data packets count - ByteVector.fromULong(3456000, false), // Play duration - ByteVector.fromULong(4567000, false), // Send duration - ByteVector.fromULong(5, false), // Preroll - ByteVector.fromUInt(123, false), // Flags - ByteVector.fromUInt(234, false), // Minimum data packet size - ByteVector.fromUInt(345, false), // Maximum data packet size - ByteVector.fromUInt(456, false) // Maximum bitrate + ByteVector.fromUlong(1234, false), // File Size + ByteVector.fromUlong(BigInt(116559432000000000), false), // Creation date + ByteVector.fromUlong(2345, false), // Data packets count + ByteVector.fromUlong(3456000, false), // Play duration + ByteVector.fromUlong(4567000, false), // Send duration + ByteVector.fromUlong(5, false), // Preroll + ByteVector.fromUint(123, false), // Flags + ByteVector.fromUint(234, false), // Minimum data packet size + ByteVector.fromUint(345, false), // Maximum data packet size + ByteVector.fromUint(456, false) // Maximum bitrate ); const streamPropertiesBytes = ByteVector.concatenate( - Guids.AsfStreamPropertiesObject.toBytes(), // Object ID - ByteVector.fromULong(117, false), // Object size - Guids.AsfAudioMedia.toBytes(), // Stream type + Guids.ASF_STREAM_PROPERTIES_OBJECT.toBytes(), // Object ID + ByteVector.fromUlong(117, false), // Object size + Guids.ASF_AUDIO_MEDIA.toBytes(), // Stream type new UuidWrapper().toBytes(), // Error correction type GUID - ByteVector.fromULong(1234567890, false), // Time offset - ByteVector.fromUInt(16, false), // Type specific data length - ByteVector.fromUInt(23, false), // Error correction data length + ByteVector.fromUlong(1234567890, false), // Time offset + ByteVector.fromUint(16, false), // Type specific data length + ByteVector.fromUint(23, false), // Error correction data length ByteVector.fromShort(0x1200, false), // Flags ByteVector.fromSize(4, 0x0), // Reserved // AUDIO TYPE SPECIFIC DATA - ByteVector.fromUShort(0xF1AC, false), // Format tag - ByteVector.fromUShort(3, false), // Number of channels - ByteVector.fromUInt(1234, false), // Samples per second - ByteVector.fromUInt(2345, false), // Average bytes per second - ByteVector.fromUShort(88, false), // Block align - ByteVector.fromUShort(16, false), // Bits per sample + ByteVector.fromUshort(0xF1AC, false), // Format tag + ByteVector.fromUshort(3, false), // Number of channels + ByteVector.fromUint(1234, false), // Samples per second + ByteVector.fromUint(2345, false), // Average bytes per second + ByteVector.fromUshort(88, false), // Block align + ByteVector.fromUshort(16, false), // Bits per sample ByteVector.fromSize(23, 0x23) ); @@ -298,7 +295,7 @@ const assert = Chai.assert; // Assert // NOTE: the padding object is removed, so it "shrunk", then it's added back, so // the contents should be the same. - Testers.bvEqual(output, headerData.mid(10)); + Testers.bvEqual(output, headerData.subarray(10)); } @test @@ -322,7 +319,7 @@ const assert = Chai.assert; PaddingObject.fromSize(4096) ]; const expected = Asf_HeaderObjectTests.getObjectBytesFromObjects(expectedChildren); - Testers.bvEqual(output, expected.mid(10)); + Testers.bvEqual(output, expected.subarray(10)); } @test @@ -339,15 +336,15 @@ const assert = Chai.assert; const output = headerObject.render(); // Assert - Testers.bvEqual(output, headerData.mid(10)); + Testers.bvEqual(output, headerData.subarray(10)); } private static getObjectBytesFromBytes(children: ByteVector, childrenCount: number) { return ByteVector.concatenate( ByteVector.fromSize(10), // Offset - Guids.AsfHeaderObject.toBytes(), // Object ID - ByteVector.fromULong(30 + children.length, false), // Object size - ByteVector.fromUInt(childrenCount, false), // Child objects + Guids.ASF_HEADER_OBJECT.toBytes(), // Object ID + ByteVector.fromUlong(30 + children.length, false), // Object size + ByteVector.fromUint(childrenCount, false), // Child objects 0x01, 0x02, // Invalid reserved children ); @@ -357,9 +354,9 @@ const assert = Chai.assert; const childrenBytes = ByteVector.concatenate(... children.map((o) => o.render())); return ByteVector.concatenate( ByteVector.fromSize(10), // Offset - Guids.AsfHeaderObject.toBytes(), // Object ID - ByteVector.fromULong(30 + childrenBytes.length, false), // Object size - ByteVector.fromUInt(children.length, false), // Child objects + Guids.ASF_HEADER_OBJECT.toBytes(), // Object ID + ByteVector.fromUlong(30 + childrenBytes.length, false), // Object size + ByteVector.fromUint(children.length, false), // Child objects 0x01, 0x02, // Reserved bytes childrenBytes ); diff --git a/test-unit/asf/metadataLibraryObjectTests.ts b/test-unit/asf/metadataLibraryObjectTests.ts index 6e83b806..ba1c1e32 100644 --- a/test-unit/asf/metadataLibraryObjectTests.ts +++ b/test-unit/asf/metadataLibraryObjectTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import ObjectTests from "./objectTests"; import TestFile from "../utilities/testFile"; @@ -11,9 +11,6 @@ import {File} from "../../src/file"; import {MetadataDescriptor, MetadataLibraryObject} from "../../src/asf/objects/metadataLibraryObject"; import {Testers} from "../utilities/testers"; -// Setup Chai -const assert = Chai.assert; - @suite class Asf_MetadataDescriptorTests { @test public constructor_invalidParameters() { @@ -35,16 +32,16 @@ const assert = Chai.assert; assert.strictEqual(object.languageListIndex, 123); assert.strictEqual(object.streamNumber, 234); - assert.strictEqual(object.getUshort(), 1234); + assert.strictEqual(object.ushortValue, 1234); const expectedBytes = ByteVector.concatenate( - ByteVector.fromUShort(123, false), - ByteVector.fromUShort(234, false), - ByteVector.fromUShort(8, false), - ByteVector.fromUShort(DataType.Word, false), - ByteVector.fromUInt(2, false), + ByteVector.fromUshort(123, false), + ByteVector.fromUshort(234, false), + ByteVector.fromUshort(8, false), + ByteVector.fromUshort(DataType.Word, false), + ByteVector.fromUint(2, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromUShort(1234, false) + ByteVector.fromUshort(1234, false) ); Testers.bvEqual(object.render(), expectedBytes); } @@ -53,13 +50,13 @@ const assert = Chai.assert; public fromFile_word() { // Arrange const bytes = ByteVector.concatenate( - ByteVector.fromUShort(123, false), - ByteVector.fromUShort(234, false), - ByteVector.fromUShort(8, false), - ByteVector.fromUShort(DataType.Word, false), - ByteVector.fromUInt(2, false), + ByteVector.fromUshort(123, false), + ByteVector.fromUshort(234, false), + ByteVector.fromUshort(8, false), + ByteVector.fromUshort(DataType.Word, false), + ByteVector.fromUint(2, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromUShort(1234, false) + ByteVector.fromUshort(1234, false) ); const file = TestFile.getFile(bytes); @@ -71,7 +68,7 @@ const assert = Chai.assert; assert.strictEqual(object.type, DataType.Word); assert.strictEqual(object.languageListIndex, 123); assert.strictEqual(object.streamNumber, 234); - assert.strictEqual(object.getUshort(), 1234); + assert.strictEqual(object.ushortValue, 1234); } @test @@ -85,16 +82,16 @@ const assert = Chai.assert; assert.strictEqual(object.languageListIndex, 123); assert.strictEqual(object.streamNumber, 234); - assert.strictEqual(object.getBool(), true); + assert.strictEqual(object.boolValue, true); const expectedBytes = ByteVector.concatenate( - ByteVector.fromUShort(123, false), - ByteVector.fromUShort(234, false), - ByteVector.fromUShort(8, false), - ByteVector.fromUShort(DataType.Bool, false), - ByteVector.fromUInt(2, false), + ByteVector.fromUshort(123, false), + ByteVector.fromUshort(234, false), + ByteVector.fromUshort(8, false), + ByteVector.fromUshort(DataType.Bool, false), + ByteVector.fromUint(2, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromUShort(1, false) + ByteVector.fromUshort(1, false) ); Testers.bvEqual(object.render(), expectedBytes); } @@ -103,13 +100,13 @@ const assert = Chai.assert; public fromFile_bool_twoByte() { // Arrange const bytes = ByteVector.concatenate( - ByteVector.fromUShort(123, false), - ByteVector.fromUShort(234, false), - ByteVector.fromUShort(8, false), - ByteVector.fromUShort(DataType.Bool, false), - ByteVector.fromUInt(2, false), + ByteVector.fromUshort(123, false), + ByteVector.fromUshort(234, false), + ByteVector.fromUshort(8, false), + ByteVector.fromUshort(DataType.Bool, false), + ByteVector.fromUint(2, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromUShort(1, false) + ByteVector.fromUshort(1, false) ); const file = TestFile.getFile(bytes); @@ -122,20 +119,20 @@ const assert = Chai.assert; assert.strictEqual(object.languageListIndex, 123); assert.strictEqual(object.streamNumber, 234); - assert.strictEqual(object.getBool(), true); + assert.strictEqual(object.boolValue, true); } @test public fromFile_bool_fourByte() { // Arrange const bytes = ByteVector.concatenate( - ByteVector.fromUShort(123, false), - ByteVector.fromUShort(234, false), - ByteVector.fromUShort(8, false), - ByteVector.fromUShort(DataType.Bool, false), - ByteVector.fromUInt(4, false), + ByteVector.fromUshort(123, false), + ByteVector.fromUshort(234, false), + ByteVector.fromUshort(8, false), + ByteVector.fromUshort(DataType.Bool, false), + ByteVector.fromUint(4, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromUInt(0, false) + ByteVector.fromUint(0, false) ); const file = TestFile.getFile(bytes); @@ -148,7 +145,7 @@ const assert = Chai.assert; assert.strictEqual(object.languageListIndex, 123); assert.strictEqual(object.streamNumber, 234); - assert.strictEqual(object.getBool(), false); + assert.strictEqual(object.boolValue, false); } @test @@ -162,16 +159,16 @@ const assert = Chai.assert; assert.strictEqual(object.languageListIndex, 123); assert.strictEqual(object.streamNumber, 234); - assert.strictEqual(object.getUint(), 1234); + assert.strictEqual(object.uintValue, 1234); const expectedBytes = ByteVector.concatenate( - ByteVector.fromUShort(123, false), - ByteVector.fromUShort(234, false), - ByteVector.fromUShort(8, false), - ByteVector.fromUShort(DataType.DWord, false), - ByteVector.fromUInt(4, false), + ByteVector.fromUshort(123, false), + ByteVector.fromUshort(234, false), + ByteVector.fromUshort(8, false), + ByteVector.fromUshort(DataType.DWord, false), + ByteVector.fromUint(4, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromUInt(1234, false) + ByteVector.fromUint(1234, false) ); Testers.bvEqual(object.render(), expectedBytes); } @@ -180,13 +177,13 @@ const assert = Chai.assert; public fromFile_dword() { // Arrange const bytes = ByteVector.concatenate( - ByteVector.fromUShort(123, false), - ByteVector.fromUShort(234, false), - ByteVector.fromUShort(8, false), - ByteVector.fromUShort(DataType.DWord, false), - ByteVector.fromUInt(4, false), + ByteVector.fromUshort(123, false), + ByteVector.fromUshort(234, false), + ByteVector.fromUshort(8, false), + ByteVector.fromUshort(DataType.DWord, false), + ByteVector.fromUint(4, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromUInt(1234, false) + ByteVector.fromUint(1234, false) ); const file = TestFile.getFile(bytes); @@ -199,7 +196,7 @@ const assert = Chai.assert; assert.strictEqual(object.languageListIndex, 123); assert.strictEqual(object.streamNumber, 234); - assert.strictEqual(object.getUint(), 1234); + assert.strictEqual(object.uintValue, 1234); } @test @@ -213,16 +210,16 @@ const assert = Chai.assert; assert.strictEqual(object.languageListIndex, 123); assert.strictEqual(object.streamNumber, 234); - assert.strictEqual(object.getUlong(), BigInt(1234)); + assert.strictEqual(object.ulongValue, BigInt(1234)); const expectedBytes = ByteVector.concatenate( - ByteVector.fromUShort(123, false), - ByteVector.fromUShort(234, false), - ByteVector.fromUShort(8, false), - ByteVector.fromUShort(DataType.QWord, false), - ByteVector.fromUInt(8, false), + ByteVector.fromUshort(123, false), + ByteVector.fromUshort(234, false), + ByteVector.fromUshort(8, false), + ByteVector.fromUshort(DataType.QWord, false), + ByteVector.fromUint(8, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromULong(1234, false) + ByteVector.fromUlong(1234, false) ); Testers.bvEqual(object.render(), expectedBytes); } @@ -231,13 +228,13 @@ const assert = Chai.assert; public fromFile_qword() { // Arrange const bytes = ByteVector.concatenate( - ByteVector.fromUShort(123, false), - ByteVector.fromUShort(234, false), - ByteVector.fromUShort(8, false), - ByteVector.fromUShort(DataType.QWord, false), - ByteVector.fromUInt(8, false), + ByteVector.fromUshort(123, false), + ByteVector.fromUshort(234, false), + ByteVector.fromUshort(8, false), + ByteVector.fromUshort(DataType.QWord, false), + ByteVector.fromUint(8, false), ByteVector.fromString("foo\0", StringType.UTF16LE), - ByteVector.fromULong(1234, false) + ByteVector.fromUlong(1234, false) ); const file = TestFile.getFile(bytes); @@ -250,7 +247,7 @@ const assert = Chai.assert; assert.strictEqual(object.languageListIndex, 123); assert.strictEqual(object.streamNumber, 234); - assert.strictEqual(object.getUlong(), BigInt(1234)); + assert.strictEqual(object.ulongValue, BigInt(1234)); } @test @@ -264,14 +261,14 @@ const assert = Chai.assert; assert.strictEqual(object.languageListIndex, 123); assert.strictEqual(object.streamNumber, 234); - assert.strictEqual(object.getString(), "foobarbaz"); + assert.strictEqual(object.toString(), "foobarbaz"); const expectedBytes = ByteVector.concatenate( - ByteVector.fromUShort(123, false), - ByteVector.fromUShort(234, false), - ByteVector.fromUShort(8, false), - ByteVector.fromUShort(DataType.Unicode, false), - ByteVector.fromUInt(20, false), + ByteVector.fromUshort(123, false), + ByteVector.fromUshort(234, false), + ByteVector.fromUshort(8, false), + ByteVector.fromUshort(DataType.Unicode, false), + ByteVector.fromUint(20, false), ByteVector.fromString("foo\0", StringType.UTF16LE), ByteVector.fromString("foobarbaz\0", StringType.UTF16LE) ); @@ -282,11 +279,11 @@ const assert = Chai.assert; public fromFile_unicode() { // Arrange const bytes = ByteVector.concatenate( - ByteVector.fromUShort(123, false), - ByteVector.fromUShort(234, false), - ByteVector.fromUShort(8, false), - ByteVector.fromUShort(DataType.Unicode, false), - ByteVector.fromUInt(20, false), + ByteVector.fromUshort(123, false), + ByteVector.fromUshort(234, false), + ByteVector.fromUshort(8, false), + ByteVector.fromUshort(DataType.Unicode, false), + ByteVector.fromUint(20, false), ByteVector.fromString("foo\0", StringType.UTF16LE), ByteVector.fromString("foobarbaz\0", StringType.UTF16LE) ); @@ -301,13 +298,13 @@ const assert = Chai.assert; assert.strictEqual(object.languageListIndex, 123); assert.strictEqual(object.streamNumber, 234); - assert.strictEqual(object.getString(), "foobarbaz"); + assert.strictEqual(object.stringValue, "foobarbaz"); } @test public constructor_bytes() { // Arrange - const bytes = ByteVector.fromString("abcdef"); + const bytes = ByteVector.fromString("abcdef", StringType.UTF8); // Act const object = new MetadataDescriptor(123, 234, "foo", DataType.Bytes, bytes); @@ -318,14 +315,14 @@ const assert = Chai.assert; assert.strictEqual(object.languageListIndex, 123); assert.strictEqual(object.streamNumber, 234); - Testers.bvEqual(object.getBytes(), bytes); + Testers.bvEqual(object.byteValue, bytes); const expectedBytes = ByteVector.concatenate( - ByteVector.fromUShort(123, false), - ByteVector.fromUShort(234, false), - ByteVector.fromUShort(8, false), - ByteVector.fromUShort(DataType.Bytes, false), - ByteVector.fromUInt(6, false), + ByteVector.fromUshort(123, false), + ByteVector.fromUshort(234, false), + ByteVector.fromUshort(8, false), + ByteVector.fromUshort(DataType.Bytes, false), + ByteVector.fromUint(6, false), ByteVector.fromString("foo\0", StringType.UTF16LE), bytes ); @@ -335,15 +332,15 @@ const assert = Chai.assert; @test public fromFile_bytes() { // Arrange - const bytes = ByteVector.fromString("abcdef"); + const bytes = ByteVector.fromString("abcdef", StringType.UTF8); // Arrange const data = ByteVector.concatenate( - ByteVector.fromUShort(123, false), - ByteVector.fromUShort(234, false), - ByteVector.fromUShort(8, false), - ByteVector.fromUShort(DataType.Bytes, false), - ByteVector.fromUInt(6, false), + ByteVector.fromUshort(123, false), + ByteVector.fromUshort(234, false), + ByteVector.fromUshort(8, false), + ByteVector.fromUshort(DataType.Bytes, false), + ByteVector.fromUint(6, false), ByteVector.fromString("foo\0", StringType.UTF16LE), bytes ); @@ -358,7 +355,7 @@ const assert = Chai.assert; assert.strictEqual(object.languageListIndex, 123); assert.strictEqual(object.streamNumber, 234); - Testers.bvEqual(object.getBytes(), bytes); + Testers.bvEqual(object.byteValue, bytes); } @test @@ -375,14 +372,14 @@ const assert = Chai.assert; assert.strictEqual(object.languageListIndex, 123); assert.strictEqual(object.streamNumber, 234); - assert.isTrue(object.getGuid().equals(guid)); + assert.isTrue(object.guidValue.equals(guid)); const expectedBytes = ByteVector.concatenate( - ByteVector.fromUShort(123, false), - ByteVector.fromUShort(234, false), - ByteVector.fromUShort(8, false), - ByteVector.fromUShort(DataType.Guid, false), - ByteVector.fromUInt(16, false), + ByteVector.fromUshort(123, false), + ByteVector.fromUshort(234, false), + ByteVector.fromUshort(8, false), + ByteVector.fromUshort(DataType.Guid, false), + ByteVector.fromUint(16, false), ByteVector.fromString("foo\0", StringType.UTF16LE), guid.toBytes() ); @@ -396,11 +393,11 @@ const assert = Chai.assert; // Arrange const data = ByteVector.concatenate( - ByteVector.fromUShort(123, false), - ByteVector.fromUShort(234, false), - ByteVector.fromUShort(8, false), - ByteVector.fromUShort(DataType.Guid, false), - ByteVector.fromUInt(16, false), + ByteVector.fromUshort(123, false), + ByteVector.fromUshort(234, false), + ByteVector.fromUshort(8, false), + ByteVector.fromUshort(DataType.Guid, false), + ByteVector.fromUint(16, false), ByteVector.fromString("foo\0", StringType.UTF16LE), guid.toBytes() ); @@ -415,7 +412,7 @@ const assert = Chai.assert; assert.strictEqual(object.languageListIndex, 123); assert.strictEqual(object.streamNumber, 234); - assert.isTrue(object.getGuid().equals(guid)); + assert.isTrue(object.guidValue.equals(guid)); } } @@ -424,7 +421,7 @@ const assert = Chai.assert; return MetadataLibraryObject.fromFile; } protected get minSize(): number { return 26; } - protected get objectGuid(): UuidWrapper { return Guids.AsfMetadataLibraryObject; } + protected get objectGuid(): UuidWrapper { return Guids.ASF_METADATA_LIBRARY_OBJECT; } @test public fromEmpty() { @@ -433,7 +430,7 @@ const assert = Chai.assert; // Assert assert.isOk(object); - assert.isTrue(object.guid.equals(Guids.AsfMetadataLibraryObject)); + assert.isTrue(object.guid.equals(Guids.ASF_METADATA_LIBRARY_OBJECT)); assert.strictEqual(object.objectType, ObjectType.MetadataLibraryObject); assert.strictEqual(object.originalSize, 0); assert.isTrue(object.isEmpty); @@ -449,9 +446,9 @@ const assert = Chai.assert; const record2Bytes = record2.render(); const bytes = ByteVector.concatenate( ByteVector.fromSize(10), // Offset - Guids.AsfMetadataLibraryObject.toBytes(), - ByteVector.fromULong(16 + 8 + 2 + record1Bytes.length + record2Bytes.length, false), - ByteVector.fromUShort(2, false), + Guids.ASF_METADATA_LIBRARY_OBJECT.toBytes(), + ByteVector.fromUlong(16 + 8 + 2 + record1Bytes.length + record2Bytes.length, false), + ByteVector.fromUshort(2, false), record1Bytes, record2Bytes ); @@ -462,7 +459,7 @@ const assert = Chai.assert; // Assert assert.isOk(object); - assert.isTrue(object.guid.equals(Guids.AsfMetadataLibraryObject)); + assert.isTrue(object.guid.equals(Guids.ASF_METADATA_LIBRARY_OBJECT)); assert.strictEqual(object.objectType, ObjectType.MetadataLibraryObject); assert.strictEqual(object.originalSize, bytes.length - 10); assert.isFalse(object.isEmpty); @@ -650,9 +647,9 @@ const assert = Chai.assert; const record2Bytes = record2.render(); const bytes = ByteVector.concatenate( ByteVector.fromSize(10), // Offset - Guids.AsfMetadataLibraryObject.toBytes(), - ByteVector.fromULong(16 + 8 + 2 + record1Bytes.length + record2Bytes.length, false), - ByteVector.fromUShort(2, false), + Guids.ASF_METADATA_LIBRARY_OBJECT.toBytes(), + ByteVector.fromUlong(16 + 8 + 2 + record1Bytes.length + record2Bytes.length, false), + ByteVector.fromUshort(2, false), record1Bytes, record2Bytes ); @@ -663,7 +660,7 @@ const assert = Chai.assert; const output = object.render(); // Assert - Testers.bvEqual(output, bytes.mid(10)); + Testers.bvEqual(output, bytes.subarray(10)); } @test diff --git a/test-unit/asf/objectTests.ts b/test-unit/asf/objectTests.ts index c0cdea7b..6362937b 100644 --- a/test-unit/asf/objectTests.ts +++ b/test-unit/asf/objectTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {test} from "@testdeck/mocha"; +import {assert} from "chai"; import TestFile from "../utilities/testFile"; import UuidWrapper from "../../src/uuidWrapper"; @@ -7,9 +7,6 @@ import {ByteVector} from "../../src/byteVector"; import {Testers} from "../utilities/testers"; import {File} from "../../src/file"; -// Setup chai -const assert = Chai.assert; - export default abstract class ObjectTests { protected abstract get fromFileConstructor(): (f: File, p: number) => TObject; protected abstract get minSize(): number; @@ -36,7 +33,7 @@ export default abstract class ObjectTests { const data = ByteVector.concatenate( ByteVector.fromSize(10), // Offset this.objectGuid.toBytes(), // Object ID - ByteVector.fromULong(Math.min(26, this.minSize - 10)) // Object size + ByteVector.fromUlong(Math.min(26, this.minSize - 10)) // Object size ); const file = TestFile.getFile(data); @@ -55,7 +52,7 @@ export default abstract class ObjectTests { const data = ByteVector.concatenate( ByteVector.fromSize(10), // Offset new UuidWrapper().toBytes(), // Object ID - ByteVector.fromULong(123), // Object size + ByteVector.fromUlong(123), // Object size ByteVector.fromSize(20) // Just some bogus bytes ); const file = TestFile.getFile(data); diff --git a/test-unit/asf/paddingObjectTests.ts b/test-unit/asf/paddingObjectTests.ts index 26171d86..756298a0 100644 --- a/test-unit/asf/paddingObjectTests.ts +++ b/test-unit/asf/paddingObjectTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import ObjectTests from "./objectTests"; import PaddingObject from "../../src/asf/objects/PaddingObject"; @@ -11,21 +11,18 @@ import {Guids, ObjectType} from "../../src/asf/constants"; import {File} from "../../src/file"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - @suite class Asf_PaddingObjectTests extends ObjectTests { protected get fromFileConstructor(): (f: File, p: number) => PaddingObject { return PaddingObject.fromFile; } protected get minSize(): number { return undefined; } - protected get objectGuid(): UuidWrapper { return Guids.AsfPaddingObject; } + protected get objectGuid(): UuidWrapper { return Guids.ASF_PADDING_OBJECT; } @test public fromFile_validParameters() { // Arrange const data = ByteVector.concatenate( ByteVector.fromSize(10), // Offset - Guids.AsfPaddingObject.toBytes(), // Object ID - ByteVector.fromULong(32, false), // Object size + Guids.ASF_PADDING_OBJECT.toBytes(), // Object ID + ByteVector.fromUlong(32, false), // Object size ByteVector.fromSize(8) ); const file = TestFile.getFile(data); @@ -35,7 +32,7 @@ const assert = Chai.assert; // Assert assert.isOk(object); - assert.isTrue(object.guid.equals(Guids.AsfPaddingObject)); + assert.isTrue(object.guid.equals(Guids.ASF_PADDING_OBJECT)); assert.strictEqual(object.objectType, ObjectType.PaddingObject); assert.strictEqual(object.originalSize, 32); assert.strictEqual(object.size, 8); @@ -54,7 +51,7 @@ const assert = Chai.assert; // Assert assert.isOk(object); - assert.isTrue(object.guid.equals(Guids.AsfPaddingObject)); + assert.isTrue(object.guid.equals(Guids.ASF_PADDING_OBJECT)); assert.strictEqual(object.objectType, ObjectType.PaddingObject); assert.strictEqual(object.originalSize, 0); assert.strictEqual(object.size, 123); @@ -89,8 +86,8 @@ const assert = Chai.assert; // Arrange const data = ByteVector.concatenate( ByteVector.fromSize(10), // Offset - Guids.AsfPaddingObject.toBytes(), // Object ID - ByteVector.fromULong(32, false), // Object size + Guids.ASF_PADDING_OBJECT.toBytes(), // Object ID + ByteVector.fromUlong(32, false), // Object size ByteVector.fromSize(8) ); const file = TestFile.getFile(data); @@ -100,6 +97,6 @@ const assert = Chai.assert; const output = object.render(); // Assert - Testers.bvEqual(output, data.mid(10)); + Testers.bvEqual(output, data.subarray(10)); } } diff --git a/test-unit/asf/streamPropertiesObjectTests.ts b/test-unit/asf/streamPropertiesObjectTests.ts index d5e680e1..92938dfd 100644 --- a/test-unit/asf/streamPropertiesObjectTests.ts +++ b/test-unit/asf/streamPropertiesObjectTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import ObjectTests from "./objectTests"; import RiffBitmapInfoHeader from "../../src/riff/riffBitmapInfoHeader"; @@ -10,19 +10,16 @@ import UuidWrapper from "../../src/uuidWrapper"; import {ByteVector} from "../../src/byteVector"; import {Guids, ObjectType} from "../../src/asf/constants"; import {File} from "../../src/file"; -import {MediaTypes} from "../../src/icodec"; +import {MediaTypes} from "../../src/properties"; import {Testers} from "../utilities/testers"; import {NumberUtils} from "../../src/utils"; -// Setup chai -const assert = Chai.assert; - @suite class Asf_StreamPropertiesObjectTests extends ObjectTests { protected get fromFileConstructor(): (f: File, p: number) => StreamPropertiesObject { return StreamPropertiesObject.fromFile; } protected get minSize(): number { return 78; } - protected get objectGuid(): UuidWrapper { return Guids.AsfStreamPropertiesObject; } + protected get objectGuid(): UuidWrapper { return Guids.ASF_STREAM_PROPERTIES_OBJECT; } @test public fromFile_validParameters() { @@ -35,7 +32,7 @@ const assert = Chai.assert; // Assert assert.isOk(object); - assert.isTrue(object.guid.equals(Guids.AsfStreamPropertiesObject)); + assert.isTrue(object.guid.equals(Guids.ASF_STREAM_PROPERTIES_OBJECT)); assert.strictEqual(object.objectType, ObjectType.StreamPropertiesObject); assert.strictEqual(object.originalSize, this._originalSize); Testers.bvEqual(object.errorCorrectionData, this._errorCorrectionData); @@ -61,29 +58,29 @@ const assert = Chai.assert; // Assert assert.isOk(output); - Testers.bvEqual(output, data.mid(10)); + Testers.bvEqual(output, data.subarray(10)); } @test public codec_audioStream() { // Arrange const bytes = ByteVector.concatenate( - Guids.AsfStreamPropertiesObject.toBytes(), // Object ID - ByteVector.fromULong(this._originalSize, false), // Object size - Guids.AsfAudioMedia.toBytes(), // Stream type + Guids.ASF_STREAM_PROPERTIES_OBJECT.toBytes(), // Object ID + ByteVector.fromUlong(this._originalSize, false), // Object size + Guids.ASF_AUDIO_MEDIA.toBytes(), // Stream type this._errorCorrectionGuid.toBytes(), // Error correction type GUID - ByteVector.fromULong(this._timeOffset, false), // Time offset - ByteVector.fromUInt(16, false), // Type specific data length - ByteVector.fromUInt(this._errorCorrectionData.length, false), // Error correction data length + ByteVector.fromUlong(this._timeOffset, false), // Time offset + ByteVector.fromUint(16, false), // Type specific data length + ByteVector.fromUint(this._errorCorrectionData.length, false), // Error correction data length ByteVector.fromShort(this._flags, false), // Flags ByteVector.fromSize(4, 0x0), // Reserved // AUDIO TYPE SPECIFIC DATA - ByteVector.fromUShort(0xF1AC, false), // Format tag - ByteVector.fromUShort(3, false), // Number of channels - ByteVector.fromUInt(1234, false), // Samples per second - ByteVector.fromUInt(2345, false), // Average bytes per second - ByteVector.fromUShort(88, false), // Block align - ByteVector.fromUShort(16, false), // Bits per sample + ByteVector.fromUshort(0xF1AC, false), // Format tag + ByteVector.fromUshort(3, false), // Number of channels + ByteVector.fromUint(1234, false), // Samples per second + ByteVector.fromUint(2345, false), // Average bytes per second + ByteVector.fromUshort(88, false), // Block align + ByteVector.fromUshort(16, false), // Bits per sample this._errorCorrectionData ); const file = TestFile.getFile(bytes); @@ -102,28 +99,28 @@ const assert = Chai.assert; public codec_videoStream() { // Arrange const bytes = ByteVector.concatenate( - Guids.AsfStreamPropertiesObject.toBytes(), // Object ID - ByteVector.fromULong(this._originalSize, false), // Object size - Guids.AsfVideoMedia.toBytes(), // Stream type + Guids.ASF_STREAM_PROPERTIES_OBJECT.toBytes(), // Object ID + ByteVector.fromUlong(this._originalSize, false), // Object size + Guids.ASF_VIDEO_MEDIA.toBytes(), // Stream type this._errorCorrectionGuid.toBytes(), // Error correction type GUID - ByteVector.fromULong(this._timeOffset, false), // Time offset - ByteVector.fromUInt(51, false), // Type specific data length - ByteVector.fromUInt(this._errorCorrectionData.length, false), // Error correction data length + ByteVector.fromUlong(this._timeOffset, false), // Time offset + ByteVector.fromUint(51, false), // Type specific data length + ByteVector.fromUint(this._errorCorrectionData.length, false), // Error correction data length ByteVector.fromShort(this._flags, false), // Flags ByteVector.fromSize(4, 0x0), // Reserved // VIDEO TYPE SPECIFIC DATA ByteVector.fromSize(11), // Offset (ASF summary of video specific data) - ByteVector.fromUInt(40, false), // Size of the struct - ByteVector.fromUInt(123, false), // Width of image - ByteVector.fromUInt(234, false), // Height of image - ByteVector.fromUShort(345, false), // Number of planes - ByteVector.fromUShort(456, false), // Average bits per pixel - ByteVector.fromUInt(0x58564944, false), // FOURCC [DIVX] - ByteVector.fromUInt(567, false), // Size of the image - ByteVector.fromUInt(678, false), // Pixels per meter X - ByteVector.fromUInt(789, false), // Pixels per meter Y - ByteVector.fromUInt(890, false), // Colors used - ByteVector.fromUInt(1234, false), // Important colors + ByteVector.fromUint(40, false), // Size of the struct + ByteVector.fromUint(123, false), // Width of image + ByteVector.fromUint(234, false), // Height of image + ByteVector.fromUshort(345, false), // Number of planes + ByteVector.fromUshort(456, false), // Average bits per pixel + ByteVector.fromUint(0x58564944, false), // FOURCC [DIVX] + ByteVector.fromUint(567, false), // Size of the image + ByteVector.fromUint(678, false), // Pixels per meter X + ByteVector.fromUint(789, false), // Pixels per meter Y + ByteVector.fromUint(890, false), // Colors used + ByteVector.fromUint(1234, false), // Important colors this._errorCorrectionData ); const file = TestFile.getFile(bytes); @@ -151,13 +148,13 @@ const assert = Chai.assert; private getObjectBytes() { return ByteVector.concatenate( ByteVector.fromSize(10), // Offset - Guids.AsfStreamPropertiesObject.toBytes(), // Object ID - ByteVector.fromULong(this._originalSize, false), // Object size + Guids.ASF_STREAM_PROPERTIES_OBJECT.toBytes(), // Object ID + ByteVector.fromUlong(this._originalSize, false), // Object size this._streamTypeGuid.toBytes(), // Stream type this._errorCorrectionGuid.toBytes(), // Error correction type GUID - ByteVector.fromULong(this._timeOffset, false), // Time offset - ByteVector.fromUInt(this._typeSpecificData.length, false), // Type specific data length - ByteVector.fromUInt(this._errorCorrectionData.length, false), // Error correction data length + ByteVector.fromUlong(this._timeOffset, false), // Time offset + ByteVector.fromUint(this._typeSpecificData.length, false), // Type specific data length + ByteVector.fromUint(this._errorCorrectionData.length, false), // Error correction data length ByteVector.fromShort(this._flags, false), // Flags ByteVector.fromSize(4, 0x0), // Reserved this._typeSpecificData, diff --git a/test-unit/asf/unknownObjectTests.ts b/test-unit/asf/unknownObjectTests.ts index 37a5aa90..4998e3d3 100644 --- a/test-unit/asf/unknownObjectTests.ts +++ b/test-unit/asf/unknownObjectTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import ObjectTests from "./objectTests"; import TestFile from "../utilities/testFile"; @@ -10,9 +10,6 @@ import {ObjectType} from "../../src/asf/constants"; import {File} from "../../src/file"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - @suite class Asf_UnknownObjectTests extends ObjectTests { protected get fromFileConstructor(): (f: File, p: number) => UnknownObject { return UnknownObject.fromFile; } protected get minSize(): number { return undefined; } @@ -75,7 +72,7 @@ const assert = Chai.assert; // Assert assert.isOk(output); - Testers.bvEqual(output, data.mid(10)); + Testers.bvEqual(output, data.subarray(10)); } private readonly _bytes = ByteVector.fromSize(32, 0x12); @@ -86,7 +83,7 @@ const assert = Chai.assert; return ByteVector.concatenate( ByteVector.fromSize(10), // Offset this._guid.toBytes(), - ByteVector.fromULong(this._originalSize, false), + ByteVector.fromUlong(this._originalSize, false), this._bytes ); } diff --git a/test-unit/byteVectorConstructorTests.ts b/test-unit/byteVectorConstructorTests.ts index 68c1f4b1..3d64e8dd 100644 --- a/test-unit/byteVectorConstructorTests.ts +++ b/test-unit/byteVectorConstructorTests.ts @@ -6,7 +6,7 @@ import {suite, test} from "@testdeck/mocha"; import TestConstants from "./testConstants"; import TestStream from "./utilities/testStream"; -import {ByteVector, StringType} from "../src/byteVector"; +import {ByteVector, Encoding, StringType} from "../src/byteVector"; import {IFileAbstraction} from "../src/fileAbstraction"; import {IStream} from "../src/stream"; import {Testers} from "./utilities/testers"; @@ -29,6 +29,16 @@ const assert = Chai.assert; assert.equal(bv.length, 0); } + @test + public concatenate_undefined() { + // Act + const bv = ByteVector.concatenate(undefined, null); + + // Assert + assert.ok(bv); + assert.equal(bv.length, 0); + } + @test public concatenate_oneByte() { // Act @@ -54,60 +64,90 @@ const assert = Chai.assert; @test public concatenate_oneArray() { + // Arrange + const testArray = new Uint8Array(this.testArray); + // Act const bv = ByteVector.concatenate(this.testArray); // Assert assert.ok(bv); - assert.equal(bv.length, this.testArray.length); + assert.equal(bv.length, testArray.length); for (let i = 0; i < bv.length; i++) { - assert.equal(bv.data[i], this.testArray[i]); + assert.equal(bv.get(i), testArray[i]); } + + // Act / Assert - Changing source does not change bv + testArray[0] = 88; + assert.equal(bv.get(0), this.testArray[0]); } @test public concatenate_twoArrays() { + // Arrange + const testArray = new Uint8Array(this.testArray); + // Act const bv = ByteVector.concatenate( - this.testArray, - this.testArray + testArray, + testArray ); // Assert assert.ok(bv); - assert.strictEqual(bv.length, this.testArray.length * 2); + assert.strictEqual(bv.length, testArray.length * 2); for (let i = 0; i < bv.length; i++) { - assert.strictEqual(bv.data[i], this.testArray[i % this.testArray.length]); + assert.strictEqual(bv.get(i), testArray[i % this.testArray.length]); } + + // Act / Assert - Changing source does not change bv + testArray[0] = 88; + assert.equal(bv.get(0), this.testArray[0]); + assert.equal(bv.get(testArray.length), this.testArray[0]); } @test public concatenate_oneVector() { + // Arrange + const testVector = this.testByteVector.toByteVector(); + // Act - const bv = ByteVector.concatenate(this.testByteVector); + const bv = ByteVector.concatenate(testVector); // Assert assert.ok(bv); - assert.strictEqual(bv.length, this.testByteVector.length); + assert.strictEqual(bv.length, testVector.length); for (let i = 0; i < bv.length; i++) { - assert.strictEqual(bv.data[i], this.testByteVector.data[i]); + assert.strictEqual(bv.get(i), testVector.get(i)); } + + // Act / Assert - Changing source does not change bv + testVector.set(0, 88); + assert.equal(bv.get(0), this.testByteVector.get(0)); } @test public concatenate_twoVectors() { + // Arrange + const testVector = this.testByteVector.toByteVector(); + // Act const bv = ByteVector.concatenate( - this.testByteVector, - this.testByteVector + testVector, + testVector ); // Assert assert.ok(bv); - assert.strictEqual(bv.length, this.testByteVector.length * 2); + assert.strictEqual(bv.length, testVector.length * 2); for (let i = 0; i < bv.length; i++) { - assert.strictEqual(bv.data[i], this.testByteVector.data[i % this.testByteVector.length]); + assert.strictEqual(bv.get(i), testVector.get(i % this.testByteVector.length)); } + + // Act / Assert - Changing source does not change bv + testVector.set(0, 88); + assert.equal(bv.get(0), this.testByteVector.get(0)); + assert.equal(bv.get(this.testByteVector.length), this.testByteVector.get(0)); } @test @@ -120,6 +160,17 @@ const assert = Chai.assert; assert.strictEqual(bv.length, 0); } + @test + public fromByteArray_invalidParams() { + // Arrange + const bytes = new Uint8Array(0); + + // Act / Assert + Testers.testTruthy((v: Uint8Array) => ByteVector.fromByteArray(v, 123)); + Testers.testSafeUint((v) => ByteVector.fromByteArray(bytes, v), true); + assert.throws(() => ByteVector.fromByteArray(bytes, 123)); + } + @test public fromByteArray_noData() { // Arrange, Act, Assert @@ -134,10 +185,13 @@ const assert = Chai.assert; // Assert assert.isOk(bv); + + assert.strictEqual(bv.checksum, 0x00000000); assert.strictEqual(bv.length, 0); assert.isTrue(bv.isEmpty); assert.isFalse(bv.isReadOnly); - assert.deepEqual(bv.data, data); + + ByteVector_ConstructorTests.equalContents(bv, data); } @test @@ -148,79 +202,38 @@ const assert = Chai.assert; // Assert assert.isOk(bv); + + assert.strictEqual(bv.checksum, 0xbe33eab6); assert.strictEqual(bv.length, data.length); assert.isFalse(bv.isEmpty); assert.isFalse(bv.isReadOnly); - assert.deepEqual(bv.data, data); - } - @test - public fromByteArray_withLength() { - // Arrange, Act - const data = new Uint8Array([0x0, 0x1, 0x2, 0x3, 0x4]); - const bv = ByteVector.fromByteArray(data, 3); + ByteVector_ConstructorTests.equalContents(bv, data); - // Assert - assert.isOk(bv); - assert.strictEqual(bv.length, 3); - assert.isFalse(bv.isEmpty); - assert.isFalse(bv.isReadOnly); - assert.deepEqual(bv.data, data.slice(0, 3)); + // Act / Assert - Changes to source affects bv + data[2] = 0x88; + assert.strictEqual(bv.get(2), 0x88); } @test - public fromByteArray_readOnly() { + public fromByteArray_withLength() { // Arrange, Act const data = new Uint8Array([0x0, 0x1, 0x2, 0x3, 0x4]); - const bv = ByteVector.fromByteArray(data, undefined, true); + const bv = ByteVector.fromByteArray(data, 3); // Assert assert.isOk(bv); - assert.strictEqual(bv.length, data.length); - assert.isFalse(bv.isEmpty); - assert.isTrue(bv.isReadOnly); - assert.deepEqual(bv.data, data); - } - - @test - public fromByteVector_noVector() { - // Arrange, Act, Assert - assert.throws(() => { - ByteVector.fromByteVector(null); - }); - assert.throws(() => { - ByteVector.fromByteArray(undefined); - }); - } - - @test - public fromByteVector_withData() { - // Arrange, Act - const data = new Uint8Array([0x1, 0x2]); - const original = ByteVector.fromByteArray(data); - const bv = ByteVector.fromByteVector(original); - // Assert - assert.isOk(bv); - assert.strictEqual(bv.length, data.length); + assert.strictEqual(bv.checksum, 0xdb9bfab2); + assert.strictEqual(bv.length, 3); assert.isFalse(bv.isEmpty); assert.isFalse(bv.isReadOnly); - assert.deepEqual(bv.data, data); - } - @test - public fromByteVector_readOnly() { - // Arrange, Act - const data = new Uint8Array([0x1, 0x2]); - const original = ByteVector.fromByteArray(data); - const bv = ByteVector.fromByteVector(original, true); + ByteVector_ConstructorTests.equalContents(bv, data.subarray(0, 3)); - // Assert - assert.isOk(bv); - assert.strictEqual(bv.length, data.length); - assert.isFalse(bv.isEmpty); - assert.isTrue(bv.isReadOnly); - assert.deepEqual(bv.data, data); + // Act / Assert - Changes to source does not affect b/c it is copied + data[2] = 0x88; + assert.strictEqual(bv.get(2), 0x02); } @test @@ -231,8 +244,13 @@ const assert = Chai.assert; @test public fromFileAbstraction() { - // Arrange - const bytes = new Uint8Array(TestConstants.testFileContents); + // Arrange - Make a file big enough to fill up a buffer + const bytes = new Uint8Array(5000); + let total = 0; + while (total < 5000) { + bytes.set(TestConstants.testFileContents, total); + total += TestConstants.testFileContents.length; + } const mockStream = new TestStream(ByteVector.fromByteArray(bytes), false); const mockFileAbstraction = TypeMoq.Mock.ofType(); @@ -247,7 +265,7 @@ const assert = Chai.assert; assert.strictEqual(bv.length, bytes.length); assert.isFalse(bv.isEmpty); assert.isFalse(bv.isReadOnly); - assert.deepEqual(bv.data, bytes); + ByteVector_ConstructorTests.equalContents(bv, bytes); mockFileAbstraction.verify((a) => a.closeStream(TypeMoq.It.isValue(mockStream)), TypeMoq.Times.once()); } @@ -263,7 +281,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testInt( 0x0, [0x0, 0x0, 0x0, 0x0], - undefined, + 0x00000000, undefined ); } @@ -273,8 +291,8 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testInt( 0x0, [0x0, 0x0, 0x0, 0x0], - undefined, - false + 0x00000000, + undefined ); } @@ -283,7 +301,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testInt( 0x12, [0x00, 0x00, 0x00, 0x12], - undefined, + 0x4593e01e, undefined ); } @@ -293,7 +311,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testInt( 0x12, [0x12, 0x00, 0x00, 0x00], - undefined, + 0x4b0e057a, false ); } @@ -303,7 +321,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testInt( 0x1234, [0x00, 0x00, 0x12, 0x34], - undefined, + 0x77951e50, undefined ); } @@ -313,7 +331,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testInt( 0x1234, [0x34, 0x12, 0x00, 0x00], - undefined, + 0x7f33b629, false ); } @@ -323,7 +341,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testInt( 0x123456, [0x00, 0x12, 0x34, 0x56], - undefined, + 0x09fcfb57, undefined ); } @@ -333,7 +351,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testInt( 0x123456, [0x56, 0x34, 0x12, 0x00], - undefined, + 0x77b636ba, false ); } @@ -343,7 +361,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testInt( 0x12345678, [0x12, 0x34, 0x56, 0x78], - undefined, + 0x188e5750, undefined ); } @@ -353,7 +371,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testInt( 0x12345678, [0x78, 0x56, 0x34, 0x12], - undefined, + 0x6a330d2d, false ); } @@ -363,7 +381,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testInt( -0x12, [0xFF, 0xFF, 0xFF, 0xEE], - undefined, + 0x8fd41bbc, undefined ); } @@ -373,7 +391,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testInt( -0x12, [0xEE, 0xFF, 0xFF, 0xFF], - undefined, + 0xec7d6a6f, false ); } @@ -383,7 +401,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testInt( -0x1234, [0xFF, 0xFF, 0xED, 0xCC], - undefined, + 0xaed6932e, undefined ); } @@ -393,7 +411,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testInt( -0x1234, [0xCC, 0xED, 0xFF, 0xFF], - undefined, + 0xa4b59539, false ); } @@ -403,7 +421,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testInt( -0x123456, [0xFF, 0xED, 0xCB, 0xAA], - undefined, + 0xc3bb00f5, undefined ); } @@ -413,7 +431,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testInt( -0x123456, [0xAA, 0xCB, 0xED, 0xFF], - undefined, + 0xd0c559af, false ); } @@ -423,7 +441,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testInt( -0x12345678, [0xED, 0xCB, 0xA9, 0x88], - undefined, + 0xe7c53796, undefined ); } @@ -433,21 +451,11 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testInt( -0x12345678, [0x88, 0xA9, 0xCB, 0xED], - undefined, + 0x485fb637, false ); } - @test - public fromInt_readOnly() { - ByteVector_ConstructorTests.testInt( - 0, - [0x00, 0x00, 0x00, 0x00], - true, - undefined - ); - } - @test public fromInternalStream_badStream() { // Act / Assert @@ -464,10 +472,13 @@ const assert = Chai.assert; // Assert assert.isOk(bv); + + assert.strictEqual(bv.checksum, 0x00000000); assert.strictEqual(bv.length, 0); assert.isTrue(bv.isEmpty); assert.isFalse(bv.isReadOnly); - assert.deepEqual(bv.data, new Uint8Array([])); + + ByteVector_ConstructorTests.equalContents(bv, []); } @test @@ -481,31 +492,95 @@ const assert = Chai.assert; // Assert assert.isOk(bv); + + assert.strictEqual(bv.checksum, 0x8227a366); assert.strictEqual(bv.length, bytes.length); assert.isFalse(bv.isEmpty); assert.isFalse(bv.isReadOnly); - assert.deepEqual(bv.data, bytes); + + ByteVector_ConstructorTests.equalContents(bv, bytes); } @test - public fromLong_badValue() { + public fromLong_badValues() { // Arrange, Act, Assert Testers.testTruthy((v: bigint) => { ByteVector.fromLong(v); }); } @test public fromLong_overflow() { + // Arrange, Act, Assert assert.throws(() => { ByteVector.fromLong(BigInt("9223372036854775808")); }); assert.throws(() => { ByteVector.fromLong(BigInt("-9223372036854775809")); }); } + @test + public fromLong_positiveNumber_bigEndian() { + this.testLong( + 0x1234, + [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x34], + 0x77951e50, + undefined + ); + } + + @test + public fromLong_positiveNumber_littleEndian() { + this.testLong( + 0x1234, + [0x34, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], + 0xe032bc9b, + false + ); + } + + @test + public fromLong_negativeNumber_bigEndian() { + this.testLong( + -0x1234, + [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xED, 0xCC], + 0xc7d22877, + undefined + ); + } + + @test + public fromLong_negativeNumber_littleEndian() { + this.testLong( + -0x1234, + [0xCC, 0xED, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], + 0xc896d178, + false + ); + } + + @test + public fromLong_bigPositiveNumber_bigEndian() { + this.testLong( + 0x1234000000, + [0x00, 0x00, 0x00, 0x12, 0x34, 0x00, 0x00, 0x00], + 0x70c0e641, + undefined + ); + } + + @test + public fromLong_bigPositiveNumber_littleEndian() { + this.testLong( + 0x1234000000, + [0x00, 0x00, 0x00, 0x34, 0x12, 0x00, 0x00, 0x00], + 0xeb4d895a, + false + ); + } + @test public fromLong_positive1Byte_bigEndian() { this.testLong( BigInt("0x12"), [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12], - undefined, + 0x4593e01e, undefined ); } @@ -515,7 +590,7 @@ const assert = Chai.assert; this.testLong( BigInt("0x12"), [0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - undefined, + 0x1a9b1e5f, false ); } @@ -525,7 +600,7 @@ const assert = Chai.assert; this.testLong( BigInt("0x1234"), [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x34], - undefined, + 0x77951e50, undefined ); } @@ -535,7 +610,7 @@ const assert = Chai.assert; this.testLong( BigInt("0x1234"), [0x34, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - undefined, + 0xe032bc9b, false ); } @@ -545,7 +620,7 @@ const assert = Chai.assert; this.testLong( BigInt("0x123456"), [0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x34, 0x56], - undefined, + 0x09fcfb57, undefined ); } @@ -555,7 +630,7 @@ const assert = Chai.assert; this.testLong( BigInt("0x123456"), [0x56, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00], - undefined, + 0x59e6bc55, false ); } @@ -565,7 +640,7 @@ const assert = Chai.assert; this.testLong( BigInt("0x12345678"), [0x00, 0x00, 0x00, 0x00, 0x12, 0x34, 0x56, 0x78], - undefined, + 0x188e5750, undefined ); } @@ -575,7 +650,7 @@ const assert = Chai.assert; this.testLong( BigInt("0x12345678"), [0x78, 0x56, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00], - undefined, + 0xee67587a, false ); } @@ -585,7 +660,7 @@ const assert = Chai.assert; this.testLong( BigInt("0x123456789A"), [0x00, 0x00, 0x00, 0x12, 0x34, 0x56, 0x78, 0x9A], - undefined, + 0xeed98b80, undefined ); } @@ -595,7 +670,7 @@ const assert = Chai.assert; this.testLong( BigInt("0x123456789A"), [0x9A, 0x78, 0x56, 0x34, 0x12, 0x00, 0x00, 0x00], - undefined, + 0xa9896e71, false ); } @@ -605,7 +680,7 @@ const assert = Chai.assert; this.testLong( BigInt("0x123456789ABC"), [0x00, 0x00, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC], - undefined, + 0xa89e1069, undefined ); } @@ -615,7 +690,7 @@ const assert = Chai.assert; this.testLong( BigInt("0x123456789ABC"), [0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12, 0x00, 0x00], - undefined, + 0x8c546d6b, false ); } @@ -625,7 +700,7 @@ const assert = Chai.assert; this.testLong( BigInt("0x123456789ABCDE"), [0x00, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE], - undefined, + 0x64223955, undefined ); } @@ -635,7 +710,7 @@ const assert = Chai.assert; this.testLong( BigInt("0x123456789ABCDE"), [0xDE, 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12, 0x00], - undefined, + 0x662acd89, false ); } @@ -645,7 +720,7 @@ const assert = Chai.assert; this.testLong( BigInt("0x123456789ABCDEF0"), [0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0], - undefined, + 0x14201842, undefined ); } @@ -655,7 +730,7 @@ const assert = Chai.assert; this.testLong( BigInt("0x123456789ABCDEF0"), [0xF0, 0xDE, 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12], - undefined, + 0x47c71870, false ); } @@ -665,7 +740,7 @@ const assert = Chai.assert; this.testLong( BigInt("-18"), [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEE], - undefined, + 0xe6d0a0e5, undefined ); } @@ -675,7 +750,7 @@ const assert = Chai.assert; this.testLong( BigInt("-18"), [0xEE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], - undefined, + 0x58791d23, false ); } @@ -685,7 +760,7 @@ const assert = Chai.assert; this.testLong( BigInt("-4660"), [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xED, 0xCC], - undefined, + 0xc7d22877, undefined ); } @@ -695,7 +770,7 @@ const assert = Chai.assert; this.testLong( BigInt("-4660"), [0xCC, 0xED, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], - undefined, + 0xc896d178, false ); } @@ -705,7 +780,7 @@ const assert = Chai.assert; this.testLong( BigInt("-1193046"), [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xED, 0xCB, 0xAA], - undefined, + 0xaabfbbac, undefined ); } @@ -715,7 +790,7 @@ const assert = Chai.assert; this.testLong( BigInt("-1193046"), [0xAA, 0xCB, 0xED, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], - undefined, + 0x1b04bf29, false ); } @@ -725,7 +800,7 @@ const assert = Chai.assert; this.testLong( BigInt("-305419896"), [0xFF, 0xFF, 0xFF, 0xFF, 0xED, 0xCB, 0xA9, 0x88], - undefined, + 0x8ec18ccf, undefined ); } @@ -735,7 +810,7 @@ const assert = Chai.assert; this.testLong( BigInt("-305419896"), [0x88, 0xA9, 0xCB, 0xED, 0xFF, 0xFF, 0xFF, 0xFF], - undefined, + 0x124fe8a7, false ); } @@ -745,7 +820,7 @@ const assert = Chai.assert; this.testLong( BigInt("-78187493530"), [0xFF, 0xFF, 0xFF, 0xED, 0xCB, 0xA9, 0x87, 0x66], - undefined, + 0x4d9acb7b, undefined ); } @@ -755,7 +830,7 @@ const assert = Chai.assert; this.testLong( BigInt("-78187493530"), [0x66, 0x87, 0xA9, 0xCB, 0xED, 0xFF, 0xFF, 0xFF], - undefined, + 0xeb6b6d0d, false ); } @@ -765,7 +840,7 @@ const assert = Chai.assert; this.testLong( BigInt("-20015998343868"), [0xFF, 0xFF, 0xED, 0xCB, 0xA9, 0x87, 0x65, 0x44], - undefined, + 0x18d9264e, undefined ); } @@ -775,7 +850,7 @@ const assert = Chai.assert; this.testLong( BigInt("-20015998343868"), [0x44, 0x65, 0x87, 0xA9, 0xCB, 0xED, 0xFF, 0xFF], - undefined, + 0xa4f00088, false ); } @@ -785,7 +860,7 @@ const assert = Chai.assert; this.testLong( BigInt("-5124095576030430"), [0xFF, 0xED, 0xCB, 0xA9, 0x87, 0x65, 0x43, 0x22], - undefined, + 0xc76179ae, undefined ); } @@ -795,7 +870,7 @@ const assert = Chai.assert; this.testLong( BigInt("-5124095576030430"), [0x22, 0x43, 0x65, 0x87, 0xA9, 0xCB, 0xED, 0xFF], - undefined, + 0x24c8cef5, false ); } @@ -805,7 +880,7 @@ const assert = Chai.assert; this.testLong( BigInt("-1311768467463790320"), [0xED, 0xCB, 0xA9, 0x87, 0x65, 0x43, 0x21, 0x10], - undefined, + 0xce7e18ad, undefined ); } @@ -815,7 +890,7 @@ const assert = Chai.assert; this.testLong( BigInt("-1311768467463790320"), [0x10, 0x21, 0x43, 0x65, 0x87, 0xA9, 0xCB, 0xED], - undefined, + 0x16370f66, false ); } @@ -825,7 +900,7 @@ const assert = Chai.assert; this.testLong( BigInt(0), [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - undefined, + 0x00000000, undefined ); } @@ -835,18 +910,8 @@ const assert = Chai.assert; this.testLong( BigInt(0), [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - undefined, - true - ); - } - - @test - public fromLong_readOnly() { - this.testLong( - BigInt(0), - [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - true, - undefined + 0x00000000, + false ); } @@ -863,23 +928,13 @@ const assert = Chai.assert; // Assert assert.isOk(bv); + + assert.strictEqual(bv.checksum, 0x8227a366); assert.strictEqual(bv.length, TestConstants.testFileContents.length); assert.isFalse(bv.isEmpty); assert.isFalse(bv.isReadOnly); - assert.deepEqual(bv.data, new Uint8Array(TestConstants.testFileContents)); - } - - @test - public fromPath_readOnly() { - // Arrange, Act - const bv = ByteVector.fromPath(TestConstants.testFilePath, true); - // Assert - assert.isOk(bv); - assert.strictEqual(bv.length, TestConstants.testFileContents.length); - assert.isFalse(bv.isEmpty); - assert.isTrue(bv.isReadOnly); - assert.deepEqual(bv.data, new Uint8Array(TestConstants.testFileContents)); + ByteVector_ConstructorTests.equalContents(bv, TestConstants.testFileContents); } @test @@ -900,7 +955,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testShort( 0x0, [0x0, 0x0], - undefined, + 0x00000000, undefined ); } @@ -910,7 +965,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testShort( 0x0, [0x0, 0x0], - undefined, + 0x00000000, false ); } @@ -920,7 +975,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testShort( 0x12, [0x00, 0x12], - undefined, + 0x4593e01e, undefined ); } @@ -930,7 +985,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testShort( 0x12, [0x12, 0x00], - undefined, + 0xb0a3051c, false ); } @@ -940,7 +995,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testShort( 0x1234, [0x12, 0x34], - undefined, + 0x77951e50, undefined ); } @@ -950,7 +1005,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testShort( 0x1234, [0x34, 0x12], - undefined, + 0x30456c82, false ); } @@ -960,7 +1015,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testShort( -0x12, [0xFF, 0xEE], - undefined, + 0xb798a2ba, undefined ); } @@ -970,7 +1025,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testShort( -0x12, [0xEE, 0xFF], - undefined, + 0x3d003eb2, false ); } @@ -980,7 +1035,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testShort( -0x1234, [0xED, 0xCC], - undefined, + 0x969a2a28, undefined ); } @@ -990,21 +1045,11 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testShort( -0x1234, [0xCC, 0xED], - undefined, + 0xf8c27685, false ); } - @test - public fromShort_readOnly() { - ByteVector_ConstructorTests.testShort( - 0x0, - [0x0, 0x0], - true, - undefined - ); - } - @test public fromSize_badSize() { // Arrange, Act, Assert @@ -1024,10 +1069,11 @@ const assert = Chai.assert; // Assert assert.isOk(bv); + + assert.strictEqual(bv.checksum, 0x00000000); assert.strictEqual(bv.length, 0); assert.isTrue(bv.isEmpty); assert.isFalse(bv.isReadOnly); - assert.deepEqual(bv.data, new Uint8Array()); } @test @@ -1037,10 +1083,13 @@ const assert = Chai.assert; // Assert assert.isOk(bv); + + assert.strictEqual(bv.checksum, 0x00000000); assert.strictEqual(bv.length, 4); assert.isFalse(bv.isEmpty); assert.isFalse(bv.isReadOnly); - assert.deepEqual(bv.data, new Uint8Array([0x00, 0x00, 0x00, 0x00])); + + ByteVector_ConstructorTests.equalContents(bv, [0x00, 0x00, 0x00, 0x00]); } @test @@ -1050,23 +1099,13 @@ const assert = Chai.assert; // Assert assert.isOk(bv); + + assert.strictEqual(bv.checksum, 0x7ab79290); assert.strictEqual(bv.length, 4); assert.isFalse(bv.isEmpty); assert.isFalse(bv.isReadOnly); - assert.deepEqual(bv.data, new Uint8Array([0xEE, 0xEE, 0xEE, 0xEE])); - } - @test - public fromSize_readOnly() { - // Arrange, Act - const bv = ByteVector.fromSize(4, undefined, true); - - // Assert - assert.isOk(bv); - assert.strictEqual(bv.length, 4); - assert.isFalse(bv.isEmpty); - assert.isTrue(bv.isReadOnly); - assert.deepEqual(bv.data, new Uint8Array([0x00, 0x00, 0x00, 0x00])); + ByteVector_ConstructorTests.equalContents(bv, [0xEE, 0xEE, 0xEE, 0xEE]); } @test @@ -1089,14 +1128,17 @@ const assert = Chai.assert; // Assert assert.isOk(bv); + + assert.strictEqual(bv.checksum, 0x000000); assert.strictEqual(bv.length, 0); assert.isTrue(bv.isEmpty); assert.isFalse(bv.isReadOnly); - assert.deepEqual(bv.data, new Uint8Array([])); + + ByteVector_ConstructorTests.equalContents(bv, []); } @test - public async fromStream_readWrite() { + public async fromStream() { // Arrange - Create a stream with some data in it const stream = new StreamBuffers.ReadableStreamBuffer(); const bytes = new Uint8Array(TestConstants.testFileContents); @@ -1109,32 +1151,17 @@ const assert = Chai.assert; // Assert assert.isOk(bv); + + assert.strictEqual(bv.checksum, 0x8227a366); assert.strictEqual(bv.length, bytes.length); assert.isFalse(bv.isEmpty); assert.isFalse(bv.isReadOnly); - assert.deepEqual(bv.data, bytes); - } - @test - public async fromStream_readOnly() { - // Arrange - Create a stream with some data in it - const stream = new StreamBuffers.ReadableStreamBuffer(); - const bytes = new Uint8Array(TestConstants.testFileContents); - stream.put(Buffer.from(bytes.buffer)); - - // Act - Get the promise, end the stream, await the promise - const bvPromise = ByteVector.fromStream(stream, true); - stream.stop(); - const bv = await bvPromise; - - // Assert - assert.isOk(bv); - assert.strictEqual(bv.length, bytes.length); - assert.isFalse(bv.isEmpty); - assert.isTrue(bv.isReadOnly); - assert.deepEqual(bv.data, bytes); + ByteVector_ConstructorTests.equalContents(bv, bytes); } + // @TODO: Add test for failing stream read + @test public fromString_invalidLength() { // Arrange, Act, Assert @@ -1146,8 +1173,8 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testString( TestConstants.testStrings.UTF8.str, TestConstants.testStrings.UTF8.bytes, - undefined, - undefined, + 0x88b08693, + StringType.UTF8, undefined ); } @@ -1157,9 +1184,9 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testString( TestConstants.testStrings.UTF8.str, TestConstants.testStrings.UTF8.bytes.slice(0, 9), - undefined, - 6, - undefined + 0xbd58b35e, + StringType.UTF8, + 6 ); } @@ -1168,7 +1195,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testString( "", [], - undefined, + 0x00000000, undefined, undefined ); @@ -1176,80 +1203,74 @@ const assert = Chai.assert; @test public fromString_utf16LittleEndianFull() { - const originalLastUtf16Encoding = ByteVector.lastUtf16Encoding; ByteVector_ConstructorTests.testString( TestConstants.testStrings.UTF16LE.str, TestConstants.testStrings.UTF16LE.bytes, + 0xd74d6dea, StringType.UTF16LE, - undefined, undefined ); - assert.strictEqual(ByteVector.lastUtf16Encoding, originalLastUtf16Encoding); } @test public fromString_utf16LittleEndianPartial() { - const originalLastUtf16Encoding = ByteVector.lastUtf16Encoding; ByteVector_ConstructorTests.testString( TestConstants.testStrings.UTF16LE.str, TestConstants.testStrings.UTF16LE.bytes.slice(0, 12), + 0xe9e1088f, StringType.UTF16LE, - 6, - undefined + 6 ); - assert.strictEqual(ByteVector.lastUtf16Encoding, originalLastUtf16Encoding); } @test public fromString_utf16LittleEndianEmpty() { - const originalLastUtf16Encoding = ByteVector.lastUtf16Encoding; ByteVector_ConstructorTests.testString( "", [], + 0x00000000, StringType.UTF16LE, - undefined, undefined ); - assert.strictEqual(ByteVector.lastUtf16Encoding, originalLastUtf16Encoding); } @test public fromString_utf16BigEndianFull() { - const originalLastUtf16Encoding = ByteVector.lastUtf16Encoding; + const originalLastUtf16Encoding = Encoding["_lastUtf16Encoding"]; ByteVector_ConstructorTests.testString( TestConstants.testStrings.UTF16BE.str, TestConstants.testStrings.UTF16BE.bytes, + 0xa8031d65, StringType.UTF16BE, - undefined, undefined ); - assert.strictEqual(ByteVector.lastUtf16Encoding, originalLastUtf16Encoding); + assert.strictEqual(Encoding["_lastUtf16Encoding"], originalLastUtf16Encoding); } @test public fromString_utf16BigEndianPartial() { - const originalLastUtf16Encoding = ByteVector.lastUtf16Encoding; + const originalLastUtf16Encoding = Encoding["_lastUtf16Encoding"]; ByteVector_ConstructorTests.testString( TestConstants.testStrings.UTF16BE.str, TestConstants.testStrings.UTF16BE.bytes.slice(0, 12), + 0xa5d3b1ab, StringType.UTF16BE, - 6, - undefined + 6 ); - assert.strictEqual(ByteVector.lastUtf16Encoding, originalLastUtf16Encoding); + assert.strictEqual(Encoding["_lastUtf16Encoding"], originalLastUtf16Encoding); } @test public fromString_utf16BigEndianEmpty() { - const originalLastUtf16Encoding = ByteVector.lastUtf16Encoding; + const originalLastUtf16Encoding = Encoding["_lastUtf16Encoding"]; ByteVector_ConstructorTests.testString( "", [], + 0x00000000, StringType.UTF16BE, - undefined, undefined ); - assert.strictEqual(ByteVector.lastUtf16Encoding, originalLastUtf16Encoding); + assert.strictEqual(Encoding["_lastUtf16Encoding"], originalLastUtf16Encoding); } @test @@ -1257,8 +1278,8 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testString( TestConstants.testStrings.Latin1.str, TestConstants.testStrings.Latin1.bytes, + 0xd1733f6b, StringType.Latin1, - undefined, undefined ); } @@ -1268,9 +1289,9 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testString( TestConstants.testStrings.Latin1.str, TestConstants.testStrings.Latin1.bytes.slice(0, 6), + 0x919ae494, StringType.Latin1, - 6, - undefined + 6 ); } @@ -1279,8 +1300,8 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testString( "", [], + 0x00000000, StringType.Latin1, - undefined, undefined ); } @@ -1288,81 +1309,67 @@ const assert = Chai.assert; @test public fromString_utf16Full() { // This test will change the last used utf16 encoding, so we'll restore it afterward - const originalLastEncoding = ByteVector.lastUtf16Encoding; - ByteVector.lastUtf16Encoding = "something bogus"; - - ByteVector_ConstructorTests.testString( - TestConstants.testStrings.UTF16LEWithBOM.str, - TestConstants.testStrings.UTF16LEWithBOM.bytes, - StringType.UTF16, - undefined, - undefined - ); - assert.strictEqual(ByteVector.lastUtf16Encoding, "utf16-le"); - - // Cleanup - ByteVector.lastUtf16Encoding = originalLastEncoding; + const originalLastEncoding = Encoding["_lastUtf16Encoding"]; + Encoding["_lastUtf16Encoding"] = StringType.Latin1; + try { + ByteVector_ConstructorTests.testString( + TestConstants.testStrings.UTF16LEWithBOM.str, + TestConstants.testStrings.UTF16LEWithBOM.bytes, + 0x37993f26, + StringType.UTF16, + undefined + ); + assert.strictEqual(Encoding["_lastUtf16Encoding"], StringType.UTF16LE); + } finally { + // Cleanup + Encoding["_lastUtf16Encoding"] = originalLastEncoding; + } } @test public fromString_utf16Partial() { // This test will change the last used utf16 encoding, so we'll restore it afterward - const originalLastEncoding = ByteVector.lastUtf16Encoding; - ByteVector.lastUtf16Encoding = "something bogus"; - - ByteVector_ConstructorTests.testString( - TestConstants.testStrings.UTF16LEWithBOM.str, - TestConstants.testStrings.UTF16LEWithBOM.bytes.slice(0, 14), - StringType.UTF16, - 6, - undefined - ); - assert.strictEqual(ByteVector.lastUtf16Encoding, "utf16-le"); - - // Cleanup - ByteVector.lastUtf16Encoding = originalLastEncoding; + const originalLastEncoding = Encoding["_lastUtf16Encoding"]; + Encoding["_lastUtf16Encoding"] = StringType.Latin1; + try { + ByteVector_ConstructorTests.testString( + TestConstants.testStrings.UTF16LEWithBOM.str, + TestConstants.testStrings.UTF16LEWithBOM.bytes.slice(0, 14), + 0xee6338ca, + StringType.UTF16, + 6 + ); + assert.strictEqual(Encoding["_lastUtf16Encoding"], StringType.UTF16LE); + } finally { + // Cleanup + Encoding["_lastUtf16Encoding"] = originalLastEncoding; + } } @test public fromString_utf16Empty() { // This test will change the last used utf16 encoding, so we'll restore it afterward - const originalLastEncoding = ByteVector.lastUtf16Encoding; - ByteVector.lastUtf16Encoding = "something bogus"; - - ByteVector_ConstructorTests.testString( - "", - TestConstants.testStrings.UTF16LEWithBOM.bytes.slice(0, 2), - StringType.UTF16, - undefined, - undefined - ); - assert.strictEqual(ByteVector.lastUtf16Encoding, "something bogus"); - - // Cleanup - ByteVector.lastUtf16Encoding = originalLastEncoding; - } - - @test - public fromString_readOnly() { - ByteVector_ConstructorTests.testString( - "", - [], - StringType.Latin1, - undefined, - true - ); + const originalLastEncoding = Encoding["_lastUtf16Encoding"]; + Encoding["_lastUtf16Encoding"] = StringType.Latin1; + try { + ByteVector_ConstructorTests.testString( + "", + TestConstants.testStrings.UTF16LEWithBOM.bytes.slice(0, 2), + 0xfb8979ca, + StringType.UTF16, + undefined + ); + assert.strictEqual(Encoding["_lastUtf16Encoding"], StringType.Latin1); + } finally { + // Cleanup + Encoding["_lastUtf16Encoding"] = originalLastEncoding; + } } @test public fromUInt_badInteger() { // Arrange, Act, Assert - Testers.testUint((v: number) => { ByteVector.fromUInt(v); }); - } - - @test - public fromUInt_overflow() { - // Arrange, Act, Assert - assert.throws(() => { ByteVector.fromUInt(0x10000000000); }); + Testers.testUint((v: number) => { ByteVector.fromUint(v); }); } @test @@ -1370,7 +1377,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testUInt( 0x0, [0x0, 0x0, 0x0, 0x0], - undefined, + 0x00000000, undefined ); } @@ -1380,7 +1387,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testUInt( 0x0, [0x0, 0x0, 0x0, 0x0], - undefined, + 0x00000000, false ); } @@ -1390,7 +1397,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testUInt( 0x12, [0x00, 0x00, 0x00, 0x12], - undefined, + 0x4593e01e, undefined ); } @@ -1400,7 +1407,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testUInt( 0x12, [0x12, 0x00, 0x00, 0x00], - undefined, + 0x4b0e057a, false ); } @@ -1410,7 +1417,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testUInt( 0x1234, [0x00, 0x00, 0x12, 0x34], - undefined, + 0x77951e50, undefined ); } @@ -1420,7 +1427,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testUInt( 0x1234, [0x34, 0x12, 0x00, 0x00], - undefined, + 0x7f33b629, false ); } @@ -1430,7 +1437,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testUInt( 0x123456, [0x00, 0x12, 0x34, 0x56], - undefined, + 0x09fcfb57, undefined ); } @@ -1440,7 +1447,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testUInt( 0x123456, [0x56, 0x34, 0x12, 0x00], - undefined, + 0x77b636ba, false ); } @@ -1450,7 +1457,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testUInt( 0x12345678, [0x12, 0x34, 0x56, 0x78], - undefined, + 0x188e5750, undefined ); } @@ -1460,7 +1467,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testUInt( 0x12345678, [0x78, 0x56, 0x34, 0x12], - undefined, + 0x6a330d2d, false ); } @@ -1470,7 +1477,7 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testUInt( 0xFFFFFFFF, [0xFF, 0xFF, 0xFF, 0xFF], - undefined, + 0xc704dd7b, undefined ); } @@ -1480,617 +1487,618 @@ const assert = Chai.assert; ByteVector_ConstructorTests.testUInt( 0xFFFFFFFF, [0xFF, 0xFF, 0xFF, 0xFF], - undefined, + 0xc704dd7b, false ); } @test - public fromUInt_readOnly() { - ByteVector_ConstructorTests.testUInt( - 0, - [0x00, 0x00, 0x00, 0x00], - true, + public fromUlong_bigInt_badValue() { + // Arrange, Act, Assert + Testers.testTruthy((v: bigint) => { ByteVector.fromUlong(v); }); + } + + @test + public fromUlong_number_badValue() { + // Arrange / Act / Assert + Testers.testSafeUint((v: number) => { ByteVector.fromUlong(v); }); + } + + @test + public fromUlong_bigInt_overflow() { + // Arrange, Act, Assert + assert.throws(() => { ByteVector.fromUlong(BigInt("18446744073709551616")); }); + assert.throws(() => { ByteVector.fromUlong(BigInt("-1")); }); + } + + @test + public fromUlong_positiveNumber_bigEndian() { + this.testUlong( + 0x1234, + [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x34], + 0x77951e50, undefined ); } @test - public fromULong_bigInt_badValue() { - // Arrange, Act, Assert - Testers.testTruthy((v: bigint) => { ByteVector.fromULong(v); }); + public fromUlong_positiveNumber_littleEndian() { + this.testUlong( + 0x1234, + [0x34, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], + 0xe032bc9b, + false + ); } @test - public fromULong_number_badValue() { - // Arrange / Act / Assert - Testers.testSafeUint((v: number) => { ByteVector.fromULong(v); }); + public fromUlong_bigPositiveNumber_bigEndian() { + this.testUlong( + 0x1234000000, + [0x00, 0x00, 0x00, 0x12, 0x34, 0x00, 0x00, 0x00], + 0x70c0e641, + undefined + ); } @test - public fromULong_bigInt_overflow() { - // Arrange, Act, Assert - assert.throws(() => { ByteVector.fromULong(BigInt("18446744073709551616")); }); - assert.throws(() => { ByteVector.fromULong(BigInt("-1")); }); + public fromUlong_bigPositiveNumber_littleEndian() { + this.testUlong( + 0x1234000000, + [0x00, 0x00, 0x00, 0x34, 0x12, 0x00, 0x00, 0x00], + 0xeb4d895a, + false + ); } @test - public fromULong_bigIntPositive1Byte_bigEndian() { - this.testULong( + public fromUlong_bigIntPositive1Byte_bigEndian() { + this.testUlong( BigInt("0x12"), [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12], - undefined, + 0x4593e01e, undefined ); } @test - public fromULong_numberPositive1Byte_bigEndian() { - this.testULong( + public fromUlong_numberPositive1Byte_bigEndian() { + this.testUlong( 0x12, [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12], - undefined, + 0x4593e01e, undefined ); } @test - public fromULong_bigIntPositive1Byte_littleEndian() { - this.testULong( + public fromUlong_bigIntPositive1Byte_littleEndian() { + this.testUlong( BigInt("0x12"), [0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - undefined, + 0x1a9b1e5f, false ); } @test - public fromULong_numberPositive1Byte_littleEndian() { - this.testULong( + public fromUlong_numberPositive1Byte_littleEndian() { + this.testUlong( 0x12, [0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - undefined, + 0x1a9b1e5f, false ); } @test - public fromULong_bigIntPositive2Byte_bigEndian() { - this.testULong( + public fromUlong_bigIntPositive2Byte_bigEndian() { + this.testUlong( BigInt("0x1234"), [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x34], - undefined, + 0x77951e50, undefined ); } @test - public fromULong_numberPositive2Byte_bigEndian() { - this.testULong( + public fromUlong_numberPositive2Byte_bigEndian() { + this.testUlong( 0x1234, [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x34], - undefined, + 0x77951e50, undefined ); } @test - public fromULong_bigIntPositive2Byte_littleEndian() { - this.testULong( + public fromUlong_bigIntPositive2Byte_littleEndian() { + this.testUlong( BigInt("0x1234"), [0x34, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - undefined, + 0xe032bc9b, false ); } @test - public fromULong_numberPositive2Byte_littleEndian() { - this.testULong( + public fromUlong_numberPositive2Byte_littleEndian() { + this.testUlong( 0x1234, [0x34, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - undefined, + 0xe032bc9b, false ); } @test - public fromULong_bigIntPositive3Byte_bigEndian() { - this.testULong( + public fromUlong_bigIntPositive3Byte_bigEndian() { + this.testUlong( BigInt("0x123456"), [0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x34, 0x56], - undefined, + 0x09fcfb57, undefined ); } @test - public fromULong_numberPositive3Byte_bigEndian() { - this.testULong( + public fromUlong_numberPositive3Byte_bigEndian() { + this.testUlong( 0x123456, [0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x34, 0x56], - undefined, + 0x09fcfb57, undefined ); } @test - public fromULong_bigIntPositive3Byte_littleEndian() { - this.testULong( + public fromUlong_bigIntPositive3Byte_littleEndian() { + this.testUlong( BigInt("0x123456"), [0x56, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00], - undefined, + 0x59e6bc55, false ); } @test - public fromULong_numberPositive3Byte_littleEndian() { - this.testULong( + public fromUlong_numberPositive3Byte_littleEndian() { + this.testUlong( 0x123456, [0x56, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00], - undefined, + 0x59e6bc55, false ); } @test - public fromULong_bigIntPositive4Byte_bigEndian() { - this.testULong( + public fromUlong_bigIntPositive4Byte_bigEndian() { + this.testUlong( BigInt("0x12345678"), [0x00, 0x00, 0x00, 0x00, 0x12, 0x34, 0x56, 0x78], - undefined, + 0x188e5750, undefined ); } @test - public fromULong_numberPositive4Byte_bigEndian() { - this.testULong( + public fromUlong_numberPositive4Byte_bigEndian() { + this.testUlong( 0x12345678, [0x00, 0x00, 0x00, 0x00, 0x12, 0x34, 0x56, 0x78], - undefined, + 0x188e5750, undefined ); } @test - public fromULong_bigIntPositive4Byte_littleEndian() { - this.testULong( + public fromUlong_bigIntPositive4Byte_littleEndian() { + this.testUlong( BigInt("0x12345678"), [0x78, 0x56, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00], - undefined, + 0xee67587a, false ); } @test - public fromULong_numberPositive4Byte_littleEndian() { - this.testULong( + public fromUlong_numberPositive4Byte_littleEndian() { + this.testUlong( 0x12345678, [0x78, 0x56, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00], - undefined, + 0xee67587a, false ); } @test - public fromULong_bigIntPositive5Byte_bigEndian() { - this.testULong( + public fromUlong_bigIntPositive5Byte_bigEndian() { + this.testUlong( BigInt("0x123456789A"), [0x00, 0x00, 0x00, 0x12, 0x34, 0x56, 0x78, 0x9A], - undefined, + 0xeed98b80, undefined ); } @test - public fromULong_numberPositive5Byte_bigEndian() { - this.testULong( + public fromUlong_numberPositive5Byte_bigEndian() { + this.testUlong( 0x123456789A, [0x00, 0x00, 0x00, 0x12, 0x34, 0x56, 0x78, 0x9A], - undefined, + 0xeed98b80, undefined ); } @test - public fromULong_bigIntPositive5Byte_littleEndian() { - this.testULong( + public fromUlong_bigIntPositive5Byte_littleEndian() { + this.testUlong( BigInt("0x123456789A"), [0x9A, 0x78, 0x56, 0x34, 0x12, 0x00, 0x00, 0x00], - undefined, + 0xa9896e71, false ); } @test - public fromULong_numberPositive5Byte_littleEndian() { - this.testULong( + public fromUlong_numberPositive5Byte_littleEndian() { + this.testUlong( 0x123456789A, [0x9A, 0x78, 0x56, 0x34, 0x12, 0x00, 0x00, 0x00], - undefined, + 0xa9896e71, false ); } @test - public fromULong_bigIntPositive6Byte_bigEndian() { - this.testULong( + public fromUlong_bigIntPositive6Byte_bigEndian() { + this.testUlong( BigInt("0x123456789ABC"), [0x00, 0x00, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC], - undefined, + 0xa89e1069, undefined ); } @test - public fromULong_numberPositive6Byte_bigEndian() { - this.testULong( + public fromUlong_numberPositive6Byte_bigEndian() { + this.testUlong( 0x123456789ABC, [0x00, 0x00, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC], - undefined, + 0xa89e1069, undefined ); } @test - public fromULong_bigIntPositive6Byte_littleEndian() { - this.testULong( + public fromUlong_bigIntPositive6Byte_littleEndian() { + this.testUlong( BigInt("0x123456789ABC"), [0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12, 0x00, 0x00], - undefined, + 0x8c546d6b, false ); } @test - public fromULong_numberPositive6Byte_littleEndian() { - this.testULong( + public fromUlong_numberPositive6Byte_littleEndian() { + this.testUlong( 0x123456789ABC, [0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12, 0x00, 0x00], - undefined, + 0x8c546d6b, false ); } @test - public fromULong_bigIntPositive7Byte_bigEndian() { - this.testULong( + public fromUlong_bigIntPositive7Byte_bigEndian() { + this.testUlong( BigInt("0x123456789ABCDE"), [0x00, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE], - undefined, + 0x64223955, undefined ); } @test - public fromULong_bigIntPositive7Byte_littleEndian() { - this.testULong( + public fromUlong_bigIntPositive7Byte_littleEndian() { + this.testUlong( BigInt("0x123456789ABCDE"), [0xDE, 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12, 0x00], - undefined, + 0x662acd89, false ); } @test - public fromULong_bigIntPositive8Byte_bigEndian() { - this.testULong( + public fromUlong_bigIntPositive8Byte_bigEndian() { + this.testUlong( BigInt("0x123456789ABCDEF0"), [0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0], - undefined, + 0x14201842, undefined ); } @test - public fromULong_bigIntPositive8Byte_littleEndian() { - this.testULong( + public fromUlong_bigIntPositive8Byte_littleEndian() { + this.testUlong( BigInt("0x123456789ABCDEF0"), [0xF0, 0xDE, 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12], - undefined, + 0x47c71870, false ); } @test - public fromULong_bigIntUnsignedRange_bigEndian() { - this.testULong( + public fromUlong_bigIntUnsignedRange_bigEndian() { + this.testUlong( BigInt("0xFFFFFFFFFFFFFFFF"), [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], - undefined, + 0xae006622, undefined ); } @test - public fromULong_bigIntUnsignedRange_littleEndian() { - this.testULong( + public fromUlong_bigIntUnsignedRange_littleEndian() { + this.testUlong( BigInt("0xFFFFFFFFFFFFFFFF"), [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], - undefined, + 0xae006622, false ); } @test - public fromULong_bigIntZero_bigEndian() { - this.testULong( + public fromUlong_bigIntZero_bigEndian() { + this.testUlong( BigInt(0), [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - undefined, + 0x00000000, undefined ); } @test - public fromULong_numberZero_bigEndian() { - this.testULong( + public fromUlong_numberZero_bigEndian() { + this.testUlong( 0, [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - undefined, + 0x00000000, undefined ); } @test - public fromULong_bigIntZero_littleEndian() { - this.testULong( + public fromUlong_bigIntZero_littleEndian() { + this.testUlong( BigInt(0), [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - undefined, - true + 0x00000000, + false ); } @test - public fromULong_numberZero_littleEndian() { - this.testULong( + public fromUlong_numberZero_littleEndian() { + this.testUlong( 0, [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - undefined, - true - ); - } - - @test - public fromULong_readOnly() { - this.testULong( - BigInt(0), - [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], - true, - undefined + 0x00000000, + false ); } @test - public fromUShort_badShort() { + public fromUshort_badShort() { // Arrange, Act, Assert - Testers.testUint((v: number) => { ByteVector.fromUShort(v); }); + Testers.testUint((v: number) => { ByteVector.fromUshort(v); }); } @test - public fromUShort_overflow() { + public fromUshort_overflow() { // Arrange, Act, Assert - assert.throws(() => { ByteVector.fromUShort(0x1000000); }); - assert.throws(() => { ByteVector.fromUShort(-0x1000000); }); + assert.throws(() => { ByteVector.fromUshort(0x1000000); }); + assert.throws(() => { ByteVector.fromUshort(-0x1000000); }); } @test - public fromUShort_zero_bigEndian() { - ByteVector_ConstructorTests.testUShort( + public fromUshort_zero_bigEndian() { + ByteVector_ConstructorTests.testUshort( 0x0, [0x0, 0x0], - undefined, + 0x00000000, undefined ); } @test - public fromUShort_zero_littleEndian() { - ByteVector_ConstructorTests.testUShort( + public fromUshort_zero_littleEndian() { + ByteVector_ConstructorTests.testUshort( 0x0, [0x0, 0x0], - undefined, + 0x00000000, false ); } @test - public fromUShort_positive1Byte_bigEndian() { - ByteVector_ConstructorTests.testUShort( + public fromUshort_positive1Byte_bigEndian() { + ByteVector_ConstructorTests.testUshort( 0x12, [0x00, 0x12], - undefined, + 0x4593e01e, undefined ); } @test - public fromUShort_positive1Byte_littleEndian() { - ByteVector_ConstructorTests.testUShort( + public fromUshort_positive1Byte_littleEndian() { + ByteVector_ConstructorTests.testUshort( 0x12, [0x12, 0x00], - undefined, + 0xb0a3051c, false ); } @test - public fromUShort_positive2Byte_bigEndian() { - ByteVector_ConstructorTests.testUShort( + public fromUshort_positive2Byte_bigEndian() { + ByteVector_ConstructorTests.testUshort( 0x1234, [0x12, 0x34], - undefined, + 0x77951e50, undefined ); } @test - public fromUShort_positive2Byte_littleEndian() { - ByteVector_ConstructorTests.testUShort( + public fromUshort_positive2Byte_littleEndian() { + ByteVector_ConstructorTests.testUshort( 0x1234, [0x34, 0x12], - undefined, + 0x30456c82, false ); } @test - public fromUShort_unsignedRange_bigEndian() { - ByteVector_ConstructorTests.testUShort( + public fromUshort_unsignedRange_bigEndian() { + ByteVector_ConstructorTests.testUshort( 0xFFFF, [0xFF, 0xFF], - undefined, + 0xff48647d, undefined ); } @test - public fromUShort_unsignedRange_littleEndian() { - ByteVector_ConstructorTests.testUShort( + public fromUshort_unsignedRange_littleEndian() { + ByteVector_ConstructorTests.testUshort( 0xFFFF, [0xFF, 0xFF], - undefined, + 0xff48647d, false ); } - @test - public fromUShort_readOnly() { - ByteVector_ConstructorTests.testUShort( - 0x0, - [0x0, 0x0], - true, - undefined - ); + private static equalContents(bv: ByteVector, expected: ArrayLike): void { + assert.strictEqual(bv.length, expected.length); + for (let i = 0; i < bv.length; i++) { + assert.strictEqual(bv.get(i), expected[i]); + } } - private static testInt(value: number, expectedData: number[], isReadOnly: boolean, bigEndian: boolean): void { - // Arrange, Act - const bv = ByteVector.fromInt(value, bigEndian, isReadOnly); - - // Assert - assert.isOk(bv); - assert.strictEqual(bv.length, 4); - assert.isFalse(bv.isEmpty); - if (isReadOnly !== undefined) { - assert.strictEqual(bv.isReadOnly, isReadOnly); - } else { - assert.isFalse(bv.isReadOnly); - } - assert.deepEqual(bv.data, new Uint8Array(expectedData)); + private static testInt( + value: number, + expectedData: number[], + expectedCrc: number, + bigEndian: boolean + ): void { + ByteVector_ConstructorTests.testFromX( + ByteVector.fromInt(value, bigEndian), + expectedData, + expectedCrc + ); } private testLong( - value: bigint, + value: bigint | number, expectedData: number[], - isReadOnly: boolean, + expectedCrc: number, bigEndian: boolean ): void { - // Arrange, Act - const bv = ByteVector.fromLong(value, bigEndian, isReadOnly); - - // Assert - assert.isOk(bv); - assert.strictEqual(bv.length, 8); - assert.isFalse(bv.isEmpty); - if (isReadOnly !== undefined) { - assert.strictEqual(bv.isReadOnly, isReadOnly); - } else { - assert.isFalse(bv.isReadOnly); - } - assert.deepEqual(bv.data, new Uint8Array(expectedData)); + ByteVector_ConstructorTests.testFromX( + ByteVector.fromLong(value, bigEndian), + expectedData, + expectedCrc, + ); } - private static testShort(value: number, expectedData: number[], isReadOnly: boolean, bigEndian: boolean): void { - // Arrange, Act - const bv = ByteVector.fromShort(value, bigEndian, isReadOnly); - - // Assert - assert.isOk(bv); - assert.strictEqual(bv.length, 2); - assert.isFalse(bv.isEmpty); - if (isReadOnly !== undefined) { - assert.strictEqual(bv.isReadOnly, isReadOnly); - } else { - assert.isFalse(bv.isReadOnly); - } - assert.deepEqual(bv.data, new Uint8Array(expectedData)); + private static testShort( + value: number, + expectedData: number[], + expectedCrc: number, + bigEndian: boolean + ): void { + ByteVector_ConstructorTests.testFromX( + ByteVector.fromShort(value, bigEndian), + expectedData, + expectedCrc + ); } private static testString( str: string, - expectedData: number[], + expectedData: number[]|Uint8Array, + expectedCrc: number, stringType: StringType, - inputLength: number, - isReadOnly: boolean + inputLength: number ) { - // Arrange, Act - const bv = ByteVector.fromString(str, stringType, inputLength, isReadOnly); - - // Assert - assert.isOk(bv); - assert.strictEqual(bv.isEmpty, expectedData.length === 0); - if (isReadOnly !== undefined) { - assert.strictEqual(bv.isReadOnly, isReadOnly); - } else { - assert.isFalse(bv.isReadOnly); - } - assert.deepEqual(bv.data, new Uint8Array(expectedData)); + ByteVector_ConstructorTests.testFromX( + ByteVector.fromString(str, stringType, inputLength), + expectedData, + expectedCrc + ); } - private static testUInt(value: number, expectedData: number[], isReadOnly: boolean, bigEndian: boolean): void { - // Arrange, Act - const bv = ByteVector.fromUInt(value, bigEndian, isReadOnly); - - // Assert - assert.isOk(bv); - assert.strictEqual(bv.length, 4); - assert.isFalse(bv.isEmpty); - if (isReadOnly !== undefined) { - assert.strictEqual(bv.isReadOnly, isReadOnly); - } else { - assert.isFalse(bv.isReadOnly); - } - assert.deepEqual(bv.data, new Uint8Array(expectedData)); + private static testUInt( + value: number, + expectedData: number[], + expectedCrc: number, + bigEndian: boolean + ): void { + ByteVector_ConstructorTests.testFromX( + ByteVector.fromUint(value, bigEndian), + expectedData, + expectedCrc + ); } - private testULong( + private testUlong( value: bigint | number, expectedData: number[], - isReadOnly: boolean, + expectedCrc: number, bigEndian: boolean ): void { - // Arrange, Act - const bv = ByteVector.fromULong(value, bigEndian, isReadOnly); - - // Assert - assert.isOk(bv); - assert.strictEqual(bv.length, 8); - assert.isFalse(bv.isEmpty); - if (isReadOnly !== undefined) { - assert.strictEqual(bv.isReadOnly, isReadOnly); - } else { - assert.isFalse(bv.isReadOnly); - } - assert.deepEqual(bv.data, new Uint8Array(expectedData)); + ByteVector_ConstructorTests.testFromX( + ByteVector.fromUlong(value, bigEndian), + expectedData, + expectedCrc, + ); } - private static testUShort(value: number, expectedData: number[], isReadOnly: boolean, bigEndian: boolean): void { - // Arrange, Act - const bv = ByteVector.fromUShort(value, bigEndian, isReadOnly); + private static testUshort( + value: number, + expectedData: number[], + expectedCrc: number, + bigEndian: boolean + ): void { + ByteVector_ConstructorTests.testFromX( + ByteVector.fromUshort(value, bigEndian), + expectedData, + expectedCrc + ); + } + private static testFromX( + bv: ByteVector, + expectedData: number[]|Uint8Array, + expectedCrc: number + ): ByteVector { // Assert assert.isOk(bv); - assert.strictEqual(bv.length, 2); - assert.isFalse(bv.isEmpty); - if (isReadOnly !== undefined) { - assert.strictEqual(bv.isReadOnly, isReadOnly); - } else { - assert.isFalse(bv.isReadOnly); - } - assert.deepEqual(bv.data, new Uint8Array(expectedData)); + + assert.strictEqual(bv.checksum, expectedCrc); + assert.strictEqual(bv.isEmpty, expectedData.length === 0); + assert.isFalse(bv.isReadOnly); + assert.isFalse(bv.isView); + assert.strictEqual(bv.length, expectedData.length); + + ByteVector_ConstructorTests.equalContents(bv, expectedData); + + return bv; } } diff --git a/test-unit/byteVectorConversionTests.ts b/test-unit/byteVectorConversionTests.ts index 62668964..fa0c5cbb 100644 --- a/test-unit/byteVectorConversionTests.ts +++ b/test-unit/byteVectorConversionTests.ts @@ -2,7 +2,7 @@ import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; import TestConstants from "./testConstants"; -import {ByteVector, StringType} from "../src/byteVector"; +import {ByteVector, Encoding, StringType} from "../src/byteVector"; const assert = Chai.assert; @@ -74,6 +74,103 @@ const assert = Chai.assert; new Uint8Array([0x01]) ); + @test + public toBase64String() { + // Arrange + const bv = ByteVector.fromString(TestConstants.testFileContentsStr, StringType.Latin1); + + // Act + const encoded = bv.toBase64String(); + + // Assert + assert.strictEqual(encoded, "MTIzNDVhYmNkZQ=="); + } + + @test + public toBase64String_view() { + // Arrange + const bv = ByteVector.concatenate( + 0xAA, + ByteVector.fromString(TestConstants.testFileContentsStr, StringType.Latin1), + 0xAA + ); + + // Act + const encoded = bv.subarray(1, TestConstants.testFileContentsStr.length).toBase64String(); + + // Assert + assert.strictEqual(encoded, "MTIzNDVhYmNkZQ=="); + } + + @test + public toByteArray() { + // Arrange + const ba = new Uint8Array(4); + const bv = ByteVector.fromByteArray(ba); + + // Act + // noinspection JSDeprecatedSymbols This is to test the deprecated method + const output = bv.toByteArray(); + + // Assert + assert.strictEqual(output, ba); + } + + @test + public toByteVector_notView() { + // Arrange + const ba = new Uint8Array(4); + const bv = ByteVector.fromByteArray(ba); + + // Act + const output = bv.toByteVector(); + + // Assert - Point to same underlying array + ba[0] = 88; + assert.strictEqual(bv.get(0), 88); + assert.strictEqual(output.get(0), 88); + } + + @test + public toByteVector_offsetView() { + // Arrange + const ba = new Uint8Array([0x00, 0x01, 0x02, 0x03]); + const bv = ByteVector.fromByteArray(ba); + + // Act + const output = bv.subarray(1).toByteVector(); + + // Assert + // - Contains the subarray + assert.strictEqual(output.length, 3); + assert.strictEqual(output.get(0), 0x01); + + // - Do not point to same underlying array + ba[1] = 88; + assert.strictEqual(bv.get(1), 88); + assert.strictEqual(output.get(0), 1); + } + + @test + public toByteVector_lengthView() { + // Arrange + const ba = new Uint8Array([0x01, 0x02, 0x03, 0x04]); + const bv = ByteVector.fromByteArray(ba); + + // Act + const output = bv.subarray(0, 3).toByteVector(); + + // Assert + // - Contains the subarray + assert.strictEqual(output.length, 3); + assert.strictEqual(output.get(0), 0x01); + + // Assert - Point to same underlying array + ba[0] = 88; + assert.strictEqual(bv.get(0), 88); + assert.strictEqual(output.get(0), 88); + } + @test public toDouble_invalidSize() { assert.throws(() => { ByteVector.fromSize(0).toDouble(); }); @@ -88,46 +185,87 @@ const assert = Chai.assert; @test public toDouble_zero_complete() { - const float = ByteVector.fromByteArray(new Uint8Array([0x00, 0x00, 0x00, 0x00])).toFloat(); - assert.strictEqual(float, 0); + const double = ByteVector.fromByteArray([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) + .toDouble(); + assert.strictEqual(double, 0); + } + + @test + public toDouble_zero_completeView() { + const double = ByteVector.fromByteArray([0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAA]) + .subarray(1, 8) + .toDouble(); + assert.strictEqual(double, 0); } @test public toDouble_positiveBigEndian() { const double = this.doublePositiveBV.toDouble(); - assert.closeTo(double, -9.5397675953257207e-233, 0.000000000001e-233); + assert.approximately(double, -9.5397675953257207e-233, 0.000000000001e-233); + } + + @test + public toDouble_positiveBigEndianView() { + const double = ByteVector.concatenate(0xAA, this.doublePositiveBV, 0xAA) + .subarray(1, this.doublePositiveBV.length) + .toDouble(); + assert.approximately(double, -9.5397675953257207e-233, 0.000000000001e-233); } @test public toDouble_positiveLittleEndian() { const double = this.doublePositiveBV.toDouble(false); - assert.closeTo(double, 56.12, 0.01); + assert.approximately(double, 56.12, 0.01); + } + + @test + public toDouble_positiveLittleEndianView() { + const double = ByteVector.concatenate(0xAA, this.doublePositiveBV, 0xAA) + .subarray(1, this.doublePositiveBV.length) + .toDouble(false); + assert.approximately(double, 56.12, 0.01); } @test public toDouble_negativeBigEndian() { const double = this.doubleNegativeBV.toDouble(); - assert.closeTo(double, -9.6037214055410557e-86, 0.00000000001e-86); + assert.approximately(double, -9.6037214055410557e-86, 0.00000000001e-86); + } + + @test + public toDouble_negativeBigEndianView() { + const double = ByteVector.concatenate(0xAA, this.doubleNegativeBV, 0xAA) + .subarray(1, this.doubleNegativeBV.length) + .toDouble(); + assert.approximately(double, -9.6037214055410557e-86, 0.00000000001e-86); } @test public toDouble_negativeLittleEndian() { const double = this.doubleNegativeBV.toDouble(false); - assert.closeTo(double, -12.34, 0.01); + assert.approximately(double, -12.34, 0.01); + } + + @test + public toDouble_negativeLittleEndianView() { + const double = ByteVector.concatenate(0xAA, this.doubleNegativeBV, 0xAA) + .subarray(1, this.doubleNegativeBV.length) + .toDouble(false); + assert.approximately(double, -12.34, 0.01); } @test public toDouble_doubleRangeBigEndian() { - const double = ByteVector.fromByteArray(new Uint8Array([0x7F, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF])) + const double = ByteVector.fromByteArray([0x7F, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]) .toDouble(); - assert.closeTo(double, 1.7976931348623157e308, 0.000000000001e308); + assert.approximately(double, 1.7976931348623157e308, 0.000000000001e308); } @test public toDouble_doubleRangeLittleEndian() { - const double = ByteVector.fromByteArray(new Uint8Array([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0x7F])) + const double = ByteVector.fromByteArray([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0x7F]) .toDouble(false); - assert.closeTo(double, 1.7976931348623157e308, 0.000000000001e308); + assert.approximately(double, 1.7976931348623157e308, 0.000000000001e308); } @test @@ -140,49 +278,116 @@ const assert = Chai.assert; @test public toFloat_zero_complete() { - const float = ByteVector.fromByteArray(new Uint8Array([0x00, 0x00, 0x00, 0x00])).toFloat(); + const float = ByteVector.fromByteArray([0x00, 0x00, 0x00, 0x00]).toFloat(); assert.strictEqual(float, 0); } + @test + public toFloat_zero_completeView() { + const double = ByteVector.fromByteArray([0xAA, 0x00, 0x00, 0x00, 0x00, 0xAA]) + .subarray(1, 4) + .toFloat(); + assert.strictEqual(double, 0); + } + @test public toFloat_positiveBigEndian() { const float = this.floatPositiveBV.toFloat(); - assert.closeTo(float, -2.88663883e20, 0.00000001e20); + assert.approximately(float, -2.88663883e20, 0.00000001e20); + } + + @test + public toFloat_positiveBigEndianView() { + const float = ByteVector.concatenate(0xAA, this.floatPositiveBV, 0xAA) + .subarray(1, this.floatPositiveBV.length) + .toFloat(); + assert.approximately(float, -2.88663883e20, 0.00000001e20); } @test public toFloat_positiveLittleEndian() { const float = this.floatPositiveBV.toFloat(false); - assert.closeTo(float, 56.12, 0.01); + assert.approximately(float, 56.12, 0.01); + } + + @test + public toFloat_positiveLittleEndianView() { + const float = ByteVector.concatenate(0xAA, this.floatPositiveBV, 0xAA) + .subarray(1, this.floatPositiveBV.length) + .toFloat(false); + assert.approximately(float, 56.12, 0.01); } @test public toFloat_negativeBigEndian() { const float = this.floatNegativeBV.toFloat(); - assert.closeTo(float, -5.21007881e-17, 0.00000001e-17); + assert.approximately(float, -5.21007881e-17, 0.00000001e-17); + } + + @test + public toFloat_negativeBigEndianView() { + const float = ByteVector.concatenate(0xAA, this.floatNegativeBV, 0xAA) + .subarray(1, this.floatNegativeBV.length) + .toFloat(); + assert.approximately(float, -5.21007881e-17, 0.00000001e-17); } @test public toFloat_negativeLittleEndian() { const float = this.floatNegativeBV.toFloat(false); - assert.closeTo(float, -12.34, 0.01); + assert.approximately(float, -12.34, 0.01); + } + + @test + public toFloat_negativeLittleEndianView() { + const float = ByteVector.concatenate(0xAA, this.floatNegativeBV, 0xAA) + .subarray(1, this.floatNegativeBV.length) + .toFloat(false); + assert.approximately(float, -12.34, 0.01); } @test public toInt_empty() { - const int = ByteVector.fromSize(0).toInt(); + const int = ByteVector.fromSize(0) + .toInt(); assert.strictEqual(int, 0); } + @test + public toInt_emptyView() { + const uint = ByteVector.fromByteArray([0xAA, 0xAA]) + .subarray(1, 0) + .toInt(); + assert.strictEqual(uint, 0); + } + @test public toInt_zero_complete() { - const int = ByteVector.fromByteArray(new Uint8Array([0x0, 0x0, 0x0, 0x0, 0xAA])).toInt(); + const int = ByteVector.fromByteArray([0x0, 0x0, 0x0, 0x0, 0xAA]) + .toInt(); + assert.strictEqual(int, 0); + } + + @test + public toInt_zero_completeView() { + const int = ByteVector.fromByteArray([0xAA, 0x0, 0x0, 0x0, 0x0, 0xAA]) + .subarray(1, 4) + .toInt(); assert.strictEqual(int, 0); } @test public toInt_zero_incomplete() { - const int = ByteVector.fromByteArray(new Uint8Array([0x0, 0x0])).toInt(); + const int = ByteVector.fromByteArray([0x0, 0x0]) + .toInt(); + assert.strictEqual(int, 0); + } + + @test + public toInt_zero_incompleteView() { + const int = ByteVector.fromByteArray([0xAA, 0x0, 0x0, 0xAA]) + .subarray(1, 2) + .toInt(); assert.strictEqual(int, 0); } @@ -192,67 +397,153 @@ const assert = Chai.assert; assert.strictEqual(int, 0x01020304); } + @test + public toInt_positiveBigEndian_completeView() { + const int = ByteVector.concatenate(0xAA, this.intPositiveCompleteBV, 0xAA) + .subarray(1, 4) + .toInt(); + assert.strictEqual(int, 0x01020304); + } + @test public toInt_positiveBigEndian_incomplete() { const int = this.intPositiveIncompleteBV.toInt(); assert.strictEqual(int, 0x00000102); } + @test + public toInt_positiveBigEndian_incompleteView() { + const int = ByteVector.concatenate(0xAA, this.intPositiveIncompleteBV, 0xAA) + .subarray(1, 2) + .toInt(); + assert.strictEqual(int, 0x00000102); + } + @test public toInt_positiveLittleEndian_complete() { const int = this.intPositiveCompleteBV.toInt(false); assert.strictEqual(int, 0x04030201); } + @test + public toInt_positiveLittleEndian_completeView() { + const int = ByteVector.concatenate(0xAA, this.intPositiveCompleteBV, 0xAA) + .subarray(1, 4) + .toInt(false); + assert.strictEqual(int, 0x04030201); + } + @test public toInt_positiveLittleEndian_incomplete() { const int = this.intPositiveIncompleteBV.toInt(false); assert.strictEqual(int, 0x00000201); } + @test + public toInt_positiveLittleEndian_incompleteView() { + const int = ByteVector.concatenate(0xAA, this.intPositiveIncompleteBV, 0xAA) + .subarray(1, 2) + .toInt(false); + assert.strictEqual(int, 0x00000201); + } + @test public toInt_negativeBigEndian_complete() { const int = this.intNegativeCompleteBV.toInt(); assert.strictEqual(int, -0x01020304); } + @test + public toInt_negativeBigEndian_completeView() { + const int = ByteVector.concatenate(0xAA, this.intNegativeCompleteBV, 0xAA) + .subarray(1, 4) + .toInt(true); + assert.strictEqual(int, -0x01020304); + } + @test public toInt_negativeBigEndian_incomplete() { const int = this.intNegativeIncompleteBV.toInt(); assert.strictEqual(int, 0x0000FCFD); } + @test + public toInt_negativeBigEndian_incompleteView() { + const int = ByteVector.concatenate(0xAA, this.intNegativeIncompleteBV, 0xAA) + .subarray(1, 2) + .toInt(true); + assert.strictEqual(int, 0x0000FCFD); + } + @test public toInt_negativeLittleEndian_complete() { const int = this.intNegativeCompleteBV.toInt(false); assert.strictEqual(int, -0x03030202); } + @test + public toInt_negativeLittleEndian_completeView() { + const int = ByteVector.concatenate(0xAA, this.intNegativeCompleteBV, 0xAA) + .subarray(1, 4) + .toInt(false); + assert.strictEqual(int, -0x03030202); + } + @test public toInt_negativeLittleEndian_incomplete() { const int = this.intNegativeIncompleteBV.toInt(false); assert.strictEqual(int, 0x0000FDFC); } + @test + public toInt_negativeLittleEndian_incompleteView() { + const int = ByteVector.concatenate(0xAA, this.intNegativeIncompleteBV, 0xAA) + .subarray(1, 2) + .toInt(false); + assert.strictEqual(int, 0x0000FDFC); + } + @test public toLong_empty() { const long = ByteVector.fromSize(0).toLong(); assert.strictEqual(long, BigInt(0)); } + @test + public toLong_emptyView() { + const ulong = ByteVector.fromByteArray([0xAA, 0xAA]) + .subarray(1, 0) + .toLong(); + assert.strictEqual(ulong, BigInt(0)); + } + @test public toLong_zero_complete() { - const long = ByteVector.fromByteArray( - new Uint8Array([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAA]) + const long = ByteVector.fromByteArray([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAA] ).toLong(); - assert.isTrue(long === BigInt(0)); + assert.strictEqual(long, BigInt(0)); + } + + @test + public toLong_zero_completeView() { + const long = ByteVector.fromByteArray([0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAA]) + .subarray(1, 8) + .toLong(); + assert.strictEqual(long, BigInt(0)); } @test public toLong_zero_incomplete() { - const long = ByteVector.fromByteArray( - new Uint8Array([0x00, 0x00, 0x00, 0x00]) - ).toLong(); + const long = ByteVector.fromByteArray([0x00, 0x00, 0x00, 0x00]) + .toLong(); + assert.strictEqual(long, BigInt(0)); + } + + @test + public toLong_zero_incompleteView() { + const long = ByteVector.fromByteArray([0xAA, 0x00, 0x00, 0x00, 0x00, 0xAA]) + .subarray(1, 4) + .toLong(); assert.strictEqual(long, BigInt(0)); } @@ -262,114 +553,268 @@ const assert = Chai.assert; assert.strictEqual(long, BigInt("0x0102030405060708")); } + @test + public toLong_positiveBigEndian_completeView() { + const long = ByteVector.concatenate(0xAA, this.longPositiveCompleteBV, 0xAA) + .subarray(1, this.longPositiveCompleteBV.length) + .toLong(); + assert.strictEqual(long, BigInt("0x0102030405060708")); + } + @test public toLong_positiveBigEndian_incomplete() { const long = this.longPositiveIncompleteBV.toLong(); assert.strictEqual(long, BigInt("0x01020304")); } + @test + public toLong_positiveBigEndian_incompleteView() { + const long = ByteVector.concatenate(0xAA, this.longPositiveIncompleteBV, 0xAA) + .subarray(1, this.longPositiveIncompleteBV.length) + .toLong(); + assert.strictEqual(long, BigInt("0x01020304")); + } + @test public toLong_positiveLittleEndian_complete() { const long = this.longPositiveCompleteBV.toLong(false); assert.strictEqual(long, BigInt("0x0807060504030201")); } + @test + public toLong_positiveLittleEndian_completeView() { + const long = ByteVector.concatenate(0xAA, this.longPositiveCompleteBV, 0xAA) + .subarray(1, this.longPositiveCompleteBV.length) + .toLong(false); + assert.strictEqual(long, BigInt("0x0807060504030201")); + } + @test public toLong_positiveLittleEndian_incomplete() { const long = this.longPositiveIncompleteBV.toLong(false); assert.strictEqual(long, BigInt("0x04030201")); } + @test + public toLong_positiveLittleEndian_incompleteView() { + const long = ByteVector.concatenate(0xAA, this.longPositiveIncompleteBV, 0xAA) + .subarray(1, this.longPositiveIncompleteBV.length) + .toLong(false); + assert.strictEqual(long, BigInt("0x04030201")); + } + @test public toLong_negativeBigEndian_complete() { const long = this.longNegativeCompleteBV.toLong(); assert.strictEqual(long, BigInt("-72623859790382856")); } + @test + public toLong_negativeBigEndian_completeView() { + const long = ByteVector.concatenate(0xAA, this.longNegativeCompleteBV, 0xAA) + .subarray(1, this.longNegativeCompleteBV.length) + .toLong(); + assert.strictEqual(long, BigInt("-72623859790382856")); + } + @test public toLong_negativeBigEndian_incomplete() { const long = this.longNegativeIncompleteBV.toLong(); assert.strictEqual(long, BigInt("0xFEFDFCFC")); } + @test + public toLong_negativeBigEndian_incompleteView() { + const long = ByteVector.concatenate(0xAA, this.longNegativeIncompleteBV, 0xAA) + .subarray(1, this.longNegativeIncompleteBV.length) + .toLong(); + assert.strictEqual(long, BigInt("0xFEFDFCFC")); + } + @test public toLong_negativeLittleEndian_complete() { const long = this.longNegativeCompleteBV.toLong(false); assert.strictEqual(long, BigInt("-506380101714379266")); } + @test + public toLong_negativeLittleEndian_completeView() { + const long = ByteVector.concatenate(0xAA, this.longNegativeCompleteBV, 0xAA) + .subarray(1, this.longNegativeCompleteBV.length) + .toLong(false); + assert.strictEqual(long, BigInt("-506380101714379266")); + } + @test public toLong_negativeLittleEndian_incomplete() { const long = this.longNegativeIncompleteBV.toLong(false); assert.strictEqual(long, BigInt("0xFCFCFDFE")); } + @test + public toLong_negativeLittleEndian_incompleteView() { + const long = ByteVector.concatenate(0xAA, this.longNegativeIncompleteBV, 0xAA) + .subarray(1, this.longNegativeIncompleteBV.length) + .toLong(false); + assert.strictEqual(long, BigInt("0xFCFCFDFE")); + } + @test public toShort_empty() { const int = ByteVector.fromSize(0).toShort(); assert.strictEqual(int, 0); } + @test + public toShort_emptyView() { + const short = ByteVector.fromByteArray([0xAA, 0xAA]) + .subarray(1, 0) + .toShort(); + assert.strictEqual(short, 0); + } + @test public toShort_zero_complete() { - const int = ByteVector.fromByteArray(new Uint8Array([0x0, 0x0, 0x0, 0x0, 0xAA])).toShort(); + const int = ByteVector.fromByteArray([0x0, 0x0, 0xAA]) + .toShort(); assert.strictEqual(int, 0); } + @test + public toShort_zero_completeView() { + const short = ByteVector.fromByteArray([0xAA, 0x00, 0x00, 0xAA]) + .subarray(1, 2) + .toShort(); + assert.strictEqual(short, 0); + } + @test public toShort_zero_incomplete() { - const int = ByteVector.fromByteArray(new Uint8Array([0x0, 0x0])).toShort(); + const int = ByteVector.fromByteArray([0x0]) + .toShort(); assert.strictEqual(int, 0); } + @test + public toShort_zero_incompleteView() { + const short = ByteVector.fromByteArray([0xAA, 0x00, 0xAA]) + .subarray(1, 1) + .toShort(); + assert.strictEqual(short, 0); + } + @test public toShort_positiveBigEndian_complete() { const int = this.shortPositiveCompleteBV.toShort(); assert.strictEqual(int, 0x0102); } + @test + public toShort_positiveBigEndian_completeView() { + const short = ByteVector.concatenate(0xAA, this.shortPositiveCompleteBV, 0xAA) + .subarray(1, this.shortPositiveCompleteBV.length) + .toShort(); + assert.strictEqual(short, 0x0102); + } + @test public toShort_positiveBigEndian_incomplete() { const int = this.shortPositiveIncompleteBV.toShort(); assert.strictEqual(int, 0x01); } + @test + public toShort_positiveBigEndian_incompleteView() { + const short = ByteVector.concatenate(0xAA, this.shortPositiveIncompleteBV, 0xAA) + .subarray(1, this.shortPositiveIncompleteBV.length) + .toShort(); + assert.strictEqual(short, 0x01); + } + @test public toShort_positiveLittleEndian_complete() { const int = this.shortPositiveCompleteBV.toShort(false); assert.strictEqual(int, 0x0201); } + @test + public toShort_positiveLittleEndian_completeView() { + const short = ByteVector.concatenate(0xAA, this.shortPositiveCompleteBV, 0xAA) + .subarray(1, this.shortPositiveCompleteBV.length) + .toShort(false); + assert.strictEqual(short, 0x0201); + } + @test public toShort_positiveLittleEndian_incomplete() { const int = this.shortPositiveIncompleteBV.toShort(false); assert.strictEqual(int, 0x01); } + @test + public toShort_positiveLittleEndian_incompleteView() { + const short = ByteVector.concatenate(0xAA, this.shortPositiveIncompleteBV, 0xAA) + .subarray(1, this.shortPositiveIncompleteBV.length) + .toShort(); + assert.strictEqual(short, 0x01); + } + @test public toShort_negativeBigEndian_complete() { const int = this.shortNegativeCompleteBV.toShort(); assert.strictEqual(int, -0x0103); } + @test + public toShort_negativeBigEndian_completeView() { + const short = ByteVector.concatenate(0xAA, this.shortNegativeCompleteBV, 0xAA) + .subarray(1, this.shortNegativeCompleteBV.length) + .toShort(); + assert.strictEqual(short, -0x0103); + } + @test public toShort_negativeBigEndian_incomplete() { const int = this.shortNegativeIncompleteBV.toShort(); assert.strictEqual(int, 0x00FC); } + @test + public toShort_negativeBigEndian_incompleteView() { + const short = ByteVector.concatenate(0xAA, this.shortNegativeIncompleteBV, 0xAA) + .subarray(1, this.shortNegativeIncompleteBV.length) + .toShort(); + assert.strictEqual(short, 0x00FC); + } + @test public toShort_negativeLittleEndian_complete() { const int = this.shortNegativeCompleteBV.toShort(false); assert.strictEqual(int, -0x0202); } + @test + public toShort_negativeLittleEndian_completeView() { + const short = ByteVector.concatenate(0xAA, this.shortNegativeCompleteBV, 0xAA) + .subarray(1, this.shortNegativeCompleteBV.length) + .toShort(false); + assert.strictEqual(short, -0x0202); + } + @test public toShort_negativeLittleEndian_incomplete() { const int = this.shortNegativeIncompleteBV.toShort(false); assert.strictEqual(int, 0x00FC); } + @test + public toShort_negativeLittleEndian_incompleteView() { + const short = ByteVector.concatenate(0xAA, this.shortNegativeIncompleteBV, 0xAA) + .subarray(1, this.shortNegativeIncompleteBV.length) + .toShort(false); + assert.strictEqual(short, 0x00FC); + } + @test public toString_invalidOffset() { // Arrange, Act, Assert @@ -378,204 +823,134 @@ const assert = Chai.assert; assert.throws(() => { ByteVector.fromSize(0).toString(1234); }); } - @test - public toString_invalidCount() { - // Arrange, Act, Assert - assert.throws(() => { ByteVector.fromSize(1).toString(0, undefined, 0.1); }); - assert.throws(() => { ByteVector.fromSize(1).toString(0, undefined, -1); }); - assert.throws(() => { ByteVector.fromSize(1).toString(0, undefined, 1234); }); - } - @test public toString_utf8Full() { - const str = ByteVector.fromString(TestConstants.testStrings.UTF8.str) - .toString(TestConstants.testStrings.UTF8.bytes.length); - assert.strictEqual(str, TestConstants.testStrings.UTF8.str); - } - - @test - public toString_utf8Partial() { - const str = ByteVector.fromString(TestConstants.testStrings.UTF8.str + TestConstants.testStrings.UTF8.str) - .toString( - TestConstants.testStrings.UTF8.bytes.length, - undefined, - TestConstants.testStrings.UTF8.bytes.length - ); + const str = ByteVector.fromString(TestConstants.testStrings.UTF8.str, StringType.UTF8) + .toString(StringType.UTF8); assert.strictEqual(str, TestConstants.testStrings.UTF8.str); } @test public toString_utf8Empty() { - const str = ByteVector.fromSize(0).toString(0); + const str = ByteVector.fromSize(0) + .toString(StringType.UTF8); assert.strictEqual(str, ""); } @test public toString_utf16LittleEndianFull() { - const originalLastUtf16Encoding = ByteVector.lastUtf16Encoding; + const originalLastUtf16Encoding = Encoding["_lastUtf16Encoding"]; const str = ByteVector.fromString(TestConstants.testStrings.UTF16LE.str, StringType.UTF16LE) - .toString(TestConstants.testStrings.UTF16LE.bytes.length, StringType.UTF16LE); + .toString(StringType.UTF16LE); assert.strictEqual(str, TestConstants.testStrings.UTF16LE.str); - assert.strictEqual(ByteVector.lastUtf16Encoding, originalLastUtf16Encoding); - } - - @test - public toString_utf16LittleEndianPartial() { - const originalLastUtf16Encoding = ByteVector.lastUtf16Encoding; - const str = ByteVector.fromString( - TestConstants.testStrings.UTF16LE.str + TestConstants.testStrings.UTF16LE.str, - StringType.UTF16LE - ) - .toString( - TestConstants.testStrings.UTF16LE.bytes.length, - StringType.UTF16LE, - TestConstants.testStrings.UTF16LE.bytes.length - ); - assert.strictEqual(str, TestConstants.testStrings.UTF16LE.str); - assert.strictEqual(ByteVector.lastUtf16Encoding, originalLastUtf16Encoding); + assert.strictEqual(Encoding["_lastUtf16Encoding"], originalLastUtf16Encoding); } @test public toString_utf16LittleEndianEmpty() { - const str = ByteVector.fromSize(0).toString(0, StringType.UTF16LE); + const str = ByteVector.fromSize(0).toString(StringType.UTF16LE); assert.strictEqual(str, ""); } @test public toString_utf16BigEndianFull() { - const originalLastUtf16Encoding = ByteVector.lastUtf16Encoding; + const originalLastUtf16Encoding = Encoding["_lastUtf16Encoding"]; const str = ByteVector.fromString(TestConstants.testStrings.UTF16BE.str, StringType.UTF16BE) - .toString(TestConstants.testStrings.UTF16BE.bytes.length, StringType.UTF16BE); - assert.strictEqual(str, TestConstants.testStrings.UTF16BE.str); - assert.strictEqual(ByteVector.lastUtf16Encoding, originalLastUtf16Encoding); - } - - @test - public toString_utf16BigEndianPartial() { - const originalLastUtf16Encoding = ByteVector.lastUtf16Encoding; - const str = ByteVector.fromString( - TestConstants.testStrings.UTF16BE.str + TestConstants.testStrings.UTF16BE.str, - StringType.UTF16BE - ) - .toString( - TestConstants.testStrings.UTF16BE.bytes.length, - StringType.UTF16BE, - TestConstants.testStrings.UTF16BE.bytes.length - ); + .toString(StringType.UTF16BE); assert.strictEqual(str, TestConstants.testStrings.UTF16BE.str); - assert.strictEqual(ByteVector.lastUtf16Encoding, originalLastUtf16Encoding); + assert.strictEqual(Encoding["_lastUtf16Encoding"], originalLastUtf16Encoding); } @test public toString_utf16BigEndianEmpty() { - const str = ByteVector.fromSize(0).toString(0, StringType.UTF16BE); + const str = ByteVector.fromSize(0).toString(StringType.UTF16BE); assert.strictEqual(str, ""); } @test public toString_latin1Full() { const str = ByteVector.fromString(TestConstants.testStrings.Latin1.str, StringType.Latin1) - .toString(TestConstants.testStrings.Latin1.bytes.length, StringType.Latin1); - assert.strictEqual(str, TestConstants.testStrings.Latin1.str); - } - - @test - public toString_latin1Partial() { - const str = ByteVector.fromString( - TestConstants.testStrings.Latin1.str + TestConstants.testStrings.Latin1.str, - StringType.Latin1 - ) - .toString( - TestConstants.testStrings.Latin1.bytes.length, - StringType.Latin1, - TestConstants.testStrings.Latin1.bytes.length - ); + .toString(StringType.Latin1); assert.strictEqual(str, TestConstants.testStrings.Latin1.str); } @test public toString_latin1Empty() { - const str = ByteVector.fromSize(0).toString(0, StringType.Latin1); + const str = ByteVector.fromSize(0).toString(StringType.Latin1); assert.strictEqual(str, ""); } @test public toString_utf16Full() { // This test will change the last used utf16 encoding, so we'll restore it afterward - const originalLastEncoding = ByteVector.lastUtf16Encoding; - ByteVector.lastUtf16Encoding = "something bogus"; + const originalLastEncoding = Encoding["_lastUtf16Encoding"]; + Encoding["_lastUtf16Encoding"] = 123; try { const str = ByteVector.fromString(TestConstants.testStrings.UTF16LEWithBOM.str, StringType.UTF16) - .toString(TestConstants.testStrings.UTF16LEWithBOM.bytes.length, StringType.UTF16); + .toString(StringType.UTF16); assert.strictEqual(str, TestConstants.testStrings.UTF16LEWithBOM.str); - assert.strictEqual(ByteVector.lastUtf16Encoding, "utf16-le"); + assert.strictEqual(Encoding["_lastUtf16Encoding"], StringType.UTF16LE); } finally { // Cleanup - ByteVector.lastUtf16Encoding = originalLastEncoding; - } - } - - @test - public toString_utf16Partial() { - // This test will change the last used utf16 encoding, so we'll restore it afterward - const originalLastEncoding = ByteVector.lastUtf16Encoding; - ByteVector.lastUtf16Encoding = "something bogus"; - - try { - const str = ByteVector.fromString( - TestConstants.testStrings.UTF16LEWithBOM.str, - StringType.UTF16 - ) - .toString( - TestConstants.testStrings.UTF16LEWithBOM.bytes.length, - StringType.UTF16 - ); - assert.strictEqual(str, TestConstants.testStrings.UTF16LEWithBOM.str); - assert.strictEqual(ByteVector.lastUtf16Encoding, "utf16-le"); - } finally { - // Cleanup - ByteVector.lastUtf16Encoding = originalLastEncoding; + Encoding["_lastUtf16Encoding"] = originalLastEncoding; } } @test public toString_utf16Empty() { // This test will change the last used utf16 encoding, so we'll restore it afterward - const originalLastEncoding = ByteVector.lastUtf16Encoding; - ByteVector.lastUtf16Encoding = "utf16-le"; + const originalLastEncoding = Encoding["_lastUtf16Encoding"]; + Encoding["_lastUtf16Encoding"] = StringType.UTF16LE; try { - const str = ByteVector.fromSize(0).toString(0, StringType.UTF16); + const str = ByteVector.fromSize(0).toString(StringType.UTF16); assert.strictEqual(str, ""); - assert.strictEqual(ByteVector.lastUtf16Encoding, "utf16-le"); + assert.strictEqual(Encoding["_lastUtf16Encoding"], StringType.UTF16LE); } finally { // Cleanup - ByteVector.lastUtf16Encoding = originalLastEncoding; + Encoding["_lastUtf16Encoding"] = originalLastEncoding; } } @test - public toStrings_invalidOffset() { + public toStrings_invalidCount() { // Arrange, Act, Assert - assert.throws(() => { ByteVector.fromSize(0).toString(0.1); }); - assert.throws(() => { ByteVector.fromSize(0).toString(-1); }); - assert.throws(() => { ByteVector.fromSize(0).toString(1234); }); + assert.throws(() => { ByteVector.fromSize(1).toStrings(undefined, 0.1); }); + assert.throws(() => { ByteVector.fromSize(1).toStrings(undefined, -1); }); } @test - public toStrings_invalidCount() { - // Arrange, Act, Assert - assert.throws(() => { ByteVector.fromSize(1).toString(0, undefined, 0.1); }); - assert.throws(() => { ByteVector.fromSize(1).toString(0, undefined, -1); }); + public toStrings_dangling() { + // Arrange + const bv = ByteVector.concatenate( + TestConstants.testStrings.UTF8.bytes, + 0x00, + TestConstants.testStrings.UTF8.bytes + ); + + // Act + const strs = bv.toStrings(StringType.UTF8); + + // Assert + assert.deepEqual(strs, [TestConstants.testStrings.UTF8.str, TestConstants.testStrings.UTF8.str]); + } + + @test + public toStrings_maxCount() { + ByteVector_ConversionTests.testStrings( + [TestConstants.testStrings.UTF8.str, TestConstants.testStrings.UTF8.str], + StringType.UTF8, + 1, + [TestConstants.testStrings.UTF8.str] + ); } @test public toStrings_utf8Single() { ByteVector_ConversionTests.testStrings( - "\0\0" + TestConstants.testStrings.UTF8.str, + [TestConstants.testStrings.UTF8.str], StringType.UTF8, - 2, undefined, [TestConstants.testStrings.UTF8.str] ); @@ -584,262 +959,429 @@ const assert = Chai.assert; @test public toStrings_utf8Multiple() { ByteVector_ConversionTests.testStrings( - TestConstants.testStrings.UTF8.str + "\0\0" + TestConstants.testStrings.UTF8.str, + [TestConstants.testStrings.UTF8.str, TestConstants.testStrings.UTF8.str], StringType.UTF8, - 0, undefined, - [TestConstants.testStrings.UTF8.str, "", TestConstants.testStrings.UTF8.str] + [TestConstants.testStrings.UTF8.str, TestConstants.testStrings.UTF8.str] ); } @test public toStrings_utf16LittleEndianSingle() { ByteVector_ConversionTests.testStrings( - "\0\0" + TestConstants.testStrings.UTF16LE.str, + [TestConstants.testStrings.UTF16LE.str], StringType.UTF16LE, - 2, undefined, - ["", TestConstants.testStrings.UTF16LE.str] + [TestConstants.testStrings.UTF16LE.str] ); } @test - public toStrings_ut16LittleEndianMultiple() { + public toStrings_utf16LittleEndianMultiple() { ByteVector_ConversionTests.testStrings( - TestConstants.testStrings.UTF16LE.str + "\0\0" + TestConstants.testStrings.UTF16LE.str, + [TestConstants.testStrings.UTF16LE.str, TestConstants.testStrings.UTF16LE.str], StringType.UTF16LE, - 0, undefined, - [TestConstants.testStrings.UTF16LE.str, "", TestConstants.testStrings.UTF16LE.str] + [TestConstants.testStrings.UTF16LE.str, TestConstants.testStrings.UTF16LE.str] ); } @test public toStrings_utf16BigEndianSingle() { ByteVector_ConversionTests.testStrings( - "\0\0" + TestConstants.testStrings.UTF16BE.str, + [TestConstants.testStrings.UTF16BE.str], StringType.UTF16BE, - 2, undefined, - ["", TestConstants.testStrings.UTF16BE.str] + [TestConstants.testStrings.UTF16BE.str] ); } @test - public toStrings_ut16BigEndianMultiple() { + public toStrings_utf16BigEndianMultiple() { ByteVector_ConversionTests.testStrings( - TestConstants.testStrings.UTF16BE.str + "\0\0" + TestConstants.testStrings.UTF16BE.str, + [TestConstants.testStrings.UTF16BE.str, TestConstants.testStrings.UTF16BE.str], StringType.UTF16BE, - 0, undefined, - [TestConstants.testStrings.UTF16BE.str, "", TestConstants.testStrings.UTF16BE.str] + [TestConstants.testStrings.UTF16BE.str, TestConstants.testStrings.UTF16BE.str] ); } @test public toStrings_utf16Single() { // This test will change the last used utf16 encoding, so we'll restore it afterward - const originalLastEncoding = ByteVector.lastUtf16Encoding; - ByteVector.lastUtf16Encoding = "utf16-le"; + const originalLastEncoding = Encoding["_lastUtf16Encoding"]; + Encoding["_lastUtf16Encoding"] = StringType.UTF16LE; try { ByteVector_ConversionTests.testStrings( - "\0\0" + TestConstants.testStrings.UTF16LEWithBOM.str, + [TestConstants.testStrings.UTF16LEWithBOM.str], StringType.UTF16, - 2, undefined, - ["", "", TestConstants.testStrings.UTF16LEWithBOM.str] + [TestConstants.testStrings.UTF16LEWithBOM.str] ); - assert.strictEqual(ByteVector.lastUtf16Encoding, "utf16-le"); + assert.strictEqual(Encoding["_lastUtf16Encoding"], StringType.UTF16LE); } finally { // Cleanup - ByteVector.lastUtf16Encoding = originalLastEncoding; + Encoding["_lastUtf16Encoding"] = originalLastEncoding; } } @test public toStrings_utf16Multiple() { // This test will change the last used utf16 encoding, so we'll restore it afterward - const originalLastEncoding = ByteVector.lastUtf16Encoding; - ByteVector.lastUtf16Encoding = "utf16-le"; + const originalLastEncoding = Encoding["_lastUtf16Encoding"]; + Encoding["_lastUtf16Encoding"] = StringType.UTF16LE; try { ByteVector_ConversionTests.testStrings( - TestConstants.testStrings.UTF16LEWithBOM.str + "\0\0" + TestConstants.testStrings.UTF16LEWithBOM.str, + [TestConstants.testStrings.UTF16LEWithBOM.str, TestConstants.testStrings.UTF16LEWithBOM.str], StringType.UTF16, - 0, undefined, - [TestConstants.testStrings.UTF16LEWithBOM.str, "", TestConstants.testStrings.UTF16LEWithBOM.str] + [TestConstants.testStrings.UTF16LEWithBOM.str, TestConstants.testStrings.UTF16LEWithBOM.str] ); - assert.strictEqual(ByteVector.lastUtf16Encoding, "utf16-le"); + assert.strictEqual(Encoding["_lastUtf16Encoding"], StringType.UTF16LE); } finally { // Cleanup - ByteVector.lastUtf16Encoding = originalLastEncoding; + Encoding["_lastUtf16Encoding"] = originalLastEncoding; } } @test - public toUInt_empty() { - const int = ByteVector.fromSize(0).toUInt(); + public toUint_empty() { + const int = ByteVector.fromSize(0).toUint(); assert.strictEqual(int, 0); } @test - public toUInt_zero_complete() { - const int = ByteVector.fromByteArray(new Uint8Array([0x0, 0x0, 0x0, 0x0, 0xAA])).toUInt(); + public toUint_emptyView() { + const uint = ByteVector.fromByteArray([0xAA, 0xAA]) + .subarray(1, 0) + .toUint(); + assert.strictEqual(uint, 0); + } + + @test + public toUint_zero_complete() { + const int = ByteVector.fromByteArray([0x0, 0x0, 0x0, 0x0, 0xAA]) + .toUint(); assert.strictEqual(int, 0); } @test - public toUInt_zero_incomplete() { - const int = ByteVector.fromByteArray(new Uint8Array([0x0, 0x0])).toUInt(); + public toUint_zero_completeView() { + const short = ByteVector.fromByteArray([0xAA, 0x0, 0x0, 0x0, 0x0, 0xAA]) + .subarray(1, 4) + .toShort(); + assert.strictEqual(short, 0); + } + + @test + public toUint_zero_incomplete() { + const int = ByteVector.fromByteArray([0x0, 0x0]) + .toUint(); assert.strictEqual(int, 0); } @test - public toUInt_positiveBigEndian_complete() { - const int = this.uintPositiveCompleteBV.toUInt(); + public toUint_zero_incompleteView() { + const short = ByteVector.fromByteArray([0xAA, 0x0, 0x0, 0xAA]) + .subarray(1, 2) + .toShort(); + assert.strictEqual(short, 0); + } + + @test + public toUint_positiveBigEndian_complete() { + const int = this.uintPositiveCompleteBV.toUint(); assert.strictEqual(int, 0x01020304); } @test - public toUInt_positiveBigEndian_incomplete() { - const int = this.uintPositiveIncompleteBV.toUInt(); + public toUint_positiveBigEndian_completeView() { + const short = ByteVector.concatenate(0xAA, this.uintPositiveCompleteBV, 0xAA) + .subarray(1, this.uintPositiveCompleteBV.length) + .toUint(); + assert.strictEqual(short, 0x01020304); + } + + @test + public toUint_positiveBigEndian_incomplete() { + const int = this.uintPositiveIncompleteBV.toUint(); assert.strictEqual(int, 0x00000102); } @test - public toUInt_positiveLittleEndian_complete() { - const int = this.uintPositiveCompleteBV.toUInt(false); + public toUint_positiveBigEndian_incompleteView() { + const short = ByteVector.concatenate(0xAA, this.uintPositiveIncompleteBV, 0xAA) + .subarray(1, this.uintPositiveIncompleteBV.length) + .toUint(); + assert.strictEqual(short, 0x00000102); + } + + @test + public toUint_positiveLittleEndian_complete() { + const int = this.uintPositiveCompleteBV.toUint(false); assert.strictEqual(int, 0x04030201); } @test - public toUInt_positiveLittleEndian_incomplete() { - const int = this.uintPositiveIncompleteBV.toUInt(false); + public toUint_positiveLittleEndian_completeView() { + const short = ByteVector.concatenate(0xAA, this.uintPositiveCompleteBV, 0xAA) + .subarray(1, this.uintPositiveCompleteBV.length) + .toUint(false); + assert.strictEqual(short, 0x04030201); + } + + @test + public toUint_positiveLittleEndian_incomplete() { + const int = this.uintPositiveIncompleteBV.toUint(false); assert.strictEqual(int, 0x00000201); } @test - public toUInt_unsignedRange_complete() { - const int = ByteVector.fromByteArray(new Uint8Array([0xFF, 0xFF, 0xFF, 0xFF])).toUInt(); + public toUint_positiveLittleEndian_incompleteView() { + const short = ByteVector.concatenate(0xAA, this.uintPositiveIncompleteBV, 0xAA) + .subarray(1, this.uintPositiveIncompleteBV.length) + .toShort(false); + assert.strictEqual(short, 0x00000201); + } + + @test + public toUint_unsignedRange_complete() { + const int = ByteVector.fromByteArray([0xFF, 0xFF, 0xFF, 0xFF]) + .toUint(); assert.strictEqual(int, 0xFFFFFFFF); } @test - public toULong_empty() { - const long = ByteVector.fromSize(0).toULong(); + public toUlong_empty() { + const long = ByteVector.fromSize(0).toUlong(); assert.strictEqual(long, BigInt(0)); } @test - public toULong_zero_complete() { - const long = ByteVector.fromByteArray( - new Uint8Array([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAA]) - ).toULong(); + public toUlong_emptyView() { + const ulong = ByteVector.fromByteArray([0xAA, 0xAA]) + .subarray(1, 0) + .toUlong(); + assert.strictEqual(ulong, BigInt(0)); + } + + @test + public toUlong_zero_complete() { + const long = ByteVector.fromByteArray([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAA]) + .toUlong(); assert.strictEqual(long, BigInt(0)); } @test - public toULong_zero_incomplete() { - const long = ByteVector.fromByteArray( - new Uint8Array([0x00, 0x00, 0x00, 0x00]) - ).toULong(); + public toUlong_zero_completeView() { + const long = ByteVector.fromByteArray([0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAA]) + .subarray(1, 8) + .toUlong(); + assert.strictEqual(long, BigInt(0)); + } + + @test + public toUlong_zero_incomplete() { + const long = ByteVector.fromByteArray([0x00, 0x00, 0x00, 0x00]) + .toUlong(); assert.strictEqual(long, BigInt(0)); } @test - public toULong_positiveBigEndian_complete() { - const long = this.ulongPositiveCompleteBV.toULong(); + public toUlong_zero_incompleteView() { + const long = ByteVector.fromByteArray([0xAA, 0x00, 0x00, 0x00, 0x00, 0xAA]) + .subarray(1, 4) + .toUlong(); + assert.strictEqual(long, BigInt(0)); + } + + @test + public toUlong_positiveBigEndian_complete() { + const long = this.ulongPositiveCompleteBV.toUlong(); assert.strictEqual(long, BigInt("0x0102030405060708")); } @test - public toULong_positiveBigEndian_incomplete() { - const long = this.ulongPositiveIncompleteBV.toULong(); + public toUlong_positiveBigEndian_completeView() { + const long = ByteVector.concatenate(0xAA, this.ulongPositiveCompleteBV, 0xAA) + .subarray(1, this.ulongPositiveCompleteBV.length) + .toUlong(); + assert.strictEqual(long, BigInt("0x0102030405060708")); + } + + @test + public toUlong_positiveBigEndian_incomplete() { + const long = this.ulongPositiveIncompleteBV.toUlong(); assert.strictEqual(long, BigInt("0x01020304")); } @test - public toULong_positiveLittleEndian_complete() { - const long = this.ulongPositiveCompleteBV.toULong(false); + public toUlong_positiveBigEndian_incompleteView() { + const long = ByteVector.concatenate(0xAA, this.ulongPositiveIncompleteBV, 0xAA) + .subarray(1, this.ulongPositiveIncompleteBV.length) + .toUlong(); + assert.strictEqual(long, BigInt("0x01020304")); + } + + @test + public toUlong_positiveLittleEndian_complete() { + const long = this.ulongPositiveCompleteBV.toUlong(false); + assert.strictEqual(long, BigInt("0x0807060504030201")); + } + + @test + public toUlong_positiveLittleEndian_completeView() { + const long = ByteVector.concatenate(0xAA, this.ulongPositiveCompleteBV, 0xAA) + .subarray(1, this.ulongPositiveCompleteBV.length) + .toUlong(false); assert.strictEqual(long, BigInt("0x0807060504030201")); } @test - public toULong_positiveLittleEndian_incomplete() { - const long = this.ulongPositiveIncompleteBV.toULong(false); + public toUlong_positiveLittleEndian_incomplete() { + const long = this.ulongPositiveIncompleteBV.toUlong(false); assert.strictEqual(long, BigInt("0x04030201")); } @test - public toULong_unsignedRange_complete() { + public toUlong_positiveLittleEndian_incompleteView() { + const long = ByteVector.concatenate(0xAA, this.ulongPositiveIncompleteBV, 0xAA) + .subarray(1, this.ulongPositiveIncompleteBV.length) + .toUlong(false); + assert.strictEqual(long, BigInt("0x04030201")); + } + + @test + public toUlong_unsignedRange_complete() { const long = ByteVector.fromByteArray( new Uint8Array([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]) - ).toULong(); + ).toUlong(); assert.strictEqual(long, BigInt("0xFFFFFFFFFFFFFFFF")); } @test - public toUSong_empty() { - const int = ByteVector.fromSize(0).toUShort(); + public toUshort_empty() { + const int = ByteVector.fromSize(0).toUshort(); assert.strictEqual(int, 0); } @test - public toUSong_zero_complete() { - const int = ByteVector.fromByteArray(new Uint8Array([0x0, 0x0, 0x0, 0x0, 0xAA])).toUShort(); + public toUshort_emptyView() { + const short = ByteVector.fromByteArray([0xAA, 0xAA]) + .subarray(1, 0) + .toUshort(); + assert.strictEqual(short, 0); + } + + @test + public toUshort_zero_complete() { + const int = ByteVector.fromByteArray([0x0, 0x0, 0xAA]) + .toUshort(); assert.strictEqual(int, 0); } @test - public toUSong_zero_incomplete() { - const int = ByteVector.fromByteArray(new Uint8Array([0x0, 0x0])).toUShort(); + public toUshort_zero_completeView() { + const short = ByteVector.fromByteArray([0xAA, 0x0, 0x0, 0xAA]) + .subarray(1, 2) + .toUshort(); + assert.strictEqual(short, 0); + } + + @test + public toUshort_zero_incomplete() { + const int = ByteVector.fromByteArray([0x0]) + .toUshort(); assert.strictEqual(int, 0); } @test - public toUSong_positiveBigEndian_complete() { - const int = this.ushortPositiveCompleteBV.toUShort(); + public toUshort_zero_incompleteView() { + const short = ByteVector.fromByteArray([0xAA, 0x00, 0xAA]) + .subarray(1, 1) + .toUshort(); + assert.strictEqual(short, 0); + } + + @test + public toUshort_positiveBigEndian_complete() { + const int = this.ushortPositiveCompleteBV.toUshort(); assert.strictEqual(int, 0x0102); } @test - public toUSong_positiveBigEndian_incomplete() { - const int = this.ushortPositiveIncompleteBV.toUShort(); + public toUshort_positiveBigEndian_completeView() { + const short = ByteVector.concatenate(0xAA, this.ushortPositiveCompleteBV, 0xAA) + .subarray(1, this.ushortPositiveCompleteBV.length) + .toUshort(); + assert.strictEqual(short, 0x0102); + } + + @test + public toUshort_positiveBigEndian_incomplete() { + const int = this.ushortPositiveIncompleteBV.toUshort(); assert.strictEqual(int, 0x01); } @test - public toUSong_positiveLittleEndian_complete() { - const int = this.ushortPositiveCompleteBV.toUShort(false); + public toUshort_positiveBigEndian_incompleteView() { + const short = ByteVector.concatenate(0xAA, this.ushortPositiveIncompleteBV, 0xAA) + .subarray(1, this.ushortPositiveIncompleteBV.length) + .toUshort(); + assert.strictEqual(short, 0x01); + } + + @test + public toUshort_positiveLittleEndian_complete() { + const int = this.ushortPositiveCompleteBV.toUshort(false); assert.strictEqual(int, 0x0201); } @test - public toUSong_positiveLittleEndian_incomplete() { - const int = this.ushortPositiveIncompleteBV.toUShort(false); + public toUshort_positiveLittleEndian_completeView() { + const short = ByteVector.concatenate(0xAA, this.ushortPositiveCompleteBV, 0xAA) + .subarray(1, this.ushortPositiveCompleteBV.length) + .toUshort(false); + assert.strictEqual(short, 0x0201); + } + + @test + public toUshort_positiveLittleEndian_incomplete() { + const int = this.ushortPositiveIncompleteBV.toUshort(false); assert.strictEqual(int, 0x01); } + @test + public toUshort_positiveLittleEndian_incompleteView() { + const short = ByteVector.concatenate(0xAA, this.ushortPositiveIncompleteBV, 0xAA) + .subarray(1, this.ushortPositiveIncompleteBV.length) + .toUshort(false); + assert.strictEqual(short, 0x01); + } @test - public toUSong_unsignedRange_complete() { - const short = ByteVector.fromByteArray(new Uint8Array([0xFF, 0xFF])).toUShort(); + public toUshort_unsignedRange_complete() { + const short = ByteVector.fromByteArray([0xFF, 0xFF]).toUshort(); assert.strictEqual(short, 0xFFFF); } private static testStrings( - textInput: string, + textInput: string[], stringType: StringType, - offset: number, count: number, expected: string[] ) { // Arrange - const bv = ByteVector.fromString(textInput, stringType); + const renderedStrings = []; + for (const s of textInput) { + renderedStrings.push(ByteVector.fromString(s, stringType)); + renderedStrings.push(ByteVector.getTextDelimiter(stringType)); + } + const bv = ByteVector.concatenate(... renderedStrings); // Act - const strs = bv.toStrings(stringType, offset, count); + const strs = bv.toStrings(stringType, count); // Assert assert.deepEqual(strs, expected); diff --git a/test-unit/byteVectorMethodTests.ts b/test-unit/byteVectorMethodTests.ts new file mode 100644 index 00000000..95516b00 --- /dev/null +++ b/test-unit/byteVectorMethodTests.ts @@ -0,0 +1,2537 @@ +import * as Chai from "chai"; +import {suite, test} from "@testdeck/mocha"; + +import {ByteVector, StringType} from "../src/byteVector"; +import {Testers} from "./utilities/testers"; + +// Setup chai +const assert = Chai.assert; + +@suite class ByteVector_MethodTests { + private readonly vectorToAdd: ByteVector = ByteVector.fromByteArray( + new Uint8Array([0xAA, 0xBB]) + ); + + @test + public iterator() { + // Arrange + const array = [0x01, 0x02, 0x03, 0x04]; + const bv = ByteVector.fromByteArray(new Uint8Array(array)); + + // Act + const output = []; + for (const b of bv) { + output.push(b); + } + + // Assert + assert.deepStrictEqual(output, array); + } + + @test + public iterator_view() { + // Arrange + const array = [0x01, 0x02, 0x03, 0x04]; + const uintArray = new Uint8Array(array.length + 2); + uintArray.set(array, 1); + const bv = ByteVector.fromByteArray(uintArray).subarray(1, 4); + + // Act + const output = []; + for (const b of bv) { + output.push(b); + } + + // Assert + assert.deepStrictEqual(output, array); + } + + @test + public addByte_invalidByte() { + // Arrange - Create ByteVector + const bv = ByteVector.fromSize(1); + + // Act / Assert + // - AddByte should fail + Testers.testByte((v: number) => { bv.addByte(v); }); + + // - ByteVector should be unchanged + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00])); + } + + @test + public addByte_readOnly() { + // Arrange - Create readonly ByteVector + const bv = ByteVector.fromSize(1, 0x0).makeReadOnly(); + + // Act / Assert + // - AddByte should fail + assert.throws(() => { bv.addByte(0x01); }); + + // - Bytes should be unchanged + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00])); + } + + @test + public addByte_addToEmpty() { + // Arrange - Create ByteVector that is empty + const bv = ByteVector.fromSize(0); + const ba = bv["_bytes"]; + + // Act - Add a byte to it + bv.addByte(0x01); + + // Assert + // - Bytes should have the new value + assert.deepEqual(bv["_bytes"], new Uint8Array([0x01])); + assert.notStrictEqual(bv["_bytes"], ba); + } + + @test + public addByte_addToExisting() { + // Arrange - Create ByteVector with something in it + const bv = ByteVector.fromSize(1); + const ba = bv["_bytes"]; + + // Act - Add a byte to it + bv.addByte(0x01); + + // Assert + // - Bytes should have the new value + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0x01])); + assert.notStrictEqual(bv["_bytes"], ba); + } + + @test + public addByte_addToView() { + // Arrange - Create byte vector that's a view + const bv = ByteVector.fromSize(3).subarray(1, 1); + const ba = bv["_bytes"]; + + // Act + bv.addByte(0x01); + + // Assert + // - Bytes should have the new value + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0x01])); + assert.notStrictEqual(bv["_bytes"], ba); + assert.isFalse(bv.isView); + } + + @test + public addByteArray_invalidByteArray() { + // Arrange + const bv = ByteVector.fromSize(1, 0x0); + + // Act, Assert + Testers.testTruthy((v: Uint8Array) => { bv.addByteArray(v); }); + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00])); + } + + @test + public addByteArray_ReadOnly() { + // Arrange - Create readonly ByteVector + const bv = ByteVector.fromSize(1, 0x0).makeReadOnly(); + + // Act, Assert - AddByte should fail, ByteVector should be unchanged + assert.throws(() => { bv.addByteArray(new Uint8Array(0x01)); }); + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00])); + } + + @test + public addByteArray_addEmptyToEmpty() { + // Arrange - Create ByteVector that is empty + const bv = ByteVector.fromSize(0); + + // Act - Add nothing to it + bv.addByteArray(new Uint8Array()); + bv.addByteArray(new Uint8Array([0x01, 0x02, 0x03]), 0); + + // Assert - ByteVector should remain empty + assert.deepEqual(bv["_bytes"], new Uint8Array()); + } + + @test + public addByteArray_addSingleToEmpty() { + // Arrange - Create ByteVector that is empty + const bv = ByteVector.fromSize(0); + const ba = bv["_bytes"]; + + // Act - Add a byte to it + bv.addByteArray(new Uint8Array([0x01])); + + // Assert - ByteVector should contain the new byte + assert.deepEqual(bv["_bytes"], new Uint8Array([0x01])); + assert.notStrictEqual(bv["_bytes"], ba); + } + + @test + public addByteArray_addMultipleToEmpty() { + // Arrange - Create ByteVector that is empty + const bv = ByteVector.fromSize(0); + const ba = bv["_bytes"]; + + // Act - Add two bytes to it + bv.addByteArray(new Uint8Array([0x01, 0x02])); + + // Assert - ByteVector should contain the new bytes + assert.deepEqual(bv["_bytes"], new Uint8Array([0x01, 0x02])); + assert.notStrictEqual(bv["_bytes"], ba); + } + + @test + public addByteArray_addEmptyToExisting() { + // Arrange - Create ByteVector that has bytes + const bv = ByteVector.fromSize(1); + const ba = bv["_bytes"]; + + // Act - Add nothing to it + bv.addByteArray(new Uint8Array()); + bv.addByteArray(new Uint8Array([0x01, 0x02, 0x03]), 0); + + // Assert - ByteVector should contain the new byte + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00])); + assert.strictEqual(bv["_bytes"], ba); + } + + @test + public addByteArray_addSingleToExisting() { + // Arrange - Create ByteVector that has bytes + const bv = ByteVector.fromSize(1); + const ba = bv["_bytes"]; + + // Act - Add a byte to it + bv.addByteArray(new Uint8Array([0x01])); + + // Assert - ByteVector should contain the new byte + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0x01])); + assert.notStrictEqual(bv["_bytes"], ba); + } + + @test + public addByteArray_addMultipleToExisting() { + // Arrange - Create ByteVector that is empty + const bv = ByteVector.fromSize(1); + const ba = bv["_bytes"]; + + // Act - Add two bytes to it + bv.addByteArray(new Uint8Array([0x01, 0x02])); + + // Assert - ByteVector should contain the new bytes + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0x01, 0x02])); + assert.notStrictEqual(bv["_bytes"], ba); + } + + @test + public addByteArray_addEmptyToView() { + // Arrange + const bv = ByteVector.fromSize(3).subarray(1, 1); + const ba = bv["_bytes"]; + + // Act + bv.addByteArray(new Uint8Array()); + bv.addByteArray(new Uint8Array([0x01, 0x02, 0x03]), 0); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00])); + assert.strictEqual(bv["_bytes"], ba); + assert.isTrue(bv.isView); + } + + @test + public addByteArray_addSingleToView() { + // Arrange + const bv = ByteVector.fromSize(3).subarray(1, 1); + const ba = bv["_bytes"]; + + // Act + bv.addByteArray(new Uint8Array([0x01])); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0x01])); + assert.notStrictEqual(bv["_bytes"], ba); + assert.isFalse(bv.isView); + } + + @test + public addByteArray_addMultipleToView() { + // Arrange + const bv = ByteVector.fromSize(3).subarray(1, 1); + const ba = bv["_bytes"]; + + // Act + bv.addByteArray(new Uint8Array([0x01, 0x02])); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0x01, 0x02])); + assert.notStrictEqual(bv["_bytes"], ba); + assert.isFalse(bv.isView); + } + + @test + public addByteVector_invalidByteVector() { + // Arrange + const bv = ByteVector.fromSize(1, 0x0); + + // Act, Assert + Testers.testTruthy((v: ByteVector) => { bv.addByteVector(v); }); + } + + @test + public addByteVector_readOnly() { + // Arrange - Create readonly ByteVector + const bv = ByteVector.fromSize(1, 0x0).makeReadOnly(); + + // Act, Assert - AddByte should fail, ByteVector should be unchanged + assert.throws(() => bv.addByteVector(this.vectorToAdd)); + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00])); + } + + @test + public addByteVector_addEmptyToEmpty() { + // Arrange - Create ByteVector that is empty + const bv = ByteVector.fromSize(0); + + // Act - Add nothing to it + bv.addByteVector(ByteVector.fromSize(0)); + + // Assert - ByteVector should contain the new byte + assert.deepEqual(bv["_bytes"], new Uint8Array()); + } + + @test + public addByteVector_addSingleToEmpty() { + // Arrange - Create ByteVector that is empty + const bv = ByteVector.fromSize(0); + const ba = bv["_bytes"]; + const add = ByteVector.fromSize(1, 0x1); + + // Act - Add a byte to it + bv.addByteVector(add); + + // Assert - ByteVector should contain the new byte + assert.deepEqual(bv["_bytes"], new Uint8Array([0x01])); + assert.notStrictEqual(bv["_bytes"], ba); + } + + @test + public addByteVector_addMultipleToEmpty() { + // Arrange - Create ByteVector that is empty + const bv = ByteVector.fromSize(0); + const ba = bv["_bytes"]; + const add = ByteVector.fromByteArray([0x01, 0x02]); + + // Act - Add two bytes to it + bv.addByteVector(add); + + // Assert - ByteVector should contain the new bytes + assert.deepEqual(bv["_bytes"], new Uint8Array([0x01, 0x02])); + assert.notStrictEqual(bv["_bytes"], ba); + } + + @test + public addByteVector_addSingleToExisting() { + // Arrange - Create ByteVector that has bytes + const bv = ByteVector.fromSize(1); + const ba = bv["_bytes"]; + const add = ByteVector.fromByteArray([0x01]); + + // Act - Add a byte to it + bv.addByteVector(add); + + // Assert - ByteVector should contain the new byte + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0x01])); + assert.notStrictEqual(bv["_bytes"], ba); + } + + @test + public addByteVector_addMultipleToExisting() { + // Arrange - Create ByteVector that is empty + const bv = ByteVector.fromSize(1); + const ba = bv["_bytes"]; + const add = ByteVector.fromByteArray([0x01, 0x02]); + + // Act - Add two bytes to it + bv.addByteVector(add); + + // Assert - ByteVector should contain the new bytes + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0x01, 0x02])); + assert.notStrictEqual(bv["_bytes"], ba); + } + + @test + public addByteVector_addEmptyToView() { + // Arrange + const bv = ByteVector.fromSize(3).subarray(1, 1); + + // Act + bv.addByteVector(ByteVector.fromSize(0)); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00])); + assert.isTrue(bv.isView); + } + + @test + public addByteVector_addSingleToView() { + // Arrange + const bv = ByteVector.fromSize(3).subarray(1, 1); + const ba = bv["_bytes"]; + const add = ByteVector.fromByteArray([0x01]); + + // Act + bv.addByteVector(add); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0x01])); + assert.notStrictEqual(bv["_bytes"], ba); + assert.isFalse(bv.isView); + } + + @test + public addByteVector_addMultipleToView() { + // Arrange + const bv = ByteVector.fromSize(3).subarray(1, 1); + const ba = bv["_bytes"]; + const add = ByteVector.fromByteArray([0x01, 0x02]); + + // Act + bv.addByteVector(add); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0x01, 0x02])); + assert.notStrictEqual(bv["_bytes"], ba); + assert.isFalse(bv.isView); + } + + @test + public addByteVector_addViewToMultiple() { + // Arrange + const bv = ByteVector.fromSize(1); + const ba = bv["_bytes"]; + const add = ByteVector.fromByteArray([0xAA, 0x01, 0x02, 0xAA]) + .subarray(1, 2); + + // Act + bv.addByteVector(add); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0x01, 0x02])); + assert.notStrictEqual(bv["_bytes"], ba); + assert.isFalse(bv.isView); + } + + @test + public addByteVector_addViewToView() { + // Arrange + const bv = ByteVector.fromSize(3).subarray(1, 1); + const ba = bv["_bytes"]; + const add = ByteVector.fromByteArray([0xAA, 0x01, 0x02, 0xAA]) + .subarray(1, 2); + + // Act + bv.addByteVector(add); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0x01, 0x02])); + assert.notStrictEqual(bv["_bytes"], ba); + assert.isFalse(bv.isView); + } + + @test + public clear_readOnly() { + // Arrange - Create readonly bytevector + const bv = ByteVector.fromSize(1, 0x00).makeReadOnly(); + + // Act, Assert - Should throw, bytevector should be unchanged + assert.throws(() => { bv.clear(); } ); + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00])); + } + + @test + public clear_empty() { + // Arrange - Create empty ByteVector + const bv = ByteVector.fromSize(0); + + // Act + bv.clear(); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array()); + } + + @test + public clear_existing() { + // Arrange - Create ByteVector with some data + const bv = ByteVector.fromSize(1, 0x00); + + // Act + bv.clear(); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array()); + } + + @test + public clear_view() { + // Arrange + const bv = ByteVector.fromSize(3).subarray(1, 1); + + // Act + bv.clear(); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array()); + assert.isFalse(bv.isView); + } + + @test + public containsAt_invalidParameters() { + // Arrange + const bv = ByteVector.empty(); + const pattern = ByteVector.empty(); + + // Act / Assert + Testers.testTruthy((v: ByteVector) => { bv.containsAt(v, 0); }); + Testers.testSafeInt((v: number) => { bv.containsAt(pattern, v); }, true); + } + + @test + public containsAt_sanityCheckFailures() { + // Arrange + const bv = ByteVector.fromSize(5); + + // Act / Assert + assert.isFalse(bv.containsAt(ByteVector.fromSize(10))); // Pattern longer than source + assert.isFalse(bv.containsAt(ByteVector.fromSize(1), 10)); // Offset longer than source + assert.isFalse(bv.containsAt(ByteVector.fromSize(1), 5)); // Offset equal to source + assert.isFalse(bv.containsAt(ByteVector.empty())); // Pattern is empty + } + + @test + public containsAt_doesNotContainAnywhere() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("qux", StringType.Latin1); + + // Act + const output = bv.containsAt(pattern); + + // Assert + assert.isFalse(output); + } + + @test + public containsAt_doesNotContainAt() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("qux", StringType.Latin1); + + // Act + const output = bv.containsAt(pattern, 1); + + // Assert + assert.isFalse(output); + } + + @test + public containsAt_containsPartial() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("foobux", StringType.Latin1); + + // Act + const output = bv.containsAt(pattern); + + // Assert + assert.isFalse(output); + } + + @test + public containsAt_containsAll() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("foo", StringType.Latin1); + + // Act + const output = bv.containsAt(pattern); + + // Assert + assert.isTrue(output); + } + + @test + public containsAt_containsAllAt() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("bar", StringType.Latin1); + + // Act + const output = bv.containsAt(pattern, 3); + + // Assert + assert.isTrue(output); + } + + @test + public containsAt_doesNotContainInView() { + const bv = ByteVector.fromString("0foobarbaz0", StringType.Latin1) + .subarray(1, 9); + const pattern = ByteVector.fromString("qux", StringType.Latin1); + + // Act + const output = bv.containsAt(pattern, 3); + + // Assert + assert.isFalse(output); + } + + @test + public containsAt_containsAllInView() { + // Arrange + const bv = ByteVector.fromString("0foobarbaz0", StringType.Latin1) + .subarray(1, 9); + const pattern = ByteVector.fromString("bar", StringType.Latin1); + + // Act + const output = bv.containsAt(pattern, 3); + + // Assert + assert.isTrue(output); + } + + @test + public compare_invalidParameter() { + // Arrange + const bv = ByteVector.fromSize(1); + + // Act / Assert + Testers.testTruthy((v: ByteVector) => { bv.compareTo(v); }); + Testers.testTruthy((v: ByteVector) => { ByteVector.compare(bv, v); }); + } + + @test + public compare_lessThan() { + // Arrange + const bv = ByteVector.concatenate(0x00, 0x05); + const other = ByteVector.concatenate(0x00, 0x06); + + // Act + const output1 = bv.compareTo(other); + const output2 = ByteVector.compare(bv, other); + + // Assert + assert.strictEqual(output1, -1); + assert.strictEqual(output2, -1); + } + + @test + public compare_greaterThan() { + // Arrange + const bv = ByteVector.concatenate(0x00, 0x05); + const other = ByteVector.concatenate(0x00, 0x04); + + // Act + const output1 = bv.compareTo(other); + const output2 = ByteVector.compare(bv, other); + + // Assert + assert.strictEqual(output1, 1); + assert.strictEqual(output2, 1); + } + + @test + public compare_equalTo() { + // Arrange + const bv = ByteVector.concatenate(0x00, 0x05); + const other = ByteVector.concatenate(0x00, 0x05); + + // Act + const output1 = bv.compareTo(other); + const output2 = ByteVector.compare(bv, other); + + // Assert + assert.strictEqual(output1, 0); + assert.strictEqual(output2, 0); + } + + @test + public compare_unequalSizes() { + // Arrange + const bv = ByteVector.concatenate(0x00, 0x05); + const other = ByteVector.concatenate(0x00); + + // Act + const output1 = bv.compareTo(other); + const output2 = ByteVector.compare(bv, other); + + // Assert + assert.strictEqual(output1, 1); + assert.strictEqual(output2, 1); + } + + @test + public compare_viewToConcrete() { + // Arrange + const bv = ByteVector.concatenate(0xAA, 0x00, 0x05, 0xAA) + .subarray(1, 2); + const other = ByteVector.concatenate(0x00, 0x04); + + // Act + const output1 = bv.compareTo(other); + const output2 = ByteVector.compare(bv, other); + + // Assert + assert.strictEqual(output1, 1); + assert.strictEqual(output2, 1); + } + + @test + public compare_concreteToView() { + // Arrange + const bv = ByteVector.concatenate(0x00, 0x05); + const other = ByteVector.concatenate(0xAA, 0x00, 0x04, 0xAA) + .subarray(1, 2); + + // Act + const output1 = bv.compareTo(other); + const output2 = ByteVector.compare(bv, other); + + // Assert + assert.strictEqual(output1, 1); + assert.strictEqual(output2, 1); + } + + @test + public compare_viewToView() { + // Arrange + const bv = ByteVector.concatenate(0xAA, 0x00, 0x05, 0xAA) + .subarray(1, 2); + const other = ByteVector.concatenate(0xAA, 0x00, 0x04, 0xAA) + .subarray(1, 2); + + // Act + const output1 = bv.compareTo(other); + const output2 = ByteVector.compare(bv, other); + + // Assert + assert.strictEqual(output1, 1); + assert.strictEqual(output2, 1); + } + + @test + public endsWith_invalidParam() { + // Arrange + const bv = ByteVector.empty(); + + // Act / Assert + Testers.testTruthy((v: ByteVector) => { bv.endsWith(v); }); + } + + @test + public endsWith_endsWith() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("baz", StringType.Latin1); + + // Act / Assert + assert.isTrue(bv.endsWith(pattern)); + } + + @test + public endsWith_doesNotEndWith() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("bux", StringType.Latin1); + + // Act / Assert + assert.isFalse(bv.endsWith(pattern)); + } + + @test + public endsWith_endsWithView() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("0baz0", StringType.Latin1) + .subarray(1, 3); + + // Act / Assert + assert.isTrue(bv.endsWith(pattern)); + } + + @test + public endsWith_doesNotEndWithView() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("0qux0", StringType.Latin1) + .subarray(1, 3); + + // Act / Assert + assert.isFalse(bv.endsWith(pattern)); + } + + @test + public endsWith_viewEndsWith() { + // Arrange + const bv = ByteVector.fromString("0foobarbaz0", StringType.Latin1) + .subarray(1, 9); + const pattern = ByteVector.fromString("baz", StringType.Latin1); + + // Act / Assert + assert.isTrue(bv.endsWith(pattern)); + } + + @test + public endsWith_viewDoesNotEndWith() { + // Arrange + const bv = ByteVector.fromString("0foobarbaz0", StringType.Latin1) + .subarray(1, 9); + const pattern = ByteVector.fromString("bux", StringType.Latin1); + + // Act / Assert + assert.isFalse(bv.endsWith(pattern)); + } + + @test + public endsWith_viewEndsWithView() { + // Arrange + const bv = ByteVector.fromString("0foobarbaz0", StringType.Latin1) + .subarray(1, 9); + const pattern = ByteVector.fromString("0baz0", StringType.Latin1) + .subarray(1, 3); + + // Act / Assert + assert.isTrue(bv.endsWith(pattern)); + } + + @test + public endsWith_viewDoesNotEndWithView() { + // Arrange + const bv = ByteVector.fromString("0foobarbaz0", StringType.Latin1) + .subarray(1, 9); + const pattern = ByteVector.fromString("0bux0", StringType.Latin1) + .subarray(1, 3); + + // Act / Assert + assert.isFalse(bv.endsWith(pattern)); + } + + @test + public endsWithPartialMatch_invalidProperty() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + + // Act / Assert + Testers.testTruthy((v: ByteVector) => { bv.endsWithPartialMatch(v); }); + } + + @test + public endsWithPartialMatch_patternTooLong() { + // Arrange + const bv = ByteVector.fromSize(5); + const pattern = ByteVector.fromSize(10); + + // Act / Assert + assert.strictEqual(bv.endsWithPartialMatch(pattern), -1); + } + + @test + public endsWithPartialMatch_doesNotEndWith() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("qux", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.endsWithPartialMatch(pattern), -1); + } + + @test + public endsWithPartialMatch_endsWithPartial() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("bazqqq", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.endsWithPartialMatch(pattern), 6); + } + + @test + public endsWithPartialMatch_endsWithFull() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("baz", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.endsWithPartialMatch(pattern), 6); + } + + @test + public endsWithPartialMatch_endsWithPartialView() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("0bazqqq0", StringType.Latin1) + .subarray(1, 6); + + // Act / Assert + assert.strictEqual(bv.endsWithPartialMatch(pattern), 6); + } + + @test + public endsWithPartialMatch_viewEndsWithPartial() { + // Arrange + const bv = ByteVector.fromString("0foobarbaz0", StringType.Latin1) + .subarray(1, 9); + const pattern = ByteVector.fromString("bazqqq", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.endsWithPartialMatch(pattern), 6); + } + + @test + public endsWithPartialMatch_viewEndsWithPartialView() { + // Arrange + const bv = ByteVector.fromString("0foobarbaz0", StringType.Latin1) + .subarray(1, 9); + const pattern = ByteVector.fromString("0bazqqq0", StringType.Latin1) + .subarray(1, 6); + + // Act / Assert + assert.strictEqual(bv.endsWithPartialMatch(pattern), 6); + } + + @test + public equals_bothNullUndefined() { + // Arrange, Act, Assert + assert.isTrue(ByteVector.equals(undefined, undefined)); + assert.isTrue(ByteVector.equals(null, null)); + } + + @test + public equals_mixedNullUndefined() { + // Arrange, Act, Assert + assert.isFalse(ByteVector.equals(undefined, null)); + assert.isFalse(ByteVector.equals(null, undefined)); + } + + @test + public equals_mixedFalsySomething() { + // Arrange + const bv = ByteVector.fromSize(1); + + // Act, Assert + assert.isFalse(ByteVector.equals(undefined, bv)); + assert.isFalse(ByteVector.equals(null, bv)); + assert.isFalse(ByteVector.equals(bv, undefined)); + assert.isFalse(bv.equals(undefined)); + assert.isFalse(bv.subarray(0).equals(undefined)); + assert.isFalse(ByteVector.equals(bv, null)); + assert.isFalse(bv.equals(null)); + assert.isFalse(bv.subarray(0).equals(null)); + + } + + @test + public equals_equal() { + // Arrange + const bv1 = ByteVector.fromByteArray([0x01, 0x02]); + const bv2 = ByteVector.fromByteArray([0x01, 0x02]); + + // Act, Assert + assert.isTrue(ByteVector.equals(bv1, bv2)); + assert.isTrue(bv1.equals(bv2)); + Testers.bvEqual(bv1, bv2); + } + + @test + public equals_concreteEqualsView() { + // Arrange + const bv1 = ByteVector.fromByteArray([0x01, 0x02]); + const bv2 = ByteVector.fromByteArray([0xAA, 0x01, 0x02, 0xAA]) + .subarray(1, 2); + + // Act, Assert + assert.isTrue(ByteVector.equals(bv1, bv2)); + assert.isTrue(bv1.equals(bv2)); + Testers.bvEqual(bv1, bv2); + } + + @test + public equals_viewEqualsConcrete() { + // Arrange + const bv1 = ByteVector.fromByteArray([0xAA, 0x01, 0x02, 0xAA]) + .subarray(1, 2); + const bv2 = ByteVector.fromByteArray([0x01, 0x02]); + + // Act, Assert + assert.isTrue(ByteVector.equals(bv1, bv2)); + assert.isTrue(bv1.equals(bv2)); + Testers.bvEqual(bv1, bv2); + } + + @test + public equals_viewEqualsView() { + // Arrange + const bv1 = ByteVector.fromByteArray([0xAA, 0x01, 0x02, 0xAA]) + .subarray(1, 2); + const bv2 = ByteVector.fromByteArray([0xAA, 0x01, 0x02, 0xAA]) + .subarray(1, 2); + + // Act, Assert + assert.isTrue(ByteVector.equals(bv1, bv2)); + assert.isTrue(bv1.equals(bv2)); + Testers.bvEqual(bv1, bv2); + } + + @test + public equals_notEqual() { + // Arrange + const bv1 = ByteVector.fromByteArray([0x01, 0x02]); + const bv2 = ByteVector.fromByteArray([0x03, 0x04]); + + // Act, Assert + assert.isFalse(ByteVector.equals(bv1, bv2)); + } + + @test + public equals_concreteDoesNotEqualView() { + // Arrange + const bv1 = ByteVector.fromByteArray([0x01, 0x02]); + const bv2 = ByteVector.fromByteArray([0xAA, 0x03, 0x04, 0xAA]) + .subarray(1, 2); + + // Act, Assert + assert.isFalse(ByteVector.equals(bv1, bv2)); + assert.isFalse(bv1.equals(bv2)); + assert.throws(() => Testers.bvEqual(bv1, bv2)); + } + + @test + public equals_viewDoesNotEqualConcrete() { + // Arrange + const bv1 = ByteVector.fromByteArray([0xAA, 0x01, 0x02, 0xAA]) + .subarray(1, 2); + const bv2 = ByteVector.fromByteArray([0x03, 0x04]); + + // Act, Assert + assert.isFalse(ByteVector.equals(bv1, bv2)); + assert.isFalse(bv1.equals(bv2)); + assert.throws(() => Testers.bvEqual(bv1, bv2)); + } + + @test + public equals_viewDoesNotEqualsView() { + // Arrange + const bv1 = ByteVector.fromByteArray([0xAA, 0x01, 0x02, 0xAA]) + .subarray(1, 2); + const bv2 = ByteVector.fromByteArray([0xAA, 0x03, 0x04, 0xAA]) + .subarray(1, 2); + + // Act, Assert + assert.isFalse(ByteVector.equals(bv1, bv2)); + assert.isFalse(bv1.equals(bv2)); + assert.throws(() => Testers.bvEqual(bv1, bv2)); + } + + @test + public find_invalidParameters() { + // Arrange + const bv = ByteVector.empty(); + const pattern = ByteVector.empty(); + + // Act / Assert + Testers.testTruthy((v: ByteVector) => { bv.find(v, 1); }); + Testers.testUint((v: number) => { bv.find(pattern, v); }, true); + assert.throws(() => { bv.find(pattern, 0); }); + } + + @test + public find_patternTooLong() { + // Arrange + const bv = ByteVector.fromSize(5); + const pattern = ByteVector.fromSize(10); + + // Act / Assert + assert.strictEqual(bv.find(pattern), -1); + } + + @test + public find_sanityChecks() { + // Act / Assert + assert.strictEqual(ByteVector.fromSize(0).find(ByteVector.fromSize(1)), -1); + assert.strictEqual(ByteVector.fromSize(1).find(ByteVector.fromSize(0)), -1); + assert.strictEqual(ByteVector.fromSize(1).find(ByteVector.fromSize(5)), -1); + } + + @test + public find_singleBytePattern_noMatch() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromByteArray([0x05]); + + // Act / Assert + assert.strictEqual(bv.find(pattern), -1); + } + + @test + public find_singleBytePattern_withMatch() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("b", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.find(pattern), 3); + } + + @test + public find_multiBytePattern_noMatch() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("qux", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.find(pattern), -1); + } + + @test + public find_multiBytePattern_singleMatch() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("bar", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.find(pattern), 3); + } + + @test + public find_multiBytePattern_multiMatch() { + // Arrange + const bv = ByteVector.fromString("foofoofoo", StringType.Latin1); + const pattern = ByteVector.fromString("foo", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.find(pattern), 0); + } + + @test + public find_multiByteWithAlign_noMatch() { + // Arrange + const bv = ByteVector.fromString("0abc", StringType.Latin1); + const pattern = ByteVector.fromString("ab", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.find(pattern, 2), -1); + } + + @test + public find_multiByteWithAlign_withMatch() { + // Arrange + const bv = ByteVector.fromString("00abc", StringType.Latin1); + const pattern = ByteVector.fromString("ab", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.find(pattern, 2), 2); + } + + @test + public find_viewInConcrete() { + // Arrange + const bv = ByteVector.fromString("0foobarbaz0", StringType.Latin1) + .subarray(1, 9); + const pattern = ByteVector.fromString("bar", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.find(pattern), 3); + } + + @test + public find_concreteInView() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("0bar0", StringType.Latin1) + .subarray(1, 3); + + // Act / Assert + assert.strictEqual(bv.find(pattern), 3); + + } + + @test + public find_viewInView() { + // Arrange + const bv = ByteVector.fromString("0foobarbaz0", StringType.Latin1) + .subarray(1, 9); + const pattern = ByteVector.fromString("0bar0", StringType.Latin1) + .subarray(1, 3); + + // Act / Assert + assert.strictEqual(bv.find(pattern), 3); + } + + @test + public find_multibyteInViewWithAlign() { + // Arrange + const bv = ByteVector.fromString("000abc0", StringType.Latin1) + .subarray(1, 5); + const pattern = ByteVector.fromString("ab", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.find(pattern, 2), 2); + } + + @test + public get_invalidParameter() { + // Arrange + const bv = ByteVector.fromSize(1); + + // Act / Assert + Testers.testUint((v: number) => bv.get(v)); + assert.throws(() => bv.get(bv.length)); + assert.throws(() => bv.subarray(1).get(0)); + } + + @test + public get_validParameter() { + // Arrange + const bv = ByteVector.fromByteArray([1, 2, 3]); + + // Act + const output = bv.get(1); + + // Assert + assert.strictEqual(output, 2); + } + + @test + public get_validParameterView() { + // Arrange + const bv = ByteVector.fromByteArray([0xAA, 1, 2, 3, 0xAA]) + .subarray(1, 3); + + // Act + const output = bv.get(1); + + // Assert + assert.strictEqual(output, 2); + } + + @test + public indexOf_exists() { + // Arrange + const bv = ByteVector.fromByteArray([1, 2, 3]); + + // Act + const output = bv.indexOf(2); + + // Assert + assert.strictEqual(output, 1); + } + + @test + public indexOf_doesNotExist() { + // Arrange + const bv = ByteVector.fromByteArray([1, 2, 3]); + + // Act + const output = bv.indexOf(888); + + // Assert + assert.strictEqual(output, -1); + } + + @test + public indexOf_existsView() { + // Arrange + const bv = ByteVector.fromByteArray([0xAA, 1, 2, 3, 0xAA]) + .subarray(1, 3); + + // Act + const output = bv.indexOf(2); + + // Assert + assert.strictEqual(output, 1); + } + + @test + public indexOf_doesNotExistView() { + // Arrange + const bv = ByteVector.fromByteArray([0xAA, 1, 2, 3, 0xAA]) + .subarray(1, 3); + + // Act + const output = bv.indexOf(0xAA); + + // Assert + assert.strictEqual(output, -1); + } + + @test + public makeReadOnly() { + // Arrange + const bv = ByteVector.fromSize(1); + + // Act + bv.makeReadOnly(); + + // Assert + assert.isTrue(bv.isReadOnly); + assert.throws(() => bv.clear()); + } + + @test + public offsetFind_invalidParameters() { + // Arrange + const bv = ByteVector.empty(); + const pattern = ByteVector.empty(); + + // Act / Assert + Testers.testTruthy((v: ByteVector) => bv.offsetFind(v, 1)); + Testers.testSafeUint((v) => bv.offsetFind(pattern, v)); + Testers.testUint((v) => bv.offsetFind(pattern, 0, v), true); + assert.throws(() => bv.offsetFind(pattern, 0, 0)); + } + + @test + public offsetFind_patternTooLong() { + // Arrange + const bv = ByteVector.fromSize(5); + const pattern = ByteVector.fromSize(5); + + // Act / Assert + assert.strictEqual(bv.offsetFind(pattern, 1), -1); + } + + @test + public offsetFind_sanityChecks() { + // Act / Assert + assert.strictEqual(ByteVector.fromSize(1).offsetFind(ByteVector.fromSize(1), 1), -1); + assert.strictEqual(ByteVector.fromSize(2).offsetFind(ByteVector.fromSize(0), 1), -1); + assert.strictEqual(ByteVector.fromSize(2).offsetFind(ByteVector.fromSize(5), 1), -1); + } + + @test + public offsetFind_singleBytePattern_noMatch() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromByteArray([0x05]); + + // Act / Assert + assert.strictEqual(bv.offsetFind(pattern, 1), -1); + } + + @test + public offsetFind_singleBytePattern_withMatch() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("b", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.offsetFind(pattern, 1), 3); + } + + @test + public offsetFind_multiBytePattern_noMatch() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("qux", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.offsetFind(pattern, 1), -1); + } + + @test + public offsetFind_multiBytePattern_singleMatch() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("bar", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.offsetFind(pattern, 1), 3); + } + + @test + public offsetFind_multiBytePattern_multiMatch() { + // Arrange + const bv = ByteVector.fromString("foofoofoo", StringType.Latin1); + const pattern = ByteVector.fromString("foo", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.offsetFind(pattern, 1), 3); + } + + @test + public offsetFind_multiByteWithAlign_noMatch() { + // Arrange + const bv = ByteVector.fromString("00abc", StringType.Latin1); + const pattern = ByteVector.fromString("ab", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.offsetFind(pattern, 1, 2), -1); + } + + @test + public offsetFind_multiByteWithAlign_withMatch() { + // Arrange + const bv = ByteVector.fromString("000abc", StringType.Latin1); + const pattern = ByteVector.fromString("ab", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.offsetFind(pattern, 1, 2), 3); + } + + @test + public offsetFind_viewInConcrete() { + // Arrange + const bv = ByteVector.fromString("0foobarbaz0", StringType.Latin1) + .subarray(1, 9); + const pattern = ByteVector.fromString("bar", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.offsetFind(pattern, 1), 3); + } + + @test + public offsetFind_concreteInView() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("0bar0", StringType.Latin1) + .subarray(1, 3); + + // Act / Assert + assert.strictEqual(bv.offsetFind(pattern, 1), 3); + } + + @test + public offsetFind_viewInView() { + // Arrange + const bv = ByteVector.fromString("0foobarbaz0", StringType.Latin1) + .subarray(1, 9); + const pattern = ByteVector.fromString("0bar0", StringType.Latin1) + .subarray(1, 3); + + // Act / Assert + assert.strictEqual(bv.offsetFind(pattern, 1), 3); + } + + @test + public offsetFind_multibyteInViewWithAlign() { + // Arrange + const bv = ByteVector.fromString("0000abc0", StringType.Latin1) + .subarray(1, 5); + const pattern = ByteVector.fromString("ab", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.offsetFind(pattern, 1, 2), 3); + } + + @test + public resize_invalidParameters() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + + // Act / Assert + Testers.testUint((v: number) => bv.resize(v)); + Testers.testByte((v: number) => bv.resize(1, v)); + } + + @test + public resize_shorten() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + + // Act + bv.resize(6); + + // Assert + assert.strictEqual(bv.length, 6); + Testers.bvEqual(bv, ByteVector.fromString("foobar", StringType.Latin1)); + } + + @test + public resize_sameSize() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + + // Act + bv.resize(9); + + // Assert + assert.strictEqual(bv.length, 9); + Testers.bvEqual(bv, ByteVector.fromString("foobarbaz", StringType.Latin1)); + } + + @test + public resize_lengthen() { + // Arrange + const bv = ByteVector.fromByteArray([0x00, 0x01, 0x02, 0x03]); + + // Act + bv.resize(7); + + // Assert + assert.strictEqual(bv.length, 7); + assert.deepStrictEqual(bv["_bytes"], new Uint8Array([0x00, 0x01, 0x02, 0x03, 0x00, 0x00, 0x00])); + } + + @test + public resize_lengthenWithPadding() { + // Arrange + const bv = ByteVector.fromByteArray([0x00, 0x01, 0x02, 0x03]); + + // Act + bv.resize(7, 0xAA); + + // Assert + assert.strictEqual(bv.length, 7); + assert.deepStrictEqual(bv["_bytes"], new Uint8Array([0x00, 0x01, 0x02, 0x03, 0xAA, 0xAA, 0xAA])); + } + + @test + public resize_shortenView() { + // Arrange + const bv = ByteVector.fromString("0foobarbaz0", StringType.Latin1) + .subarray(1, 9); + + // Act + bv.resize(6); + + // Assert + assert.isFalse(bv.isView); + assert.strictEqual(bv.length, 6); + Testers.bvEqual(bv, ByteVector.fromString("foobar", StringType.Latin1)); + } + + @test + public resize_sameSizeView() { + // Arrange + const bv = ByteVector.fromString("0foobarbaz0", StringType.Latin1) + .subarray(1, 9); + + // Act + bv.resize(9); + + // Assert + assert.isTrue(bv.isView); + assert.strictEqual(bv.length, 9); + Testers.bvEqual(bv, ByteVector.fromString("foobarbaz", StringType.Latin1)); + } + + @test + public resize_lengthenView() { + // Arrange + const bv = ByteVector.fromByteArray([0xAA, 0x00, 0x01, 0x02, 0x03, 0xAA]) + .subarray(1, 4); + + // Act + bv.resize(7); + + // Assert + assert.isFalse(bv.isView); + assert.strictEqual(bv.length, 7); + assert.deepStrictEqual(bv["_bytes"], new Uint8Array([0x00, 0x01, 0x02, 0x03, 0x00, 0x00, 0x00])); + } + + @test + public resize_lengthenViewWithPadding() { + // Arrange + const bv = ByteVector.fromByteArray([0xAA, 0x00, 0x01, 0x02, 0x03, 0xAA]) + .subarray(1, 4); + + // Act + bv.resize(7, 0xBB); + + // Assert + assert.isFalse(bv.isView); + assert.strictEqual(bv.length, 7); + assert.deepStrictEqual(bv["_bytes"], new Uint8Array([0x00, 0x01, 0x02, 0x03, 0xBB, 0xBB, 0xBB])); + } + + @test + public rFind_invalidParameters() { + // Arrange + const bv = ByteVector.empty(); + const pattern = ByteVector.empty(); + + // Act / Assert + Testers.testTruthy((v: ByteVector) => bv.rFind(v, 1)); + Testers.testUint((v: number) => bv.rFind(pattern, v), true); + assert.throws(() => bv.rFind(pattern, 0)); + } + + @test + public rFind_sanityChecks() { + // Act / Assert + assert.strictEqual(ByteVector.fromSize(0).rFind(ByteVector.fromSize(1)), -1); + assert.strictEqual(ByteVector.fromSize(1).rFind(ByteVector.fromSize(0)), -1); + assert.strictEqual(ByteVector.fromSize(1).rFind(ByteVector.fromSize(5)), -1); + } + + @test + public rFind_singleBytePattern_noMatch() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromByteArray([0x05]); + + // Act / Assert + assert.strictEqual(bv.rFind(pattern), -1); + } + + @test + public rFind_singleBytePattern_withMatch() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("b", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.rFind(pattern), 6); + } + + @test + public rFind_multiBytePattern_noMatch() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("qux", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.rFind(pattern), -1); + } + + @test + public rFind_multiBytePattern_singleMatch() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("bar", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.rFind(pattern), 3); + } + + @test + public rFind_multiBytePattern_multiMatch() { + // Arrange + const bv = ByteVector.fromString("foofoofoo", StringType.Latin1); + const pattern = ByteVector.fromString("foo", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.rFind(pattern), 6); + } + + @test + public rFind_multiByteWithAlign_noMatch() { + // Arrange + const bv = ByteVector.fromString("0abc", StringType.Latin1); + const pattern = ByteVector.fromString("ab", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.rFind(pattern, 2), -1); + } + + @test + public rFind_multiByteWithAlign_withMatch() { + // Arrange + const bv = ByteVector.fromString("00abc", StringType.Latin1); + const pattern = ByteVector.fromString("ab", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.rFind(pattern, 2), 2); + } + + @test + public rFind_viewInConcrete() { + // Arrange + const bv = ByteVector.fromString("0foobarbaz0", StringType.Latin1) + .subarray(1, 9); + const pattern = ByteVector.fromString("bar", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.find(pattern), 3); + } + + @test + public rFind_concreteInView() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("0bar0", StringType.Latin1) + .subarray(1, 3); + + // Act / Assert + assert.strictEqual(bv.find(pattern), 3); + + } + + @test + public rFind_viewInView() { + // Arrange + const bv = ByteVector.fromString("0foobarbaz0", StringType.Latin1) + .subarray(1, 9); + const pattern = ByteVector.fromString("0bar0", StringType.Latin1) + .subarray(1, 3); + + // Act / Assert + assert.strictEqual(bv.find(pattern), 3); + } + + @test + public rFind_multibyteInViewWithAlign() { + // Arrange + const bv = ByteVector.fromString("000abc0", StringType.Latin1) + .subarray(1, 5); + const pattern = ByteVector.fromString("ab", StringType.Latin1); + + // Act / Assert + assert.strictEqual(bv.find(pattern, 2), 2); + } + + @test + public set_readOnly() { + // Arrange + const bv = ByteVector.fromSize(1, 0x00).makeReadOnly(); + + // Act, Assert + assert.throws(() => bv.set(0, 1)); + + assert.isTrue(bv.isReadOnly); + assert.isFalse(bv.isEmpty); + assert.strictEqual(bv.length, 1); + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00])); + } + + @test + public set_indexOutOfRange() { + // Arrange + const bv = ByteVector.fromSize(1, 0x00); + + // Act, Assert + Testers.testUint((v: number) => bv.set(v, 1)); + assert.throws(() => bv.set(bv.length, 1)); + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00])); + } + + @test + public set_valueOutOfRange() { + // Arrange + const bv = ByteVector.fromSize(1, 0x00); + + // Act, Assert + Testers.testByte((v: number) => { bv.set(0, v); }); + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00])); + } + + @test + public set_concrete() { + // Arrange + const bv = ByteVector.fromByteArray([0x00, 0x01, 0x02]); + + // Act + bv.set(1, 0xAA); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0xAA, 0x02])); + } + + @test + public set_view() { + // Arrange + const bv = ByteVector.fromByteArray([0xAA, 0x00, 0x01, 0x02, 0xAA]) + .subarray(1, 3); + + // Act + bv.set(1, 0xBB); + + // Assert + assert.isFalse(bv.isView); + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0xBB, 0x02])); + } + + @test + public splice_readOnly() { + // Arrange + const bv = ByteVector.fromSize(1, 0x00).makeReadOnly(); + + // Act, Assert + assert.throws(() => bv.splice(0, 1)); + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00])); + } + + @test + public splice_invalidParameters() { + // Arrange + const bv = ByteVector.fromSize(1, 0x00); + + // Act, Assert + Testers.testSafeUint((v) => bv.splice(v, 0)); + Testers.testSafeUint((v) => bv.splice(0, v)); + assert.throws(() => bv.splice(2, 0)); + + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00])); + } + + @test + public splice_insertByte_insertIntoEmpty() { + // Arrange + const bv = ByteVector.fromSize(0); + + // Act + bv.splice(0, 0, [0x01]); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x01])); + } + + @test + public splice_insertByte_insertAtFront() { + // Arrange + const bv = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02, 0x03, 0x04])); + + // Act + bv.splice(0, 0, [0xAA]); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0xAA, 0x01, 0x02, 0x03, 0x04])); + } + + @test + public splice_insertByte_insertAtBack() { + // Arrange + const bv = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02, 0x03, 0x04])); + + // Act + bv.splice(bv.length, 0, [0xAA]); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x01, 0x02, 0x03, 0x04, 0xAA])); + } + + @test + public splice_insertByte_insertInMiddle() { + // Arrange + const bv = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02, 0x03, 0x04])); + + // Act + bv.splice(2, 0, [0xAA]); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x01, 0x02, 0xAA, 0x03, 0x04])); + } + + @test + public splice_insertByte_insertIntoView() { + // Arrange + const bv = ByteVector.fromByteArray([0x11, 0x01, 0x02, 0x03, 0x04, 0x11]) + .subarray(1, 4); + + // Act + bv.splice(2, 0, [0xAA]); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x01, 0x02, 0xAA, 0x03, 0x04])); + assert.isFalse(bv.isView); + } + + @test + public splice_insertByteArray_insertEmpty() { + // Arrange + const bv = ByteVector.fromSize(1, 0x00); + + // Act + bv.splice(0, 0, new Uint8Array()); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00])); + } + + @test + public splice_insertByteArray_insertIntoEmpty() { + // Arrange + const bv = ByteVector.fromSize(0); + + // Act + bv.splice(0, 0, new Uint8Array([0x01, 0x02])); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x01, 0x02])); + } + + @test + public splice_insertByteArray_insertAtFront() { + // Arrange + const bv = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02, 0x03, 0x04])); + + // Act + bv.splice(0, 0, new Uint8Array([0xAA, 0xBB])); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0xAA, 0xBB, 0x01, 0x02, 0x03, 0x04])); + } + + @test + public splice_insertByteArray_insertAtBack() { + // Arrange + const bv = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02, 0x03, 0x04])); + + // Act + bv.splice(bv.length, 0, new Uint8Array([0xAA, 0xBB])); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x01, 0x02, 0x03, 0x04, 0xAA, 0xBB])); + } + + @test + public splice_insertByteArray_insertInMiddle() { + // Arrange + const bv = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02, 0x03, 0x04])); + + // Act + bv.splice(2, 0, new Uint8Array([0xAA, 0xBB])); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x01, 0x02, 0xAA, 0xBB, 0x03, 0x04])); + } + + @test + public splice_insertByteArray_insertIntoView() { + // Arrange + const bv = ByteVector.fromByteArray([0x11, 0x01, 0x02, 0x03, 0x04, 0x11]) + .subarray(1, 4); + + // Act + bv.splice(2, 0, new Uint8Array([0xAA, 0xBB])); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x01, 0x02, 0xAA, 0xBB, 0x03, 0x04])); + assert.isFalse(bv.isView); + } + + @test + public splice_insertByteVector_insertEmpty() { + // Arrange + const bv = ByteVector.fromSize(1, 0x00); + + // Act + bv.splice(0, 0, ByteVector.fromSize(0)); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00])); + } + + @test + public splice_insertByteVector_insertIntoEmpty() { + // Arrange + const bv = ByteVector.fromSize(0); + + // Act + bv.splice(0, 0, this.vectorToAdd); + + // Assert + assert.isFalse(bv.isEmpty); + assert.strictEqual(bv.length, 2); + assert.deepEqual(bv["_bytes"], new Uint8Array([0xAA, 0xBB])); + } + + @test + public splice_insertByteVector_insertAtFront() { + // Arrange + const bv = ByteVector.fromByteArray([0x01, 0x02, 0x03, 0x04]); + + // Act + bv.splice(0, 0, this.vectorToAdd); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0xAA, 0xBB, 0x01, 0x02, 0x03, 0x04])); + } + + @test + public splice_insertByteVector_insertAtBack() { + // Arrange + const bv = ByteVector.fromByteArray([0x01, 0x02, 0x03, 0x04]); + + // Act + bv.splice(bv.length, 0, this.vectorToAdd); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x01, 0x02, 0x03, 0x04, 0xAA, 0xBB])); + } + + @test + public splice_insertByteVector_insertInMiddle() { + // Arrange + const bv = ByteVector.fromByteArray([0x01, 0x02, 0x03, 0x04]); + + // Act + bv.splice(2, 0, this.vectorToAdd); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x01, 0x02, 0xAA, 0xBB, 0x03, 0x04])); + } + + @test + public splice_insertByteVector_insertIntoView() { + // Arrange + const bv = ByteVector.fromByteArray([0x11, 0x01, 0x02, 0x03, 0x04, 0x11]) + .subarray(1, 4); + + // Act + bv.splice(2, 0, this.vectorToAdd); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x01, 0x02, 0xAA, 0xBB, 0x03, 0x04])); + assert.isFalse(bv.isView); + } + + @test + public splice_insertByteVectorView_insertInMiddle() { + // Arrange + const bv = ByteVector.fromByteArray([0x01, 0x02, 0x03, 0x04]); + const add = ByteVector.fromByteArray([0x11, 0xAA, 0xBB, 0x11]) + .subarray(1, 2); + + // Act + bv.splice(2, 0, add); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x01, 0x02, 0xAA, 0xBB, 0x03, 0x04])); + } + + @test + public splice_insertByteVectorView_insertIntoView() { + // Arrange + const bv = ByteVector.fromByteArray([0x11, 0x01, 0x02, 0x03, 0x04, 0x11]) + .subarray(1, 4); + const add = ByteVector.fromByteArray([0x11, 0xAA, 0xBB, 0x11]) + .subarray(1, 2); + + // Act + bv.splice(2, 0, add); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x01, 0x02, 0xAA, 0xBB, 0x03, 0x04])); + } + + @test + public splice_removeRange_tooManyBytes() { + // Arrange + const bv = ByteVector.fromSize(1, 0x00); + + // Act + bv.splice(0, 5); + + // Assert + assert.isTrue(bv.isEmpty); + assert.deepEqual(bv["_bytes"], new Uint8Array([])); + } + + @test + public splice_removeRange_tooManyBytesView() { + // Arrange + const bv = ByteVector.fromSize(3, 0x00) + .subarray(1, 1); + + // Act + bv.splice(0, 5); + + // Assert + assert.isTrue(bv.isEmpty); + assert.deepEqual(bv["_bytes"], new Uint8Array([])); + assert.isFalse(bv.isView); + } + + @test + public splice_removeRange_removeFromFront() { + // Arrange + const bv = ByteVector.fromByteArray([0xAA, 0xBB, 0x00, 0x01, 0x02, 0x03]); + + // Act + bv.splice(0, 2); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0x01, 0x02, 0x03])); + } + + @test + public splice_removeRange_removeFromFrontView() { + // Arrange + const bv = ByteVector.fromByteArray([0x11, 0xAA, 0xBB, 0x00, 0x01, 0x02, 0x03, 0x11]) + .subarray(1, 6); + + // Act + bv.splice(0, 2); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0x01, 0x02, 0x03])); + assert.isFalse(bv.isView); + } + + @test + public splice_removeRange_removeFromBack() { + // Arrange + const bv = ByteVector.fromByteArray([0x00, 0x01, 0x02, 0x03, 0xAA, 0xBB]); + + // Act + bv.splice(bv.length - 2, 2); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0x01, 0x02, 0x03])); + } + + @test + public splice_removeRange_removeFromBackView() { + // Arrange + const bv = ByteVector.fromByteArray([0x11, 0x00, 0x01, 0x02, 0x03, 0xAA, 0xBB, 0x11]) + .subarray(1, 6); + + // Act + bv.splice(bv.length - 2, 2); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0x01, 0x02, 0x03])); + assert.isFalse(bv.isView); + } + + @test + public splice_removeRange_removeFromMiddle() { + // Arrange + const bv = ByteVector.fromByteArray([0x00, 0x01, 0xAA, 0xBB, 0x02, 0x03]); + + // Act + bv.splice(2, 2); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0x01, 0x02, 0x03])); + } + + @test + public splice_removeRange_removeFromMiddleView() { + // Arrange + const bv = ByteVector.fromByteArray([0x11, 0x00, 0x01, 0xAA, 0xBB, 0x02, 0x03, 0x11]) + .subarray(1, 6); + + // Act + bv.splice(2, 2); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0x01, 0x02, 0x03])); + assert.isFalse(bv.isView); + } + + @test + public splice_removeAndInsert() { + // Arrange + const bv = ByteVector.fromByteArray([0x00, 0x01, 0xAA, 0xBB, 0x02, 0x03]); + + // Act + bv.splice(2, 2, new Uint8Array([0x88, 0x99])); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0x01, 0x88, 0x99, 0x02, 0x03])); + } + + @test + public splice_removeAndInsertView() { + // Arrange + const bv = ByteVector.fromByteArray([0x11, 0x00, 0x01, 0xAA, 0xBB, 0x02, 0x03, 0x11]) + .subarray(1, 6); + + // Act + bv.splice(2, 2, new Uint8Array([0x88, 0x99])); + + // Assert + assert.deepEqual(bv["_bytes"], new Uint8Array([0x00, 0x01, 0x88, 0x99, 0x02, 0x03])); + assert.isFalse(bv.isView); + } + + @test + public split_invalidParameters() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromSize(1); + + // Act / Assert + Testers.testTruthy((v: ByteVector) => { bv.split(v); }); + Testers.testUint((v: number) => { bv.split(pattern, v); }, true); + Testers.testUint((v: number) => { bv.split(pattern, 1, v); }, true); + assert.throws(() => bv.split(pattern, 0)); + } + + @test + public split_singleByteSplit_noMatch() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString(",", StringType.Latin1); + + // Act + const output = bv.split(pattern); + + // Assert + ByteVector_MethodTests.verifySplitOutput(output, ["foobarbaz"]); + } + + @test + public split_singleByteSplit_oneMatch() { + // Arrange + const bv = ByteVector.fromString("foo,baz", StringType.Latin1); + const pattern = ByteVector.fromString(",", StringType.Latin1); + + // Act + const output = bv.split(pattern); + + // Assert + ByteVector_MethodTests.verifySplitOutput(output, ["foo", "baz"]); + } + + @test + public split_singleByteSplit_multipleMatch() { + // Arrange + const bv = ByteVector.fromString("foo,bar,,baz", StringType.Latin1); + const pattern = ByteVector.fromString(",", StringType.Latin1); + + // Act + const output = bv.split(pattern); + + // Assert + ByteVector_MethodTests.verifySplitOutput(output, ["foo", "bar", "", "baz"]); + } + + @test + public split_multiByteSplit_noMatch() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString(",,", StringType.Latin1); + + // Act + const output = bv.split(pattern); + + // Assert + ByteVector_MethodTests.verifySplitOutput(output, ["foobarbaz"]); + } + + @test + public split_multiByteSplit_singleMatch() { + // Arrange + const bv = ByteVector.fromString("foo,,baz", StringType.Latin1); + const pattern = ByteVector.fromString(",,", StringType.Latin1); + + // Act + const output = bv.split(pattern); + + // Assert + ByteVector_MethodTests.verifySplitOutput(output, ["foo", "baz"]); + } + + @test + public split_multiByteSplit_multipleMatch() { + // Arrange + const bv = ByteVector.fromString("foo,,bar,,,,baz", StringType.Latin1); + const pattern = ByteVector.fromString(",,", StringType.Latin1); + + // Act + const output = bv.split(pattern); + + // Assert + ByteVector_MethodTests.verifySplitOutput(output, ["foo", "bar", "", "baz"]); + } + + @test + public split_singleByte_maxMatches() { + // Arrange + const bv = ByteVector.fromString("foo,bar,,baz", StringType.Latin1); + const pattern = ByteVector.fromString(",", StringType.Latin1); + + // Act + const output = bv.split(pattern, undefined, 2); + + // Assert + ByteVector_MethodTests.verifySplitOutput(output, ["foo", "bar,,baz"]); + } + + @test + public split_multiByteWithByteAlign_noMatch() { + // Arrange + const bv = ByteVector.fromString("foo,,bar", StringType.Latin1); + const pattern = ByteVector.fromString(",,", StringType.Latin1); + + // Act + const output = bv.split(pattern, 2); + + // Assert + ByteVector_MethodTests.verifySplitOutput(output, ["foo,,bar"]); + } + + @test + public split_multiByteWithByteAlignOnView_noMatch() { + // Arrange + const bv = ByteVector.fromString("Afoo,,barA", StringType.Latin1) + .subarray(1, 8); + const pattern = ByteVector.fromString(",,", StringType.Latin1); + + // Act + const output = bv.split(pattern, 2); + + // Assert + ByteVector_MethodTests.verifySplitOutput(output, ["foo,,bar"]); + } + + @test + public split_multiByteViewWithByteAlign_noMatch() { + // Arrange + const bv = ByteVector.fromString("foo,,bar", StringType.Latin1); + const pattern = ByteVector.fromString("0,,0", StringType.Latin1) + .subarray(1, 2); + + // Act + const output = bv.split(pattern, 2); + + // Assert + ByteVector_MethodTests.verifySplitOutput(output, ["foo,,bar"]); + } + + @test + public split_multiByteViewWithByteAlignOnView_noMatch() { + // Arrange + const bv = ByteVector.fromString("Afoo,,barA", StringType.Latin1) + .subarray(1, 8); + const pattern = ByteVector.fromString("0,,0", StringType.Latin1) + .subarray(1, 2); + + // Act + const output = bv.split(pattern, 2); + + // Assert + ByteVector_MethodTests.verifySplitOutput(output, ["foo,,bar"]); + } + + @test + public split_multiByteWithByteAlign_match() { + // Arrange + const bv = ByteVector.fromString("0foo,,bar", StringType.Latin1); + const pattern = ByteVector.fromString(",,", StringType.Latin1); + + // Act + const output = bv.split(pattern, 2); + + // Assert + ByteVector_MethodTests.verifySplitOutput(output, ["0foo", "bar"]); + } + + @test + public split_multiByteWithByteAlignOnView_match() { + // Arrange + const bv = ByteVector.fromString(" 0foo,,bar ", StringType.Latin1) + .subarray(1, 9); + const pattern = ByteVector.fromString(",,", StringType.Latin1); + + // Act + const output = bv.split(pattern, 2); + + // Assert + ByteVector_MethodTests.verifySplitOutput(output, ["0foo", "bar"]); + } + + @test + public split_multiByteViewWithByteAlign_match() { + // Arrange + const bv = ByteVector.fromString("0foo,,bar", StringType.Latin1); + const pattern = ByteVector.fromString(" ,, ", StringType.Latin1) + .subarray(1, 2); + + // Act + const output = bv.split(pattern, 2); + + // Assert + ByteVector_MethodTests.verifySplitOutput(output, ["0foo", "bar"]); + } + + @test + public split_multiByteViewWithByteAlignOnView_match() { + // Arrange + const bv = ByteVector.fromString(" 0foo,,bar ", StringType.Latin1) + .subarray(1, 9); + const pattern = ByteVector.fromString(" ,, ", StringType.Latin1) + .subarray(1, 2); + + // Act + const output = bv.split(pattern, 2); + + // Assert + ByteVector_MethodTests.verifySplitOutput(output, ["0foo", "bar"]); + } + + @test + public startsWith_invalidParam() { + // Arrange + const bv = ByteVector.empty(); + + // Act / Assert + Testers.testTruthy((v: ByteVector) => { bv.startsWith(v); }); + } + + @test + public startsWith_startsWith() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("foo", StringType.Latin1); + + // Act / Assert + assert.isTrue(bv.startsWith(pattern)); + } + + @test + public startsWith_doesNotStartWith() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("fux", StringType.Latin1); + + // Act / Assert + assert.isFalse(bv.startsWith(pattern)); + } + + @test + public startsWith_viewStartsWith() { + // Arrange + const bv = ByteVector.fromString("0foobarbaz0", StringType.Latin1) + .subarray(1, 9); + const pattern = ByteVector.fromString("foo", StringType.Latin1); + + // Act / Assert + assert.isTrue(bv.startsWith(pattern)); + } + + @test + public startsWith_viewDoesNotStartsWith() { + // Arrange + const bv = ByteVector.fromString("0foobarbaz0", StringType.Latin1) + .subarray(1, 9); + const pattern = ByteVector.fromString("bux", StringType.Latin1); + + // Act / Assert + assert.isFalse(bv.startsWith(pattern)); + } + + @test + public startsWith_startsWithView() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("0foo0", StringType.Latin1) + .subarray(1, 3); + + // Act / Assert + assert.isTrue(bv.startsWith(pattern)); + } + + @test + public startsWith_doesNotStartsWithView() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + const pattern = ByteVector.fromString("0fux0", StringType.Latin1) + .subarray(1, 3); + + // Act / Assert + assert.isFalse(bv.startsWith(pattern)); + } + + @test + public startsWith_viewStartsWithView() { + // Arrange + const bv = ByteVector.fromString("0foobarbaz0", StringType.Latin1) + .subarray(1, 9); + const pattern = ByteVector.fromString("0foo0", StringType.Latin1) + .subarray(1, 3); + + // Act / Assert + assert.isTrue(bv.startsWith(pattern)); + } + + @test + public startsWith_viewDoesNotStartWithView() { + // Arrange + const bv = ByteVector.fromString("0foobarbaz0", StringType.Latin1) + .subarray(1, 9); + const pattern = ByteVector.fromString("0fux0", StringType.Latin1) + .subarray(1, 3); + + // Act / Assert + assert.isFalse(bv.startsWith(pattern)); + } + + @test + public subarray_invalidParameters() { + // Arrange + const bv = ByteVector.fromSize(1); + + // Act / Assert + Testers.testSafeUint((v) => bv.subarray(v, 1)); + Testers.testSafeUint((v) => bv.subarray(0, v), true); + } + + @test + public subarray_entireVector() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + + // Act + const output = bv.subarray(0); + + // Assert + assert.notStrictEqual(output, bv); + assert.strictEqual(output.length, bv.length); + assert.isFalse(output.isEmpty); + assert.isFalse(output.isReadOnly); + assert.isFalse(output.isView); // Should be false b/c bounds are the same + assert.deepEqual(output["_bytes"], bv["_bytes"]); + } + + @test + public subarray_partialVector() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + + // Act + const output = bv.subarray(3, 3); + + // Assert + assert.strictEqual(output.length, 3); + assert.isFalse(output.isEmpty); + assert.isFalse(output.isReadOnly); + assert.isTrue(output.isView); + assert.deepEqual(output["_bytes"], ByteVector.fromString("bar", StringType.Latin1)["_bytes"]); + } + + @test + public subarray_emptyVector() { + // Arrange + const bv = ByteVector.fromString("foobarbaz", StringType.Latin1); + + // Act + const output = bv.subarray(3, 0); + + // Assert + assert.strictEqual(output.length, 0); + assert.isTrue(output.isEmpty); + assert.isFalse(output.isReadOnly); + assert.isTrue(output.isView); + assert.deepEqual(output["_bytes"], new Uint8Array(0)); + } + + @test + public subarray_ofView() { + // Arrange + const bv = ByteVector.fromString("0foobarbaz0", StringType.Latin1) + .subarray(1, 9); + + // Act + const output = bv.subarray(3, 3); + + // Assert + assert.strictEqual(output.length, 3); + assert.isFalse(output.isEmpty); + assert.isFalse(output.isReadOnly); + assert.isTrue(output.isView); + assert.deepEqual(output["_bytes"], ByteVector.fromString("bar", StringType.Latin1)["_bytes"]); + } + + private static verifySplitOutput(output: ByteVector[], expected: string[]) { + assert.isOk(output); + assert.strictEqual(output.length, expected.length); + for (let i = 0; i < expected.length; i++) { + Testers.bvEqual(output[i], ByteVector.fromString(expected[i], StringType.Latin1)); + } + } +} diff --git a/test-unit/byteVectorStaticMethodTests.ts b/test-unit/byteVectorStaticMethodTests.ts deleted file mode 100644 index 68d0610f..00000000 --- a/test-unit/byteVectorStaticMethodTests.ts +++ /dev/null @@ -1,363 +0,0 @@ -import * as Chai from "chai"; -import {suite, test} from "@testdeck/mocha"; - -import {ByteVector} from "../src/byteVector"; -import {Testers} from "./utilities/testers"; - -// Setup chai -const assert = Chai.assert; - -@suite class ByteVector_StaticMethodTests { - @test - public add_invalidParameters() { - // Arrange - const bv = ByteVector.fromSize(1, 0x00); - - // Act/Assert - Testers.testTruthy((v: ByteVector) => { ByteVector.add(v, bv); }); - Testers.testTruthy((v: ByteVector) => { ByteVector.add(bv, v); }); - } - - @test - public add_addEmptyAndEmpty() { - // Arrange - const bv = ByteVector.fromSize(0); - - // Act - const result = ByteVector.add(bv, bv); - - // Assert - assert.isOk(result); - assert.notEqual(result, bv); // Make sure we got a new byte vector - assert.isFalse(result.isReadOnly); - assert.isTrue(result.isEmpty); - assert.strictEqual(result.length, 0); - assert.deepEqual(result.data, new Uint8Array([])); - } - - @test - public add_addSomethingAndEmpty() { - // Arrange - const something = ByteVector.fromSize(1, 0x00); - const empty = ByteVector.fromSize(0); - - // Act - const result = ByteVector.add(something, empty); - - // Assert - assert.isOk(result); - assert.notEqual(result, something); // Make sure we got a new byte vector - assert.notEqual(result, empty); - assert.isFalse(result.isReadOnly); - assert.isFalse(result.isEmpty); - assert.strictEqual(result.length, 1); - assert.deepEqual(result.data, new Uint8Array([0x00])); - } - - @test - public add_addEmptyAndSomething() { - // Arrange - const something = ByteVector.fromSize(1, 0x00); - const empty = ByteVector.fromSize(0); - - // Act - const result = ByteVector.add(empty, something); - - // Assert - assert.isOk(result); - assert.notEqual(result, something); // Make sure we got a new byte vector - assert.notEqual(result, empty); - assert.isFalse(result.isReadOnly); - assert.isFalse(result.isEmpty); - assert.strictEqual(result.length, 1); - assert.deepEqual(result.data, new Uint8Array([0x00])); - } - - @test - public equal_add_addSomethingAndSomething() { - // Arrange - const bv1 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - const bv2 = ByteVector.fromByteArray(new Uint8Array([0x03, 0x04])); - - // Act - const result1 = ByteVector.add(bv1, bv2); - const result2 = ByteVector.add(bv2, bv1); - - // Assert - assert.isOk(result1); - assert.isFalse(result1.isReadOnly); - assert.isFalse(result1.isEmpty); - assert.strictEqual(result1.length, 4); - assert.deepEqual(result1.data, new Uint8Array([0x01, 0x02, 0x03, 0x04])); - - assert.isOk(result2); - assert.isFalse(result2.isReadOnly); - assert.isFalse(result2.isEmpty); - assert.strictEqual(result2.length, 4); - assert.deepEqual(result2.data, new Uint8Array([0x03, 0x04, 0x01, 0x02])); - } - - @test - public equal_bothNullUndefined() { - // Arrange, Act, Assert - assert.isTrue(ByteVector.equal(undefined, undefined)); - assert.isTrue(ByteVector.equal(null, null)); - } - - @test - public equal_mixedNullUndefined() { - // Arrange, Act, Assert - assert.isFalse(ByteVector.equal(undefined, null)); - assert.isFalse(ByteVector.equal(null, undefined)); - } - - @test - public equal_mixedFalsySomething() { - // Arrange - const bv = ByteVector.fromSize(1); - - // Act, Assert - assert.isFalse(ByteVector.equal(undefined, bv)); - assert.isFalse(ByteVector.equal(bv, undefined)); - assert.isFalse(ByteVector.equal(null, bv)); - assert.isFalse(ByteVector.equal(bv, null)); - } - - @test - public equal_equal() { - // Arrange - const bv1 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - const bv2 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - - // Act, Assert - Testers.bvEqual(bv1, bv2); - } - - @test - public equal_notEqual() { - // Arrange - const bv1 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - const bv2 = ByteVector.fromByteArray(new Uint8Array([0x03, 0x04])); - - // Act, Assert - assert.isFalse(ByteVector.equal(bv1, bv2)); - } - - @test - public notEqual_bothNullUndefined() { - // Arrange, Act, Assert - assert.isFalse(ByteVector.notEqual(undefined, undefined)); - assert.isFalse(ByteVector.notEqual(null, null)); - } - - @test - public notEqual_mixedNullUndefined() { - // Arrange, Act, Assert - assert.isTrue(ByteVector.notEqual(undefined, null)); - assert.isTrue(ByteVector.notEqual(null, undefined)); - } - - @test - public notEqual_mixedFalsySomething() { - // Arrange - const bv = ByteVector.fromSize(1); - - // Act, Assert - assert.isTrue(ByteVector.notEqual(undefined, bv)); - assert.isTrue(ByteVector.notEqual(bv, undefined)); - assert.isTrue(ByteVector.notEqual(null, bv)); - assert.isTrue(ByteVector.notEqual(bv, null)); - } - - @test - public notEqual_equal() { - // Arrange - const bv1 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - const bv2 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - - // Act, Assert - assert.isFalse(ByteVector.notEqual(bv1, bv2)); - } - - @test - public notEqual_notEqual() { - // Arrange - const bv1 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - const bv2 = ByteVector.fromByteArray(new Uint8Array([0x03, 0x04])); - - // Act, Assert - assert.isTrue(ByteVector.notEqual(bv1, bv2)); - } - - @test - public greaterThan_invalidParameters() { - // Arrange - const bv = ByteVector.fromSize(0); - - // Act, Assert - Testers.testTruthy((v: ByteVector) => { ByteVector.greaterThan(v, bv); }); - Testers.testTruthy((v: ByteVector) => { ByteVector.greaterThan(bv, v); }); - } - - @test - public greaterThan_greaterThan() { - // Arrange - const bv1 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x03])); - const bv2 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - - // Act, Assert - assert.isTrue(ByteVector.greaterThan(bv1, bv2)); // bv1 > bv2 -> true - assert.isFalse(ByteVector.greaterThan(bv2, bv1)); // bv2 > bv1 -> false - } - - @test - public greaterThan_lessThan() { - // Arrange - const bv1 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x00])); - const bv2 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - - // Act, Assert - assert.isFalse(ByteVector.greaterThan(bv1, bv2)); // bv1 > bv2 -> false - assert.isTrue(ByteVector.greaterThan(bv2, bv1)); // bv2 > bv1 -> true - } - - @test - public greaterThan_equal() { - // Arrange - const bv1 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - const bv2 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - - // Act, Assert - assert.isFalse(ByteVector.greaterThan(bv1, bv2)); // bv1 > bv2 -> false - assert.isFalse(ByteVector.greaterThan(bv2, bv1)); // bv2 > bv1 -> false - } - - @test - public greaterThanEqual_invalidParameters() { - // Arrange - const bv = ByteVector.fromSize(0); - - // Act, Assert - Testers.testTruthy((v: ByteVector) => { ByteVector.greaterThanEqual(v, bv); }); - Testers.testTruthy((v: ByteVector) => { ByteVector.greaterThanEqual(bv, v); }); - } - - @test - public greaterThanEqual_greaterThan() { - // Arrange - const bv1 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x03])); - const bv2 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - - // Act, Assert - assert.isTrue(ByteVector.greaterThanEqual(bv1, bv2)); // bv1 > bv2 -> true - assert.isFalse(ByteVector.greaterThanEqual(bv2, bv1)); // bv2 > bv1 -> false - } - - @test - public greaterThanEqual_lessThan() { - // Arrange - const bv1 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x00])); - const bv2 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - - // Act, Assert - assert.isFalse(ByteVector.greaterThanEqual(bv1, bv2)); // bv1 > bv2 -> false - assert.isTrue(ByteVector.greaterThanEqual(bv2, bv1)); // bv2 > bv1 -> true - } - - @test - public greaterThanEqual_equal() { - // Arrange - const bv1 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - const bv2 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - - // Act, Assert - assert.isTrue(ByteVector.greaterThanEqual(bv1, bv2)); // bv1 > bv2 -> true - assert.isTrue(ByteVector.greaterThanEqual(bv2, bv1)); // bv2 > bv1 -> true - } - - @test - public lessThan_invalidParameters() { - // Arrange - const bv = ByteVector.fromSize(0); - - // Act, Assert - Testers.testTruthy((v: ByteVector) => { ByteVector.lessThan(v, bv); }); - Testers.testTruthy((v: ByteVector) => { ByteVector.lessThan(bv, v); }); - } - - @test - public lessThan_greaterThan() { - // Arrange - const bv1 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x03])); - const bv2 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - - // Act, Assert - assert.isFalse(ByteVector.lessThan(bv1, bv2)); // bv1 < bv2 -> false - assert.isTrue(ByteVector.lessThan(bv2, bv1)); // bv2 < bv1 -> true - } - - @test - public lessThan_lessThan() { - // Arrange - const bv1 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x00])); - const bv2 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - - // Act, Assert - assert.isTrue(ByteVector.lessThan(bv1, bv2)); // bv1 > bv2 -> false - assert.isFalse(ByteVector.lessThan(bv2, bv1)); // bv2 < bv1 -> true - } - - @test - public lessThan_equal() { - // Arrange - const bv1 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - const bv2 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - - // Act, Assert - assert.isFalse(ByteVector.lessThan(bv1, bv2)); // bv1 < bv2 -> false - assert.isFalse(ByteVector.lessThan(bv2, bv1)); // bv2 < bv1 -> false - } - - @test - public lessThanEqual_invalidParameters() { - // Arrange - const bv = ByteVector.fromSize(0); - - // Act, Assert - Testers.testTruthy((v: ByteVector) => { ByteVector.lessThanEqual(v, bv); }); - Testers.testTruthy((v: ByteVector) => { ByteVector.lessThanEqual(bv, v); }); - } - - @test - public lessThanEqual_greaterThan() { - // Arrange - const bv1 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x03])); - const bv2 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - - // Act, Assert - assert.isFalse(ByteVector.lessThanEqual(bv1, bv2)); // bv1 < bv2 -> false - assert.isTrue(ByteVector.lessThanEqual(bv2, bv1)); // bv2 < bv1 -> true - } - - @test - public lessThanEqual_lessThan() { - // Arrange - const bv1 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x00])); - const bv2 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - - // Act, Assert - assert.isTrue(ByteVector.lessThanEqual(bv1, bv2)); // bv1 > bv2 -> false - assert.isFalse(ByteVector.lessThanEqual(bv2, bv1)); // bv2 < bv1 -> true - } - - @test - public lessThanEqual_equal() { - // Arrange - const bv1 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - const bv2 = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - - // Act, Assert - assert.isTrue(ByteVector.lessThanEqual(bv1, bv2)); // bv1 < bv2 -> true - assert.isTrue(ByteVector.lessThanEqual(bv2, bv1)); // bv2 < bv1 -> true - } -} diff --git a/test-unit/byteVectorVoidMethodTests.ts b/test-unit/byteVectorVoidMethodTests.ts deleted file mode 100644 index 9dfab888..00000000 --- a/test-unit/byteVectorVoidMethodTests.ts +++ /dev/null @@ -1,1629 +0,0 @@ -import * as Chai from "chai"; -import {suite, test} from "@testdeck/mocha"; - -import {ByteVector} from "../src/byteVector"; -import {Testers} from "./utilities/testers"; - -// Setup chai -const assert = Chai.assert; - -@suite class ByteVector_VoidMethodTests { - private readonly vectorToAdd: ByteVector = ByteVector.fromByteArray( - new Uint8Array([0xAA, 0xBB]) - ); - - @test - public iterator() { - // Arrange - const array = [0x01, 0x02, 0x03, 0x04]; - const bv = ByteVector.fromByteArray(new Uint8Array(array)); - - // Act - const output = []; - for (const b of bv) { - output.push(b); - } - - // Assert - assert.deepStrictEqual(output, array); - } - - @test - public addByte_ReadOnly() { - // Arrange - Create readonly ByteVector - const bv = ByteVector.fromSize(1, 0x0, true); - - // Act, Assert - AddByte should fail, ByteVector should be unchanged - assert.throws(() => { bv.addByte(0x01); }); - assert.isTrue(bv.isReadOnly); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public addByte_InvalidByte() { - // Arrange - Create ByteVector - const bv = ByteVector.fromSize(1); - - // Act, Assert - AddByte should fail, ByteVector should be unchanged - Testers.testByte((v: number) => { bv.addByte(v); }); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public addByte_AddToEmpty() { - // Arrange - Create ByteVector that is empty - const bv = ByteVector.fromSize(0); - - // Act - Add a byte to it - bv.addByte(0x01); - - // Assert - ByteVector should contain the new byte - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x01])); - } - - @test - public addByte_AddToExisting() { - // Arrange - Create ByteVector with something in it - const bv = ByteVector.fromSize(1); - - // Act - Add a byte to it - bv.addByte(0x01); - - // Assert - ByteVector should contain the new byte - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 2); - assert.deepEqual(bv.data, new Uint8Array([0x00, 0x01])); - } - - @test - public addByteArray_ReadOnly() { - // Arrange - Create readonly ByteVector - const bv = ByteVector.fromSize(1, 0x0, true); - - // Act, Assert - AddByte should fail, ByteVector should be unchanged - assert.throws(() => { bv.addByteArray(new Uint8Array(0x01)); }); - assert.isTrue(bv.isReadOnly); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public addByteArray_InvalidByteArray() { - // Arrange - const bv = ByteVector.fromSize(1, 0x0, true); - - // Act, Assert - Testers.testTruthy((v: Uint8Array) => { bv.addByteArray(v); }); - } - - @test - public addByteArray_AddEmptyToEmpty() { - // Arrange - Create ByteVector that is empty - const bv = ByteVector.fromSize(0); - - // Act - Add nothing to it - bv.addByteArray(new Uint8Array()); - - // Assert - ByteVector should contain the new byte - assert.isTrue(bv.isEmpty); - assert.strictEqual(bv.length, 0); - assert.deepEqual(bv.data, new Uint8Array()); - } - - @test - public addByteArray_AddSingleToEmpty() { - // Arrange - Create ByteVector that is empty - const bv = ByteVector.fromSize(0); - - // Act - Add a byte to it - bv.addByteArray(new Uint8Array([0x01])); - - // Assert - ByteVector should contain the new byte - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x01])); - } - - @test - public addByteArray_AddMultipleToEmpty() { - // Arrange - Create ByteVector that is empty - const bv = ByteVector.fromSize(0); - - // Act - Add two bytes to it - bv.addByteArray(new Uint8Array([0x01, 0x02])); - - // Assert - ByteVector should contain the new bytes - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 2); - assert.deepEqual(bv.data, new Uint8Array([0x01, 0x02])); - } - - @test - public addByteArray_AddEmptyToExisting() { - // Arrange - Create ByteVector that has bytes - const bv = ByteVector.fromSize(1); - - // Act - Add nothing to it - bv.addByteArray(new Uint8Array()); - - // Assert - ByteVector should contain the new byte - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public addByteArray_AddSingleToExisting() { - // Arrange - Create ByteVector that has bytes - const bv = ByteVector.fromSize(1); - - // Act - Add a byte to it - bv.addByteArray(new Uint8Array([0x01])); - - // Assert - ByteVector should contain the new byte - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 2); - assert.deepEqual(bv.data, new Uint8Array([0x00, 0x01])); - } - - @test - public addByteArray_AddMultipleToExisting() { - // Arrange - Create ByteVector that is empty - const bv = ByteVector.fromSize(1); - - // Act - Add two bytes to it - bv.addByteArray(new Uint8Array([0x01, 0x02])); - - // Assert - ByteVector should contain the new bytes - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 3); - assert.deepEqual(bv.data, new Uint8Array([0x00, 0x01, 0x02])); - } - - @test - public addByteVector_ReadOnly() { - // Arrange - Create readonly ByteVector - const bv = ByteVector.fromSize(1, 0x0, true); - const add = ByteVector.fromSize(1, 0x1); - - // Act, Assert - AddByte should fail, ByteVector should be unchanged - assert.throws(() => { bv.addByteVector(add); }); - assert.isTrue(bv.isReadOnly); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public addByteVector_InvalidByteVector() { - // Arrange - const bv = ByteVector.fromSize(1, 0x0, true); - - // Act, Assert - Testers.testTruthy((v: ByteVector) => { bv.addByteVector(v); }); - } - - @test - public addByteVector_AddEmptyToEmpty() { - // Arrange - Create ByteVector that is empty - const bv = ByteVector.fromSize(0); - - // Act - Add nothing to it - bv.addByteVector(ByteVector.fromSize(0)); - - // Assert - ByteVector should contain the new byte - assert.isTrue(bv.isEmpty); - assert.strictEqual(bv.length, 0); - assert.deepEqual(bv.data, new Uint8Array()); - } - - @test - public addByteVector_AddSingleToEmpty() { - // Arrange - Create ByteVector that is empty - const bv = ByteVector.fromSize(0); - const add = ByteVector.fromSize(1, 0x1); - - // Act - Add a byte to it - bv.addByteVector(add); - - // Assert - ByteVector should contain the new byte - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x01])); - } - - @test - public addByteVector_AddMultipleToEmpty() { - // Arrange - Create ByteVector that is empty - const bv = ByteVector.fromSize(0); - const add = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - - // Act - Add two bytes to it - bv.addByteVector(add); - - // Assert - ByteVector should contain the new bytes - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 2); - assert.deepEqual(bv.data, new Uint8Array([0x01, 0x02])); - } - - @test - public addByteVector_AddSingleToExisting() { - // Arrange - Create ByteVector that has bytes - const bv = ByteVector.fromSize(1); - const add = ByteVector.fromByteArray(new Uint8Array([0x01])); - - // Act - Add a byte to it - bv.addByteVector(add); - - // Assert - ByteVector should contain the new byte - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 2); - assert.deepEqual(bv.data, new Uint8Array([0x00, 0x01])); - } - - @test - public addByteVector_AddMultipleToExisting() { - // Arrange - Create ByteVector that is empty - const bv = ByteVector.fromSize(1); - const add = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02])); - - // Act - Add two bytes to it - bv.addByteVector(add); - - // Assert - ByteVector should contain the new bytes - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 3); - assert.deepEqual(bv.data, new Uint8Array([0x00, 0x01, 0x02])); - } - - @test - public clear_ReadOnly() { - // Arrange - Create readonly bytevector - const bv = ByteVector.fromSize(1, 0x00, true); - - // Act, Assert - Should throw, bytevector should be unchanged - assert.throws(() => { bv.clear(); } ); - assert.isTrue(bv.isReadOnly); - assert.isFalse(bv.isEmpty); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public clear_Empty() { - // Arrange - Create empty ByteVector - const bv = ByteVector.fromSize(0); - - // Act - bv.clear(); - - // Assert - assert.isTrue(bv.isEmpty); - assert.strictEqual(bv.length, 0); - assert.deepEqual(bv.data, new Uint8Array()); - } - - @test - public clear_Existing() { - // Arrange - Create ByteVector with some data - const bv = ByteVector.fromSize(1, 0x00); - - // Act - bv.clear(); - - // Assert - assert.isTrue(bv.isEmpty); - assert.strictEqual(bv.length, 0); - assert.deepEqual(bv.data, new Uint8Array()); - } - - @test - public containsAt_invalidParameters() { - // Arrange - const bv = ByteVector.empty(); - const pattern = ByteVector.empty(); - - // Act / Assert - Testers.testTruthy((v: ByteVector) => { bv.containsAt(v, 0, 0, 0); }); - Testers.testInt((v: number) => { bv.containsAt(pattern, v, 0, 0); }, true); - Testers.testInt((v: number) => { bv.containsAt(pattern, 0, v, 0); }, true); - Testers.testInt((v: number) => { bv.containsAt(pattern, 0, 0, v); }, true); - } - - @test - public containsAt_sanityCheckFailures() { - // Arrange - const bv = ByteVector.fromSize(5); - - // Act / Assert - assert.isFalse(bv.containsAt(ByteVector.fromSize(10))); // Pattern longer than source - assert.isFalse(bv.containsAt(ByteVector.fromSize(1), 10)); // Offset longer than source - assert.isFalse(bv.containsAt(ByteVector.fromSize(1), 5)); // Offset equal to source - assert.isFalse(bv.containsAt(ByteVector.fromSize(1), 0, 5)); // Pattern offset greater than pattern - assert.isFalse(bv.containsAt(ByteVector.fromSize(1), 0, 1)); // Pattern offset equal to pattern - assert.isFalse(bv.containsAt(ByteVector.empty())); // Pattern is empty - assert.isFalse(bv.containsAt(ByteVector.fromSize(1), 0, 0, 0)); // Pattern length is 0 - assert.isFalse(bv.containsAt(ByteVector.fromSize(1), 0, 0, -1)); // Pattern length is negative - assert.isFalse(bv.containsAt(ByteVector.fromSize(1), -1)); // Offset is negative - } - - @test - public containsAt_doesNotContainAnywhere() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromString("qux"); - - // Act - const output = bv.containsAt(pattern); - - // Assert - assert.isFalse(output); - } - - @test - public containsAt_doesNotContainAt() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromString("qux"); - - // Act - const output = bv.containsAt(pattern); - - // Assert - assert.isFalse(output); - } - - @test - public containsAt_containsPartial() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromString("foobux"); - - // Act - const output = bv.containsAt(pattern); - - // Assert - assert.isFalse(output); - } - - @test - public containsAt_containsAll() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromString("foo"); - - // Act - const output = bv.containsAt(pattern); - - // Assert - assert.isTrue(output); - } - - @test - public containsAt_containsAllWithOffset() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromString("0bar0"); - - // Act - const output = bv.containsAt(pattern, 3, 1, 3); - - // Assert - assert.isTrue(output); - } - - @test - public compareTo_invalidParameter() { - // Arrange - const bv = ByteVector.fromSize(1); - - // Act / Assert - Testers.testTruthy((v: ByteVector) => { bv.compareTo(v); }); - } - - @test - public compareTo_lessThan() { - // Arrange - const bv = ByteVector.concatenate(0x00, 0x05); - const other = ByteVector.concatenate(0x00, 0x06); - - // Act - const output = bv.compareTo(other); - - // Assert - assert.strictEqual(output, -1); - } - - @test - public compareTo_greaterThan() { - // Arrange - const bv = ByteVector.concatenate(0x00, 0x05); - const other = ByteVector.concatenate(0x00, 0x04); - - // Act - const output = bv.compareTo(other); - - // Assert - assert.strictEqual(output, 1); - } - - @test - public compareTo_equalTo() { - // Arrange - const bv = ByteVector.concatenate(0x00, 0x05); - const other = ByteVector.concatenate(0x00, 0x05); - - // Act - const output = bv.compareTo(other); - - // Assert - assert.strictEqual(output, 0); - } - - @test - public compareTo_unequalSizes() { - // Arrange - const bv = ByteVector.concatenate(0x00, 0x05); - const other = ByteVector.concatenate(0x00); - - // Act - const output = bv.compareTo(other); - - // Assert - assert.strictEqual(output, 1); - } - - @test - public endsWith_invalidParam() { - // Arrange - const bv = ByteVector.empty(); - - // Act / Assert - Testers.testTruthy((v: ByteVector) => { bv.endsWith(v); }); - } - - @test - public endsWith_doesEndsWith() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromString("baz"); - - // Act / Assert - assert.isTrue(bv.endsWith(pattern)); - } - - @test - public endsWith_doesNotEndWith() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromString("bux"); - - // Act / Assert - assert.isFalse(bv.endsWith(pattern)); - } - - @test - public endsWithPartialMatch_invalidProperty() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - - // Act / Assert - Testers.testTruthy((v: ByteVector) => { bv.endsWithPartialMatch(v); }); - } - - @test - public endsWithPartialMatch_patternTooLong() { - // Arrange - const bv = ByteVector.fromSize(5); - const pattern = ByteVector.fromSize(10); - - // Act / Assert - assert.strictEqual(bv.endsWithPartialMatch(pattern), -1); - } - - @test - public endsWithPartialMatch_doesNotEndWith() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromString("qux"); - - // Act / Assert - assert.strictEqual(bv.endsWithPartialMatch(pattern), -1); - } - - @test - public endsWithPartialMatch_endsWithPartial() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromString("bazqqq"); - - // Act / Assert - assert.strictEqual(bv.endsWithPartialMatch(pattern), 6); - } - - @test - public endsWithPartialMatch_endsWithFull() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromString("bazq"); - - // Act / Assert - assert.strictEqual(bv.endsWithPartialMatch(pattern), 6); - } - - @test - public find_invalidParameters() { - // Arrange - const bv = ByteVector.empty(); - const pattern = ByteVector.empty(); - - // Act / Assert - Testers.testTruthy((v: ByteVector) => { bv.find(v, 0, 1); }); - Testers.testUint((v: number) => { bv.find(pattern, v, 1); }, true); - Testers.testUint((v: number) => { bv.find(pattern, 0, v); }, true); - assert.throws(() => { bv.find(pattern, 0, 0); }); - } - - @test - public find_patternTooLong() { - // Arrange - const bv = ByteVector.fromSize(5); - const pattern = ByteVector.fromSize(10); - - // Act / Assert - assert.strictEqual(bv.find(pattern), -1); - } - - @test - public find_singleBytePattern_noMatch() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromByteArray(new Uint8Array(0x05)); - - // Act / Assert - assert.strictEqual(bv.find(pattern), -1); - } - - @test - public find_singleBytePattern_withMatch() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromString("b"); - - // Act / Assert - assert.strictEqual(bv.find(pattern), 3); - } - - @test - public find_multiBytePattern_noMatch() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromString("qux"); - - // Act / Assert - assert.strictEqual(bv.find(pattern), -1); - } - - @test - public find_multiBytePattern_singleMatch() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromString("bar"); - - // Act / Assert - assert.strictEqual(bv.find(pattern), 3); - } - - @test - public find_multiBytePattern_multiMatch() { - // Arrange - const bv = ByteVector.fromString("foofoofoo"); - const pattern = ByteVector.fromString("foo"); - - // Act / Assert - assert.strictEqual(bv.find(pattern), 0); - } - - @test - public find_multiByteWithOffset_noMatch() { - // Arrange - const bv = ByteVector.fromString("fooabc"); - const pattern = ByteVector.fromString("foo"); - - // Act / Assert - assert.strictEqual(bv.find(pattern, 1), -1); - } - - @test - public find_multiByteWithOffset_withMatch() { - // Arrange - const bv = ByteVector.fromString("foofoofoo"); - const pattern = ByteVector.fromString("foo"); - - // Act / Assert - assert.strictEqual(bv.find(pattern, 1), 3); - } - - @test - public find_multiByteWithAlign_noMatch() { - // Arrange - const bv = ByteVector.fromString("0abc"); - const pattern = ByteVector.fromString("ab"); - - // Act / Assert - assert.strictEqual(bv.find(pattern, 0, 2), -1); - } - - @test - public find_multiByteWithAlign_withMatch() { - // Arrange - const bv = ByteVector.fromString("00abc"); - const pattern = ByteVector.fromString("ab"); - - // Act / Assert - assert.strictEqual(bv.find(pattern, 0, 2), 2); - } - - @test - public get_invalidParameter() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - - // Act / Assert - Testers.testUint((v: number) => { bv.get(v); }); - assert.throws(() => { bv.get(bv.length); }); - } - - @test - public get_validParameter() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - - // Act - const output = bv.get(5); - - // Assert - assert.strictEqual(output, "r".codePointAt(0)); - } - - @test - public indexOf_exists() { - // Arrange - const bv = ByteVector.fromByteArray(new Uint8Array([1, 2, 3])); - - // Act - const output = bv.indexOf(2); - - // Assert - assert.strictEqual(output, 1); - } - - @test - public indexOf_doesNotExist() { - // Arrange - const bv = ByteVector.fromByteArray(new Uint8Array([1, 2, 3])); - - // Act - const output = bv.indexOf(888); - - // Assert - assert.strictEqual(output, -1); - } - - @test - public insertByte_ReadOnly() { - // Arrange - const bv = ByteVector.fromSize(1, 0x00, true); - - // Act, Assert - assert.throws(() => { bv.insertByte(0, 0x00); }); - - assert.isTrue(bv.isReadOnly); - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public insertByte_IndexOutOfRange() { - // Arrange - const bv = ByteVector.fromSize(1, 0x00); - - // Act, Assert - Testers.testUint((v: number) => { bv.insertByte(v, 0x01); }); - assert.throws(() => { bv.insertByte(2, 0x01); }); - - assert.isFalse(bv.isReadOnly); - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public insertByte_ByteOutOfRange() { - // Arrange - const bv = ByteVector.fromSize(1, 0x00); - - // Act, Assert - Testers.testByte((v: number) => { bv.insertByte(0, v); }); - - assert.isFalse(bv.isReadOnly); - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public insertByte_InsertIntoEmpty() { - // Arrange - const bv = ByteVector.fromSize(0); - - // Act - bv.insertByte(0, 0x01); - - // Assert - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x01])); - } - - @test - public insertByte_InsertAtFront() { - // Arrange - const bv = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02, 0x03, 0x04])); - - // Act - bv.insertByte(0, 0xAA); - - // Assert - assert.strictEqual(bv.length, 5); - assert.deepEqual(bv.data, new Uint8Array([0xAA, 0x01, 0x02, 0x03, 0x04])); - } - - @test - public insertByte_InsertAtBack() { - // Arrange - const bv = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02, 0x03, 0x04])); - - // Act - bv.insertByte(bv.length, 0xAA); - - // Assert - assert.strictEqual(bv.length, 5); - assert.deepEqual(bv.data, new Uint8Array([0x01, 0x02, 0x03, 0x04, 0xAA])); - } - - @test - public insertByte_InsertInMiddle() { - // Arrange - const bv = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02, 0x03, 0x04])); - - // Act - bv.insertByte(2, 0xAA); - - // Assert - assert.strictEqual(bv.length, 5); - assert.deepEqual(bv.data, new Uint8Array([0x01, 0x02, 0xAA, 0x03, 0x04])); - } - - @test - public insertByteArray_ReadOnly() { - // Arrange - const bv = ByteVector.fromSize(1, 0x00, true); - - // Act, Assert - assert.throws(() => { bv.insertByteArray(0, new Uint8Array()); }); - - assert.isTrue(bv.isReadOnly); - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public insertByteArray_IndexOutOfRange() { - // Arrange - const bv = ByteVector.fromSize(1, 0x00); - - // Act, Assert - Testers.testUint((v: number) => { bv.insertByteArray(v, new Uint8Array()); }); - assert.throws(() => { bv.insertByteArray(2, new Uint8Array()); }); - - assert.isFalse(bv.isReadOnly); - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public insertByteArray_ByteArrayInvalid() { - // Arrange - const bv = ByteVector.fromSize(1, 0x00); - - // Act, Assert - Testers.testTruthy((v: Uint8Array) => { bv.insertByteArray(0, v); }); - - assert.isFalse(bv.isReadOnly); - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public insertByteArray_InsertEmpty() { - // Arrange - const bv = ByteVector.fromSize(1, 0x00); - - // Act - bv.insertByteArray(0, new Uint8Array()); - - // Assert - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public insertByteArray_InsertIntoEmpty() { - // Arrange - const bv = ByteVector.fromSize(0); - - // Act - bv.insertByteArray(0, new Uint8Array([0x01, 0x02])); - - // Assert - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 2); - assert.deepEqual(bv.data, new Uint8Array([0x01, 0x02])); - } - - @test - public insertByteArray_InsertAtFront() { - // Arrange - const bv = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02, 0x03, 0x04])); - - // Act - bv.insertByteArray(0, new Uint8Array([0xAA, 0xBB])); - - // Assert - assert.strictEqual(bv.length, 6); - assert.deepEqual(bv.data, new Uint8Array([0xAA, 0xBB, 0x01, 0x02, 0x03, 0x04])); - } - - @test - public insertByteArray_InsertAtBack() { - // Arrange - const bv = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02, 0x03, 0x04])); - - // Act - bv.insertByteArray(bv.length, new Uint8Array([0xAA, 0xBB])); - - // Assert - assert.strictEqual(bv.length, 6); - assert.deepEqual(bv.data, new Uint8Array([0x01, 0x02, 0x03, 0x04, 0xAA, 0xBB])); - } - - @test - public insertByteArray_InsertInMiddle() { - // Arrange - const bv = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02, 0x03, 0x04])); - - // Act - bv.insertByteArray(2, new Uint8Array([0xAA, 0xBB])); - - // Assert - assert.strictEqual(bv.length, 6); - assert.deepEqual(bv.data, new Uint8Array([0x01, 0x02, 0xAA, 0xBB, 0x03, 0x04])); - } - - @test - public insertByteVector_ReadOnly() { - // Arrange - const bv = ByteVector.fromSize(1, 0x00, true); - - // Act, Assert - assert.throws(() => { bv.insertByteVector(0, this.vectorToAdd); }); - - assert.isTrue(bv.isReadOnly); - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public insertByteVector_IndexOutOfRange() { - // Arrange - const bv = ByteVector.fromSize(1, 0x00); - - // Act, Assert - Testers.testUint((v: number) => { bv.insertByteVector(v, this.vectorToAdd); }); - - assert.isFalse(bv.isReadOnly); - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public insertByteVector_ByteArrayInvalid() { - // Arrange - const bv = ByteVector.fromSize(1, 0x00); - - // Act, Assert - Testers.testTruthy((v: ByteVector) => { bv.insertByteVector(0, v); }); - - assert.isFalse(bv.isReadOnly); - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public insertByteVector_InsertEmpty() { - // Arrange - const bv = ByteVector.fromSize(1, 0x00); - - // Act - bv.insertByteVector(0, ByteVector.fromSize(0)); - - // Assert - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public insertByteVector_InsertIntoEmpty() { - // Arrange - const bv = ByteVector.fromSize(0); - - // Act - bv.insertByteVector(0, this.vectorToAdd); - - // Assert - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 2); - assert.deepEqual(bv.data, new Uint8Array([0xAA, 0xBB])); - } - - @test - public insertByteVector_InsertAtFront() { - // Arrange - const bv = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02, 0x03, 0x04])); - - // Act - bv.insertByteVector(0, this.vectorToAdd); - - // Assert - assert.strictEqual(bv.length, 6); - assert.deepEqual(bv.data, new Uint8Array([0xAA, 0xBB, 0x01, 0x02, 0x03, 0x04])); - } - - @test - public insertByteVector_InsertAtBack() { - // Arrange - const bv = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02, 0x03, 0x04])); - - // Act - bv.insertByteVector(bv.length, this.vectorToAdd); - - // Assert - assert.strictEqual(bv.length, 6); - assert.deepEqual(bv.data, new Uint8Array([0x01, 0x02, 0x03, 0x04, 0xAA, 0xBB])); - } - - @test - public insertByteVector_InsertInMiddle() { - // Arrange - const bv = ByteVector.fromByteArray(new Uint8Array([0x01, 0x02, 0x03, 0x04])); - - // Act - bv.insertByteVector(2, this.vectorToAdd); - - // Assert - assert.strictEqual(bv.length, 6); - assert.deepEqual(bv.data, new Uint8Array([0x01, 0x02, 0xAA, 0xBB, 0x03, 0x04])); - } - - @test - public mid_invalidParameters() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - - // Act / Assert - Testers.testUint((v: number) => { bv.mid(v); }); - Testers.testUint((v: number) => { bv.mid(1, v); }, true); - assert.throws(() => bv.mid(1, bv.length)); - } - - @test - public mid_entireVector() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - - // Act - const output = bv.mid(0); - - // Assert - assert.notStrictEqual(output, bv); - Testers.bvEqual(output, bv); - } - - @test - public mid_partialVector() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - - // Act - const output = bv.mid(3, 3); - - // Assert - Testers.bvEqual(output, ByteVector.fromString("bar")); - } - - @test - public mid_emptyVector() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - - // Act - const output = bv.mid(3, 0); - - // Assert - assert.isTrue(output.isEmpty); - } - - @test - public removeAtIndex_ReadOnly() { - // Arrange - const bv = ByteVector.fromSize(1, 0x00, true); - - // Act, Assert - assert.throws(() => { bv.removeAtIndex(0); }); - - assert.isTrue(bv.isReadOnly); - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public removeAtIndex_IndexOutOfRange() { - // Arrange - const bv = ByteVector.fromSize(1, 0x00, true); - - // Act, Assert - Testers.testUint((v: number) => { bv.removeAtIndex(v); }); - assert.throws(() => { bv.removeAtIndex(bv.length); }); - - assert.isTrue(bv.isReadOnly); - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public removeAtIndex_RemoveFromFront() { - // Arrange - const bv = ByteVector.fromByteArray(new Uint8Array([0xAA, 0x00, 0x01, 0x02, 0x03])); - - // Act - bv.removeAtIndex(0); - - // Assert - assert.strictEqual(bv.length, 4); - assert.deepEqual(bv.data, new Uint8Array([0x00, 0x01, 0x02, 0x03])); - } - - @test - public removeAtIndex_RemoveFromBack() { - // Arrange - const bv = ByteVector.fromByteArray(new Uint8Array([0x00, 0x01, 0x02, 0x03, 0xAA])); - - // Act - bv.removeAtIndex(bv.length - 1); - - // Assert - assert.strictEqual(bv.length, 4); - assert.deepEqual(bv.data, new Uint8Array([0x00, 0x01, 0x02, 0x03])); - } - - @test - public removeAtIndex_RemoveFromMiddle() { - // Arrange - const bv = ByteVector.fromByteArray(new Uint8Array([0x00, 0x01, 0xAA, 0x02, 0x03])); - - // Act - bv.removeAtIndex(2); - - // Assert - assert.strictEqual(bv.length, 4); - assert.deepEqual(bv.data, new Uint8Array([0x00, 0x01, 0x02, 0x03])); - } - - @test - public removeRange_ReadOnly() { - // Arrange - const bv = ByteVector.fromSize(1, 0x00, true); - - // Act, Assert - assert.throws(() => { bv.removeRange(0, 1); }); - - assert.isTrue(bv.isReadOnly); - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public removeRange_IndexOutOfRange() { - // Arrange - const bv = ByteVector.fromSize(1, 0x00, true); - - // Act, Assert - Testers.testUint((v: number) => { bv.removeRange(v, 1); }); - assert.throws(() => { bv.removeRange(bv.length, 1); }); - - assert.isTrue(bv.isReadOnly); - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public removeRange_CountOutOfRange() { - // Arrange - const bv = ByteVector.fromSize(1, 0x00, true); - - // Act, Assert - assert.throws(() => { bv.removeRange(0, 0.1); }); - assert.throws(() => { bv.removeRange(0, -1); }); - - assert.isTrue(bv.isReadOnly); - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public removeRange_RemoveFromFront() { - // Arrange - const bv = ByteVector.fromByteArray(new Uint8Array([0xAA, 0xBB, 0x00, 0x01, 0x02, 0x03])); - - // Act - bv.removeRange(0, 2); - - // Assert - assert.strictEqual(bv.length, 4); - assert.deepEqual(bv.data, new Uint8Array([0x00, 0x01, 0x02, 0x03])); - } - - @test - public removeRange_RemoveFromBack() { - // Arrange - const bv = ByteVector.fromByteArray(new Uint8Array([0x00, 0x01, 0x02, 0x03, 0xAA, 0xBB])); - - // Act - bv.removeRange(bv.length - 2, 2); - - // Assert - assert.strictEqual(bv.length, 4); - assert.deepEqual(bv.data, new Uint8Array([0x00, 0x01, 0x02, 0x03])); - } - - @test - public removeRange_RemoveFromMiddle() { - // Arrange - const bv = ByteVector.fromByteArray(new Uint8Array([0x00, 0x01, 0xAA, 0xBB, 0x02, 0x03])); - - // Act - bv.removeRange(2, 2); - - // Assert - assert.strictEqual(bv.length, 4); - assert.deepEqual(bv.data, new Uint8Array([0x00, 0x01, 0x02, 0x03])); - } - - @test - public resize_invalidParameters() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - - // Act / Assert - Testers.testUint((v: number) => { bv.resize(v); }); - Testers.testByte((v: number) => { bv.resize(1, v); }); - } - - @test - public resize_shorten() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - - // Act - const output = bv.resize(6); - - // Assert - assert.strictEqual(output, bv); - Testers.bvEqual(output, ByteVector.fromString("foobar")); - } - - @test - public resize_sameSize() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - - // Act - const output = bv.resize(9); - - // Assert - assert.strictEqual(output, bv); - Testers.bvEqual(output, ByteVector.fromString("foobarbaz")); - } - - @test - public resize_lengthen() { - // Arrange - const bv = ByteVector.fromByteArray(new Uint8Array([0x00, 0x01, 0x02, 0x03])); - - // Act - const output = bv.resize(7); - - // Assert - assert.strictEqual(output, bv); - assert.isTrue(ByteVector.equal( - output, - ByteVector.fromByteArray(new Uint8Array([0x00, 0x01, 0x02, 0x03, 0x00, 0x00, 0x00]))) - ); - } - - @test - public resize_lengthenWithPadding() { - // Arrange - const bv = ByteVector.fromByteArray(new Uint8Array([0x00, 0x01, 0x02, 0x03])); - - // Act - const output = bv.resize(7, 0x12); - - // Assert - assert.strictEqual(output, bv); - assert.isTrue(ByteVector.equal( - output, - ByteVector.fromByteArray(new Uint8Array([0x00, 0x01, 0x02, 0x03, 0x12, 0x12, 0x12])) - )); - } - - @test - public rFind_invalidParameters() { - // Arrange - const bv = ByteVector.empty(); - const pattern = ByteVector.empty(); - - // Act / Assert - Testers.testTruthy((v: ByteVector) => { bv.rFind(v, 0, 1); }); - Testers.testUint((v: number) => { bv.rFind(pattern, v, 1); }, true); - Testers.testUint((v: number) => { bv.rFind(pattern, 0, v); }, true); - assert.throws(() => { bv.rFind(pattern, 0, 0); }); - } - - @test - public rFind_patternTooLong() { - // Arrange - const bv = ByteVector.fromSize(5); - const pattern = ByteVector.fromSize(10); - - // Act / Assert - assert.strictEqual(bv.rFind(pattern), -1); - } - - @test - public rFind_singleBytePattern_noMatch() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromByteArray(new Uint8Array(0x05)); - - // Act / Assert - assert.strictEqual(bv.rFind(pattern), -1); - } - - @test - public rFind_singleBytePattern_withMatch() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromString("b"); - - // Act / Assert - assert.strictEqual(bv.rFind(pattern), 6); - } - - @test - public rFind_multiBytePattern_noMatch() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromString("qux"); - - // Act / Assert - assert.strictEqual(bv.rFind(pattern), -1); - } - - @test - public rFind_multiBytePattern_singleMatch() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromString("bar"); - - // Act / Assert - assert.strictEqual(bv.rFind(pattern), 3); - } - - @test - public rFind_multiBytePattern_multiMatch() { - // Arrange - const bv = ByteVector.fromString("foofoofoo"); - const pattern = ByteVector.fromString("foo"); - - // Act / Assert - assert.strictEqual(bv.rFind(pattern), 6); - } - - @test - public rFind_multiByteWithOffset_noMatch() { - // Arrange - const bv = ByteVector.fromString("abcfoo"); - const pattern = ByteVector.fromString("foo"); - - // Act / Assert - assert.strictEqual(bv.rFind(pattern, 1), -1); - } - - @test - public rFind_multiByteWithOffset_withMatch() { - // Arrange - const bv = ByteVector.fromString("foofoofoo"); - const pattern = ByteVector.fromString("foo"); - - // Act / Assert - assert.strictEqual(bv.rFind(pattern, 1), 3); - } - - @test - public rFind_multiByteWithAlign_noMatch() { - // Arrange - const bv = ByteVector.fromString("0abc"); - const pattern = ByteVector.fromString("ab"); - - // Act / Assert - assert.strictEqual(bv.rFind(pattern, 0, 2), -1); - } - - @test - public rFind_multiByteWithAlign_withMatch() { - // Arrange - const bv = ByteVector.fromString("00abc"); - const pattern = ByteVector.fromString("ab"); - - // Act / Assert - assert.strictEqual(bv.rFind(pattern, 0, 2), 2); - } - - @test - public set_ReadOnly() { - // Arrange - const bv = ByteVector.fromSize(1, 0x00, true); - - // Act, Assert - assert.throws(() => { bv.set(0, 1); }); - - assert.isTrue(bv.isReadOnly); - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public set_IndexOutOfRange() { - // Arrange - const bv = ByteVector.fromSize(1, 0x00, true); - - // Act, Assert - Testers.testUint((v: number) => { bv.set(v, 1); }); - assert.throws(() => { bv.set(bv.length, 1); }); - - assert.isTrue(bv.isReadOnly); - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public set_ValueOutOfRange() { - // Arrange - const bv = ByteVector.fromSize(1, 0x00, true); - - // Act, Assert - Testers.testByte((v: number) => { bv.set(0, v); }); - - assert.isTrue(bv.isReadOnly); - assert.isFalse(bv.isEmpty); - assert.strictEqual(bv.length, 1); - assert.deepEqual(bv.data, new Uint8Array([0x00])); - } - - @test - public set_SetValue() { - // Arrange - const bv = ByteVector.fromByteArray(new Uint8Array([0x00, 0x01, 0x02])); - - // Act - bv.set(1, 0xAA); - - // Assert - assert.strictEqual(bv.length, 3); - assert.deepEqual(bv.data, new Uint8Array([0x00, 0xAA, 0x02])); - } - - @test - public split_invalidParameters() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromSize(1); - - // Act / Assert - Testers.testTruthy((v: ByteVector) => { bv.split(v); }); - Testers.testUint((v: number) => { bv.split(pattern, v); }, true); - Testers.testUint((v: number) => { bv.split(pattern, 1, v); }, true); - assert.throws(() => bv.split(pattern, 0)); - } - - @test - public split_singleByteSplit_noMatch() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromString(","); - - // Act - const output = bv.split(pattern); - - // Assert - ByteVector_VoidMethodTests.verifySplitOutput(output, ["foobarbaz"]); - } - - @test - public split_singleByteSplit_oneMatch() { - // Arrange - const bv = ByteVector.fromString("foo,baz"); - const pattern = ByteVector.fromString(","); - - // Act - const output = bv.split(pattern); - - // Assert - ByteVector_VoidMethodTests.verifySplitOutput(output, ["foo", "baz"]); - } - - @test - public split_singleByteSplit_multipleMatch() { - // Arrange - const bv = ByteVector.fromString("foo,bar,,baz"); - const pattern = ByteVector.fromString(","); - - // Act - const output = bv.split(pattern); - - // Assert - ByteVector_VoidMethodTests.verifySplitOutput(output, ["foo", "bar", "", "baz"]); - } - - @test - public split_multiByteSplit_noMatch() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromString(",,"); - - // Act - const output = bv.split(pattern); - - // Assert - ByteVector_VoidMethodTests.verifySplitOutput(output, ["foobarbaz"]); - } - - @test - public split_multiByteSplit_singleMatch() { - // Arrange - const bv = ByteVector.fromString("foo,,baz"); - const pattern = ByteVector.fromString(",,"); - - // Act - const output = bv.split(pattern); - - // Assert - ByteVector_VoidMethodTests.verifySplitOutput(output, ["foo", "baz"]); - } - - @test - public split_multiByteSplit_multipleMatch() { - // Arrange - const bv = ByteVector.fromString("foo,,bar,,,,baz"); - const pattern = ByteVector.fromString(",,"); - - // Act - const output = bv.split(pattern); - - // Assert - ByteVector_VoidMethodTests.verifySplitOutput(output, ["foo", "bar", "", "baz"]); - } - - @test - public split_singleByte_maxMatches() { - // Arrange - const bv = ByteVector.fromString("foo,bar,,baz"); - const pattern = ByteVector.fromString(","); - - // Act - const output = bv.split(pattern, undefined, 2); - - // Assert - ByteVector_VoidMethodTests.verifySplitOutput(output, ["foo", "bar,,baz"]); - } - - @test - public split_multiByteWithByteAlign_noMatch() { - // Arrange - const bv = ByteVector.fromString("foo,,bar"); - const pattern = ByteVector.fromString(",,"); - - // Act - const output = bv.split(pattern, 2); - - // Assert - ByteVector_VoidMethodTests.verifySplitOutput(output, ["foo,,bar"]); - } - - @test - public split_multiByteWithByteAlign_match() { - // Arrange - const bv = ByteVector.fromString("0foo,,bar"); - const pattern = ByteVector.fromString(",,"); - - // Act - const output = bv.split(pattern, 2); - - // Assert - ByteVector_VoidMethodTests.verifySplitOutput(output, ["0foo", "bar"]); - } - - @test - public startsWith_invalidParam() { - // Arrange - const bv = ByteVector.empty(); - - // Act / Assert - Testers.testTruthy((v: ByteVector) => { bv.startsWith(v); }); - } - - @test - public startsWith_doesStartWith() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromString("foo"); - - // Act / Assert - assert.isTrue(bv.startsWith(pattern)); - } - - @test - public startsWith_doesNotStartWith() { - // Arrange - const bv = ByteVector.fromString("foobarbaz"); - const pattern = ByteVector.fromString("fux"); - - // Act / Assert - assert.isFalse(bv.startsWith(pattern)); - } - - private static verifySplitOutput(output: ByteVector[], expected: string[]) { - assert.isOk(output); - assert.strictEqual(output.length, expected.length); - for (let i = 0; i < expected.length; i++) { - Testers.bvEqual(output[i], ByteVector.fromString(expected[i])); - } - } -} diff --git a/test-unit/combinedTagTests.ts b/test-unit/combinedTagTests.ts index 245f8db2..a505a8bd 100644 --- a/test-unit/combinedTagTests.ts +++ b/test-unit/combinedTagTests.ts @@ -4,10 +4,14 @@ import {assert} from "chai"; import ApeTag from "../src/ape/apeTag"; import CombinedTag from "../src/combinedTag"; import Id3v2Tag from "../src/id3v2/id3v2Tag"; +import PropertyTests from "./utilities/propertyTests"; +import XiphComment from "../src/xiph/xiphComment"; import {Tag, TagTypes} from "../src/tag"; -import {TagTesters} from "./utilities/testers"; +import {TagTesters, Testers} from "./utilities/testers"; +import {Mock} from "typemoq"; +import {IPicture} from "../src"; -@suite class CombinedTagTests { +@suite class CombinedTag_MethodTests { @test public constructor_noTags() { // Arrange @@ -39,7 +43,7 @@ import {TagTesters} from "./utilities/testers"; const tags = [ id3v2Tag, apeTag ]; // Act - const tag = new TestCombinedTag(tagTypes, tags); + const tag = new TestCombinedTag(tagTypes, true, tags); // Assert assert.isOk(tag); @@ -64,10 +68,10 @@ import {TagTesters} from "./utilities/testers"; id3v2Tag.album = "foobarbaz"; const apeTag = ApeTag.fromEmpty(); apeTag.title = "fuxbuxquxx"; - const nestedTag = new TestCombinedTag(TagTypes.AllTags, [id3v2Tag]); + const nestedTag = new TestCombinedTag(TagTypes.AllTags, true, [id3v2Tag]); // Act - const rootTag = new TestCombinedTag(TagTypes.AllTags, [nestedTag, apeTag]); + const rootTag = new TestCombinedTag(TagTypes.AllTags, true, [nestedTag, apeTag]); // Assert assert.isOk(rootTag); @@ -89,8 +93,8 @@ import {TagTesters} from "./utilities/testers"; id3v2Tag.album = "foobarbaz"; const apeTag = ApeTag.fromEmpty(); apeTag.title = "fuxbuxquxx"; - const nestedTag = new TestCombinedTag(TagTypes.AllTags, [id3v2Tag]); - const rootTag = new TestCombinedTag(TagTypes.AllTags, [nestedTag, apeTag]); + const nestedTag = new TestCombinedTag(TagTypes.AllTags, true, [id3v2Tag]); + const rootTag = new TestCombinedTag(TagTypes.AllTags, true, [nestedTag, apeTag]); // Act rootTag.clear(); @@ -98,6 +102,7 @@ import {TagTesters} from "./utilities/testers"; // Assert assert.isTrue(rootTag.isEmpty); assert.sameMembers(rootTag.tags, [id3v2Tag, apeTag]); + assert.isTrue(nestedTag.isEmpty); assert.isTrue(id3v2Tag.isEmpty); assert.isTrue(apeTag.isEmpty); } @@ -110,7 +115,7 @@ import {TagTesters} from "./utilities/testers"; const apeTag = ApeTag.fromEmpty(); apeTag.album = "fuxbuxquxx"; const tags = [ apeTag, id3v2Tag ]; - const tag = new TestCombinedTag(TagTypes.AllTags, tags); + const tag = new TestCombinedTag(TagTypes.AllTags, true, tags); // Act const album = tag.album; @@ -126,7 +131,7 @@ import {TagTesters} from "./utilities/testers"; id3v2Tag.album = "foobarbaz"; const apeTag = ApeTag.fromEmpty(); const tags = [ apeTag, id3v2Tag ]; - const tag = new TestCombinedTag(TagTypes.AllTags, tags); + const tag = new TestCombinedTag(TagTypes.AllTags, true, tags); // Act const album = tag.album; @@ -141,7 +146,7 @@ import {TagTesters} from "./utilities/testers"; const id3v2Tag = Id3v2Tag.fromEmpty(); const apeTag = ApeTag.fromEmpty(); const tags = [ apeTag, id3v2Tag ]; - const tag = new TestCombinedTag(TagTypes.AllTags, tags); + const tag = new TestCombinedTag(TagTypes.AllTags, true, tags); // Act const album = tag.album; @@ -160,7 +165,7 @@ import {TagTesters} from "./utilities/testers"; const apeTag = ApeTag.fromEmpty(); apeTag.performers = ["fux", "bux", "quxx"]; const tags = [ apeTag, id3v2Tag ]; - const tag = new TestCombinedTag(TagTypes.AllTags, tags); + const tag = new TestCombinedTag(TagTypes.AllTags, true, tags); // Act const performers = tag.performers; @@ -176,7 +181,7 @@ import {TagTesters} from "./utilities/testers"; id3v2Tag.performers = ["foo", "bar", "baz"]; const apeTag = ApeTag.fromEmpty(); const tags = [ apeTag, id3v2Tag ]; - const tag = new TestCombinedTag(TagTypes.AllTags, tags); + const tag = new TestCombinedTag(TagTypes.AllTags, true, tags); // Act const performers = tag.performers; @@ -191,7 +196,7 @@ import {TagTesters} from "./utilities/testers"; const id3v2Tag = Id3v2Tag.fromEmpty(); const apeTag = ApeTag.fromEmpty(); const tags = [ apeTag, id3v2Tag ]; - const tag = new TestCombinedTag(TagTypes.AllTags, tags); + const tag = new TestCombinedTag(TagTypes.AllTags, true, tags); // Act const performers = tag.performers; @@ -205,9 +210,9 @@ import {TagTesters} from "./utilities/testers"; public getTag_tagDoesNotExist() { // Arrange const id3Tag = Id3v2Tag.fromEmpty(); - const nestedTag = new TestCombinedTag(TagTypes.AllTags, [id3Tag]); + const nestedTag = new TestCombinedTag(TagTypes.AllTags, true, [id3Tag]); const apeTag = ApeTag.fromEmpty(); - const rootTag = new TestCombinedTag(TagTypes.AllTags, [nestedTag, apeTag]); + const rootTag = new TestCombinedTag(TagTypes.AllTags, true, [nestedTag, apeTag]); // Act const output = rootTag.getTag(TagTypes.Xiph); @@ -220,9 +225,9 @@ import {TagTesters} from "./utilities/testers"; public getTag_tagExistsAtRootLevel() { // Arrange const id3Tag = Id3v2Tag.fromEmpty(); - const nestedTag = new TestCombinedTag(TagTypes.AllTags, [id3Tag]); + const nestedTag = new TestCombinedTag(TagTypes.AllTags, true, [id3Tag]); const apeTag = ApeTag.fromEmpty(); - const rootTag = new TestCombinedTag(TagTypes.AllTags, [nestedTag, apeTag]); + const rootTag = new TestCombinedTag(TagTypes.AllTags, true, [nestedTag, apeTag]); // Act const output = rootTag.getTag(TagTypes.Ape); @@ -235,9 +240,9 @@ import {TagTesters} from "./utilities/testers"; public getTag_tagExistsInNestedTag() { // Arrange const id3Tag = Id3v2Tag.fromEmpty(); - const nestedTag = new TestCombinedTag(TagTypes.AllTags, [id3Tag]); + const nestedTag = new TestCombinedTag(TagTypes.AllTags, true, [id3Tag]); const apeTag = ApeTag.fromEmpty(); - const rootTag = new TestCombinedTag(TagTypes.AllTags, [nestedTag, apeTag]); + const rootTag = new TestCombinedTag(TagTypes.AllTags, true, [nestedTag, apeTag]); // Act const output = rootTag.getTag(TagTypes.Id3v2); @@ -251,7 +256,7 @@ import {TagTesters} from "./utilities/testers"; // Arrange const id3Tag = Id3v2Tag.fromEmpty(); const apeTag = ApeTag.fromEmpty(); - const tag = new TestCombinedTag(TagTypes.AllTags, [id3Tag, apeTag]); + const tag = new TestCombinedTag(TagTypes.AllTags, true, [id3Tag, apeTag]); // Act tag.removeTags(TagTypes.Xiph); @@ -267,7 +272,7 @@ import {TagTesters} from "./utilities/testers"; // Arrange const id3Tag = Id3v2Tag.fromEmpty(); const apeTag = ApeTag.fromEmpty(); - const tag = new TestCombinedTag(TagTypes.AllTags, [id3Tag, apeTag]); + const tag = new TestCombinedTag(TagTypes.AllTags, true, [id3Tag, apeTag]); // Act tag.removeTags(TagTypes.Ape); @@ -283,7 +288,7 @@ import {TagTesters} from "./utilities/testers"; // Arrange const id3Tag = Id3v2Tag.fromEmpty(); const apeTag = ApeTag.fromEmpty(); - const tag = new TestCombinedTag(TagTypes.AllTags, [id3Tag, apeTag]); + const tag = new TestCombinedTag(TagTypes.AllTags, true, [id3Tag, apeTag]); // Act tag.removeTags(TagTypes.AllTags); @@ -298,9 +303,9 @@ import {TagTesters} from "./utilities/testers"; public removeTags_nestedList_tagDoesNotExist() { // Arrange const id3Tag = Id3v2Tag.fromEmpty(); - const nestedTag = new TestCombinedTag(TagTypes.AllTags, [id3Tag]); + const nestedTag = new TestCombinedTag(TagTypes.AllTags, true, [id3Tag]); const apeTag = ApeTag.fromEmpty(); - const rootTag = new TestCombinedTag(TagTypes.AllTags, [nestedTag, apeTag]); + const rootTag = new TestCombinedTag(TagTypes.AllTags, true, [nestedTag, apeTag]); // Act rootTag.removeTags(TagTypes.Xiph); @@ -319,9 +324,9 @@ import {TagTesters} from "./utilities/testers"; public removeTags_nestedList_tagExists() { // Arrange const id3Tag = Id3v2Tag.fromEmpty(); - const nestedTag = new TestCombinedTag(TagTypes.AllTags, [id3Tag]); + const nestedTag = new TestCombinedTag(TagTypes.AllTags, true, [id3Tag]); const apeTag = ApeTag.fromEmpty(); - const rootTag = new TestCombinedTag(TagTypes.AllTags, [nestedTag, apeTag]); + const rootTag = new TestCombinedTag(TagTypes.AllTags, true, [nestedTag, apeTag]); // Act rootTag.removeTags(TagTypes.Id3v2); @@ -340,9 +345,9 @@ import {TagTesters} from "./utilities/testers"; public removeTags_nestedList_allTags() { // Arrange const id3Tag = Id3v2Tag.fromEmpty(); - const nestedTag = new TestCombinedTag(TagTypes.AllTags, [id3Tag]); + const nestedTag = new TestCombinedTag(TagTypes.AllTags, true, [id3Tag]); const apeTag = ApeTag.fromEmpty(); - const rootTag = new TestCombinedTag(TagTypes.AllTags, [nestedTag, apeTag]); + const rootTag = new TestCombinedTag(TagTypes.AllTags, true, [nestedTag, apeTag]); // Act rootTag.removeTags(TagTypes.AllTags); @@ -358,14 +363,14 @@ import {TagTesters} from "./utilities/testers"; } @test - public setAllValues() { + public setValue_writeToAll() { // Arrange const id3v2Tag = Id3v2Tag.fromEmpty(); id3v2Tag.album = "foobarbaz"; const apeTag = ApeTag.fromEmpty(); apeTag.album = "fuxbuxquxx"; const tags = [ apeTag, id3v2Tag ]; - const tag = new TestCombinedTag(TagTypes.AllTags, tags); + const tag = new TestCombinedTag(TagTypes.AllTags, true, tags); // Act tag.album = "something"; @@ -377,14 +382,33 @@ import {TagTesters} from "./utilities/testers"; } @test - public setAllUint() { + public setValue_writeToFirst() { + // Arrange + const id3v2Tag = Id3v2Tag.fromEmpty(); + id3v2Tag.album = "foobarbaz"; + const apeTag = ApeTag.fromEmpty(); + apeTag.album = "fuxbuxquxx"; + const tags = [ apeTag, id3v2Tag ]; + const tag = new TestCombinedTag(TagTypes.AllTags, false, tags); + + // Act + tag.album = "something"; + + // Assert + assert.strictEqual(tag.album, "something"); + assert.strictEqual(apeTag.album, "something"); + assert.strictEqual(id3v2Tag.album, "foobarbaz"); + } + + @test + public setUint_writeToAll() { // Arrange const id3v2Tag = Id3v2Tag.fromEmpty(); id3v2Tag.track = 123; const apeTag = ApeTag.fromEmpty(); apeTag.track = 234; const tags = [ apeTag, id3v2Tag ]; - const tag = new TestCombinedTag(TagTypes.AllTags, tags); + const tag = new TestCombinedTag(TagTypes.AllTags, true, tags); // Act tag.track = 888; @@ -396,14 +420,33 @@ import {TagTesters} from "./utilities/testers"; } @test - public setAllArray() { + public setUint_writeToFirst() { + // Arrange + const id3v2Tag = Id3v2Tag.fromEmpty(); + id3v2Tag.track = 123; + const apeTag = ApeTag.fromEmpty(); + apeTag.track = 234; + const tags = [ apeTag, id3v2Tag ]; + const tag = new TestCombinedTag(TagTypes.AllTags, false, tags); + + // Act + tag.track = 888; + + // Assert + assert.strictEqual(tag.track, 888); + assert.strictEqual(apeTag.track, 888); + assert.strictEqual(id3v2Tag.track, 123); + } + + @test + public setArray_writeToAll() { // Arrange const id3v2Tag = Id3v2Tag.fromEmpty(); id3v2Tag.performers = ["foo", "bar", "baz"]; const apeTag = ApeTag.fromEmpty(); apeTag.performers = ["fux", "bux", "quxx"]; const tags = [ apeTag, id3v2Tag ]; - const tag = new TestCombinedTag(TagTypes.AllTags, tags); + const tag = new TestCombinedTag(TagTypes.AllTags, true, tags); // Act tag.performers = ["some", "thing"]; @@ -414,10 +457,29 @@ import {TagTesters} from "./utilities/testers"; assert.sameMembers(apeTag.performers, ["some", "thing"]); } + @test + public setArray_writeToFirst() { + // Arrange + const id3v2Tag = Id3v2Tag.fromEmpty(); + id3v2Tag.performers = ["foo", "bar", "baz"]; + const apeTag = ApeTag.fromEmpty(); + apeTag.performers = ["fux", "bux", "quxx"]; + const tags = [ apeTag, id3v2Tag ]; + const tag = new TestCombinedTag(TagTypes.AllTags, false, tags); + + // Act + tag.performers = ["some", "thing"]; + + // Assert + assert.sameMembers(tag.performers, ["some", "thing"]); + assert.sameMembers(apeTag.performers, ["some", "thing"]); + assert.sameMembers(id3v2Tag.performers, ["foo", "bar", "baz"]); + } + @test public protected_addTag() { // Arrange - const tag = new TestCombinedTag(TagTypes.AllTags, []); + const tag = new TestCombinedTag(TagTypes.AllTags, true, []); const newTag = Id3v2Tag.fromEmpty(); // Act @@ -432,7 +494,7 @@ import {TagTesters} from "./utilities/testers"; @test public protected_validateTagCreation_notSupported() { // Arrange - const tag = new TestCombinedTag(TagTypes.Ape | TagTypes.Id3v2, []); + const tag = new TestCombinedTag(TagTypes.Ape | TagTypes.Id3v2, true, []); // Act / Assert assert.throws(() => tag.testValidateTagCreation(TagTypes.Xiph)); @@ -442,7 +504,7 @@ import {TagTesters} from "./utilities/testers"; public protected_validateTagCreation_alreadyExists() { // Arrange const apeTag = ApeTag.fromEmpty(); - const tag = new TestCombinedTag(TagTypes.Ape | TagTypes.Id3v2, [apeTag]); + const tag = new TestCombinedTag(TagTypes.Ape | TagTypes.Id3v2, true, [apeTag]); // Act / Assert assert.throws(() => tag.testValidateTagCreation(TagTypes.Ape)); @@ -451,19 +513,410 @@ import {TagTesters} from "./utilities/testers"; @test public protected_validateTagCreation_success() { // Arrange - const tag = new TestCombinedTag(TagTypes.Ape | TagTypes.Id3v2, []); + const tag = new TestCombinedTag(TagTypes.Ape | TagTypes.Id3v2, true, []); // Act / Assert assert.doesNotThrow(() => tag.testValidateTagCreation(TagTypes.Ape)); } } +@suite class CombinedTag_PropertyTests { + @test + public title() { + this.testTextItem((t, v) => { t.title = v; }, (t) => t.title); + } + + @test + public titleSort() { + this.testTextItem((t, v) => { t.titleSort = v; }, (t) => t.titleSort); + } + + @test + public subtitle() { + this.testTextItem((t, v) => { t.subtitle = v; }, (t) => t.subtitle); + } + + @test + public description() { + this.testTextItem((t, v) => { t.description = v; }, (t) => t.description); + } + + @test + public performers() { + this.testTextArrayItem((t, v) => { t.performers = v; }, (t) => t.performers); + } + + @test + public performersSort() { + this.testTextArrayItem((t, v) => { t.performersSort = v; }, (t) => t.performersSort); + } + + @test + public performersRole() { + this.testTextArrayItem((t, v) => { t.performersRole = v; }, (t) => t.performersRole); + } + + @test + public albumArtists() { + this.testTextArrayItem((t, v) => { t.albumArtists = v; }, (t) => t.albumArtists); + } + + @test + public albumArtistsSort() { + this.testTextArrayItem((t, v) => { t.albumArtistsSort = v; }, (t) => t.albumArtistsSort); + } + + @test + public composers() { + this.testTextArrayItem((t, v) => { t.composers = v; }, (t) => t.composers); + } + + @test + public composersSort() { + this.testTextArrayItem((t, v) => { t.composersSort = v; }, (t) => t.composersSort); + } + + @test + public album() { + this.testTextItem((t, v) => { t.album = v; }, (t) => t.album); + } + + @test + public albumSort() { + this.testTextItem((t, v) => { t.albumSort = v; }, (t) => t.albumSort); + } + + @test + public comment() { + this.testTextItem((t, v) => { t.comment = v; }, (t) => t.comment); + } + + @test + public genres() { + this.testTextArrayItem((t, v) => { t.genres = v; }, (t) => t.genres); + } + + @test + public year() { + this.testUintItem((t, v) => { t.year = v; }, (t) => t.year); + } + @test + public track() { + this.testUintItem((t, v) => { t.track = v; }, (t) => t.track); + } + + @test + public trackCount() { + this.testUintItem((t, v) => { t.trackCount = v; }, (t) => t.trackCount); + } + + @test + public disc() { + this.testUintItem((t, v) => { t.disc = v; }, (t) => t.disc); + } + + @test + public discCount() { + this.testUintItem((t, v) => { t.discCount = v; }, (t) => t.discCount); + } + + @test + public lyrics() { + this.testTextItem((t, v) => { t.lyrics = v; }, (t) => t.lyrics); + } + + @test + public grouping() { + this.testTextItem((t, v) => { t.grouping = v; }, (t) => t.grouping); + } + + @test + public beatsPerMinutes() { + this.testUintItem((t, v) => { t.beatsPerMinute = v; }, (t) => t.beatsPerMinute); + } + + @test + public conductor() { + this.testTextItem((t, v) => { t.conductor = v; }, (t) => t.conductor); + } + + @test + public copyright() { + this.testTextItem((t, v) => { t.copyright = v; }, (t) => t.copyright); + } + + @test + public dateTagged() { + // Arrange + const comment1 = XiphComment.fromEmpty(); + const comment2 = XiphComment.fromEmpty(); + const tag = new TestCombinedTag(TagTypes.None, true, [comment1, comment2]); + + const set = (v: Date) => { tag.dateTagged = v; }; + + // Act / Assert + assert.isUndefined(tag.dateTagged); + + const date = new Date("2020-04-25 12:34:56"); + PropertyTests.propertyRoundTrip(set, () => tag.dateTagged, date); + assert.deepStrictEqual(comment1.dateTagged, date); + assert.deepStrictEqual(comment2.dateTagged, date); + + PropertyTests.propertyRoundTrip(set, () => tag.dateTagged, undefined); + assert.isUndefined(comment1.dateTagged); + assert.isUndefined(comment2.dateTagged); + } + + @test + public musicBrainzArtistId() { + this.testTextItem((t, v) => { t.musicBrainzArtistId = v; }, (t) => t.musicBrainzArtistId); + } + + @test + public musicBrainzReleaseGroupId() { + this.testTextItem((t, v) => { t.musicBrainzReleaseGroupId = v; }, (t) => t.musicBrainzReleaseGroupId); + } + + @test + public musicBrainzReleaseId() { + this.testTextItem((t, v) => { t.musicBrainzReleaseId = v; }, (t) => t.musicBrainzReleaseId); + } + + @test + public musicBrainzReleaseArtistId() { + this.testTextItem((t, v) => { t.musicBrainzReleaseArtistId = v; }, (t) => t.musicBrainzReleaseArtistId); + } + + @test + public musicBrainzTrackId() { + this.testTextItem((t, v) => { t.musicBrainzTrackId = v; }, (t) => t.musicBrainzTrackId); + } + + @test + public musicBrainzDiscId() { + this.testTextItem((t, v) => { t.musicBrainzDiscId = v; }, (t) => t.musicBrainzDiscId); + } + + @test + public musicIpId() { + this.testTextItem((t, v) => { t.musicIpId = v; }, (t) => t.musicIpId); + } + + @test + public amazonId() { + this.testTextItem((t, v) => { t.amazonId = v; }, (t) => t.amazonId); + } + + @test + public musicBrainzReleaseStatus() { + this.testTextItem((t, v) => { t.musicBrainzReleaseStatus = v; }, (t) => t.musicBrainzReleaseStatus); + } + + @test + public musicBrainzReleaseType() { + this.testTextItem((t, v) => { t.musicBrainzReleaseType = v; }, (t) => t.musicBrainzReleaseType); + } + + @test + public musicBrainzReleaseCountry() { + this.testTextItem((t, v) => { t.musicBrainzReleaseCountry = v; }, (t) => t.musicBrainzReleaseCountry); + } + + @test + public replayGainTrackGain() { + this.testFloatingPointItem((t, v) => { t.replayGainTrackGain = v; }, (t) => t.replayGainTrackGain); + } + + @test + public replayGainTrackPeak() { + this.testFloatingPointItem((t, v) => { t.replayGainTrackPeak = v; }, (t) => t.replayGainTrackPeak); + } + + @test + public replayGainAlbumGain() { + this.testFloatingPointItem((t, v) => { t.replayGainAlbumGain = v; }, (t) => t.replayGainAlbumGain); + } + + @test + public replayGainAlbumPeak() { + this.testFloatingPointItem((t, v) => { t.replayGainAlbumPeak = v; }, (t) => t.replayGainAlbumPeak); + } + + @test + public pictures() { + // Arrange + const comment1 = XiphComment.fromEmpty(); + const comment2 = XiphComment.fromEmpty(); + const tag = new TestCombinedTag(TagTypes.None, true, [comment1, comment2]); + + const mockPicture1 = Mock.ofType(); + const mockPicture2 = Mock.ofType(); + + // Act / Assert + assert.ok(tag.pictures); + assert.isEmpty(tag.pictures); + + // Act 1 + tag.pictures = [mockPicture1.object, mockPicture2.object]; + + // Assert 1 + assert.sameMembers(tag.pictures, [mockPicture1.object, mockPicture2.object]); + assert.sameMembers(comment1.pictures, [mockPicture1.object, mockPicture2.object]); + assert.sameMembers(comment2.pictures, [mockPicture1.object, mockPicture2.object]); + + // Act 2 + tag.pictures = undefined; + + // Assert 2 + assert.isOk(tag.pictures); + assert.isEmpty(tag.pictures); + assert.isEmpty(comment1.pictures); + assert.isEmpty(comment2.pictures); + } + + @test + public isCompilation() { + // Arrange + const comment1 = XiphComment.fromEmpty(); + const comment2 = XiphComment.fromEmpty(); + const tag = new TestCombinedTag(TagTypes.None, true, [comment1, comment2]); + + // Assert + assert.isFalse(tag.isCompilation); + + // Act 1 + tag.isCompilation = true; + + // Assert 1 + assert.isTrue(tag.isCompilation); + assert.isTrue(comment1.isCompilation); + assert.isTrue(comment2.isCompilation); + + // Act 2 + tag.isCompilation = false; + + // Assert 2 + assert.isFalse(tag.isCompilation); + assert.isFalse(comment1.isCompilation); + assert.isFalse(comment2.isCompilation); + } + + @test + public initialKey() { + this.testTextItem((t, v) => { t.initialKey = v; }, (t) => t.initialKey); + } + + @test + public remixedBy() { + this.testTextItem((t, v) => { t.remixedBy = v; }, (t) => t.remixedBy); + } + + @test + public publisher() { + this.testTextItem((t, v) => { t.publisher = v; }, (t) => t.publisher); + } + + @test + public isrc() { + this.testTextItem((t, v) => { t.isrc = v; }, (t) => t.isrc); + } + + private testFloatingPointItem(set: (t: Tag, v: number) => void, get: (t: Tag) => number) { + // Arrange + const comment1 = XiphComment.fromEmpty(); + const comment2 = XiphComment.fromEmpty(); + const tag = new TestCombinedTag(TagTypes.None, true, [comment1, comment2]); + + const setProp = (v: number) => set(tag, v); + + // Act / Assert + // Initially empty + assert.isNaN(get(tag)); + + // Test valid values + PropertyTests.propertyRoundTrip(setProp, () => get(tag), 1.23); + assert.strictEqual(get(comment1), 1.23); + assert.strictEqual(get(comment2), 1.23); + + // Test clear + PropertyTests.propertyRoundTrip(setProp, () => get(tag), Number.NaN); + assert.isNaN(get(comment1)); + assert.isNaN(get(comment2)); + } + + private testTextArrayItem(set: (t: Tag, v: string[]) => void, get: (t: Tag) => string[]) { + // Arrange + const comment1 = XiphComment.fromEmpty(); + const comment2 = XiphComment.fromEmpty(); + const tag = new TestCombinedTag(TagTypes.None, true, [comment1, comment2]); + + const setProp = (v: string[]) => set(tag, v); + + // Act / Assert + assert.deepStrictEqual(get(tag), []); + + PropertyTests.propertyRoundTrip(setProp, () => get(tag), ["foo", "bar", "baz"]); + assert.deepStrictEqual(get(comment1), ["foo", "bar", "baz"]); + assert.deepStrictEqual(get(comment2), ["foo", "bar", "baz"]); + + PropertyTests.propertyRoundTrip(setProp, () => get(tag), []); + assert.isEmpty(get(comment1)); + assert.isEmpty(get(comment2)); + } + + private testTextItem(set: (t: Tag, v: string) => void, get: (t: Tag) => string) { + // Arrange + const comment1 = XiphComment.fromEmpty(); + const comment2 = XiphComment.fromEmpty(); + const tag = new TestCombinedTag(TagTypes.None, true, [comment1, comment2]); + + const setProp = (v: string) => set(tag, v); + + // Act / Assert + assert.isUndefined(get(tag)); + + PropertyTests.propertyRoundTrip(setProp, () => get(tag), "foo"); + assert.strictEqual(get(comment1), "foo"); + assert.strictEqual(get(comment2), "foo"); + + PropertyTests.propertyRoundTrip(setProp, () => get(tag), undefined); + assert.isUndefined(get(comment1)); + assert.isUndefined(get(comment2)); + } + + private testUintItem(set: (t: Tag, v: number) => void, get: (t: Tag) => number) { + // Arrange + const comment1 = XiphComment.fromEmpty(); + const comment2 = XiphComment.fromEmpty(); + const tag = new TestCombinedTag(TagTypes.None, true, [comment1, comment2]); + + const setProp = (v: number) => set(tag, v); + + // Act / Assert + // Initially empty + assert.strictEqual(get(tag), 0); + + // Test invalid values + Testers.testUint(setProp); + + // Test valid values + PropertyTests.propertyRoundTrip(setProp, () => get(tag), 123); + assert.strictEqual(get(comment1), 123); + assert.strictEqual(get(comment2), 123); + + // Test clear + PropertyTests.propertyRoundTrip(setProp, () => get(tag), 0); + assert.strictEqual(get(comment1), 0); + assert.strictEqual(get(comment2), 0); + } +} + class TestCombinedTag extends CombinedTag { - public constructor(supportedTagTypes: TagTypes, tags?: Tag[]) { - super(supportedTagTypes, tags); + public constructor(supportedTagTypes: TagTypes, writeToAll: boolean, tags?: Tag[]) { + super(supportedTagTypes, writeToAll, tags); } - public createTag(tagType: TagTypes, copy: boolean): Tag { + public createTag(): Tag { return undefined; } diff --git a/test-unit/fileTests.ts b/test-unit/fileTests.ts index c523b098..b69371e6 100644 --- a/test-unit/fileTests.ts +++ b/test-unit/fileTests.ts @@ -2,21 +2,22 @@ import * as TypeMoq from "typemoq"; import {suite, test} from "@testdeck/mocha"; import {assert} from "chai"; -import Properties from "../src/properties"; +import MockFile from "./utilities/testFile"; import PropertyTests from "./utilities/propertyTests"; import TestConstants from "./testConstants"; import TestStream from "./utilities/testStream"; -import {ByteVector} from "../src/byteVector"; +import {ByteVector, StringType} from "../src/byteVector"; import {File, FileAccessMode, FileTypeConstructor, FileTypeResolver, ReadStyle} from "../src/file"; import {IFileAbstraction} from "../src/fileAbstraction"; +import {Properties} from "../src/properties"; import {IStream} from "../src/stream"; import {Tag, TagTypes} from "../src/tag"; import {Testers} from "./utilities/testers"; @suite class FileTests { private static readonly chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - private readonly pattern1 = ByteVector.fromString("efg"); - private readonly pattern3 = ByteVector.fromString("bbbbba"); + private readonly pattern1 = ByteVector.fromString("efg", StringType.Latin1); + private readonly pattern3 = ByteVector.fromString("bbbbba", StringType.Latin1); private readonly length1 = Math.floor(0.75 * File.bufferSize); // Smaller than buffer size private readonly length2 = Math.floor(1.5 * File.bufferSize); // Bigger than buffer size @@ -405,7 +406,10 @@ import {Testers} from "./utilities/testers"; // f.insert(ByteVector.fromString("123"), 4, 2); // Act / Assert - assert.strictEqual(f.find(ByteVector.fromString("U")), FileTests.chars.indexOf("U")); + assert.strictEqual( + f.find(ByteVector.fromString("U", StringType.Latin1)), + FileTests.chars.indexOf("U") + ); assert.strictEqual(f.find(this.pattern1), -1); assert.strictEqual(f.find(this.pattern1, 9), -1); @@ -426,7 +430,10 @@ import {Testers} from "./utilities/testers"; public find_file2() { const testAction = (f: TestFile) => { // Act / Assert - assert.strictEqual(f.find(ByteVector.fromString("M")), FileTests.chars.indexOf("M")); + assert.strictEqual( + f.find(ByteVector.fromString("M", StringType.Latin1)), + FileTests.chars.indexOf("M") + ); assert.strictEqual(f.find(this.pattern1), -1); assert.strictEqual(f.find(this.pattern1, 3), -1); @@ -528,7 +535,10 @@ import {Testers} from "./utilities/testers"; public rFind_file1() { const testAction = (f: TestFile, d: ByteVector) => { // Act / Assert - assert.strictEqual(f.rFind(ByteVector.fromString("U")), d.data.lastIndexOf("U".charCodeAt(0))); + assert.strictEqual( + f.rFind(ByteVector.fromString("U", StringType.Latin1)), + d["_bytes"].lastIndexOf("U".charCodeAt(0)) + ); assert.strictEqual(f.rFind(this.pattern1), -1); assert.strictEqual(f.rFind(this.pattern1, 9), -1); @@ -549,7 +559,10 @@ import {Testers} from "./utilities/testers"; public rFind_file2() { const testAction = (f: TestFile, d: ByteVector) => { // Act / Assert - assert.strictEqual(f.rFind(ByteVector.fromString("M")), d.data.lastIndexOf("M".charCodeAt(0))); + assert.strictEqual( + f.rFind(ByteVector.fromString("M", StringType.Latin1)), + d["_bytes"].lastIndexOf("M".charCodeAt(0)) + ); assert.strictEqual(f.rFind(this.pattern1), -1); assert.strictEqual(f.rFind(this.pattern1, 3), -1); @@ -616,7 +629,7 @@ import {Testers} from "./utilities/testers"; // - Mode shouldn't have changed assert.strictEqual(f.mode, FileAccessMode.Closed); - // - Open the stream to verify it's contents didn't change + // - Open the stream to verify its contents didn't change f.mode = FileAccessMode.Read; Testers.bvEqual(( f.stream).data, d); }; @@ -703,15 +716,9 @@ import {Testers} from "./utilities/testers"; for (let i = 0; i < length; i++) { data.set(i, FileTests.chars.charCodeAt(i % FileTests.chars.length)); } - const stream = new TestStream(data, true); - const mockAbstraction = TypeMoq.Mock.ofType(); - mockAbstraction.setup((a) => a.readStream).returns(() => stream); - mockAbstraction.setup((a) => a.writeStream).returns(() => stream); - mockAbstraction.setup((a) => a.closeStream(TypeMoq.It.isAny())); - mockAbstraction.setup((a) => a.name).returns(() => TestConstants.testFilePath); - - const file = File.createFromAbstraction(mockAbstraction.object); + const mockAbstraction = MockFile.getFileAbstraction(data); + const file = File.createFromAbstraction(mockAbstraction); try { testAction(file, data); @@ -731,7 +738,7 @@ class TestFile extends File { public get tag(): Tag { return undefined; } - public get stream(): IStream { return this._fileStream; } + public get stream(): IStream { return this["_fileStream"]; } public getTag(_types: TagTypes, _create: boolean): Tag { throw new Error("Not implemented"); diff --git a/test-unit/flac/flacBlockTests.ts b/test-unit/flac/flacBlockTests.ts index 3d2b3e77..1850ca27 100644 --- a/test-unit/flac/flacBlockTests.ts +++ b/test-unit/flac/flacBlockTests.ts @@ -37,10 +37,10 @@ import {Testers} from "../utilities/testers"; assert.isOk(block); assert.isTrue(block.isLoaded); assert.isUndefined(block.blockStart); - assert.isTrue(ByteVector.equal(block.data, data)); + Testers.bvEqual(block.data, data); assert.strictEqual(block.dataSize, data.length); assert.isFalse(block.isLastBlock); - assert.strictEqual(block.totalSize, data.length + FlacBlock.headerSize); + assert.strictEqual(block.totalSize, data.length + FlacBlock.HEADER_SIZE); assert.strictEqual(block.type, FlacBlockType.Padding); } @@ -60,7 +60,7 @@ import {Testers} from "../utilities/testers"; // Arrange const fileBytes = ByteVector.concatenate( ByteVector.fromSize(10), - ByteVector.fromUInt(0x86123456), + ByteVector.fromUint(0x86123456), ByteVector.fromSize(10) ); const file = TestFile.getFile(fileBytes); @@ -74,7 +74,7 @@ import {Testers} from "../utilities/testers"; assert.strictEqual(block.blockStart, 10); assert.strictEqual(block.dataSize, 0x123456); assert.isTrue(block.isLastBlock); - assert.strictEqual(block.totalSize, 0x123456 + FlacBlock.headerSize); + assert.strictEqual(block.totalSize, 0x123456 + FlacBlock.HEADER_SIZE); assert.strictEqual(block.type, FlacBlockType.Picture); } @@ -83,7 +83,7 @@ import {Testers} from "../utilities/testers"; // Arrange const fileBytes = ByteVector.concatenate( ByteVector.fromSize(10), - ByteVector.fromUInt(0x06123456), + ByteVector.fromUint(0x06123456), ByteVector.fromSize(10) ); const file = TestFile.getFile(fileBytes); @@ -97,7 +97,7 @@ import {Testers} from "../utilities/testers"; assert.strictEqual(block.blockStart, 10); assert.strictEqual(block.dataSize, 0x123456); assert.isFalse(block.isLastBlock); - assert.strictEqual(block.totalSize, 0x123456 + FlacBlock.headerSize); + assert.strictEqual(block.totalSize, 0x123456 + FlacBlock.HEADER_SIZE); assert.strictEqual(block.type, FlacBlockType.Picture); } @@ -105,7 +105,7 @@ import {Testers} from "../utilities/testers"; public fromFile_loadsOnDataAccess() { // Arrange const fileBytes = ByteVector.concatenate( - ByteVector.fromUInt(0x0600000A), + ByteVector.fromUint(0x0600000A), ByteVector.fromSize(10, 0x0B) ); const file = TestFile.getFile(fileBytes); @@ -116,7 +116,7 @@ import {Testers} from "../utilities/testers"; // Assert assert.isTrue(block.isLoaded); - assert.isTrue(ByteVector.equal(data, fileBytes.mid(4))); + Testers.bvEqual(data, fileBytes.subarray(4)); } @test @@ -146,7 +146,7 @@ import {Testers} from "../utilities/testers"; 0x81, 0x00, 0x00, 0x0A, data ); - assert.isTrue(ByteVector.equal(output, expected)); + Testers.bvEqual(output, expected); } @test @@ -163,6 +163,6 @@ import {Testers} from "../utilities/testers"; 0x01, 0x00, 0x00, 0x0A, data ); - assert.isTrue(ByteVector.equal(output, expected)); + Testers.bvEqual(output, expected); } } diff --git a/test-unit/flac/flacFileTests.ts b/test-unit/flac/flacFileTests.ts index 1cb071ae..d6661e5f 100644 --- a/test-unit/flac/flacFileTests.ts +++ b/test-unit/flac/flacFileTests.ts @@ -11,7 +11,7 @@ import Id3v2Tag from "../../src/id3v2/id3v2Tag"; import XiphComment from "../../src/xiph/xiphComment"; import XiphPicture from "../../src/xiph/xiphPicture"; import {default as TestFile} from "../utilities/testFile"; -import {ByteVector} from "../../src/byteVector"; +import {ByteVector, StringType} from "../../src/byteVector"; import {FileAccessMode, ReadStyle} from "../../src/file"; import {IFileAbstraction} from "../../src/fileAbstraction"; import {Id3v2TagHeaderFlags} from "../../src/id3v2/id3v2TagHeader"; @@ -44,14 +44,14 @@ import {Picture} from "../../src"; FlacFileSettings.defaultTagTypes = TagTypes.Id3v2 | TagTypes.Ape; // Arrange - const id3v2Tag = this.getId3v2Tag(false); - const apeTag = this.getApeTag(); + const id3v2Tag = Flac_File_ConstructorTests.getId3v2Tag(false); + const apeTag = Flac_File_ConstructorTests.getApeTag(); const tagBytes = ByteVector.concatenate(id3v2Tag.render(), apeTag.render()); const fileBytes = ByteVector.concatenate( tagBytes, - this.getBasicFile() + Flac_File_ConstructorTests.getBasicFile() ); - const testAbstraction = TestFile.getFileAbstraction(fileBytes); + const testAbstraction = TestFile.getFileAbstraction(fileBytes.toByteVector()); // Act const file = new FlacFile(testAbstraction, ReadStyle.None); @@ -62,7 +62,7 @@ import {Picture} from "../../src"; assert.strictEqual(file.mediaStartPosition, tagBytes.length); assert.strictEqual(file.mediaEndPosition, fileBytes.length); - this.assertTags(file, TagTypes.Ape | TagTypes.Id3v2, TagTypes.None, false); + Flac_File_ConstructorTests.assertTags(file, TagTypes.Ape | TagTypes.Id3v2, TagTypes.None, false); this.assertApeTag(file); this.assertId3v2Tag(file); @@ -81,15 +81,15 @@ import {Picture} from "../../src"; FlacFileSettings.defaultTagTypes = TagTypes.Id3v1 | TagTypes.Id3v1 | TagTypes.Ape; // Arrange - const id3v2Tag = this.getId3v2Tag(true); - const apeTag = this.getApeTag(); - const id3v1Tag = this.getId3v1Tag(); + const id3v2Tag = Flac_File_ConstructorTests.getId3v2Tag(true); + const apeTag = Flac_File_ConstructorTests.getApeTag(); + const id3v1Tag = Flac_File_ConstructorTests.getId3v1Tag(); const tagBytes = ByteVector.concatenate(id3v2Tag.render(), apeTag.render(), id3v1Tag.render()); const fileBytes = ByteVector.concatenate( - this.getBasicFile(), + Flac_File_ConstructorTests.getBasicFile(), tagBytes ); - const testAbstraction = TestFile.getFileAbstraction(fileBytes); + const testAbstraction = TestFile.getFileAbstraction(fileBytes.toByteVector()); // Act const file = new FlacFile(testAbstraction, ReadStyle.None); @@ -100,7 +100,10 @@ import {Picture} from "../../src"; assert.strictEqual(file.mediaStartPosition, 0); assert.strictEqual(file.mediaEndPosition, fileBytes.length - tagBytes.length); - this.assertTags(file, TagTypes.None, TagTypes.Id3v1 | TagTypes.Id3v2 | TagTypes.Ape, false); + Flac_File_ConstructorTests.assertTags( + file, + TagTypes.None, TagTypes.Id3v1 | TagTypes.Id3v2 | TagTypes.Ape, + false); this.assertApeTag(file); this.assertId3v1Tag(file); this.assertId3v2Tag(file); @@ -120,9 +123,9 @@ import {Picture} from "../../src"; FlacFileSettings.defaultTagTypes = TagTypes.Xiph; // Arrange - const xiphTag = this.getXiphTag(); + const xiphTag = Flac_File_ConstructorTests.getXiphTag(); const xiphBlock = FlacBlock.fromData(FlacBlockType.XiphComment, xiphTag.render(false)); - const fileBytes = this.getBasicFile([xiphBlock]); + const fileBytes = Flac_File_ConstructorTests.getBasicFile([xiphBlock]); const testAbstraction = TestFile.getFileAbstraction(fileBytes); // Act @@ -134,8 +137,8 @@ import {Picture} from "../../src"; assert.strictEqual(file.mediaStartPosition, 0); assert.strictEqual(file.mediaEndPosition, testAbstraction.allBytes.length); - this.assertTags(file, TagTypes.None, TagTypes.None, true); - this.assertXiphTag(file); + Flac_File_ConstructorTests.assertTags(file, TagTypes.None, TagTypes.None, true); + Flac_File_ConstructorTests.assertXiphTag(file); assert.strictEqual(file.tagTypes, TagTypes.Xiph); assert.strictEqual(file.tagTypes, TagTypes.Xiph); @@ -159,7 +162,7 @@ import {Picture} from "../../src"; xiphTag2.title = "Mobile"; const xiph2Block = FlacBlock.fromData(FlacBlockType.XiphComment, xiphTag2.render(false)); - const fileBytes = this.getBasicFile([xiph1Block, xiph2Block]); + const fileBytes = Flac_File_ConstructorTests.getBasicFile([xiph1Block, xiph2Block]); const testAbstraction = TestFile.getFileAbstraction(fileBytes); // Act @@ -171,7 +174,7 @@ import {Picture} from "../../src"; assert.strictEqual(file.mediaStartPosition, 0); assert.strictEqual(file.mediaEndPosition, testAbstraction.allBytes.length); - this.assertTags(file, TagTypes.None, TagTypes.None, true); + Flac_File_ConstructorTests.assertTags(file, TagTypes.None, TagTypes.None, true); const xiphTag = file.tag.xiphComment; assert.isOk(xiphTag); assert.strictEqual(xiphTag.album, "Ascend EP"); @@ -192,12 +195,12 @@ import {Picture} from "../../src"; // Arrange const extraBlocks = [ - this.getPictureBlock(), + Flac_File_ConstructorTests.getPictureBlock(), FlacBlock.fromData(FlacBlockType.Padding, ByteVector.fromSize(10)), - this.getPictureBlock() + Flac_File_ConstructorTests.getPictureBlock() ]; - const fileBytes = this.getBasicFile(extraBlocks); + const fileBytes = Flac_File_ConstructorTests.getBasicFile(extraBlocks); const testAbstraction = TestFile.getFileAbstraction(fileBytes); // Act @@ -209,7 +212,7 @@ import {Picture} from "../../src"; assert.strictEqual(file.mediaStartPosition, 0); assert.strictEqual(file.mediaEndPosition, testAbstraction.allBytes.length); - this.assertTags(file, TagTypes.None, TagTypes.None, false); + Flac_File_ConstructorTests.assertTags(file, TagTypes.None, TagTypes.None, false); assert.strictEqual(file.tag.pictures.length, 2); assert.strictEqual(file.tagTypes, TagTypes.FlacPictures); @@ -226,11 +229,11 @@ import {Picture} from "../../src"; FlacFileSettings.defaultTagTypes = TagTypes.None; // Arrange - const id3v2Tag = this.getId3v2Tag(false); - const apeTag = this.getApeTag(); - const id3v1Tag = this.getId3v1Tag(); - const xiphTag = this.getXiphTag(); - const picBlock = this.getPictureBlock(); + const id3v2Tag = Flac_File_ConstructorTests.getId3v2Tag(false); + const apeTag = Flac_File_ConstructorTests.getApeTag(); + const id3v1Tag = Flac_File_ConstructorTests.getId3v1Tag(); + const xiphTag = Flac_File_ConstructorTests.getXiphTag(); + const picBlock = Flac_File_ConstructorTests.getPictureBlock(); const extraBlocks = [ picBlock, FlacBlock.fromData(FlacBlockType.Padding, ByteVector.fromSize(10)), @@ -241,10 +244,10 @@ import {Picture} from "../../src"; const endTagBytes = id3v1Tag.render(); const fileBytes = ByteVector.concatenate( startTagBytes, - this.getBasicFile(extraBlocks), + Flac_File_ConstructorTests.getBasicFile(extraBlocks), endTagBytes ); - const testAbstraction = TestFile.getFileAbstraction(fileBytes); + const testAbstraction = TestFile.getFileAbstraction(fileBytes.toByteVector()); // Act const file = new FlacFile(testAbstraction, ReadStyle.None); @@ -255,11 +258,11 @@ import {Picture} from "../../src"; assert.strictEqual(file.mediaStartPosition, startTagBytes.length); assert.strictEqual(file.mediaEndPosition, fileBytes.length - endTagBytes.length); - this.assertTags(file, TagTypes.Id3v2 | TagTypes.Ape, TagTypes.Id3v1, true); + Flac_File_ConstructorTests.assertTags(file, TagTypes.Id3v2 | TagTypes.Ape, TagTypes.Id3v1, true); this.assertId3v1Tag(file); this.assertId3v2Tag(file); this.assertApeTag(file); - this.assertXiphTag(file); + Flac_File_ConstructorTests.assertXiphTag(file); assert.strictEqual(file.tag.pictures.length, 1); const expectedTags = TagTypes.FlacPictures | TagTypes.Xiph | TagTypes.Id3v1 | TagTypes.Id3v2 | TagTypes.Ape; @@ -276,7 +279,7 @@ import {Picture} from "../../src"; public constructor_averageRead_doesNotHaveStreamInfoBlock() { // Arrange const fileBytes = ByteVector.concatenate( - ByteVector.fromString("fLaC"), + ByteVector.fromString("fLaC", StringType.Latin1), ByteVector.fromSize(20, 0xFF) ); const testAbstraction = TestFile.getFileAbstraction(fileBytes); @@ -288,7 +291,7 @@ import {Picture} from "../../src"; @test public constructor_averageRead_hasStreamInfo() { // Arrange - const fileBytes = this.getBasicFile(); + const fileBytes = Flac_File_ConstructorTests.getBasicFile(); const testAbstraction = TestFile.getFileAbstraction(fileBytes); // Act @@ -311,7 +314,7 @@ import {Picture} from "../../src"; // Arrange const originalDefaults = FlacFileSettings.defaultTagTypes; try { - const testAbstraction = TestFile.getFileAbstraction(this.getBasicFile()); + const testAbstraction = TestFile.getFileAbstraction(Flac_File_ConstructorTests.getBasicFile()); // Act FlacFileSettings.defaultTagTypes = TagTypes.None; @@ -335,7 +338,7 @@ import {Picture} from "../../src"; const originalApeLocation = FlacFileSettings.preferApeTagAtFileEnd; const originalId3v2Location = FlacFileSettings.preferId3v2TagAtFileEnd; try { - const fileBytes = this.getBasicFile(); + const fileBytes = Flac_File_ConstructorTests.getBasicFile(); const testAbstraction = TestFile.getFileAbstraction(fileBytes); // Act @@ -370,7 +373,7 @@ import {Picture} from "../../src"; const originalApeLocation = FlacFileSettings.preferApeTagAtFileEnd; const originalId3v2Location = FlacFileSettings.preferId3v2TagAtFileEnd; try { - const fileBytes = this.getBasicFile(); + const fileBytes = Flac_File_ConstructorTests.getBasicFile(); const testAbstraction = TestFile.getFileAbstraction(fileBytes); // Act @@ -403,7 +406,7 @@ import {Picture} from "../../src"; // Arrange const originalDefaults = FlacFileSettings.defaultTagTypes; try { - const fileBytes = this.getBasicFile(); + const fileBytes = Flac_File_ConstructorTests.getBasicFile(); const testAbstraction = TestFile.getFileAbstraction(fileBytes); // Act @@ -429,7 +432,7 @@ import {Picture} from "../../src"; @test public getTag_tagExists() { // Arrange - const fileBytes = this.getCompleteFile(); + const fileBytes = Flac_File_ConstructorTests.getCompleteFile(); const testAbstraction = TestFile.getFileAbstraction(fileBytes); const file = new FlacFile(testAbstraction, ReadStyle.None); @@ -442,7 +445,7 @@ import {Picture} from "../../src"; @test public getTag_id3v1TagDoesNotExist() { - this.getTagCreates( + Flac_File_ConstructorTests.getTagCreates( TagTypes.Id3v1, Id3v1Tag, () => false, @@ -453,7 +456,7 @@ import {Picture} from "../../src"; @test public getTag_id3v2TagDoesNotExistCreateAtFront() { - this.getTagCreates( + Flac_File_ConstructorTests.getTagCreates( TagTypes.Id3v2, Id3v2Tag, () => FlacFileSettings.preferId3v2TagAtFileEnd, @@ -464,7 +467,7 @@ import {Picture} from "../../src"; @test public getTag_id3v2TagDoesNotExistCreateAtEnd() { - this.getTagCreates( + Flac_File_ConstructorTests.getTagCreates( TagTypes.Id3v2, Id3v2Tag, () => FlacFileSettings.preferId3v2TagAtFileEnd, @@ -475,7 +478,7 @@ import {Picture} from "../../src"; @test public getTag_apeDoesNotExistCreateAtFront() { - this.getTagCreates( + Flac_File_ConstructorTests.getTagCreates( TagTypes.Ape, ApeTag, () => FlacFileSettings.preferApeTagAtFileEnd, @@ -486,7 +489,7 @@ import {Picture} from "../../src"; @test public getTag_apeDoesNotExistCreateAtEnd() { - this.getTagCreates( + Flac_File_ConstructorTests.getTagCreates( TagTypes.Ape, ApeTag, () => FlacFileSettings.preferApeTagAtFileEnd, @@ -497,7 +500,7 @@ import {Picture} from "../../src"; @test public getTag_xiphDoesNotExistCreates() { - this.getTagCreates( + Flac_File_ConstructorTests.getTagCreates( TagTypes.Xiph, XiphComment, () => false, @@ -512,7 +515,7 @@ import {Picture} from "../../src"; try { FlacFileSettings.defaultTagTypes = TagTypes.None; - const testAbstraction = TestFile.getFileAbstraction(this.getBasicFile()); + const testAbstraction = TestFile.getFileAbstraction(Flac_File_ConstructorTests.getBasicFile()); const file = new FlacFile(testAbstraction, ReadStyle.None); // Act @@ -527,9 +530,9 @@ import {Picture} from "../../src"; } } - private getTagCreates( + private static getTagCreates( tagType: TagTypes, - // tslint:disable-next-line:ban-types It's the type that assert.instanceof uses + // eslint-disable-next-line @typescript-eslint/ban-types instanceOf: Function, locationGetter: () => boolean, locationSetter: (v: boolean) => void, @@ -542,7 +545,7 @@ import {Picture} from "../../src"; FlacFileSettings.defaultTagTypes = TagTypes.None; locationSetter(createAtEnd); - const testAbstraction = TestFile.getFileAbstraction(this.getBasicFile()); + const testAbstraction = TestFile.getFileAbstraction(Flac_File_ConstructorTests.getBasicFile()); const file = new FlacFile(testAbstraction, ReadStyle.None); // Act @@ -571,7 +574,7 @@ import {Picture} from "../../src"; @test public removeTags() { // Arrange - const fileBytes = this.getCompleteFile(); + const fileBytes = Flac_File_ConstructorTests.getCompleteFile(); const testAbstraction = TestFile.getFileAbstraction(fileBytes); const file = new FlacFile(testAbstraction, ReadStyle.None); const originalTagTypes = file.tagTypes; @@ -588,7 +591,7 @@ import {Picture} from "../../src"; @test public save_noTagsOriginally_noTagsStored() { // Arrange - const fileBytes = this.getBasicFile(); + const fileBytes = Flac_File_ConstructorTests.getBasicFile(); const testAbstraction = TestFile.getFileAbstraction(fileBytes); const file = new FlacFile(testAbstraction, ReadStyle.None); file.removeTags(TagTypes.AllTags); @@ -598,7 +601,7 @@ import {Picture} from "../../src"; // Assert const paddingBlock = FlacBlock.fromData(FlacBlockType.Padding, ByteVector.fromSize(1024)); - const expectedBytes = this.getBasicFile([paddingBlock]); + const expectedBytes = Flac_File_ConstructorTests.getBasicFile([paddingBlock]); Testers.bvEqual(testAbstraction.allBytes, expectedBytes); assert.strictEqual(file.mediaStartPosition, 0); @@ -611,7 +614,7 @@ import {Picture} from "../../src"; @test public save_noTagsOriginally_addTagsAtStart() { // Arrange - const fileBytes = this.getBasicFile(); + const fileBytes = Flac_File_ConstructorTests.getBasicFile(); const testAbstraction = TestFile.getFileAbstraction(fileBytes); const file = new FlacFile(testAbstraction, ReadStyle.None); file.removeTags(TagTypes.AllTags); @@ -629,7 +632,7 @@ import {Picture} from "../../src"; const startTagBytes = file.tag.startTag.render(); const expectedBytes = ByteVector.concatenate( startTagBytes, - this.getBasicFile([paddingBlock]) + Flac_File_ConstructorTests.getBasicFile([paddingBlock]) ); Testers.bvEqual(testAbstraction.allBytes, expectedBytes); @@ -643,7 +646,7 @@ import {Picture} from "../../src"; @test public save_noTagsOriginally_addTagsAtEnd() { // Arrange - const fileBytes = this.getBasicFile(); + const fileBytes = Flac_File_ConstructorTests.getBasicFile(); const testAbstraction = TestFile.getFileAbstraction(fileBytes); const file = new FlacFile(testAbstraction, ReadStyle.None); file.removeTags(TagTypes.AllTags); @@ -662,7 +665,7 @@ import {Picture} from "../../src"; const paddingBlock = FlacBlock.fromData(FlacBlockType.Padding, ByteVector.fromSize(1024)); const endBytes = file.tag.endTag.render(); const expectedBytes = ByteVector.concatenate( - this.getBasicFile([paddingBlock]), + Flac_File_ConstructorTests.getBasicFile([paddingBlock]), endBytes ); Testers.bvEqual(testAbstraction.allBytes, expectedBytes); @@ -677,7 +680,7 @@ import {Picture} from "../../src"; @test public save_noTagsOriginally_addXiphAndPictures() { // Arrange - const fileBytes = this.getBasicFile(); + const fileBytes = Flac_File_ConstructorTests.getBasicFile(); const testAbstraction = TestFile.getFileAbstraction(fileBytes); const file = new FlacFile(testAbstraction, ReadStyle.None); file.removeTags(TagTypes.AllTags); @@ -686,8 +689,8 @@ import {Picture} from "../../src"; xiphTag.performers = ["Andy Tau"]; xiphTag.title = "Open Your Eyes"; - const pic1 = Picture.fromData(ByteVector.fromString("foobarbaz")); - const pic2 = Picture.fromData(ByteVector.fromString("fuxbuxqux")); + const pic1 = Picture.fromData(ByteVector.fromString("foobarbaz", StringType.UTF8)); + const pic2 = Picture.fromData(ByteVector.fromString("fuxbuxqux", StringType.UTF8)); file.tag.pictures = [pic1, pic2]; // Act @@ -698,7 +701,7 @@ import {Picture} from "../../src"; const picBlock1 = FlacBlock.fromData(FlacBlockType.Picture, XiphPicture.fromPicture(pic1).renderForFlacBlock()); const picBlock2 = FlacBlock.fromData(FlacBlockType.Picture, XiphPicture.fromPicture(pic2).renderForFlacBlock()); const xiphBlock = FlacBlock.fromData(FlacBlockType.XiphComment, xiphTag.render(false)); - const expectedBytes = this.getBasicFile([xiphBlock, picBlock1, picBlock2, paddingBlock]); + const expectedBytes = Flac_File_ConstructorTests.getBasicFile([xiphBlock, picBlock1, picBlock2, paddingBlock]); Testers.bvEqual(testAbstraction.allBytes, expectedBytes); assert.strictEqual(file.mediaStartPosition, 0); @@ -711,7 +714,7 @@ import {Picture} from "../../src"; @test public save_hasTagsOriginally_newBlocksSmaller() { // Arrange - const fileBytes = this.getCompleteFile(); + const fileBytes = Flac_File_ConstructorTests.getCompleteFile(); const testAbstraction = TestFile.getFileAbstraction(fileBytes); const file = new FlacFile(testAbstraction, ReadStyle.None); file.removeTags(TagTypes.Xiph | TagTypes.FlacPictures); @@ -721,15 +724,15 @@ import {Picture} from "../../src"; // Assert const paddingLength = Flac_File_ConstructorTests.standardPadding - + this.getXiphTag().render(false).length + FlacBlock.headerSize - + this.getPictureBlock().render(false).length; + + Flac_File_ConstructorTests.getXiphTag().render(false).length + FlacBlock.HEADER_SIZE + + Flac_File_ConstructorTests.getPictureBlock().render(false).length; const paddingBlock = FlacBlock.fromData(FlacBlockType.Padding, ByteVector.fromSize(paddingLength)); const startTags = file.tag.startTag.render(); const endTags = file.tag.endTag.render(); const expectedBytes = ByteVector.concatenate( startTags, - this.getBasicFile([paddingBlock]), + Flac_File_ConstructorTests.getBasicFile([paddingBlock]), endTags ); Testers.bvEqual(testAbstraction.allBytes, expectedBytes); @@ -744,7 +747,7 @@ import {Picture} from "../../src"; @test public save_hasTagsOriginally_newBlocksBigger() { // Arrange - const fileBytes = this.getCompleteFile(); + const fileBytes = Flac_File_ConstructorTests.getCompleteFile(); const testAbstraction = TestFile.getFileAbstraction(fileBytes); const file = new FlacFile(testAbstraction, ReadStyle.None); @@ -760,9 +763,9 @@ import {Picture} from "../../src"; const endTags = file.tag.endTag.render(); const expectedBytes = ByteVector.concatenate( startTags, - this.getBasicFile([ + Flac_File_ConstructorTests.getBasicFile([ FlacBlock.fromData(FlacBlockType.XiphComment, file.tag.xiphComment.render(false)), - this.getPictureBlock(), + Flac_File_ConstructorTests.getPictureBlock(), FlacBlock.fromData(FlacBlockType.Picture, XiphPicture.fromPicture(newPicture).renderForFlacBlock()), paddingBlock ]), @@ -781,7 +784,7 @@ import {Picture} from "../../src"; @test public save_hasTagsOriginally_newBlockBigger_savesAgain() { // Arrange - const fileBytes = this.getCompleteFile(); + const fileBytes = Flac_File_ConstructorTests.getCompleteFile(); const testAbstraction = TestFile.getFileAbstraction(fileBytes); const file = new FlacFile(testAbstraction, ReadStyle.None); @@ -798,9 +801,9 @@ import {Picture} from "../../src"; const endTags = file.tag.endTag.render(); const expectedBytes = ByteVector.concatenate( startTags, - this.getBasicFile([ + Flac_File_ConstructorTests.getBasicFile([ FlacBlock.fromData(FlacBlockType.XiphComment, file.tag.xiphComment.render(false)), - this.getPictureBlock(), + Flac_File_ConstructorTests.getPictureBlock(), FlacBlock.fromData(FlacBlockType.Picture, XiphPicture.fromPicture(newPicture).renderForFlacBlock()), paddingBlock ]), @@ -819,7 +822,7 @@ import {Picture} from "../../src"; // Helpers ///////////////////////////////////////////////////////////// private static readonly standardPadding = 10; - private assertTags(file: FlacFile, startTags: TagTypes, endTags: TagTypes, xiph: boolean) { + private static assertTags(file: FlacFile, startTags: TagTypes, endTags: TagTypes, xiph: boolean) { assert.isOk(file.tag); assert.instanceOf(file.tag, FlacTag); assert.isOk(file.tag.startTag); @@ -852,19 +855,19 @@ import {Picture} from "../../src"; assert.strictEqual(id3v2Tag.title, "foo"); } - private assertXiphTag(file: FlacFile) { + private static assertXiphTag(file: FlacFile) { const xiphTag = file.tag.xiphComment; assert.isOk(xiphTag); assert.strictEqual(xiphTag.amazonId, "foobarbaz"); } - private getApeTag(): ApeTag { + private static getApeTag(): ApeTag { const apeTag = ApeTag.fromEmpty(); apeTag.album = "bar"; return apeTag; } - private getId3v2Tag(isAtEndOfFile: boolean): Id3v2Tag { + private static getId3v2Tag(isAtEndOfFile: boolean): Id3v2Tag { const id3v2Tag = Id3v2Tag.fromEmpty(); id3v2Tag.version = 4; if (isAtEndOfFile) { @@ -874,48 +877,48 @@ import {Picture} from "../../src"; return id3v2Tag; } - private getId3v1Tag(): Id3v1Tag { + private static getId3v1Tag(): Id3v1Tag { const id3v1Tag = Id3v1Tag.fromEmpty(); id3v1Tag.track = 123; return id3v1Tag; } - private getPictureBlock(): FlacBlock { - const picture = Picture.fromData(ByteVector.fromString("picturedata")); + private static getPictureBlock(): FlacBlock { + const picture = Picture.fromData(ByteVector.fromString("picturedata", StringType.UTF8)); const flacPic = XiphPicture.fromPicture(picture); return FlacBlock.fromData(FlacBlockType.Picture, flacPic.renderForFlacBlock()); } - private getXiphTag(): XiphComment { + private static getXiphTag(): XiphComment { const xiphTag = XiphComment.fromEmpty(); xiphTag.amazonId = "foobarbaz"; return xiphTag; } - private getBasicFile(extraBlocks?: FlacBlock[]): ByteVector { + private static getBasicFile(extraBlocks?: FlacBlock[]): ByteVector { const streamHeaderBytes = ByteVector.concatenate( - ByteVector.fromUInt(0x12345678), - ByteVector.fromUInt(0x23456789), - ByteVector.fromUInt(0x34567890), - ByteVector.fromUInt(0x45600000), - ByteVector.fromUInt(0x00009012) + ByteVector.fromUint(0x12345678), + ByteVector.fromUint(0x23456789), + ByteVector.fromUint(0x34567890), + ByteVector.fromUint(0x45600000), + ByteVector.fromUint(0x00009012) ); const streamHeaderBlock = FlacBlock.fromData(FlacBlockType.StreamInfo, streamHeaderBytes); return ByteVector.concatenate( - ByteVector.fromString("fLaC"), + ByteVector.fromString("fLaC", StringType.UTF8), streamHeaderBlock.render(!extraBlocks), ... (extraBlocks || []).map((b, i, a) => b.render(i === a.length - 1 )), ByteVector.fromSize(100) ); } - private getCompleteFile(): ByteVector { - const id3v2Tag = this.getId3v2Tag(false); - const apeTag = this.getApeTag(); - const id3v1Tag = this.getId3v1Tag(); - const xiphTag = this.getXiphTag(); - const picBlock = this.getPictureBlock(); + private static getCompleteFile(): ByteVector { + const id3v2Tag = Flac_File_ConstructorTests.getId3v2Tag(false); + const apeTag = Flac_File_ConstructorTests.getApeTag(); + const id3v1Tag = Flac_File_ConstructorTests.getId3v1Tag(); + const xiphTag = Flac_File_ConstructorTests.getXiphTag(); + const picBlock = Flac_File_ConstructorTests.getPictureBlock(); const extraBlocks = [ picBlock, FlacBlock.fromData(FlacBlockType.Padding, ByteVector.fromSize(Flac_File_ConstructorTests.standardPadding)), @@ -926,7 +929,7 @@ import {Picture} from "../../src"; const endTagBytes = id3v1Tag.render(); return ByteVector.concatenate( startTagBytes, - this.getBasicFile(extraBlocks), + Flac_File_ConstructorTests.getBasicFile(extraBlocks), endTagBytes ); } diff --git a/test-unit/flac/flacStreamHeaderTests.ts b/test-unit/flac/flacStreamHeaderTests.ts index 3235b14b..9776ce72 100644 --- a/test-unit/flac/flacStreamHeaderTests.ts +++ b/test-unit/flac/flacStreamHeaderTests.ts @@ -3,7 +3,7 @@ import {assert} from "chai"; import FlacStreamHeader from "../../src/flac/flacStreamHeader"; import {ByteVector} from "../../src/byteVector"; -import {MediaTypes} from "../../src/iCodec"; +import {MediaTypes} from "../../src/properties"; import {Testers} from "../utilities/testers"; @suite class Flac_StreamHeaderTests { @@ -30,11 +30,11 @@ import {Testers} from "../utilities/testers"; public constructor_invalidSampleRate() { // Arrange const data = ByteVector.concatenate( - ByteVector.fromUInt(0x12345678), - ByteVector.fromUInt(0x23456789), - ByteVector.fromUInt(0x34560000), - ByteVector.fromUInt(0x05678901), - ByteVector.fromUInt(0x56789012) + ByteVector.fromUint(0x12345678), + ByteVector.fromUint(0x23456789), + ByteVector.fromUint(0x34560000), + ByteVector.fromUint(0x05678901), + ByteVector.fromUint(0x56789012) ); // Act / Assert @@ -45,11 +45,11 @@ import {Testers} from "../utilities/testers"; public constructor_nonZeroSamples() { // Arrange const data = ByteVector.concatenate( - ByteVector.fromUInt(0x12345678), - ByteVector.fromUInt(0x23456789), - ByteVector.fromUInt(0x34567890), - ByteVector.fromUInt(0x45678901), - ByteVector.fromUInt(0x56789012) + ByteVector.fromUint(0x12345678), + ByteVector.fromUint(0x23456789), + ByteVector.fromUint(0x34567890), + ByteVector.fromUint(0x45678901), + ByteVector.fromUint(0x56789012) ); // Act @@ -69,11 +69,11 @@ import {Testers} from "../utilities/testers"; public constructor_zeroSamples() { // Arrange const data = ByteVector.concatenate( - ByteVector.fromUInt(0x12345678), - ByteVector.fromUInt(0x23456789), - ByteVector.fromUInt(0x34567890), - ByteVector.fromUInt(0x45600000), - ByteVector.fromUInt(0x00009012) + ByteVector.fromUint(0x12345678), + ByteVector.fromUint(0x23456789), + ByteVector.fromUint(0x34567890), + ByteVector.fromUint(0x45600000), + ByteVector.fromUint(0x00009012) ); // Act diff --git a/test-unit/flac/flacTagTests.ts b/test-unit/flac/flacTagTests.ts index d9b82b1a..1dc9b706 100644 --- a/test-unit/flac/flacTagTests.ts +++ b/test-unit/flac/flacTagTests.ts @@ -5,12 +5,13 @@ import {It, Mock, Times} from "typemoq"; import EndTag from "../../src/sandwich/endTag"; import FlacFileSettings from "../../src/flac/flacFileSettings"; import FlacTag from "../../src/flac/flacTag"; +import Id3v1Tag from "../../src/id3v1/id3v1Tag"; import StartTag from "../../src/sandwich/startTag"; import XiphComment from "../../src/xiph/xiphComment"; import XiphPicture from "../../src/xiph/xiphPicture"; import {TagTypes} from "../../src/tag"; import {TagTesters, Testers} from "../utilities/testers"; -import {Id3v1Tag} from "../../src"; +import {NumberUtils} from "../../src/utils"; @suite class Flac_TagTests { @test @@ -105,7 +106,7 @@ import {Id3v1Tag} from "../../src"; assert.isOk(output); assert.instanceOf(output, XiphComment); assert.include(tags.tag.tags, output); - assert.isOk(tags.tag.tagTypes & TagTypes.Xiph); + assert.isTrue(NumberUtils.hasFlag(tags.tag.tagTypes, TagTypes.Xiph)); assert.strictEqual(tags.tag.xiphComment, output); } diff --git a/test-unit/id3v1/id3v1TagTests.ts b/test-unit/id3v1/id3v1TagTests.ts index 40eb2399..6e5d775c 100644 --- a/test-unit/id3v1/id3v1TagTests.ts +++ b/test-unit/id3v1/id3v1TagTests.ts @@ -1,11 +1,8 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import Id3v1Tag from "../../src/id3v1/id3v1Tag"; -// Setup Chai -const assert = Chai.assert; - @suite class Id3v1TagTests { // NOTE: These tests are just copied from the .NET implementation. ID3v1 is too simple for me // to bother writing out 100% coverage tests @@ -296,6 +293,6 @@ const assert = Chai.assert; public testRender() { const rendered = Id3v1Tag.fromEmpty().render(); assert.strictEqual(rendered.length, 128); - assert.isTrue(rendered.startsWith(Id3v1Tag.fileIdentifier)); + assert.isTrue(rendered.startsWith(Id3v1Tag.FILE_IDENTIFIER)); } } diff --git a/test-unit/id3v2/attachmentsFrameTests.ts b/test-unit/id3v2/attachmentsFrameTests.ts index f4a0b0fa..881a71c0 100644 --- a/test-unit/id3v2/attachmentsFrameTests.ts +++ b/test-unit/id3v2/attachmentsFrameTests.ts @@ -1,6 +1,6 @@ -import * as Chai from "chai"; import * as TypeMoq from "typemoq"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import AttachmentFrame from "../../src/id3v2/frames/attachmentFrame"; import FrameConstructorTests from "./frameConstructorTests"; @@ -10,23 +10,24 @@ import {ByteVector, StringType} from "../../src/byteVector"; import {Frame, FrameClassType} from "../../src/id3v2/frames/frame"; import {Id3v2FrameHeader} from "../../src/id3v2/frames/frameHeader"; import {FrameIdentifier, FrameIdentifiers} from "../../src/id3v2/frameIdentifiers"; -import {IPicture, PictureType} from "../../src/iPicture"; +import {IPicture, PictureType} from "../../src/picture"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - -function getTestFrame() { - return getCustomTestFrame( - ByteVector.fromString("foobarbaz"), - "fux", - "bux", - "application/octet-stream", - PictureType.FrontCover - ); -} - -function getCustomTestFrame(data: ByteVector, desc: string, filename: string, mimeType: string, type: PictureType) { +const getTestFrame = () => getCustomTestFrame( + ByteVector.fromString("foobarbaz", StringType.UTF8), + "fux", + "bux", + "application/octet-stream", + PictureType.FrontCover +); + +const getCustomTestFrame = ( + data: ByteVector, + desc: string, + filename: string, + mimeType: string, + type: PictureType +): AttachmentFrame => { const mockPicture = TypeMoq.Mock.ofType(); mockPicture.setup((p) => p.data).returns(() => data); mockPicture.setup((p) => p.description).returns(() => desc); @@ -55,7 +56,7 @@ function getCustomTestFrame(data: ByteVector, desc: string, filename: string, mi @test public fromPicture_validPicture() { // Arrange - const data = ByteVector.fromString("foobarbaz"); + const data = ByteVector.fromString("foobarbaz", StringType.UTF8); const mockPicture = TypeMoq.Mock.ofType(); mockPicture.setup((p) => p.data).returns(() => data); mockPicture.setup((p) => p.description).returns(() => "fux"); @@ -82,7 +83,7 @@ function getCustomTestFrame(data: ByteVector, desc: string, filename: string, mi @test public fromPicture_notAPicture() { // Arrange - const data = ByteVector.fromString("foobarbaz"); + const data = ByteVector.fromString("foobarbaz", StringType.UTF8); const mockPicture = TypeMoq.Mock.ofType(); mockPicture.setup((p) => p.data).returns(() => data); mockPicture.setup((p) => p.description).returns(() => "fux"); @@ -443,7 +444,7 @@ function getCustomTestFrame(data: ByteVector, desc: string, filename: string, mi @test public clone_fromPictureUnread() { // Arrange - const data = ByteVector.fromString("foobarbaz"); + const data = ByteVector.fromString("foobarbaz", StringType.UTF8); const mockPicture = TypeMoq.Mock.ofType(); mockPicture.setup((p) => p.data).returns(() => data); mockPicture.setup((p) => p.description).returns(() => "fux"); @@ -507,7 +508,8 @@ function getCustomTestFrame(data: ByteVector, desc: string, filename: string, mi public clone_alreadyRead() { // Arrange const frame = getTestFrame(); - const _ = frame.data; // force a raw load + // noinspection JSUnusedLocalSymbols forces a raw load + const _ = frame.data; // Act const output = frame.clone(); @@ -636,7 +638,7 @@ function getCustomTestFrame(data: ByteVector, desc: string, filename: string, mi @test public render_apicV2InvalidMimeType_correctsEncoding() { // Arrange - const data = ByteVector.fromString("fuxbuxqux"); + const data = ByteVector.fromString("fuxbuxqux", StringType.UTF8); const frame = getCustomTestFrame(data, "foo", "bar", "this/is_not/a_mimetype", PictureType.FrontCover); // Act @@ -648,7 +650,7 @@ function getCustomTestFrame(data: ByteVector, desc: string, filename: string, mi const expected = ByteVector.concatenate( header.render(2), StringType.UTF16, - ByteVector.fromString("XXX"), + ByteVector.fromString("XXX", StringType.Latin1), PictureType.FrontCover, ByteVector.fromString("foo", StringType.UTF16), ByteVector.getTextDelimiter(StringType.UTF16), @@ -660,7 +662,7 @@ function getCustomTestFrame(data: ByteVector, desc: string, filename: string, mi @test public render_apicV2ValidMimeType_correctsEncoding() { // Arrange - const data = ByteVector.fromString("fuxbuxqux"); + const data = ByteVector.fromString("fuxbuxqux", StringType.UTF8); const frame = getCustomTestFrame(data, "foo", "bar", "image/gif", PictureType.FrontCover); // Act @@ -672,7 +674,7 @@ function getCustomTestFrame(data: ByteVector, desc: string, filename: string, mi const expected = ByteVector.concatenate( header.render(2), StringType.UTF16, - ByteVector.fromString("GIF"), + ByteVector.fromString("GIF", StringType.Latin1), PictureType.FrontCover, ByteVector.fromString("foo", StringType.UTF16), ByteVector.getTextDelimiter(StringType.UTF16), @@ -684,7 +686,7 @@ function getCustomTestFrame(data: ByteVector, desc: string, filename: string, mi @test public render_apicV4() { // Arrange - const data = ByteVector.fromString("fuxbuxqux"); + const data = ByteVector.fromString("fuxbuxqux", StringType.UTF8); const frame = getCustomTestFrame(data, "foo", "bar", "image/gif", PictureType.FrontCover); // Act @@ -696,7 +698,7 @@ function getCustomTestFrame(data: ByteVector, desc: string, filename: string, mi const expected = ByteVector.concatenate( header.render(4), Id3v2Settings.defaultEncoding, - ByteVector.fromString("image/gif"), + ByteVector.fromString("image/gif", StringType.Latin1), ByteVector.getTextDelimiter(StringType.Latin1), PictureType.FrontCover, ByteVector.fromString("foo", StringType.Latin1), @@ -709,7 +711,7 @@ function getCustomTestFrame(data: ByteVector, desc: string, filename: string, mi @test public render_geobNoMimeType() { // Arrange - const data = ByteVector.fromString("fuxbuxqux"); + const data = ByteVector.fromString("fuxbuxqux", StringType.UTF8); const frame = getCustomTestFrame(data, undefined, undefined, undefined, PictureType.NotAPicture); // Act @@ -732,7 +734,7 @@ function getCustomTestFrame(data: ByteVector, desc: string, filename: string, mi @test public render_geobWithMimeType() { // Arrange - const data = ByteVector.fromString("fuxbuxqux"); + const data = ByteVector.fromString("fuxbuxqux", StringType.UTF8); const frame = getCustomTestFrame(data, undefined, undefined, "image/gif", PictureType.NotAPicture); // Act @@ -756,7 +758,7 @@ function getCustomTestFrame(data: ByteVector, desc: string, filename: string, mi @test public render_geobWithMimeTypeAndFileName() { // Arrange - const data = ByteVector.fromString("fuxbuxqux"); + const data = ByteVector.fromString("fuxbuxqux", StringType.UTF8); const frame = getCustomTestFrame(data, undefined, "file.gif", "image/gif", PictureType.NotAPicture); // Act @@ -781,7 +783,7 @@ function getCustomTestFrame(data: ByteVector, desc: string, filename: string, mi @test public render_geobWithMimeTypeAndFileNameAndDescription() { // Arrange - const data = ByteVector.fromString("fuxbuxqux"); + const data = ByteVector.fromString("fuxbuxqux", StringType.UTF8); const frame = getCustomTestFrame(data, "foobarbaz", "file.gif", "image/gif", PictureType.NotAPicture); // Act diff --git a/test-unit/id3v2/commentsFrameTests.ts b/test-unit/id3v2/commentsFrameTests.ts index 220a7011..3d180faa 100644 --- a/test-unit/id3v2/commentsFrameTests.ts +++ b/test-unit/id3v2/commentsFrameTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import CommentsFrame from "../../src/id3v2/frames/commentsFrame"; import FrameConstructorTests from "./frameConstructorTests"; @@ -11,10 +11,7 @@ import {FrameIdentifiers} from "../../src/id3v2/frameIdentifiers"; import {Id3v2FrameHeader} from "../../src/id3v2/frames/frameHeader"; import {Testers} from "../utilities/testers"; -// Setup Chai -const assert = Chai.assert; - -function getTestFrame(): CommentsFrame { +const getTestFrame = (): CommentsFrame => { const header = new Id3v2FrameHeader(FrameIdentifiers.COMM); header.frameSize = 11; const data = ByteVector.concatenate( @@ -72,7 +69,13 @@ function getTestFrame(): CommentsFrame { const frame = CommentsFrame.fromDescription(description, language); // Assert - Id3v2_CommentsFrame_ConstructorTests.validateFrame(frame, description, language, Id3v2Settings.defaultEncoding, ""); + Id3v2_CommentsFrame_ConstructorTests.validateFrame( + frame, + description, + language, + Id3v2Settings.defaultEncoding, + "" + ); } @test diff --git a/test-unit/id3v2/eventTimeCodeFrameTests.ts b/test-unit/id3v2/eventTimeCodeFrameTests.ts index 7d1a9ab5..b267e811 100644 --- a/test-unit/id3v2/eventTimeCodeFrameTests.ts +++ b/test-unit/id3v2/eventTimeCodeFrameTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import FrameConstructorTests from "./frameConstructorTests"; import PropertyTests from "../utilities/propertyTests"; @@ -11,9 +11,6 @@ import {FrameIdentifiers} from "../../src/id3v2/frameIdentifiers"; import {Testers} from "../utilities/testers"; import {EventType, TimestampFormat} from "../../src/id3v2/utilTypes"; -// Setup Chai -const assert = Chai.assert; - @suite class Id3v2_EventTimeCodeTests { @test public constructor_invalidTime() { diff --git a/test-unit/id3v2/frameFactoryTests.ts b/test-unit/id3v2/frameFactoryTests.ts index 482906e1..af483e22 100644 --- a/test-unit/id3v2/frameFactoryTests.ts +++ b/test-unit/id3v2/frameFactoryTests.ts @@ -1,6 +1,6 @@ -import * as Chai from "chai"; import * as TypeMoq from "typemoq"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import CommentsFrame from "../../src/id3v2/frames/commentsFrame"; import FrameFactory, {FrameCreator} from "../../src/id3v2/frames/frameFactory"; @@ -16,16 +16,14 @@ import {EventTimeCodeFrame} from "../../src/id3v2/frames/eventTimeCodeFrame"; import {Frame, FrameClassType} from "../../src/id3v2/frames/frame"; import {Id3v2FrameFlags, Id3v2FrameHeader} from "../../src/id3v2/frames/frameHeader"; import {FrameIdentifiers} from "../../src/id3v2/frameIdentifiers"; -import {PictureType} from "../../src/iPicture"; +import {PictureType} from "../../src/picture"; import {RelativeVolumeFrame} from "../../src/id3v2/frames/relativeVolumeFrame"; import {TextInformationFrame, UserTextInformationFrame} from "../../src/id3v2/frames/textInformationFrame"; import {SynchronizedLyricsFrame} from "../../src/id3v2/frames/synchronizedLyricsFrame"; import {UrlLinkFrame, UserUrlLinkFrame} from "../../src/id3v2/frames/urlLinkFrame"; +import {NumberUtils} from "../../src/utils"; import {SynchronizedTextType, TimestampFormat} from "../../src/id3v2/utilTypes"; -// Setup chai -const assert = Chai.assert; - @suite class FrameFactoryTests { @test public createFrame_invalidVersion() { @@ -74,7 +72,8 @@ const assert = Chai.assert; const data = ByteVector.concatenate( FrameIdentifiers.TXXX.render(4), 0x00, 0x00, 0x00, 0x0A, - (Id3v2FrameFlags.Compression & 0xFF >> 16), (Id3v2FrameFlags.Compression & 0xFF) + NumberUtils.uintRShift(NumberUtils.uintAnd(Id3v2FrameFlags.Compression, 0xFF), 16), + NumberUtils.uintAnd(Id3v2FrameFlags.Compression, 0xFF) ); // Act / Assert @@ -87,7 +86,8 @@ const assert = Chai.assert; const data = ByteVector.concatenate( FrameIdentifiers.TXXX.render(4), 0x00, 0x00, 0x00, 0x0A, - (Id3v2FrameFlags.Encryption & 0xFF >> 16), (Id3v2FrameFlags.Encryption & 0xFF) + NumberUtils.uintRShift(NumberUtils.uintAnd(Id3v2FrameFlags.Encryption, 0xFF), 16), + NumberUtils.uintAnd(Id3v2FrameFlags.Encryption, 0xFF) ); // Act / Assert @@ -336,7 +336,7 @@ const assert = Chai.assert; header.frameSize = 3; const data = ByteVector.concatenate( header.render(4), - ByteVector.fromString("foo") + ByteVector.fromString("foo", StringType.UTF8) ); // Act @@ -475,7 +475,7 @@ const assert = Chai.assert; mockCreator.verify( (c) => c( - TypeMoq.It.is((d) => ByteVector.equal(d, data)), + TypeMoq.It.is((d) => d.equals(data)), TypeMoq.It.isValue(0), TypeMoq.It.isAny(), TypeMoq.It.isValue(4) @@ -508,7 +508,7 @@ const assert = Chai.assert; mockCreator.verify( (c) => c( - TypeMoq.It.is((d) => ByteVector.equal(d, data)), + TypeMoq.It.is((d) => d.equals(data)), TypeMoq.It.isValue(0), TypeMoq.It.isAny(), TypeMoq.It.isValue(4) diff --git a/test-unit/id3v2/frameIdentifiersTests.ts b/test-unit/id3v2/frameIdentifiersTests.ts index 48c72895..c9b04934 100644 --- a/test-unit/id3v2/frameIdentifiersTests.ts +++ b/test-unit/id3v2/frameIdentifiersTests.ts @@ -1,13 +1,10 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; -import {ByteVector} from "../../src/byteVector"; +import {ByteVector, StringType} from "../../src/byteVector"; import {FrameIdentifier, FrameIdentifiers} from "../../src/id3v2/frameIdentifiers"; import {Testers} from "../utilities/testers"; -// Setup Chai -const assert = Chai.assert; - @suite class FrameIdentifierTests { @test public isTextFrame_v2StartsWithT() { @@ -112,7 +109,7 @@ const assert = Chai.assert; const output = identifier.render(2); // Assert - Testers.bvEqual(output, ByteVector.fromString("HIJ")); + Testers.bvEqual(output, ByteVector.fromString("HIJ", StringType.UTF8)); } @test @@ -124,7 +121,7 @@ const assert = Chai.assert; const output = identifier.render(3); // Assert - Testers.bvEqual(output, ByteVector.fromString("DEFG")); + Testers.bvEqual(output, ByteVector.fromString("DEFG", StringType.UTF8)); } @test @@ -136,7 +133,7 @@ const assert = Chai.assert; const output = identifier.render(4); // Assert - Testers.bvEqual(output, ByteVector.fromString("ABCD")); + Testers.bvEqual(output, ByteVector.fromString("ABCD", StringType.UTF8)); } @test diff --git a/test-unit/id3v2/frameTests.ts b/test-unit/id3v2/frameTests.ts index 43374ed9..06e21b02 100644 --- a/test-unit/id3v2/frameTests.ts +++ b/test-unit/id3v2/frameTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import PropertyTests from "../utilities/propertyTests"; import SyncData from "../../src/id3v2/syncData"; @@ -9,9 +9,6 @@ import {Id3v2FrameFlags, Id3v2FrameHeader} from "../../src/id3v2/frames/frameHea import {FrameIdentifiers} from "../../src/id3v2/frameIdentifiers"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - class TestFrame extends Frame { public static renderFieldData = ByteVector.concatenate( ByteVector.fromSize(10, 0x00), @@ -38,7 +35,7 @@ class TestFrame extends Frame { protected parseFields(_data: ByteVector, _version: number): void { /* no-op */ } protected renderFields(_version: number): ByteVector { - return ByteVector.fromByteVector(TestFrame.renderFieldData); + return TestFrame.renderFieldData; } } @@ -119,7 +116,7 @@ class TestFrame extends Frame { // Assert const expected = ByteVector.concatenate( header.render(4), - ByteVector.fromUInt(TestFrame.renderFieldData.length), + ByteVector.fromUint(TestFrame.renderFieldData.length), TestFrame.renderFieldData ); Testers.bvEqual(output, expected); @@ -152,7 +149,7 @@ class TestFrame extends Frame { const frame = new TestFrame(header); const data = ByteVector.concatenate( header.render(4), - ByteVector.fromUInt(TestFrame.renderFieldData.length), + ByteVector.fromUint(TestFrame.renderFieldData.length), TestFrame.renderFieldData ); @@ -186,10 +183,9 @@ class TestFrame extends Frame { @test public fieldData_desynchronized() { // Arrange - const fieldData = ByteVector.fromByteVector(TestFrame.renderFieldData); - SyncData.unsyncByteVector(fieldData); + let fieldData = SyncData.unsyncByteVector(TestFrame.renderFieldData); - const header = new Id3v2FrameHeader(FrameIdentifiers.TXXX, Id3v2FrameFlags.Desynchronized); + const header = new Id3v2FrameHeader(FrameIdentifiers.TXXX, Id3v2FrameFlags.Unsynchronized); header.frameSize = fieldData.length; const frame = new TestFrame(header); const data = ByteVector.concatenate( @@ -201,7 +197,7 @@ class TestFrame extends Frame { const output = frame.callFieldData(data, 0, 4, true); // Assert - SyncData.resyncByteVector(fieldData); + fieldData = SyncData.resyncByteVector(fieldData); Testers.bvEqual(output, fieldData); } diff --git a/test-unit/id3v2/id3v2TagTests.ts b/test-unit/id3v2/id3v2TagTests.ts index 1d64aea9..515d7d9a 100644 --- a/test-unit/id3v2/id3v2TagTests.ts +++ b/test-unit/id3v2/id3v2TagTests.ts @@ -1,6 +1,6 @@ -import * as Chai from "chai"; import * as TypeMoq from "typemoq"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import CommentsFrame from "../../src/id3v2/frames/commentsFrame"; import Id3v2Settings from "../../src/id3v2/id3v2Settings"; @@ -19,16 +19,14 @@ import {FrameClassType} from "../../src/id3v2/frames/frame"; import {Id3v2FrameFlags} from "../../src/id3v2/frames/frameHeader"; import {FrameIdentifier, FrameIdentifiers} from "../../src/id3v2/frameIdentifiers"; import {Id3v2TagHeader, Id3v2TagHeaderFlags} from "../../src/id3v2/id3v2TagHeader"; -import {IPicture} from "../../src/iPicture"; +import {IPicture} from "../../src/picture"; import {TagTypes} from "../../src/tag"; import {Testers} from "../utilities/testers"; import {TextInformationFrame, UserTextInformationFrame} from "../../src/id3v2/frames/textInformationFrame"; import {UrlLinkFrame} from "../../src/id3v2/frames/urlLinkFrame"; +import PrivateFrame from "../../src/id3v2/frames/privateFrame"; -// Setup Chai -const assert = Chai.assert; - -function getTestTagHeader(version: number, flags: Id3v2TagHeaderFlags, tagSize: number): ByteVector { +const getTestTagHeader = (version: number, flags: Id3v2TagHeaderFlags, tagSize: number): ByteVector => { return ByteVector.concatenate( ByteVector.fromString("ID3", StringType.Latin1), version, 0x00, @@ -81,9 +79,12 @@ function getTestTagHeader(version: number, flags: Id3v2TagHeaderFlags, tagSize: @test public fromData_v4Tag() { // Arrange - const frame1 = PlayCountFrame.fromEmpty().render(4); - const frame2 = UniqueFileIdentifierFrame.fromData("foo", ByteVector.fromString("bar")).render(4); - const emptyFrame = UnknownFrame.fromData(FrameIdentifiers.RVRB, ByteVector.empty()).render(4); + const frame1 = PlayCountFrame.fromEmpty() + .render(4); + const frame2 = UniqueFileIdentifierFrame.fromData("foo", ByteVector.fromString("bar", StringType.UTF8)) + .render(4); + const emptyFrame = UnknownFrame.fromData(FrameIdentifiers.RVRB, ByteVector.empty()) + .render(4); const data = ByteVector.concatenate( getTestTagHeader(4, Id3v2TagHeaderFlags.None, frame1.length + frame2.length + emptyFrame.length + 5), frame1, @@ -212,9 +213,12 @@ function getTestTagHeader(version: number, flags: Id3v2TagHeaderFlags, tagSize: @test public fromFileStart_v4Tag() { - const frame1 = PlayCountFrame.fromEmpty().render(4); - const frame2 = UniqueFileIdentifierFrame.fromData("foo", ByteVector.fromString("bar")).render(4); - const emptyFrame = UnknownFrame.fromData(FrameIdentifiers.RVRB, ByteVector.empty()).render(4); + const frame1 = PlayCountFrame.fromEmpty() + .render(4); + const frame2 = UniqueFileIdentifierFrame.fromData("foo", ByteVector.fromString("bar", StringType.UTF8)) + .render(4); + const emptyFrame = UnknownFrame.fromData(FrameIdentifiers.RVRB, ByteVector.empty()) + .render(4); const data = ByteVector.concatenate( 0x00, 0x00, getTestTagHeader(4, Id3v2TagHeaderFlags.None, frame1.length + frame2.length + emptyFrame.length + 5), @@ -401,7 +405,7 @@ function getTestTagHeader(version: number, flags: Id3v2TagHeaderFlags, tagSize: tmclFrame.text = tmclText; tag.frames.push(tmclFrame); tag.performers = ["alice", "bob", "malory"]; - const expected = ["saxophone;flugelhorn", "saxophone", undefined]; + const expected = ["saxophone; flugelhorn", "saxophone", undefined]; assert.deepStrictEqual(tag.performersRole, expected); const newData = ["saxophone", "flugelhorn", undefined]; @@ -1190,7 +1194,7 @@ function getTestTagHeader(version: number, flags: Id3v2TagHeaderFlags, tagSize: assert.strictEqual(tag.frames[0].frameClassType, FrameClassType.UniqueFileIdentifierFrame); assert.strictEqual(tag.frames[0].frameId, FrameIdentifiers.UFID); assert.deepStrictEqual(( tag.frames[0]).owner, "http://musicbrainz.org"); - const expectedBytes = ByteVector.fromString("abcd-ef12-3456-7890"); + const expectedBytes = ByteVector.fromString("abcd-ef12-3456-7890", StringType.UTF8); const actualBytes = ( tag.frames[0]).identifier; Testers.bvEqual(actualBytes, expectedBytes); @@ -1866,8 +1870,8 @@ function getTestTagHeader(version: number, flags: Id3v2TagHeaderFlags, tagSize: const output = tag.render(); // Assert - frame1.flags |= Id3v2FrameFlags.Desynchronized; - frame2.flags |= Id3v2FrameFlags.Desynchronized; + frame1.flags |= Id3v2FrameFlags.Unsynchronized; + frame2.flags |= Id3v2FrameFlags.Unsynchronized; const frame1Data = frame1.render(4); const frame2Data = frame2.render(4); @@ -1893,18 +1897,21 @@ function getTestTagHeader(version: number, flags: Id3v2TagHeaderFlags, tagSize: tag.version = 3; tag.flags = Id3v2TagHeaderFlags.Unsynchronization; - const frame1 = TextInformationFrame.fromIdentifier(FrameIdentifiers.TCOM); - const frame1Data = frame1.render(3); - const frame2 = TextInformationFrame.fromIdentifier(FrameIdentifiers.TCON); - const frame2Data = frame2.render(3); + const frame1 = PrivateFrame.fromOwner("foobarbaz"); + frame1.privateData = ByteVector.fromByteArray([0xAA, 0xFF, 0x00, 0xAA]); + const frame2 = PrivateFrame.fromOwner("fuxbuxqux"); + frame2.privateData = ByteVector.fromByteArray([0xAA, 0x12, 0x34, 0xAA]); tag.frames.push(frame1, frame2); // Act const output = tag.render(); // Assert - const frameData = ByteVector.concatenate(frame1Data, frame2Data); - SyncData.unsyncByteVector(frameData); + let frameData = ByteVector.concatenate( + frame1.render(3), + frame2.render(3) + ); + frameData = SyncData.unsyncByteVector(frameData); const header = new Id3v2TagHeader(); header.flags = Id3v2TagHeaderFlags.Unsynchronization; diff --git a/test-unit/id3v2/musicCdIdentifierFrameTests.ts b/test-unit/id3v2/musicCdIdentifierFrameTests.ts index 51e10fa6..45298481 100644 --- a/test-unit/id3v2/musicCdIdentifierFrameTests.ts +++ b/test-unit/id3v2/musicCdIdentifierFrameTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import FrameConstructorTests from "./frameConstructorTests"; import MusicCdIdentifierFrame from "../../src/id3v2/frames/musicCdIdentifierFrame"; @@ -10,9 +10,6 @@ import {Id3v2FrameHeader} from "../../src/id3v2/frames/frameHeader"; import {FrameIdentifiers} from "../../src/id3v2/frameIdentifiers"; import {Testers} from "../utilities/testers"; -// Setup Chai -const assert = Chai.assert; - @suite class Id3v2_MusicCdIdentifierFrameTests extends FrameConstructorTests { public get fromOffsetRawData(): (d: ByteVector, o: number, h: Id3v2FrameHeader, v: number) => Frame { return MusicCdIdentifierFrame.fromOffsetRawData; diff --git a/test-unit/id3v2/playCountFrameTests.ts b/test-unit/id3v2/playCountFrameTests.ts index 79a7193b..f0b17fed 100644 --- a/test-unit/id3v2/playCountFrameTests.ts +++ b/test-unit/id3v2/playCountFrameTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import FrameConstructorTests from "./frameConstructorTests"; import PlayCountFrame from "../../src/id3v2/frames/playCountFrame"; @@ -10,9 +10,6 @@ import {Id3v2FrameHeader} from "../../src/id3v2/frames/frameHeader"; import {FrameIdentifiers} from "../../src/id3v2/frameIdentifiers"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - @suite class Id3v2_PlayCountFrame_ConstructorTests extends FrameConstructorTests { public get fromOffsetRawData(): (d: ByteVector, o: number, h: Id3v2FrameHeader, v: number) => Frame { return PlayCountFrame.fromOffsetRawData; @@ -38,7 +35,7 @@ const assert = Chai.assert; header.frameSize = 4; const data = ByteVector.concatenate( header.render(4), - ByteVector.fromUInt(1234) + ByteVector.fromUint(1234) ); // Act @@ -55,7 +52,7 @@ const assert = Chai.assert; header.frameSize = 6; const data = ByteVector.concatenate( header.render(4), - 0x00, 0x00, ByteVector.fromUInt(1234) + 0x00, 0x00, ByteVector.fromUint(1234) ); // Act @@ -72,7 +69,7 @@ const assert = Chai.assert; header.frameSize = 8; const data = ByteVector.concatenate( header.render(4), - ByteVector.fromULong(BigInt("4294967296")) + ByteVector.fromUlong(BigInt("4294967296")) ); // Act @@ -90,7 +87,7 @@ const assert = Chai.assert; const data = ByteVector.concatenate( header.render(4), 0x00, 0x00, - ByteVector.fromULong(BigInt("4294967296")) + ByteVector.fromUlong(BigInt("4294967296")) ); // Act @@ -150,7 +147,7 @@ const assert = Chai.assert; header.frameSize = 4; const data = ByteVector.concatenate( header.render(4), - ByteVector.fromUInt(1234) + ByteVector.fromUint(1234) ); const frame = PlayCountFrame.fromRawData(data, 4); diff --git a/test-unit/id3v2/popularimeterFrameTests.ts b/test-unit/id3v2/popularimeterFrameTests.ts index 7e013d1e..51f0c2e2 100644 --- a/test-unit/id3v2/popularimeterFrameTests.ts +++ b/test-unit/id3v2/popularimeterFrameTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import FrameConstructorTests from "./frameConstructorTests"; import PopularimeterFrame from "../../src/id3v2/frames/popularimeterFrame"; @@ -10,9 +10,6 @@ import {Id3v2FrameHeader} from "../../src/id3v2/frames/frameHeader"; import {FrameIdentifiers} from "../../src/id3v2/frameIdentifiers"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - @suite class Id3v2_PopularimeterFrame_ConstructorTests extends FrameConstructorTests { public get fromOffsetRawData(): (d: ByteVector, o: number, h: Id3v2FrameHeader, v: number) => Frame { return PopularimeterFrame.fromOffsetRawData; @@ -106,7 +103,7 @@ const assert = Chai.assert; ByteVector.fromString("fux", StringType.Latin1), ByteVector.getTextDelimiter(StringType.Latin1), 0x05, - ByteVector.fromUInt(1234) + ByteVector.fromUint(1234) ); // Act @@ -126,7 +123,7 @@ const assert = Chai.assert; ByteVector.fromString("fux", StringType.Latin1), ByteVector.getTextDelimiter(StringType.Latin1), 0x05, - ByteVector.fromULong(BigInt(1234)) + ByteVector.fromUlong(BigInt(1234)) ); // Act @@ -147,7 +144,7 @@ const assert = Chai.assert; ByteVector.fromString("fux", StringType.Latin1), ByteVector.getTextDelimiter(StringType.Latin1), 0x05, - ByteVector.fromULong(BigInt(1234)) + ByteVector.fromUlong(BigInt(1234)) ); // Act @@ -316,7 +313,7 @@ const assert = Chai.assert; ByteVector.fromString("fux", StringType.Latin1), ByteVector.getTextDelimiter(StringType.Latin1), 0x05, - ByteVector.fromUInt(1234) + ByteVector.fromUint(1234) ); const frame = PopularimeterFrame.fromRawData(data, 4); diff --git a/test-unit/id3v2/privateFrameTests.ts b/test-unit/id3v2/privateFrameTests.ts index b68f7c65..344d2dd9 100644 --- a/test-unit/id3v2/privateFrameTests.ts +++ b/test-unit/id3v2/privateFrameTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import FrameConstructorTests from "./frameConstructorTests"; import PropertyTests from "../utilities/propertyTests"; @@ -10,9 +10,6 @@ import {Id3v2FrameHeader} from "../../src/id3v2/frames/frameHeader"; import {FrameIdentifiers} from "../../src/id3v2/frameIdentifiers"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - @suite class Id3v2_PrivateFrame_ConstructorTests extends FrameConstructorTests { public get fromOffsetRawData(): (d: ByteVector, o: number, h: Id3v2FrameHeader, v: number) => Frame { return PrivateFrame.fromOffsetRawData; @@ -128,7 +125,7 @@ const assert = Chai.assert; PropertyTests.propertyRoundTrip( (v) => { frame.privateData = v; }, () => frame.privateData, - ByteVector.fromString("bux") + ByteVector.fromString("bux", StringType.UTF8) ); } } diff --git a/test-unit/id3v2/relativeVolumeFrameTests.ts b/test-unit/id3v2/relativeVolumeFrameTests.ts index 024441e2..0142bccb 100644 --- a/test-unit/id3v2/relativeVolumeFrameTests.ts +++ b/test-unit/id3v2/relativeVolumeFrameTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import ConstructorTests from "./frameConstructorTests"; import PropertyTests from "../utilities/propertyTests"; @@ -10,9 +10,6 @@ import {Id3v2FrameHeader} from "../../src/id3v2/frames/frameHeader"; import {FrameIdentifiers} from "../../src/id3v2/frameIdentifiers"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - @suite class Id3v2_RelativeVolumeChannelData { @test public peakBits_setInvalidValues() { diff --git a/test-unit/id3v2/syncDataTests.ts b/test-unit/id3v2/syncDataTests.ts index c43ba187..ab6d5d77 100644 --- a/test-unit/id3v2/syncDataTests.ts +++ b/test-unit/id3v2/syncDataTests.ts @@ -1,14 +1,11 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import SyncData from "../../src/id3v2/syncData"; import TestConstants from "../testConstants"; import {ByteVector} from "../../src/byteVector"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - @suite class Id3v2_SyncDataTests { @test public fromUint_InvalidValues() { @@ -33,7 +30,55 @@ const assert = Chai.assert; assert.throws(() => { SyncData.resyncByteVector(undefined); }); } - // @TODO: resyncByteVector_validData + @test + public resyncByteVector_validData() { + // Arrange + const data = ByteVector.concatenate( + ByteVector.fromSize(10, 0xAA), + 0xFF, 0x00, 0xFF, + ByteVector.fromSize(11, 0xBB), + 0xFF, 0x00, 0xFF, + ByteVector.fromSize(9, 0xCC), + 0xFF, 0x00, 0xE5, + ByteVector.fromSize(11, 0xDD), + 0xFF, 0x00, 0xE5, + ByteVector.fromSize(9, 0xEE), + 0xFF, 0x00, 0x00, + ByteVector.fromSize(11, 0x11), + 0xFF, 0x00, 0x00, + ByteVector.fromSize(9, 0x22), + 0xFF, 0x00, 0xFF, 0x00, 0xFF, + ByteVector.fromSize(7, 0x33), + 0xFF, 0x00, 0xFF, 0x00, 0xFF, + ByteVector.fromSize(7, 0x33) + ); + + // Act + const output = SyncData.resyncByteVector(data); + + // Assert + const expected = ByteVector.concatenate( + ByteVector.fromSize(10, 0xAA), + 0xFF, 0xFF, // Aligned to 2 + ByteVector.fromSize(11, 0xBB), + 0xFF, 0xFF, // Not aligned to 2 + ByteVector.fromSize(9, 0xCC), + 0xFF, 0xE5, // Aligned, second byte is 0b111xxxxx + ByteVector.fromSize(11, 0xDD), + 0xFF, 0xE5, // Not aligned, second byte is 0b111xxxxx + ByteVector.fromSize(9, 0xEE), + 0xFF, 0x00, // Aligned, second byte is 00 + ByteVector.fromSize(11, 0x11), + 0xFF, 0x00, // Not aligned, second byte is 00 + ByteVector.fromSize(9, 0x22), + 0xFF, 0xFF, 0xFF, // Multiple bytes + ByteVector.fromSize(7, 0x33), + 0xFF, 0xFF, 0xFF, // Multiple bytes, not aligned + ByteVector.fromSize(7, 0x33) + ); + Testers.bvEqual(output, expected); + assert.isFalse(ByteVector.equals(data, expected)); + } @test public toUint_FalsyData() { @@ -83,5 +128,53 @@ const assert = Chai.assert; Testers.testTruthy((v: ByteVector) => { SyncData.unsyncByteVector(v); }); } - // @TODO: unsyncByteVector_validData + @test + public unsyncByteVector_validData() { + // Arrange + const data = ByteVector.concatenate( + ByteVector.fromSize(10, 0xAA), + 0xFF, 0xFF, // Aligned to 2 + ByteVector.fromSize(11, 0xBB), + 0xFF, 0xFF, // Not aligned to 2 + ByteVector.fromSize(9, 0xCC), + 0xFF, 0xE5, // Aligned, second byte is 0b111xxxxx + ByteVector.fromSize(11, 0xDD), + 0xFF, 0xE5, // Not aligned, second byte is 0b111xxxxx + ByteVector.fromSize(9, 0xEE), + 0xFF, 0x00, // Aligned, second byte is 00 + ByteVector.fromSize(11, 0x11), + 0xFF, 0x00, // Not aligned, second byte is 00 + ByteVector.fromSize(9, 0x22), + 0xFF, 0xFF, 0xFF, // Multiple bytes + ByteVector.fromSize(7, 0x33), + 0xFF, 0xFF, 0xFF, // Multiple bytes, not aligned + ByteVector.fromSize(7, 0x33) + ); + + // Act + const output = SyncData.unsyncByteVector(data); + + // Assert + const expected = ByteVector.concatenate( + ByteVector.fromSize(10, 0xAA), + 0xFF, 0x00, 0xFF, + ByteVector.fromSize(11, 0xBB), + 0xFF, 0x00, 0xFF, + ByteVector.fromSize(9, 0xCC), + 0xFF, 0x00, 0xE5, + ByteVector.fromSize(11, 0xDD), + 0xFF, 0x00, 0xE5, + ByteVector.fromSize(9, 0xEE), + 0xFF, 0x00, 0x00, + ByteVector.fromSize(11, 0x11), + 0xFF, 0x00, 0x00, + ByteVector.fromSize(9, 0x22), + 0xFF, 0x00, 0xFF, 0x00, 0xFF, + ByteVector.fromSize(7, 0x33), + 0xFF, 0x00, 0xFF, 0x00, 0xFF, + ByteVector.fromSize(7, 0x33) + ); + Testers.bvEqual(output, expected); + assert.isFalse(ByteVector.equals(data, expected)); + } } diff --git a/test-unit/id3v2/synchronizedLyricsFrameTests.ts b/test-unit/id3v2/synchronizedLyricsFrameTests.ts index ad23f81d..1432b0ec 100644 --- a/test-unit/id3v2/synchronizedLyricsFrameTests.ts +++ b/test-unit/id3v2/synchronizedLyricsFrameTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import FrameConstructorTests from "./frameConstructorTests"; import Id3v2Settings from "../../src/id3v2/id3v2Settings"; @@ -12,10 +12,6 @@ import {SynchronizedLyricsFrame, SynchronizedText} from "../../src/id3v2/frames/ import {Testers} from "../utilities/testers"; import {SynchronizedTextType, TimestampFormat} from "../../src/id3v2/utilTypes"; - -// Setup chai -const assert = Chai.assert; - @suite class Id3v2_SynchronizedTextTests { @test public synchronizedText_construct() { @@ -39,7 +35,7 @@ const assert = Chai.assert; const expected = ByteVector.concatenate( ByteVector.fromString(text.text, StringType.UTF16BE), ByteVector.getTextDelimiter(StringType.UTF16BE), - ByteVector.fromUInt(text.time), + ByteVector.fromUint(text.time), ); Testers.bvEqual(output, expected); } diff --git a/test-unit/id3v2/tagExtendedHeaderTests.ts b/test-unit/id3v2/tagExtendedHeaderTests.ts index 8eec1f99..1552341b 100644 --- a/test-unit/id3v2/tagExtendedHeaderTests.ts +++ b/test-unit/id3v2/tagExtendedHeaderTests.ts @@ -1,13 +1,10 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import Id3v2ExtendedHeader from "../../src/id3v2/id3v2ExtendedHeader"; import {ByteVector} from "../../src/byteVector"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - @suite class Id3v2_TagExtendedHeaderTests { @test public fromData_falsyData() { diff --git a/test-unit/id3v2/tagFooterTests.ts b/test-unit/id3v2/tagFooterTests.ts index c74a20ed..4e95bf16 100644 --- a/test-unit/id3v2/tagFooterTests.ts +++ b/test-unit/id3v2/tagFooterTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import TestConstants from "../testConstants"; import Id3v2TagFooter from "../../src/id3v2/id3v2TagFooter"; @@ -8,12 +8,9 @@ import {ByteVector} from "../../src/byteVector"; import {Id3v2TagHeaderFlags} from "../../src/id3v2/id3v2TagHeader"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - const getTestFooter = (majorVersion: number, minorVersion: number, flags: Id3v2TagHeaderFlags): Id3v2TagFooter => { const data = ByteVector.concatenate( - Id3v2TagFooter.fileIdentifier, + Id3v2TagFooter.FILE_IDENTIFIER, majorVersion, minorVersion, flags, @@ -51,7 +48,7 @@ const getTestFooter = (majorVersion: number, minorVersion: number, flags: Id3v2T public fromData_invalidFlags_version4() { // Arrange const data = ByteVector.concatenate( - Id3v2TagFooter.fileIdentifier, + Id3v2TagFooter.FILE_IDENTIFIER, 0x04, 0x00, 0x07 ); @@ -63,7 +60,7 @@ const getTestFooter = (majorVersion: number, minorVersion: number, flags: Id3v2T public fromData_invalidTagSizeBytes() { // Arrange const testData = ByteVector.concatenate( - Id3v2TagFooter.fileIdentifier, + Id3v2TagFooter.FILE_IDENTIFIER, 0x04, 0x00, 0x00 ); const testData1 = ByteVector.concatenate(testData, 0x80, 0x00, 0x00, 0x00); @@ -85,7 +82,7 @@ const getTestFooter = (majorVersion: number, minorVersion: number, flags: Id3v2T const minorVersion = 0x00; const flags = 0xE0; const testData = ByteVector.concatenate( - Id3v2TagFooter.fileIdentifier, + Id3v2TagFooter.FILE_IDENTIFIER, majorVersion, minorVersion, flags, @@ -216,7 +213,7 @@ const getTestFooter = (majorVersion: number, minorVersion: number, flags: Id3v2T const minorVersion = 0x00; const flags = 0xE0; const testData = ByteVector.concatenate( - Id3v2TagFooter.fileIdentifier, + Id3v2TagFooter.FILE_IDENTIFIER, majorVersion, minorVersion, flags, diff --git a/test-unit/id3v2/tagHeaderTests.ts b/test-unit/id3v2/tagHeaderTests.ts index 2ddb6b22..cd776adf 100644 --- a/test-unit/id3v2/tagHeaderTests.ts +++ b/test-unit/id3v2/tagHeaderTests.ts @@ -1,18 +1,16 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import Id3v2Settings from "../../src/id3v2/id3v2Settings"; import TestConstants from "../testConstants"; import {ByteVector} from "../../src/byteVector"; import {Id3v2TagHeader, Id3v2TagHeaderFlags} from "../../src/id3v2/id3v2TagHeader"; import {Testers} from "../utilities/testers"; - -// Setup chai -const assert = Chai.assert; +import {NumberUtils} from "../../src/utils"; const getTestHeader = (majorVersion: number, minorVersion: number, flags: Id3v2TagHeaderFlags): Id3v2TagHeader => { const data = ByteVector.concatenate( - Id3v2TagHeader.fileIdentifier, + Id3v2TagHeader.FILE_IDENTIFIER, majorVersion, minorVersion, flags, @@ -49,7 +47,7 @@ const getTestHeader = (majorVersion: number, minorVersion: number, flags: Id3v2T public invalidFlagsForVersion2() { // Arrange const testData = ByteVector.concatenate( - Id3v2TagHeader.fileIdentifier, + Id3v2TagHeader.FILE_IDENTIFIER, 0x02, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00 @@ -63,7 +61,7 @@ const getTestHeader = (majorVersion: number, minorVersion: number, flags: Id3v2T public invalidFlagsForVersion3() { // Arrange const testData = ByteVector.concatenate( - Id3v2TagHeader.fileIdentifier, + Id3v2TagHeader.FILE_IDENTIFIER, 0x03, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00 @@ -77,7 +75,7 @@ const getTestHeader = (majorVersion: number, minorVersion: number, flags: Id3v2T public invalidFlagsForVersion4() { // Arrange const testData = ByteVector.concatenate( - Id3v2TagHeader.fileIdentifier, + Id3v2TagHeader.FILE_IDENTIFIER, 0x04, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00 @@ -91,7 +89,7 @@ const getTestHeader = (majorVersion: number, minorVersion: number, flags: Id3v2T public invalidTagSizeBytes() { // Arrange const testData = ByteVector.concatenate( - Id3v2TagHeader.fileIdentifier, + Id3v2TagHeader.FILE_IDENTIFIER, 0x04, 0x00, 0x00 ); @@ -114,7 +112,7 @@ const getTestHeader = (majorVersion: number, minorVersion: number, flags: Id3v2T const minorVersion = 0x00; const flags = 0xE0; const testData = ByteVector.concatenate( - Id3v2TagHeader.fileIdentifier, + Id3v2TagHeader.FILE_IDENTIFIER, majorVersion, minorVersion, flags, @@ -136,7 +134,7 @@ const getTestHeader = (majorVersion: number, minorVersion: number, flags: Id3v2T @test public getFileIdentifier() { // Act - const output = Id3v2TagHeader.fileIdentifier; + const output = Id3v2TagHeader.FILE_IDENTIFIER; // Assert assert.ok(output); @@ -276,7 +274,7 @@ const getTestHeader = (majorVersion: number, minorVersion: number, flags: Id3v2T // Assert assert.equal(header.majorVersion, 2); - assert.equal(header.flags & flags, 0); + assert.isFalse(NumberUtils.hasFlag(header.flags, flags)); } @test @@ -290,7 +288,7 @@ const getTestHeader = (majorVersion: number, minorVersion: number, flags: Id3v2T // Assert assert.equal(header.majorVersion, 3); - assert.equal(header.flags & flags, 0); + assert.isFalse(NumberUtils.hasFlag(header.flags, flags)); } @test @@ -345,7 +343,7 @@ const getTestHeader = (majorVersion: number, minorVersion: number, flags: Id3v2T const minorVersion = 0x00; const flags = 0xE0; const testData = ByteVector.concatenate( - Id3v2TagHeader.fileIdentifier, + Id3v2TagHeader.FILE_IDENTIFIER, majorVersion, minorVersion, flags, diff --git a/test-unit/id3v2/termsOfUseFrameTests.ts b/test-unit/id3v2/termsOfUseFrameTests.ts index 0df18ca2..8169e574 100644 --- a/test-unit/id3v2/termsOfUseFrameTests.ts +++ b/test-unit/id3v2/termsOfUseFrameTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import FrameConstructorTests from "./frameConstructorTests"; import Id3v2Settings from "../../src/id3v2/id3v2Settings"; @@ -11,9 +11,6 @@ import {Id3v2FrameHeader} from "../../src/id3v2/frames/frameHeader"; import {FrameIdentifiers} from "../../src/id3v2/frameIdentifiers"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - @suite class Id3v2_TermsOfUseFrame_ConstructorTests extends FrameConstructorTests { public get fromOffsetRawData(): (d: ByteVector, o: number, h: Id3v2FrameHeader, v: number) => Frame { return TermsOfUseFrame.fromOffsetRawData; diff --git a/test-unit/id3v2/textInformationFrameTests.ts b/test-unit/id3v2/textInformationFrameTests.ts index 0c59ed03..07a12966 100644 --- a/test-unit/id3v2/textInformationFrameTests.ts +++ b/test-unit/id3v2/textInformationFrameTests.ts @@ -1,5 +1,7 @@ -import * as Chai from "chai"; +// noinspection JSUnusedLocalSymbols Used extensibely to force a read + import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import FrameConstructorTests from "./frameConstructorTests"; import Id3v2Settings from "../../src/id3v2/id3v2Settings"; @@ -11,10 +13,7 @@ import {Id3v2FrameHeader} from "../../src/id3v2/frames/frameHeader"; import {FrameIdentifier, FrameIdentifiers} from "../../src/id3v2/frameIdentifiers"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - -function getTestFrame(): TextInformationFrame { +const getTestFrame = (): TextInformationFrame => { const header = new Id3v2FrameHeader(FrameIdentifiers.TCOP); header.frameSize = 8; const data = ByteVector.concatenate( diff --git a/test-unit/id3v2/uniqueFileIdentifierFrameTests.ts b/test-unit/id3v2/uniqueFileIdentifierFrameTests.ts index aada30d0..f3261d42 100644 --- a/test-unit/id3v2/uniqueFileIdentifierFrameTests.ts +++ b/test-unit/id3v2/uniqueFileIdentifierFrameTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import FrameConstructorTests from "./frameConstructorTests"; import PropertyTests from "../utilities/propertyTests"; @@ -10,11 +10,8 @@ import {Id3v2FrameHeader} from "../../src/id3v2/frames/frameHeader"; import {FrameIdentifiers} from "../../src/id3v2/frameIdentifiers"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - // Test constants -const testIdentifier = ByteVector.fromString("foobarbaz"); +const testIdentifier = ByteVector.fromString("foobarbaz", StringType.UTF8); const testOwner = "https://github.com/benrr101/node-taglib-sharp"; @suite class Id3v2_UniqueFileIdentifierFrame_ConstructorTests extends FrameConstructorTests { @@ -106,7 +103,7 @@ const testOwner = "https://github.com/benrr101/node-taglib-sharp"; const data = ByteVector.concatenate( header.render(4), 0x0, 0x0, - ByteVector.fromString(testOwner), + ByteVector.fromString(testOwner, StringType.UTF8), ByteVector.getTextDelimiter(StringType.Latin1), testIdentifier ); @@ -164,7 +161,7 @@ const testOwner = "https://github.com/benrr101/node-taglib-sharp"; header.frameSize = 55; const data = ByteVector.concatenate( header.render(4), - ByteVector.fromString(testOwner), + ByteVector.fromString(testOwner, StringType.UTF8), ByteVector.getTextDelimiter(StringType.Latin1), testIdentifier ); @@ -205,7 +202,7 @@ const testOwner = "https://github.com/benrr101/node-taglib-sharp"; public setIdentifier_valid() { // Arrange const frame = UniqueFileIdentifierFrame.fromData("fuxqux", ByteVector.fromSize(1)); - const identifier = ByteVector.fromString("quxx"); + const identifier = ByteVector.fromString("quxx", StringType.UTF8); // Act / Assert PropertyTests.propertyRoundTrip((v) => { frame.identifier = v; }, () => frame.identifier, identifier); @@ -264,7 +261,7 @@ const testOwner = "https://github.com/benrr101/node-taglib-sharp"; @test public clone_withIdentifier() { // Arrange - const frame = UniqueFileIdentifierFrame.fromData("fux", ByteVector.fromString("qux")); + const frame = UniqueFileIdentifierFrame.fromData("fux", ByteVector.fromString("qux", StringType.UTF8)); // Act const clone = frame.clone(); @@ -285,7 +282,7 @@ const testOwner = "https://github.com/benrr101/node-taglib-sharp"; header.frameSize = 55; const data = ByteVector.concatenate( header.render(4), - ByteVector.fromString(testOwner), + ByteVector.fromString(testOwner, StringType.UTF8), ByteVector.getTextDelimiter(StringType.Latin1), testIdentifier ); diff --git a/test-unit/id3v2/unknownFrameTests.ts b/test-unit/id3v2/unknownFrameTests.ts index 270cd8b1..048c3702 100644 --- a/test-unit/id3v2/unknownFrameTests.ts +++ b/test-unit/id3v2/unknownFrameTests.ts @@ -1,17 +1,14 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import FrameConstructorTests from "./frameConstructorTests"; import UnknownFrame from "../../src/id3v2/frames/unknownFrame"; -import {ByteVector} from "../../src/byteVector"; +import {ByteVector, StringType} from "../../src/byteVector"; import {Frame, FrameClassType} from "../../src/id3v2/frames/frame"; import {Id3v2FrameHeader} from "../../src/id3v2/frames/frameHeader"; import {FrameIdentifier, FrameIdentifiers} from "../../src/id3v2/frameIdentifiers"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - @suite class Id3v2_UnknownFrame_ConstructorTests extends FrameConstructorTests { public get fromOffsetRawData(): (d: ByteVector, o: number, h: Id3v2FrameHeader, v: number) => Frame { return UnknownFrame.fromOffsetRawData; @@ -55,7 +52,7 @@ const assert = Chai.assert; public fromData_withData_frameHasData() { // Arrange const frameType = FrameIdentifiers.WXXX; - const data = ByteVector.fromString("fux qux quxx"); + const data = ByteVector.fromString("fux qux quxx", StringType.UTF8); // Act const frame = UnknownFrame.fromData(frameType, data); @@ -72,14 +69,18 @@ const assert = Chai.assert; const data = ByteVector.concatenate( header.render(4), 0x0, 0x0, - ByteVector.fromString("foo bar baz") + ByteVector.fromString("foo bar baz", StringType.UTF8) ); // Act const frame = UnknownFrame.fromOffsetRawData(data, 2, header, 4); // Assert - Id3v2_UnknownFrame_ConstructorTests.assertFrame(frame, FrameIdentifiers.WXXX, ByteVector.fromString("foo bar baz")); + Id3v2_UnknownFrame_ConstructorTests.assertFrame( + frame, + FrameIdentifiers.WXXX, + ByteVector.fromString("foo bar baz", StringType.UTF8) + ); } @test @@ -89,14 +90,18 @@ const assert = Chai.assert; header.frameSize = 11; const data = ByteVector.concatenate( header.render(4), - ByteVector.fromString("foo bar baz") + ByteVector.fromString("foo bar baz", StringType.UTF8) ); // Act const frame = UnknownFrame.fromRawData(data, 4); // Assert - Id3v2_UnknownFrame_ConstructorTests.assertFrame(frame, FrameIdentifiers.WXXX, ByteVector.fromString("foo bar baz")); + Id3v2_UnknownFrame_ConstructorTests.assertFrame( + frame, + FrameIdentifiers.WXXX, + ByteVector.fromString("foo bar baz", StringType.UTF8) + ); } private static assertFrame(frame: UnknownFrame, fi: FrameIdentifier, d: ByteVector) { @@ -120,7 +125,7 @@ const assert = Chai.assert; header.frameSize = 11; const data = ByteVector.concatenate( header.render(4), - ByteVector.fromString("foo bar baz") + ByteVector.fromString("foo bar baz", StringType.UTF8) ); const frame = UnknownFrame.fromRawData(data, 4); @@ -142,7 +147,7 @@ const assert = Chai.assert; header.frameSize = 11; const data = ByteVector.concatenate( header.render(4), - ByteVector.fromString("foo bar baz") + ByteVector.fromString("foo bar baz", StringType.UTF8) ); const frame = UnknownFrame.fromRawData(data, 4); diff --git a/test-unit/id3v2/unsynchronizedLyricsFrameTests.ts b/test-unit/id3v2/unsynchronizedLyricsFrameTests.ts index 8e5fc53b..8b7b6ca2 100644 --- a/test-unit/id3v2/unsynchronizedLyricsFrameTests.ts +++ b/test-unit/id3v2/unsynchronizedLyricsFrameTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import FrameConstructorTests from "./frameConstructorTests"; import PropertyTests from "../utilities/propertyTests"; @@ -10,9 +10,6 @@ import {Id3v2FrameHeader} from "../../src/id3v2/frames/frameHeader"; import {FrameIdentifiers} from "../../src/id3v2/frameIdentifiers"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - const getTestFrameData = (): ByteVector => { const header = new Id3v2FrameHeader(FrameIdentifiers.USLT); header.frameSize = 11; @@ -21,9 +18,9 @@ const getTestFrameData = (): ByteVector => { header.render(4), // Header StringType.Latin1, // Encoding ByteVector.fromString("eng", StringType.Latin1), // Language - ByteVector.fromString("foo"), // Description + ByteVector.fromString("foo", StringType.UTF8), // Description ByteVector.getTextDelimiter(StringType.Latin1), // Delimiter - ByteVector.fromString("bar") // Content + ByteVector.fromString("bar", StringType.UTF8) // Content ); }; @@ -65,7 +62,7 @@ const getTestUnsynchronizedLyricsFrame = (): UnsynchronizedLyricsFrame => { header.render(4), // Header StringType.Latin1, // Encoding ByteVector.fromString("eng", StringType.Latin1), // Language - ByteVector.fromString("foo") // Content + ByteVector.fromString("foo", StringType.UTF8) // Content ); // Act @@ -85,9 +82,9 @@ const getTestUnsynchronizedLyricsFrame = (): UnsynchronizedLyricsFrame => { header.render(4), // Header StringType.Latin1, // Encoding ByteVector.fromString("eng", StringType.Latin1), // Language - ByteVector.fromString("foo"), // Description + ByteVector.fromString("foo", StringType.UTF8), // Description ByteVector.getTextDelimiter(StringType.Latin1), // Delimiter - ByteVector.fromString("bar") // Content + ByteVector.fromString("bar", StringType.UTF8) // Content ); // Act @@ -106,7 +103,7 @@ const getTestUnsynchronizedLyricsFrame = (): UnsynchronizedLyricsFrame => { header.render(4), // Header StringType.Latin1, // Encoding ByteVector.fromString("eng", StringType.Latin1), // Language - ByteVector.fromString("foo") // Content + ByteVector.fromString("foo", StringType.UTF8) // Content ); // Act @@ -125,9 +122,9 @@ const getTestUnsynchronizedLyricsFrame = (): UnsynchronizedLyricsFrame => { header.render(4), // Header StringType.Latin1, // Encoding ByteVector.fromString("eng", StringType.Latin1), // Language - ByteVector.fromString("foo"), // Description + ByteVector.fromString("foo", StringType.UTF8), // Description ByteVector.getTextDelimiter(StringType.Latin1), // Delimiter - ByteVector.fromString("bar") // Content + ByteVector.fromString("bar", StringType.UTF8) // Content ); // Act diff --git a/test-unit/id3v2/urlLinkFrameTests.ts b/test-unit/id3v2/urlLinkFrameTests.ts index 527343fa..3055eec0 100644 --- a/test-unit/id3v2/urlLinkFrameTests.ts +++ b/test-unit/id3v2/urlLinkFrameTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import FrameConstructorTests from "./frameConstructorTests"; import PropertyTests from "../utilities/propertyTests"; @@ -11,9 +11,6 @@ import {FrameIdentifier, FrameIdentifiers} from "../../src/id3v2/frameIdentifier import {Testers} from "../utilities/testers"; import {UrlLinkFrame} from "../../src/id3v2/frames/urlLinkFrame"; -// Setup chai -const assert = Chai.assert; - const getTestFrameData = (): ByteVector => { const header = new Id3v2FrameHeader(FrameIdentifiers.WXXX); header.frameSize = 8; @@ -21,9 +18,9 @@ const getTestFrameData = (): ByteVector => { return ByteVector.concatenate( header.render(4), StringType.Latin1, - ByteVector.fromString("foo", StringType.Latin1, undefined, true), + ByteVector.fromString("foo", StringType.Latin1), ByteVector.getTextDelimiter(StringType.Latin1), - ByteVector.fromString("bar", StringType.Latin1, undefined, true) + ByteVector.fromString("bar", StringType.Latin1) ); }; @@ -64,7 +61,7 @@ const getTestUrlLinkFrame = (): UrlLinkFrame => { const data = ByteVector.concatenate( header.render(4), 0x00, 0x00, - ByteVector.fromString("foobar", StringType.Latin1, undefined, true), + ByteVector.fromString("foobar", StringType.Latin1), 0x00, 0x00 // Some null bytes to trigger null cleanup ); @@ -84,7 +81,7 @@ const getTestUrlLinkFrame = (): UrlLinkFrame => { header.render(4), 0x00, 0x00, StringType.UTF16BE, - ByteVector.fromString("foo", StringType.UTF16BE, undefined, true), + ByteVector.fromString("foo", StringType.UTF16BE), ByteVector.getTextDelimiter(StringType.UTF16BE), ByteVector.fromString("bar", StringType.Latin1) ); @@ -108,9 +105,9 @@ const getTestUrlLinkFrame = (): UrlLinkFrame => { header.frameSize = 8; const data = ByteVector.concatenate( header.render(4), - ByteVector.fromString("foobar", StringType.Latin1, undefined, true), // - Data - 0x00, 0x00 // - null bytes to test end byte - // cleanup + ByteVector.fromString("foobar", StringType.Latin1), // - Data + 0x00, 0x00 // - null bytes to test end byte + // cleanup ); // Act @@ -287,7 +284,8 @@ const getTestUrlLinkFrame = (): UrlLinkFrame => { public clone_withoutRawData_returnsClone() { // Arrange const frame = getTestUrlLinkFrame(); - const _ = frame.text; // Force reading raw data, and trashing it + // noinspection JSUnusedLocalSymbols Forces a read of the raw data + const _ = frame.text; // Act const result = frame.clone(); diff --git a/test-unit/id3v2/userTextInformationFrameTests.ts b/test-unit/id3v2/userTextInformationFrameTests.ts index 6e367b1e..93747ea4 100644 --- a/test-unit/id3v2/userTextInformationFrameTests.ts +++ b/test-unit/id3v2/userTextInformationFrameTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import FrameConstructorTests from "./frameConstructorTests"; import Id3v2Settings from "../../src/id3v2/id3v2Settings"; @@ -10,18 +10,15 @@ import {Id3v2FrameHeader} from "../../src/id3v2/frames/frameHeader"; import {FrameIdentifiers} from "../../src/id3v2/frameIdentifiers"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - -function getTestFrame(): UserTextInformationFrame { +const getTestFrame = (): UserTextInformationFrame => { const header = new Id3v2FrameHeader(FrameIdentifiers.TXXX); header.frameSize = 8; const data = ByteVector.concatenate( header.render(4), StringType.Latin1, - ByteVector.fromString("foo"), + ByteVector.fromString("foo", StringType.UTF8), ByteVector.getTextDelimiter(StringType.Latin1), - ByteVector.fromString("bar") + ByteVector.fromString("bar", StringType.UTF8) ); return UserTextInformationFrame.fromRawData(data, 4); @@ -63,9 +60,9 @@ function getTestFrame(): UserTextInformationFrame { header.render(4), 0x00, 0x00, StringType.Latin1, - ByteVector.fromString("foo"), + ByteVector.fromString("foo", StringType.UTF8), ByteVector.getTextDelimiter(StringType.Latin1), - ByteVector.fromString("bar") + ByteVector.fromString("bar", StringType.UTF8) ); // Act @@ -83,9 +80,9 @@ function getTestFrame(): UserTextInformationFrame { const data = ByteVector.concatenate( header.render(4), StringType.Latin1, - ByteVector.fromString("foo"), + ByteVector.fromString("foo", StringType.UTF8), ByteVector.getTextDelimiter(StringType.Latin1), - ByteVector.fromString("bar") + ByteVector.fromString("bar", StringType.UTF8) ); // Act diff --git a/test-unit/id3v2/userUrlLinkFrameTests.ts b/test-unit/id3v2/userUrlLinkFrameTests.ts index c74bbdea..4df2d11b 100644 --- a/test-unit/id3v2/userUrlLinkFrameTests.ts +++ b/test-unit/id3v2/userUrlLinkFrameTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import FrameConstructorTests from "./frameConstructorTests"; import {ByteVector, StringType} from "../../src/byteVector"; @@ -9,9 +9,6 @@ import {FrameIdentifiers} from "../../src/id3v2/frameIdentifiers"; import {Testers} from "../utilities/testers"; import {UserUrlLinkFrame} from "../../src/id3v2/frames/urlLinkFrame"; -// Setup chai -const assert = Chai.assert; - const getTestFrameData = (): ByteVector => { const header = new Id3v2FrameHeader(FrameIdentifiers.WXXX); header.frameSize = 12; @@ -19,9 +16,9 @@ const getTestFrameData = (): ByteVector => { return ByteVector.concatenate( header.render(4), StringType.UTF16BE, - ByteVector.fromString("foo", StringType.UTF16BE, undefined, true), + ByteVector.fromString("foo", StringType.UTF16BE), ByteVector.getTextDelimiter(StringType.UTF16BE), - ByteVector.fromString("bar", StringType.Latin1, undefined, true) + ByteVector.fromString("bar", StringType.Latin1) ); }; @@ -48,9 +45,9 @@ const getTestUserUrlLinkFrame = (): UserUrlLinkFrame => { 0x00, 0x00, header.render(4), StringType.Latin1, - ByteVector.fromString("foo", StringType.Latin1, undefined, true), + ByteVector.fromString("foo", StringType.Latin1), ByteVector.getTextDelimiter(StringType.Latin1), - ByteVector.fromString("bar", StringType.Latin1, undefined, true) + ByteVector.fromString("bar", StringType.Latin1) ); // Act @@ -74,9 +71,9 @@ const getTestUserUrlLinkFrame = (): UserUrlLinkFrame => { const data = ByteVector.concatenate( header.render(4), StringType.Latin1, - ByteVector.fromString("foo", StringType.Latin1, undefined, true), // - String 1 - ByteVector.getTextDelimiter(StringType.Latin1), // - String separator - ByteVector.fromString("bar", StringType.Latin1, undefined, true) // - String 2 + ByteVector.fromString("foo", StringType.Latin1), // - String 1 + ByteVector.getTextDelimiter(StringType.Latin1), // - String separator + ByteVector.fromString("bar", StringType.Latin1) // - String 2 ); // Act @@ -314,7 +311,8 @@ const getTestUserUrlLinkFrame = (): UserUrlLinkFrame => { public clone_withoutRawData_returnsClone() { // Arrange const frame = getTestUserUrlLinkFrame(); - const _ = frame.text; // Force reading raw data, and trashing it + // noinspection JSUnusedLocalSymbols Forces a read of the raw data + const _ = frame.text; // Act const result = frame.clone(); diff --git a/test-unit/mpeg/mpegAudioFileTests.ts b/test-unit/mpeg/mpegAudioFileTests.ts index 46588f4a..4a2dc600 100644 --- a/test-unit/mpeg/mpegAudioFileTests.ts +++ b/test-unit/mpeg/mpegAudioFileTests.ts @@ -55,7 +55,7 @@ import {TagTypes} from "../../src/tag"; assert.strictEqual(file.tag.startTag.tags.length, 2); assert.strictEqual(file.tag.startTag.tagTypes, TagTypes.Id3v2 | TagTypes.Ape); assert.strictEqual(file.tag.endTag.tags.length, 0); - assert.strictEqual(file.tag.endTag.tagTypes, TagTypes.None) + assert.strictEqual(file.tag.endTag.tagTypes, TagTypes.None); assert.isUndefined(file.properties); diff --git a/test-unit/mpeg/mpegAudioHeaderTests.ts b/test-unit/mpeg/mpegAudioHeaderTests.ts index 33ce086b..cab44989 100644 --- a/test-unit/mpeg/mpegAudioHeaderTests.ts +++ b/test-unit/mpeg/mpegAudioHeaderTests.ts @@ -1,6 +1,6 @@ -import * as Chai from "chai"; import * as TypeMoq from "typemoq"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import MpegAudioHeader from "../../src/mpeg/mpegAudioHeader"; import TestFile from "../utilities/testFile"; @@ -8,20 +8,17 @@ import VbriHeader from "../../src/mpeg/vbriHeader"; import XingHeader from "../../src/mpeg/xingHeader"; import {ByteVector} from "../../src/byteVector"; import {File} from "../../src/file"; -import {MediaTypes} from "../../src/iCodec"; +import {MediaTypes} from "../../src/properties"; import {ChannelMode, MpegVersion} from "../../src/mpeg/mpegEnums"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - @suite class Mpeg_AudioHeader_ConstructorTests { private mockFile = TypeMoq.Mock.ofType().object; @test public unknownHeader() { // Act - const header = MpegAudioHeader.Unknown; + const header = MpegAudioHeader.UNKNOWN; // Assert Mpeg_AudioHeader_ConstructorTests.assertHeader( @@ -41,27 +38,27 @@ const assert = Chai.assert; MediaTypes.Audio, MpegVersion.Version25 ); - assert.strictEqual(header.vbriHeader, VbriHeader.unknown); - assert.strictEqual(header.xingHeader, XingHeader.unknown); + assert.strictEqual(header.vbriHeader, VbriHeader.UNKNOWN); + assert.strictEqual(header.xingHeader, XingHeader.UNKNOWN); } @test public fromInfo_invalidArguments() { // Act/Assert Testers.testSafeUint((v: number) => { - MpegAudioHeader.fromInfo(v, 123, XingHeader.unknown, VbriHeader.unknown); + MpegAudioHeader.fromInfo(v, 123, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); }); Testers.testSafeUint((v: number) => { - MpegAudioHeader.fromInfo(123, v, XingHeader.unknown, VbriHeader.unknown); + MpegAudioHeader.fromInfo(123, v, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); }); - Testers.testTruthy((v: XingHeader) => { MpegAudioHeader.fromInfo(123, 123, v, VbriHeader.unknown); }); - Testers.testTruthy((v: VbriHeader) => { MpegAudioHeader.fromInfo(123, 123, XingHeader.unknown, v); }); + Testers.testTruthy((v: XingHeader) => { MpegAudioHeader.fromInfo(123, 123, v, VbriHeader.UNKNOWN); }); + Testers.testTruthy((v: VbriHeader) => { MpegAudioHeader.fromInfo(123, 123, XingHeader.UNKNOWN, v); }); } @test public fromInfo_validArguments() { // Act - const header = MpegAudioHeader.fromInfo(0, 0, XingHeader.unknown, VbriHeader.unknown); + const header = MpegAudioHeader.fromInfo(0, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); // Assert Mpeg_AudioHeader_ConstructorTests.assertHeader( @@ -81,8 +78,8 @@ const assert = Chai.assert; MediaTypes.Audio, MpegVersion.Version25 ); - assert.strictEqual(header.vbriHeader, VbriHeader.unknown); - assert.strictEqual(header.xingHeader, XingHeader.unknown); + assert.strictEqual(header.vbriHeader, VbriHeader.UNKNOWN); + assert.strictEqual(header.xingHeader, XingHeader.UNKNOWN); } @test @@ -157,7 +154,7 @@ const assert = Chai.assert; @test public fromData_noVbrHeaders() { // Arrange - MPEG2, Layer2, 64kbps, 22050kHz - padded - const data = ByteVector.fromUInt(0xFFF48200, true); + const data = ByteVector.fromUint(0xFFF48200, true); data.addByteVector(ByteVector.fromSize(100)); const mockFile = TestFile.getFile(data); @@ -182,23 +179,23 @@ const assert = Chai.assert; MediaTypes.Audio, MpegVersion.Version2 ); - assert.strictEqual(header.xingHeader, XingHeader.unknown); - assert.strictEqual(header.vbriHeader, VbriHeader.unknown); + assert.strictEqual(header.xingHeader, XingHeader.UNKNOWN); + assert.strictEqual(header.vbriHeader, VbriHeader.UNKNOWN); } @test public fromData_hasXingHeader() { // Arrange - MPEG1, Layer1, 256kbps (via flags), 44100kHz, Stereo, not padded - const mpegFlags = ByteVector.fromUInt(0xFFFE8000, true); + const mpegFlags = ByteVector.fromUint(0xFFFE8000, true); const data = ByteVector.concatenate( ByteVector.fromSize(1), mpegFlags, ByteVector.fromSize(32), ByteVector.concatenate( - XingHeader.fileIdentifier, + XingHeader.FILE_IDENTIFIER, 0x00, 0x00, 0x00, 0x03, - ByteVector.fromUInt(12), - ByteVector.fromUInt(23) + ByteVector.fromUint(12), + ByteVector.fromUint(23) ) // Calculates to 2kbps via Xing header ); const mockFile = TestFile.getFile(data); @@ -225,27 +222,27 @@ const assert = Chai.assert; MpegVersion.Version1 ); assert.isOk(header.xingHeader); - assert.notEqual(header.xingHeader, XingHeader.unknown); + assert.notEqual(header.xingHeader, XingHeader.UNKNOWN); assert.strictEqual(header.xingHeader.totalFrames, 12); assert.strictEqual(header.xingHeader.totalSize, 23); assert.isTrue(header.xingHeader.isPresent); - assert.strictEqual(header.vbriHeader, VbriHeader.unknown); + assert.strictEqual(header.vbriHeader, VbriHeader.UNKNOWN); } @test public fromData_hasVbriHeader() { // Arrange - MPEG1, Layer1, 256kbps (via flags), 44100kHz, Stereo, not padded - const mpegFlags = ByteVector.fromUInt(0xFFFE8000, true); + const mpegFlags = ByteVector.fromUint(0xFFFE8000, true); const data = ByteVector.concatenate( ByteVector.fromSize(1), mpegFlags, ByteVector.fromSize(32), ByteVector.concatenate( - VbriHeader.fileIdentifier, + VbriHeader.FILE_IDENTIFIER, ByteVector.fromSize(6), - ByteVector.fromUInt(234), - ByteVector.fromUInt(123), + ByteVector.fromUint(234), + ByteVector.fromUint(123), ByteVector.fromSize(6) ) ); @@ -273,12 +270,12 @@ const assert = Chai.assert; MpegVersion.Version1 ); assert.isOk(header.vbriHeader); - assert.notEqual(header.vbriHeader, VbriHeader.unknown); + assert.notEqual(header.vbriHeader, VbriHeader.UNKNOWN); assert.strictEqual(header.vbriHeader.totalFrames, 123); assert.strictEqual(header.vbriHeader.totalSize, 234); assert.isTrue(header.vbriHeader.isPresent); - assert.strictEqual(header.xingHeader, XingHeader.unknown); + assert.strictEqual(header.xingHeader, XingHeader.UNKNOWN); } private static assertHeader( @@ -322,7 +319,7 @@ const assert = Chai.assert; public audioBitrateDuration_noVbrMpeg1Layer2_256() { // Arrange const flags = 0x1E8000; // MPEG1, Layer1, 256kbps, 44100kHz, 278 frame length - const header = MpegAudioHeader.fromInfo(flags, 1024, XingHeader.unknown, VbriHeader.unknown); + const header = MpegAudioHeader.fromInfo(flags, 1024, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); // Act/Assert assert.strictEqual(header.audioBitrate, 256); @@ -333,7 +330,7 @@ const assert = Chai.assert; public audioBitrateDuration_noVbrMpeg2Layer2_64() { // Arrange const flags = 0x148000; // MPEG2, Layer2, 64kbps, 22050kHz, 417 frame length - const header = MpegAudioHeader.fromInfo(flags, 1024, XingHeader.unknown, VbriHeader.unknown); + const header = MpegAudioHeader.fromInfo(flags, 1024, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); // Act/Assert assert.strictEqual(header.audioBitrate, 64); @@ -344,7 +341,7 @@ const assert = Chai.assert; public audioBitrateDuration_noVbrMpeg25Layer3_32() { // Arrange const flags = 0x24000; // MPEG2.5, Layer3, 32kbps, 11025kHz - const header = MpegAudioHeader.fromInfo(flags, 1024, XingHeader.unknown, VbriHeader.unknown); + const header = MpegAudioHeader.fromInfo(flags, 1024, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); // Act/Assert assert.strictEqual(header.audioBitrate, 32); @@ -356,7 +353,7 @@ const assert = Chai.assert; // Arrange const flags = 0x1E8000; // MPEG1, Layer1, 256kbps, 44100kHz const xingHeader = XingHeader.fromInfo(10, 0); - const header = MpegAudioHeader.fromInfo(flags, 1024, xingHeader, VbriHeader.unknown); + const header = MpegAudioHeader.fromInfo(flags, 1024, xingHeader, VbriHeader.UNKNOWN); // Act/Assert assert.strictEqual(header.audioBitrate, 256); @@ -368,7 +365,7 @@ const assert = Chai.assert; // Arrange const flags = 0x1E8000; // MPEG1, Layer1, 256kbps, 44100kHz const xingHeader = XingHeader.fromInfo(0, 10); - const header = MpegAudioHeader.fromInfo(flags, 1024, xingHeader, VbriHeader.unknown); + const header = MpegAudioHeader.fromInfo(flags, 1024, xingHeader, VbriHeader.UNKNOWN); // Act/Assert assert.strictEqual(header.audioBitrate, 256); @@ -380,7 +377,7 @@ const assert = Chai.assert; // Arrange const flags = 0x1E8000; // MPEG1, Layer1, 256kbps, 44100kHz const xingHeader = XingHeader.fromInfo(12, 23); - const header = MpegAudioHeader.fromInfo(flags, 1024, xingHeader, VbriHeader.unknown); + const header = MpegAudioHeader.fromInfo(flags, 1024, xingHeader, VbriHeader.UNKNOWN); // Act/Assert assert.strictEqual(header.audioBitrate, 2); @@ -392,7 +389,7 @@ const assert = Chai.assert; // Arrange const flags = 0x1E8000; // MPEG1, Layer1, 256kbps, 44100kHz const vbriHeader = VbriHeader.fromInfo(123, 0); - const header = MpegAudioHeader.fromInfo(flags, 1024, XingHeader.unknown, vbriHeader); + const header = MpegAudioHeader.fromInfo(flags, 1024, XingHeader.UNKNOWN, vbriHeader); // Act/Assert assert.strictEqual(header.audioBitrate, 256); @@ -404,7 +401,7 @@ const assert = Chai.assert; // Arrange const flags = 0x1E8000; // MPEG1, Layer1, 256kbps, 44100kHz const vbriHeader = VbriHeader.fromInfo(0, 10); - const header = MpegAudioHeader.fromInfo(flags, 1024, XingHeader.unknown, vbriHeader); + const header = MpegAudioHeader.fromInfo(flags, 1024, XingHeader.UNKNOWN, vbriHeader); // Act/Assert assert.strictEqual(header.audioBitrate, 256); @@ -416,7 +413,7 @@ const assert = Chai.assert; // Arrange const flags = 0x1E8000; // MPEG1, Layer1, 256kbps, 44100kHz const vbriHeader = VbriHeader.fromInfo(123, 234); - const header = MpegAudioHeader.fromInfo(flags, 1024, XingHeader.unknown, vbriHeader); + const header = MpegAudioHeader.fromInfo(flags, 1024, XingHeader.UNKNOWN, vbriHeader); // Act/Assert assert.strictEqual(header.audioBitrate, 2); @@ -427,12 +424,12 @@ const assert = Chai.assert; public audioFrameLength_layer1() { // Test 1: Padded const flags1 = 0x1E8200; // MPEG1, Layer1, 256kbps, 44100kHz - padded - const header1 = MpegAudioHeader.fromInfo(flags1, 0, XingHeader.unknown, VbriHeader.unknown); + const header1 = MpegAudioHeader.fromInfo(flags1, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.strictEqual(header1.audioFrameLength, 282); // Test 2: Unpadded const flags2 = 0x1E8000; // MPEG1, Layer1, 256kbps, 44100kHz - unpadded - const header2 = MpegAudioHeader.fromInfo(flags2, 0, XingHeader.unknown, VbriHeader.unknown); + const header2 = MpegAudioHeader.fromInfo(flags2, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.strictEqual(header2.audioFrameLength, 278); } @@ -440,12 +437,12 @@ const assert = Chai.assert; public audioFrameLength_layer2Version2() { // Test 1: Padded const flags1 = 0x148200; // MPEG2, Layer2, 64kbps, 22050kHz - padded - const header1 = MpegAudioHeader.fromInfo(flags1, 0, XingHeader.unknown, VbriHeader.unknown); + const header1 = MpegAudioHeader.fromInfo(flags1, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.strictEqual(header1.audioFrameLength, 418); // Test 2: Unpadded const flags2 = 0x148000; // MPEG2, Layer2, 64kbps, 22050kHz - unpadded - const header2 = MpegAudioHeader.fromInfo(flags2, 0, XingHeader.unknown, VbriHeader.unknown); + const header2 = MpegAudioHeader.fromInfo(flags2, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.strictEqual(header2.audioFrameLength, 417); } @@ -453,12 +450,12 @@ const assert = Chai.assert; public audioFrameLength_layer3Version1() { // Test 1: Padded const flags1 = 0xA4200; // MPEG1, Layer3, 56kbps, 11025kHz - padded - const header1 = MpegAudioHeader.fromInfo(flags1, 0, XingHeader.unknown, VbriHeader.unknown); + const header1 = MpegAudioHeader.fromInfo(flags1, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.strictEqual(header1.audioFrameLength, 183); // Test 2: Unpadded const flags2 = 0xA4000; // MPEG1, Layer3, 56kbps, 11025kHz - unpadded - const header2 = MpegAudioHeader.fromInfo(flags2, 0, XingHeader.unknown, VbriHeader.unknown); + const header2 = MpegAudioHeader.fromInfo(flags2, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.strictEqual(header2.audioFrameLength, 182); } @@ -466,12 +463,12 @@ const assert = Chai.assert; public audioFrameLength_layer3Version25() { // Test 1: Padded const flags1 = 0x24200; // MPEG2.5, Layer3, 32kbps, 11025kHz - padded - const header1 = MpegAudioHeader.fromInfo(flags1, 0, XingHeader.unknown, VbriHeader.unknown); + const header1 = MpegAudioHeader.fromInfo(flags1, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.strictEqual(header1.audioFrameLength, 209); // Test 2: Unpadded const flags2 = 0x24000; // MPEG2.5, Layer3, 32kbps, 11025kHz - unpadded - const header2 = MpegAudioHeader.fromInfo(flags2, 0, XingHeader.unknown, VbriHeader.unknown); + const header2 = MpegAudioHeader.fromInfo(flags2, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.strictEqual(header2.audioFrameLength, 208); } @@ -479,19 +476,19 @@ const assert = Chai.assert; public audioLayer_layer1() { // Test 1: 00 const flags1 = 0xFFF9FFFF; - const header1 = MpegAudioHeader.fromInfo(flags1, 0, XingHeader.unknown, VbriHeader.unknown); + const header1 = MpegAudioHeader.fromInfo(flags1, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.strictEqual(header1.audioLayer, 1); // Test 2: 11 const flags2 = 0xFFFFFFFF; - const header2 = MpegAudioHeader.fromInfo(flags2, 0, XingHeader.unknown, VbriHeader.unknown); + const header2 = MpegAudioHeader.fromInfo(flags2, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.strictEqual(header2.audioLayer, 1); } @test public audioLayer_layer2() { const flags = 0xFFFDFFFF; - const header = MpegAudioHeader.fromInfo(flags, 0, XingHeader.unknown, VbriHeader.unknown); + const header = MpegAudioHeader.fromInfo(flags, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); // Act / Assert assert.strictEqual(header.audioLayer, 2); @@ -500,7 +497,7 @@ const assert = Chai.assert; @test public audioLayer_layer3() { const flags = 0xFFFBFFFF; - const header = MpegAudioHeader.fromInfo(flags, 0, XingHeader.unknown, VbriHeader.unknown); + const header = MpegAudioHeader.fromInfo(flags, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); // Act / Assert assert.strictEqual(header.audioLayer, 3); @@ -509,37 +506,37 @@ const assert = Chai.assert; @test public audioSampleRate() { // Test 1: Version 1 - const header1 = MpegAudioHeader.fromInfo(0xFFFFF7FF, 0, XingHeader.unknown, VbriHeader.unknown); + const header1 = MpegAudioHeader.fromInfo(0xFFFFF7FF, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.strictEqual(header1.audioSampleRate, 48000); // Test 2: Version 2 - const header2 = MpegAudioHeader.fromInfo(0xFFF7F7FF, 0, XingHeader.unknown, VbriHeader.unknown); + const header2 = MpegAudioHeader.fromInfo(0xFFF7F7FF, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.strictEqual(header2.audioSampleRate, 24000); // Test 3: Version 3 - const header3 = MpegAudioHeader.fromInfo(0xFFE7F7FF, 0, XingHeader.unknown, VbriHeader.unknown); + const header3 = MpegAudioHeader.fromInfo(0xFFE7F7FF, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.strictEqual(header3.audioSampleRate, 12000); } @test public channels() { // Test 1: Stereo - const header1 = MpegAudioHeader.fromInfo(0xFFFFFF3F, 0, XingHeader.unknown, VbriHeader.unknown); + const header1 = MpegAudioHeader.fromInfo(0xFFFFFF3F, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.strictEqual(header1.channelMode, ChannelMode.Stereo); assert.strictEqual(header1.audioChannels, 2); // Test 2: Joint Stereo - const header2 = MpegAudioHeader.fromInfo(0xFFFFFF7F, 0, XingHeader.unknown, VbriHeader.unknown); + const header2 = MpegAudioHeader.fromInfo(0xFFFFFF7F, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.strictEqual(header2.channelMode, ChannelMode.JointStereo); assert.strictEqual(header2.audioChannels, 2); // Test 3: Dual Stereo - const header3 = MpegAudioHeader.fromInfo(0xFFFFFFBF, 0, XingHeader.unknown, VbriHeader.unknown); + const header3 = MpegAudioHeader.fromInfo(0xFFFFFFBF, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.strictEqual(header3.channelMode, ChannelMode.DualChannel); assert.strictEqual(header3.audioChannels, 2); // Test 4: Mono - const header4 = MpegAudioHeader.fromInfo(0xFFFFFFFF, 0, XingHeader.unknown, VbriHeader.unknown); + const header4 = MpegAudioHeader.fromInfo(0xFFFFFFFF, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.strictEqual(header4.channelMode, ChannelMode.SingleChannel); assert.strictEqual(header4.audioChannels, 1); } @@ -547,52 +544,53 @@ const assert = Chai.assert; @test public isCopyrighted() { // Test 1: 00 => false - const header1 = MpegAudioHeader.fromInfo(0xFFFFFFE7, 0, XingHeader.unknown, VbriHeader.unknown); + const header1 = MpegAudioHeader.fromInfo(0xFFFFFFE7, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.isFalse(header1.isCopyrighted); // Test 2: 01 => true - const header2 = MpegAudioHeader.fromInfo(0xFFFFFFEF, 0, XingHeader.unknown, VbriHeader.unknown); + const header2 = MpegAudioHeader.fromInfo(0xFFFFFFEF, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.isTrue(header2.isCopyrighted); } @test public isOriginal() { // Test 1: 00 => false - const header1 = MpegAudioHeader.fromInfo(0xFFFFFFF3, 0, XingHeader.unknown, VbriHeader.unknown); + const header1 = MpegAudioHeader.fromInfo(0xFFFFFFF3, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.isFalse(header1.isOriginal); // Test 2: 01 => true - const header2 = MpegAudioHeader.fromInfo(0xFFFFFFFF, 0, XingHeader.unknown, VbriHeader.unknown); + const header2 = MpegAudioHeader.fromInfo(0xFFFFFFFF, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.isTrue(header2.isOriginal); } @test public isPadded() { // Test 1: 0 => false - const header1 = MpegAudioHeader.fromInfo(0xFFFFFFF3, 0, XingHeader.unknown, VbriHeader.unknown); + const header1 = MpegAudioHeader.fromInfo(0xFFFFFFF3, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.isFalse(header1.isOriginal); // Test 2: 1 => true - const header2 = MpegAudioHeader.fromInfo(0xFFFFFFFF, 0, XingHeader.unknown, VbriHeader.unknown); + const header2 = MpegAudioHeader.fromInfo(0xFFFFFFFF, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.isTrue(header2.isOriginal); } @test public isProtected() { // Test 1: 0 => true - const header1 = MpegAudioHeader.fromInfo(0xFFFEFFFF, 0, XingHeader.unknown, VbriHeader.unknown); + const header1 = MpegAudioHeader.fromInfo(0xFFFEFFFF, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.isTrue(header1.isProtected); // Test 2: 1 => false - const header2 = MpegAudioHeader.fromInfo(0xFFFFFFFF, 0, XingHeader.unknown, VbriHeader.unknown); + const header2 = MpegAudioHeader.fromInfo(0xFFFFFFFF, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.isFalse(header2.isProtected); } @test public streamLength_set_noVbr() { // Arrange - MPEG2, Layer2, 64kbps, 22050kHz - padded - const header = MpegAudioHeader.fromInfo(0xFFF48200, 1234, XingHeader.unknown, VbriHeader.unknown); - const _ = header.durationMilliseconds; // Force calculation of durationMilliseconds + const header = MpegAudioHeader.fromInfo(0xFFF48200, 1234, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); + // noinspection JSUnusedLocalSymbols Force calculation of durationMilliseconds + const _ = header.durationMilliseconds; // Act header.streamLength = 2345; @@ -605,7 +603,7 @@ const assert = Chai.assert; public streamLength_set_withXingHeader() { // Arrange - MPEG2, Layer2, 64kbps, 22050kHz - padded const xingHeader = XingHeader.fromInfo(123, 234); - const header = MpegAudioHeader.fromInfo(0xFFF48200, 1234, xingHeader, VbriHeader.unknown); + const header = MpegAudioHeader.fromInfo(0xFFF48200, 1234, xingHeader, VbriHeader.UNKNOWN); const originalDuration = header.durationMilliseconds; // Force calculation of durationMilliseconds // Act @@ -619,7 +617,7 @@ const assert = Chai.assert; public streamLength_set_withVbriHeader() { // Arrange - MPEG2, Layer2, 64kbps, 22050kHz - padded const vbriHeader = VbriHeader.fromInfo(123, 234); - const header = MpegAudioHeader.fromInfo(0xFFF48200, 1234, XingHeader.unknown, vbriHeader); + const header = MpegAudioHeader.fromInfo(0xFFF48200, 1234, XingHeader.UNKNOWN, vbriHeader); const originalDuration = header.durationMilliseconds; // Force calculation of durationMilliseconds // Act @@ -633,12 +631,12 @@ const assert = Chai.assert; public version_version1() { // Test 1: 01 const flags1 = 0xFFFEFFFF; - const header1 = MpegAudioHeader.fromInfo(flags1, 0, XingHeader.unknown, VbriHeader.unknown); + const header1 = MpegAudioHeader.fromInfo(flags1, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.strictEqual(header1.version, MpegVersion.Version1); // Test 2: 11 const flags2 = 0xFFFFFFFF; - const header2 = MpegAudioHeader.fromInfo(flags2, 0, XingHeader.unknown, VbriHeader.unknown); + const header2 = MpegAudioHeader.fromInfo(flags2, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); assert.strictEqual(header2.version, MpegVersion.Version1); } @@ -646,7 +644,7 @@ const assert = Chai.assert; public version_version2() { // Arrange const flags = 0xFFF7FFFF; - const header = MpegAudioHeader.fromInfo(flags, 0, XingHeader.unknown, VbriHeader.unknown); + const header = MpegAudioHeader.fromInfo(flags, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); // Act / Assert assert.strictEqual(header.version, MpegVersion.Version2); @@ -656,7 +654,7 @@ const assert = Chai.assert; public version_version25() { // Arrange const flags = 0xFFE7FFFF; - const header = MpegAudioHeader.fromInfo(flags, 0, XingHeader.unknown, VbriHeader.unknown); + const header = MpegAudioHeader.fromInfo(flags, 0, XingHeader.UNKNOWN, VbriHeader.UNKNOWN); // Act / Assert assert.strictEqual(header.version, MpegVersion.Version25); @@ -706,7 +704,7 @@ const assert = Chai.assert; // Arrange const data = ByteVector.concatenate( ByteVector.fromSize(File.bufferSize * 2), - ByteVector.fromUInt(0xFFF48200, true), + ByteVector.fromUint(0xFFF48200, true), ByteVector.fromSize(100) ); const mockFile = TestFile.getFile(data); @@ -723,7 +721,7 @@ const assert = Chai.assert; // Arrange const data = ByteVector.concatenate( ByteVector.fromSize(File.bufferSize), - ByteVector.fromUInt(0xFFF48200, true), + ByteVector.fromUint(0xFFF48200, true), ByteVector.fromSize(100) ); const mockFile = TestFile.getFile(data); @@ -733,6 +731,6 @@ const assert = Chai.assert; // Assert assert.isOk(result); - assert.notEqual(result, MpegAudioHeader.Unknown); + assert.notEqual(result, MpegAudioHeader.UNKNOWN); } } diff --git a/test-unit/mpeg/mpegVideoHeaderTests.ts b/test-unit/mpeg/mpegVideoHeaderTests.ts index 752ca9ac..f9a90555 100644 --- a/test-unit/mpeg/mpegVideoHeaderTests.ts +++ b/test-unit/mpeg/mpegVideoHeaderTests.ts @@ -1,17 +1,14 @@ -import * as Chai from "chai"; import * as TypeMoq from "typemoq"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import MpegVideoHeader from "../../src/mpeg/mpegVideoHeader"; import TestFile from "../utilities/testFile"; import {ByteVector} from "../../src/byteVector"; import {File} from "../../src/file"; -import {MediaTypes} from "../../src/iCodec"; +import {MediaTypes} from "../../src/properties"; import {Testers} from "../utilities/testers"; -// Setup Chai -const assert = Chai.assert; - @suite class Mpeg_VideoHeader_ConstructorTests { @test public constructor_invalidArguments() { diff --git a/test-unit/mpeg/vbriHeaderTests.ts b/test-unit/mpeg/vbriHeaderTests.ts index 6534cb06..f0a21707 100644 --- a/test-unit/mpeg/vbriHeaderTests.ts +++ b/test-unit/mpeg/vbriHeaderTests.ts @@ -1,13 +1,10 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import VbriHeader from "../../src/mpeg/vbriHeader"; import {ByteVector} from "../../src/byteVector"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - @suite class Mpeg_XingHeaderTests { @test public fromInfo_invalidParameters() { @@ -48,10 +45,10 @@ const assert = Chai.assert; public fromData_validParameters() { // Arrange const data = ByteVector.concatenate( - VbriHeader.fileIdentifier, + VbriHeader.FILE_IDENTIFIER, ByteVector.fromSize(6), - ByteVector.fromUInt(123), - ByteVector.fromUInt(234) + ByteVector.fromUint(123), + ByteVector.fromUint(234) ); // Act diff --git a/test-unit/mpeg/xingHeaderTests.ts b/test-unit/mpeg/xingHeaderTests.ts index 6d697c45..069fc783 100644 --- a/test-unit/mpeg/xingHeaderTests.ts +++ b/test-unit/mpeg/xingHeaderTests.ts @@ -1,14 +1,11 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import XingHeader from "../../src/mpeg/xingHeader"; import {ByteVector} from "../../src/byteVector"; import {ChannelMode, MpegVersion} from "../../src/mpeg/mpegEnums"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - @suite class Mpeg_XingHeaderTests { @test public fromInfo_invalidParameters() { @@ -49,9 +46,9 @@ const assert = Chai.assert; public fromData_zeroTotalFrames() { // Arrange const data = ByteVector.concatenate( - XingHeader.fileIdentifier, + XingHeader.FILE_IDENTIFIER, 0x00, 0x00, 0x00, 0x02, - ByteVector.fromUInt(123) + ByteVector.fromUint(123) ); // Act @@ -67,9 +64,9 @@ const assert = Chai.assert; public fromData_zeroTotalSize() { // Arrange const data = ByteVector.concatenate( - XingHeader.fileIdentifier, + XingHeader.FILE_IDENTIFIER, 0x00, 0x00, 0x00, 0x01, - ByteVector.fromUInt(123) + ByteVector.fromUint(123) ); // Act @@ -85,10 +82,10 @@ const assert = Chai.assert; public fromData_totalSizeAndFrames() { // Arrange const data = ByteVector.concatenate( - XingHeader.fileIdentifier, + XingHeader.FILE_IDENTIFIER, 0x00, 0x00, 0x00, 0x03, - ByteVector.fromUInt(123), - ByteVector.fromUInt(234) + ByteVector.fromUint(123), + ByteVector.fromUint(234) ); // Act diff --git a/test-unit/ogg/codecFactoryTests.ts b/test-unit/ogg/codecFactoryTests.ts new file mode 100644 index 00000000..d65693c2 --- /dev/null +++ b/test-unit/ogg/codecFactoryTests.ts @@ -0,0 +1,96 @@ +import {assert} from "chai"; +import {suite, test} from "@testdeck/mocha"; +import {It, Mock, Times} from "typemoq"; + +import CodecPackets from "./codecPackets"; +import CodecFactory, {CodecProvider} from "../../src/ogg/codecs/codecFactory"; +import IOggCodec from "../../src/ogg/codecs/iOggCodec"; +import Opus from "../../src/ogg/codecs/opus"; +import Theora from "../../src/ogg/codecs/theora"; +import Vorbis from "../../src/ogg/codecs/vorbis"; +import {ByteVector} from "../../src/byteVector"; +import {Testers} from "../utilities/testers"; + +@suite class Ogg_CodecFactory { + @test + public addCodecProvider_invalidParameter() { + // Act / Assert + Testers.testTruthy((v: CodecProvider) => CodecFactory.addCodecProvider(v)); + } + + @test + public getCodec_invalidParameter() { + // Act / Assert + Testers.testTruthy((v: ByteVector) => CodecFactory.getCodec(v)); + } + + @test + public getCodec_opus() { + // Arrange + const opusPacket = CodecPackets.getTestOpusPacket(); + + // Act + const codec = CodecFactory.getCodec(opusPacket); + + // Assert + assert.ok(codec); + assert.instanceOf(codec, Opus); + } + + @test + public getCodec_theora() { + // Arrange + const theoraPacket = CodecPackets.getTestTheoraPacket(); + + // Act + const codec = CodecFactory.getCodec(theoraPacket); + + // Assert + assert.ok(codec); + assert.instanceOf(codec, Theora); + } + + @test + public getCodec_vorbis() { + // Arrange + const vorbisPacket = CodecPackets.getTestVorbisPacket(); + + // Act + const codec = CodecFactory.getCodec(vorbisPacket); + + // Assert + assert.ok(codec); + assert.instanceOf(codec, Vorbis); + } + + @test + public customCodecProvider() { + // Arrange + const mockCodec = Mock.ofType(); + const badCodecProvider = Mock.ofType(); + badCodecProvider.setup((cp) => cp(It.isAny())).returns(() => undefined); + const goodCodecProvider = Mock.ofType(); + goodCodecProvider.setup((cp) => cp(It.isAny())).returns(() => mockCodec.object); + + const testPacket = ByteVector.empty(); + + try { + // Act 1: Register the providers + CodecFactory.addCodecProvider(badCodecProvider.object); + CodecFactory.addCodecProvider(goodCodecProvider.object); + + // Act 2: Get codec + const codec = CodecFactory.getCodec(testPacket); + + // Assert 1/2: "Good" codec returned, both providers called, tho. + assert.strictEqual(codec, mockCodec.object); + badCodecProvider.verify((cp) => cp(It.isValue(testPacket)), Times.once()); + goodCodecProvider.verify((cp) => cp(It.isValue(testPacket)), Times.once()); + + } finally { + // Act / Assert 3: Cleanup and retry the codec read + CodecFactory.clearCustomProviders(); + assert.throws(() => CodecFactory.getCodec(testPacket)); + } + } +} diff --git a/test-unit/ogg/codecPackets.ts b/test-unit/ogg/codecPackets.ts new file mode 100644 index 00000000..3ff8cc3d --- /dev/null +++ b/test-unit/ogg/codecPackets.ts @@ -0,0 +1,40 @@ +import {ByteVector, StringType} from "../../src/byteVector"; + +export default class CodecPackets { + public static getTestOpusPacket(): ByteVector { + return ByteVector.concatenate( + ByteVector.fromString("OpusHead", StringType.UTF8), + 0x01, 0x08, 0x03, 0x04, + 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0A, 0x01, 0x05, 0x03 + ); + } + + public static getTestTheoraPacket(): ByteVector { + return ByteVector.concatenate( + 0x80, ByteVector.fromString("theora", StringType.UTF8), + 0x01, 0x02, 0x03, // version + ByteVector.fromUint(0), // Size in macro blocks + 0xF0, 0x12, 0x34, // Width in pixels + 0xF0, 0x45, 0x67, // Height in pixels + 0x01, 0x02, // Picture offset in pixels + ByteVector.fromUint(1234), // Frame rate numerator + ByteVector.fromUint(2345), // Frame rate denominator + ByteVector.fromSize(10, 0xFF), // Stuff we don't care about + 0xFC, 0x56, 0xEF // "last bits" including keyframe granule shift + ); + } + + public static getTestVorbisPacket(): ByteVector { + return ByteVector.concatenate( + 0x01, ByteVector.fromString("vorbis", StringType.UTF8), + ByteVector.fromUint(1234, false), // Version + 0x05, // Channels + ByteVector.fromUint(456789, false), // Sample rate + ByteVector.fromUint(200000, false), // bitrate max + ByteVector.fromUint(128000, false), // bitrate nominal + ByteVector.fromUint(100000, false), // bitrate min + // We don't care about anything after this + ); + } +} diff --git a/test-unit/ogg/groupedCommentTests.ts b/test-unit/ogg/groupedCommentTests.ts new file mode 100644 index 00000000..6c3c827a --- /dev/null +++ b/test-unit/ogg/groupedCommentTests.ts @@ -0,0 +1,96 @@ +import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; + +import OggTag from "../../src/ogg/oggTag"; +import XiphComment from "../../src/xiph/xiphComment"; +import {TagTypes} from "../../src/tag"; +import {TagTesters, Testers} from "../utilities/testers"; + +@suite class Ogg_GroupCommentTests { + @test + public ctor() { + // Act + const tag = new OggTag(new Map()); + + // Assert + assert.isEmpty(tag.tags); + assert.strictEqual(tag.supportedTagTypes, TagTypes.None); + + assert.isEmpty(tag.comments); + assert.isEmpty(tag.serialNumbers); + assert.strictEqual(tag.tagTypes, TagTypes.None); + assert.strictEqual(tag.sizeOnDisk, 0); + assert.isTrue(tag.isEmpty); + + TagTesters.testTagProperties(tag, {}); + } + + @test + public getComment_invalidParameters() { + // Arrange + const groupedComment = new OggTag(new Map()); + + // Act / Assert + Testers.testUint((v) => groupedComment.getComment(v)); + } + + @test + public setComment_invalidParameters() { + // Arrange + const comment = XiphComment.fromEmpty(); + const groupedComment = new OggTag(new Map()); + + // Act / Assert + Testers.testUint((v) => groupedComment.setComment(v, comment)); + Testers.testTruthy((v: XiphComment) => groupedComment.setComment(123, v)); + } + + @test + public setComment_streamSerialNumberDoesNotExist() { + // Arrange + const comment = XiphComment.fromEmpty(); + const groupComment = new OggTag(new Map()); + + // Act / Assert + assert.throws(() => groupComment.setComment(123, comment)); + } + + @test + public setComment_overwrite() { + // Arrange + const comment1 = XiphComment.fromEmpty(); + const comment2 = XiphComment.fromEmpty(); + + const groupComment = new OggTag(new Map([[123, comment1], [234, comment1]])); + + // Act + groupComment.setComment(123, comment2); + + // Assert + assert.strictEqual(groupComment.getComment(123), comment2); + assert.strictEqual(groupComment.tags[0], comment2); + } + + @test + public clear_clearsAllComments() { + // Arrange + const comment1 = XiphComment.fromEmpty(); + comment1.album = "foobarbaz"; + const comment2 = XiphComment.fromEmpty(); + comment2.title = "fuxbuxquxx"; + + const tag = new OggTag(new Map([[123, comment1], [234, comment2]])); + + // Act + tag.clear(); + + // Assert + assert.sameMembers(tag.comments, [comment1, comment2]); + assert.sameMembers(tag.serialNumbers, [123, 234]); + assert.strictEqual(tag.tagTypes, TagTypes.Xiph); + + assert.isTrue(comment1.isEmpty); + assert.isTrue(comment2.isEmpty); + assert.isTrue(tag.isEmpty); + } +} diff --git a/test-unit/ogg/oggPageHeaderTests.ts b/test-unit/ogg/oggPageHeaderTests.ts new file mode 100644 index 00000000..1b39ff54 --- /dev/null +++ b/test-unit/ogg/oggPageHeaderTests.ts @@ -0,0 +1,346 @@ +import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; +import {Mock} from "typemoq"; + +import TestFile from "../utilities/testFile"; +import {ByteVector} from "../../src/byteVector"; +import {File} from "../../src/file"; +import {OggPageFlags, OggPageHeader} from "../../src/ogg/oggPageHeader"; +import {Testers} from "../utilities/testers"; + + +@suite class Ogg_PageHeaderTests { + @test + public fromFile_invalidParams() { + // Arrange + const file = Mock.ofType().object; + const position = 123; + + // Act / Assert + Testers.testTruthy((v: File) => OggPageHeader.fromFile(v, position)); + Testers.testSafeUint((v) => OggPageHeader.fromFile(file, v)); + } + + @test + public fromFile_fileTooShort() { + // Arrange + const file = TestFile.getFile(ByteVector.fromSize(27)); + + // Act / Assert + assert.throws(() => OggPageHeader.fromFile(file, 2)); + } + + @test + public fromFile_doesNotStartWithHeader() { + // Arrange + const data = ByteVector.fromSize(50); + const file = TestFile.getFile(data); + + // Act / Assert + assert.throws(() => OggPageHeader.fromFile(file, 0)); + } + + @test + public fromFile_unsupportedSize() { + // Arrange + const data = ByteVector.concatenate( + OggPageHeader.HEADER_IDENTIFIER, + 0x05, 0x06, + ByteVector.fromUlong(BigInt(0x100000000000000)) + ); + const file = TestFile.getFile(data); + + // Act / Assert + assert.throws(() => OggPageHeader.fromFile(file, 0)); + } + + @test + public fromFile_invalidPageSegmentCount() { + // Arrange + const data = ByteVector.concatenate( + ByteVector.fromSize(10), // Buffer + OggPageHeader.HEADER_IDENTIFIER, + 0x05, // Version + 0x07, // Flags, + ByteVector.fromUlong(0x123456, false), // Absolute granular position + ByteVector.fromUint(0x1234, false), // Stream serial number + ByteVector.fromUint(0x2345, false), // Page sequence number + ByteVector.fromSize(4), // Checksum + 0x00, // Invalid page segment count + ByteVector.fromSize(10) + ); + const file = TestFile.getFile(data); + + // Act / Assert + assert.throws(() => OggPageHeader.fromFile(file, 10)); + } + + @test + public fromFile_lastPacketComplete() { + // Arrange + const data = ByteVector.concatenate( + ByteVector.fromSize(10), // Buffer + OggPageHeader.HEADER_IDENTIFIER, + 0x05, // Version + 0x07, // Flags, + ByteVector.fromUlong(0x123456, false), // Absolute granular position + ByteVector.fromUint(0x1234, false), // Stream serial number + ByteVector.fromUint(0x2345, false), // Page sequence number + ByteVector.fromSize(4), // Checksum + 0x03, // Page segment count + 0x12, // Page segment 1 (complete) + 0xFF, // Page segment 2 (partial) + 0x34 // Page segment 3 (completes the previous) + ); + const file = TestFile.getFile(data); + + // Act + const header = OggPageHeader.fromFile(file, 10); + + // Assert + assert.ok(header); + assert.strictEqual(header.absoluteGranularPosition, 0x123456); + assert.strictEqual(header.dataSize, 325); + assert.strictEqual(header.flags, 0x07); + assert.isTrue(header.lastPacketComplete); + assert.deepStrictEqual(header.packetSizes, [0x12, 0x133]); + assert.strictEqual(header.pageSequenceNumber, 0x2345); + assert.strictEqual(header.size, 30); + assert.strictEqual(header.streamSerialNumber, 0x1234); + } + + @test + public fromFile_lastPacketIncomplete() { + // Arrange + const data = ByteVector.concatenate( + ByteVector.fromSize(10), // Buffer + OggPageHeader.HEADER_IDENTIFIER, + 0x05, // Version + 0x07, // Flags, + ByteVector.fromUlong(0x123456, false), // Absolute granular position + ByteVector.fromUint(0x1234, false), // Stream serial number + ByteVector.fromUint(0x2345, false), // Page sequence number + ByteVector.fromSize(4), // Checksum + 0x03, // Page segment count + 0x12, // Page segment 1 (complete) + 0xFF, // Page segment 2 (partial) + 0xFF // Page segment 3 (partial) + ); + const file = TestFile.getFile(data); + + // Act + const header = OggPageHeader.fromFile(file, 10); + + // Assert + assert.ok(header); + assert.strictEqual(header.absoluteGranularPosition, 0x123456); + assert.strictEqual(header.dataSize, 528); + assert.strictEqual(header.flags, 0x07); + assert.isFalse(header.lastPacketComplete); + assert.deepStrictEqual(header.packetSizes, [0x12, 0x1FE]); + assert.strictEqual(header.pageSequenceNumber, 0x2345); + assert.strictEqual(header.size, 30); + assert.strictEqual(header.streamSerialNumber, 0x1234); + } + + @test + public fromInfo_invalidParameters() { + // Arrange + const serialNumber = 1234; + const pageNumber = 2345; + + // Act / Assert + Testers.testUint((v) => OggPageHeader.fromInfo(v, pageNumber, OggPageFlags.None)); + Testers.testUint((v) => OggPageHeader.fromInfo(serialNumber, v, OggPageFlags.None)); + } + + @test + public fromInfo_notFirstPageOfStream() { + // Act + const header = OggPageHeader.fromInfo(1234, 2345, OggPageFlags.None); + + // Assert + assert.ok(header); + assert.strictEqual(header.absoluteGranularPosition, 0); + assert.strictEqual(header.dataSize, 0); + assert.strictEqual(header.flags, OggPageFlags.None); + assert.isFalse(header.lastPacketComplete); + assert.deepStrictEqual(header.packetSizes, []); + assert.strictEqual(header.pageSequenceNumber, 2345); + assert.strictEqual(header.size, 0); + assert.strictEqual(header.streamSerialNumber, 1234); + } + + @test + public fromInfo_firstPageOfStream() { + // Act + const header = OggPageHeader.fromInfo(1234, 0, OggPageFlags.None); + + // Assert + assert.ok(header); + assert.strictEqual(header.absoluteGranularPosition, 0); + assert.strictEqual(header.dataSize, 0); + assert.strictEqual(header.flags, OggPageFlags.FirstPageOfStream); + assert.isFalse(header.lastPacketComplete); + assert.deepStrictEqual(header.packetSizes, []); + assert.strictEqual(header.pageSequenceNumber, 0); + assert.strictEqual(header.size, 0); + assert.strictEqual(header.streamSerialNumber, 1234); + } + + @test + public fromInfo_firstPageOfStreamContinued() { + // Act + const header = OggPageHeader.fromInfo(1234, 0, OggPageFlags.FirstPacketContinued); + + // Assert + assert.ok(header); + assert.strictEqual(header.absoluteGranularPosition, 0); + assert.strictEqual(header.dataSize, 0); + assert.strictEqual(header.flags, OggPageFlags.FirstPacketContinued); + assert.isFalse(header.lastPacketComplete); + assert.deepStrictEqual(header.packetSizes, []); + assert.strictEqual(header.pageSequenceNumber, 0); + assert.strictEqual(header.size, 0); + assert.strictEqual(header.streamSerialNumber, 1234); + } + + @test + public fromPageHeader_invalidParameters() { + // Arrange + const header = OggPageHeader.fromInfo(1234, 0, OggPageFlags.None); + + // Act / Assert + Testers.testTruthy((v: OggPageHeader) => OggPageHeader.fromPageHeader(v, 123, OggPageFlags.None)); + Testers.testUint((v) => OggPageHeader.fromPageHeader(header, v, OggPageFlags.None)); + } + + @test + public fromPageHeader_notFirstPageOfStream() { + // Arrange + const data = ByteVector.concatenate( + ByteVector.fromSize(10), // Buffer + OggPageHeader.HEADER_IDENTIFIER, + 0x05, // Version + 0x07, // Flags, + ByteVector.fromUlong(0x123456, false), // Absolute granular position + ByteVector.fromUint(0x1234, false), // Stream serial number + ByteVector.fromUint(0x2345, false), // Page sequence number + ByteVector.fromSize(4), // Checksum + 0x03, // Page segment count + 0x12, // Page segment 1 (complete) + 0xFF, // Page segment 2 (partial) + 0xFF // Page segment 3 (partial) + ); + const file = TestFile.getFile(data); + const originalHeader = OggPageHeader.fromFile(file, 10); + + // Act + const header = OggPageHeader.fromPageHeader(originalHeader, 123, OggPageFlags.None); + + // Assert + assert.ok(header); + assert.strictEqual(header.absoluteGranularPosition, 0x123456); + assert.strictEqual(header.dataSize, 528); + assert.strictEqual(header.flags, OggPageFlags.None); + assert.isFalse(header.lastPacketComplete); + assert.deepStrictEqual(header.packetSizes, []); + assert.strictEqual(header.pageSequenceNumber, 9152); + assert.strictEqual(header.size, 30); + assert.strictEqual(header.streamSerialNumber, 0x1234); + } + + @test + public fromPageHeader_firstPageOfStream() { + // Arrange + const data = ByteVector.concatenate( + ByteVector.fromSize(10), // Buffer + OggPageHeader.HEADER_IDENTIFIER, + 0x05, // Version + 0x07, // Flags, + ByteVector.fromUlong(0x123456, false), // Absolute granular position + ByteVector.fromUint(0x1234, false), // Stream serial number + ByteVector.fromUint(0x00, false), // Page sequence number + ByteVector.fromSize(4), // Checksum + 0x03, // Page segment count + 0x12, // Page segment 1 (complete) + 0xFF, // Page segment 2 (partial) + 0xFF // Page segment 3 (partial) + ); + const file = TestFile.getFile(data); + const originalHeader = OggPageHeader.fromFile(file, 10); + + // Act + const header = OggPageHeader.fromPageHeader(originalHeader, 0, OggPageFlags.None); + + // Assert + assert.ok(header); + assert.strictEqual(header.absoluteGranularPosition, 0x123456); + assert.strictEqual(header.dataSize, 528); + assert.strictEqual(header.flags, OggPageFlags.FirstPageOfStream); + assert.isFalse(header.lastPacketComplete); + assert.deepStrictEqual(header.packetSizes, []); + assert.strictEqual(header.pageSequenceNumber, 0); + assert.strictEqual(header.size, 30); + assert.strictEqual(header.streamSerialNumber, 0x1234); + } + + @test + public fromPageHeader_firstPageOfStreamContinued() { + // Arrange + const data = ByteVector.concatenate( + ByteVector.fromSize(10), // Buffer + OggPageHeader.HEADER_IDENTIFIER, + 0x05, // Version + 0x07, // Flags, + ByteVector.fromUlong(0x123456, false), // Absolute granular position + ByteVector.fromUint(0x1234, false), // Stream serial number + ByteVector.fromUint(0x00, false), // Page sequence number + ByteVector.fromSize(4), // Checksum + 0x03, // Page segment count + 0x12, // Page segment 1 (complete) + 0xFF, // Page segment 2 (partial) + 0xFF // Page segment 3 (partial) + ); + const file = TestFile.getFile(data); + const originalHeader = OggPageHeader.fromFile(file, 10); + + // Act + const header = OggPageHeader.fromPageHeader(originalHeader, 0, OggPageFlags.FirstPacketContinued); + + // Assert + assert.ok(header); + assert.strictEqual(header.absoluteGranularPosition, 0x123456); + assert.strictEqual(header.dataSize, 528); + assert.strictEqual(header.flags, OggPageFlags.FirstPacketContinued); + assert.isFalse(header.lastPacketComplete); + assert.deepStrictEqual(header.packetSizes, []); + assert.strictEqual(header.pageSequenceNumber, 0); + assert.strictEqual(header.size, 30); + assert.strictEqual(header.streamSerialNumber, 0x1234); + } + + @test + public setPacketSizes_invalidParameters() { + // Arrange + const header = OggPageHeader.fromInfo(1234, 0, OggPageFlags.None); + + // Act / Assert + Testers.testTruthy((v: number[]) => { header.packetSizes = v; }); + assert.throws(() => { header.packetSizes = [123, undefined]; }); + } + + @test + public setPacketSizes_validParameters() { + // Arrange + const header = OggPageHeader.fromInfo(1234, 0, OggPageFlags.None); + const value = [123, 234]; + + // Act + header.packetSizes = value; + + // Assert + assert.sameMembers(header.packetSizes, [123, 234]); + assert.notStrictEqual(header.packetSizes, value); + } +} diff --git a/test-unit/ogg/opusCodecTests.ts b/test-unit/ogg/opusCodecTests.ts new file mode 100644 index 00000000..f0c60eb9 --- /dev/null +++ b/test-unit/ogg/opusCodecTests.ts @@ -0,0 +1,292 @@ +import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; + +import CodecPackets from "./codecPackets"; +import Opus from "../../src/ogg/codecs/opus"; +import XiphComment from "../../src/xiph/xiphComment"; +import {ByteVector, StringType} from "../../src/byteVector"; +import {MediaTypes} from "../../src/properties"; +import {Testers} from "../utilities/testers"; + +@suite class Ogg_OpusTests { + @test + public constructor_invalidParameters() { + // Act / Assert + Testers.testTruthy((v: ByteVector) => new Opus(v)); + } + + @test + public constructor_doesNotStartWithSignature() { + // Arrange + const headerPacket = ByteVector.fromString("invalidString", StringType.Latin1); + + // Act / Assert + assert.throws(() => new Opus(headerPacket)); + } + + @test + public constructor_rtpChannelMapping_mono() { + // Arrange + const headerPacket = ByteVector.concatenate( + ByteVector.fromString("OpusHead", StringType.UTF8), // Magic header + 0x01, // Version + 0x01, // Channel count + 0x03, 0x04, // Pre-skip + 0x05, 0x06, 0x07, 0x08, // Original sample rate + 0x09, 0x0A, // Output gain + 0x00, // Channel mapping family (RTP) + ByteVector.fromSize(20, 0xBE) // Filler + ); + + // Act + const codec = new Opus(headerPacket); + + // Assert + assert.strictEqual(codec.audioBitrate, 0); + assert.strictEqual(codec.audioSampleRate, 0x08070605); + assert.strictEqual(codec.audioChannels, 1); + assert.isUndefined(codec.commentData); + assert.strictEqual(codec.description, `Opus v1 Audio`); + assert.strictEqual(codec.durationMilliseconds, 0); + assert.strictEqual(codec.mediaTypes, MediaTypes.Audio); + assert.strictEqual(codec.streamCount, 1); + } + + @test + public constructor_rtpChannelMapping_stereo() { + // Arrange + const headerPacket = ByteVector.concatenate( + ByteVector.fromString("OpusHead", StringType.UTF8), // Magic header + 0x01, // Version + 0x02, // Channel count + 0x03, 0x04, // Pre-skip + 0x05, 0x06, 0x07, 0x08, // Original sample rate + 0x09, 0x0A, // Output gain + 0x00, // Channel mapping family (RTP) + ByteVector.fromSize(20, 0xBE) // Filler + ); + + // Act + const codec = new Opus(headerPacket); + + // Assert + assert.strictEqual(codec.audioBitrate, 0); + assert.strictEqual(codec.audioSampleRate, 0x08070605); + assert.strictEqual(codec.audioChannels, 2); + assert.isUndefined(codec.commentData); + assert.strictEqual(codec.description, `Opus v1 Audio`); + assert.strictEqual(codec.durationMilliseconds, 0); + assert.strictEqual(codec.mediaTypes, MediaTypes.Audio); + assert.strictEqual(codec.streamCount, 1); + } + + @test + public constructor_vorbisChannelMapping() { + // Arrange + const headerPacket = ByteVector.concatenate( + ByteVector.fromString("OpusHead", StringType.UTF8), // Magic header + 0x01, // Version + 0x08, // Channel count + 0x03, 0x04, // Pre-skip + 0x05, 0x06, 0x07, 0x08, // Original sample rate + 0x09, 0x0A, // Output gain + 0x01, // Channel mapping family + 0x05, // Stream count 'N' + 0x03 // Two-channel stream count 'M' + ); + + // Act + const codec = new Opus(headerPacket); + + // Assert + assert.strictEqual(codec.audioBitrate, 0); + assert.strictEqual(codec.audioSampleRate, 0x08070605); + assert.strictEqual(codec.audioChannels, 8); + assert.isUndefined(codec.commentData); + assert.strictEqual(codec.description, `Opus v1 Audio`); + assert.strictEqual(codec.durationMilliseconds, 0); + assert.strictEqual(codec.mediaTypes, MediaTypes.Audio); + assert.strictEqual(codec.streamCount, 5); + } + + @test + public readPacket_packetIsNotCommentData() { + // Arrange + const codec = Ogg_OpusTests.getTestCodec(); + const packet = ByteVector.fromSize(20, 0x0F); + + // Act + const result = codec.readPacket(packet); + + // Assert + assert.isFalse(result); + assert.isUndefined(codec.commentData); + } + + @test + public readPacket_packetIsCommentData() { + // Arrange + const codec = Ogg_OpusTests.getTestCodec(); + const packet = ByteVector.concatenate( + ByteVector.fromString("OpusTags", StringType.UTF8), + ByteVector.fromString("foobarbaz", StringType.UTF8) + ); + + // Act + const result = codec.readPacket(packet); + + // Assert + assert.isTrue(result); + Testers.bvEqual(codec.commentData, packet.subarray(8)); + } + + @test + public readPacket_commentsAlreadyRead() { + // Arrange + const codec = Ogg_OpusTests.getTestCodec(); + const commentPacket1 = ByteVector.concatenate( + ByteVector.fromString("OpusTags", StringType.UTF8), + ByteVector.fromString("foobarbaz", StringType.UTF8) + ); + const commentPacket2 = ByteVector.concatenate( + ByteVector.fromString("OpusTags", StringType.UTF8), + ByteVector.fromString("fuxbuxquxx", StringType.UTF8) + ); + codec.readPacket(commentPacket1); + + // Act + const result = codec.readPacket(commentPacket2); + + // Assert + assert.isTrue(result); + Testers.bvEqual(codec.commentData, commentPacket1.subarray(8)); + } + + @test + public writeCommentPacket_invalidParameters() { + // Arrange + const codec = Ogg_OpusTests.getTestCodec(); + const comment = XiphComment.fromEmpty(); + + // Act / Assert + Testers.testTruthy((v: ByteVector[]) => codec.writeCommentPacket(v, comment)); + Testers.testTruthy((v: XiphComment) => codec.writeCommentPacket([], v)); + } + + @test + public writeCommentPacket_noPackets() { + // Arrange + const codec = Ogg_OpusTests.getTestCodec(); + const comment = XiphComment.fromEmpty(); + const packets: ByteVector[] = []; + + // Act + codec.writeCommentPacket(packets, comment); + + // Assert + assert.strictEqual(packets.length, 1); + + const expected = ByteVector.concatenate( + ByteVector.fromString("OpusTags", StringType.UTF8), + comment.render(true) + ); + Testers.bvEqual(packets[0], expected); + } + + @test + public writeCommentPacket_onePacket() { + // Arrange + const codec = Ogg_OpusTests.getTestCodec(); + const comment = XiphComment.fromEmpty(); + const packets = [ + ByteVector.fromString("OpusHead", StringType.UTF8) + ]; + + // Act + codec.writeCommentPacket(packets, comment); + + // Assert + assert.strictEqual(packets.length, 2); + + const expected = ByteVector.concatenate( + ByteVector.fromString("OpusTags", StringType.UTF8), + comment.render(true) + ); + Testers.bvEqual(packets[1], expected); + } + + @test + public writeCommentPacket_noCommentPackets() { + // Arrange + const codec = Ogg_OpusTests.getTestCodec(); + const comment = XiphComment.fromEmpty(); + const packets = [ + ByteVector.fromSize(10, 0x0C), + ByteVector.fromSize(10, 0x0F), + ]; + + // Act + codec.writeCommentPacket(packets, comment); + + // Assert + assert.strictEqual(packets.length, 3); + + const expected = ByteVector.concatenate( + ByteVector.fromString("OpusTags", StringType.UTF8), + comment.render(true) + ); + Testers.bvEqual(packets[1], expected); + } + + @test + public writeCommentPacket_hasCommentPacket() { + // Arrange + const codec = Ogg_OpusTests.getTestCodec(); + const comment = XiphComment.fromEmpty(); + const packets = [ + ByteVector.fromSize(10, 0x0C), + ByteVector.fromString("OpusTags", StringType.UTF8), + ByteVector.fromSize(10, 0x0F) + ]; + + // Act + codec.writeCommentPacket(packets, comment); + + // Assert + assert.strictEqual(packets.length, 3); + + const expected = ByteVector.concatenate( + ByteVector.fromString("OpusTags", StringType.UTF8), + comment.render(true) + ); + Testers.bvEqual(packets[1], expected); + } + + @test + public setDuration_invalidParameters() { + // Arrange + const codec = Ogg_OpusTests.getTestCodec(); + + // Act / Assert + Testers.testSafeUint((v) => codec.setDuration(v, 123)); + Testers.testSafeUint((v) => codec.setDuration(123, v)); + + assert.strictEqual(codec.durationMilliseconds, 0); + } + + @test + public setDuration_validParameters() { + // Arrange + const codec = Ogg_OpusTests.getTestCodec(); + + // Act + codec.setDuration(0, 123456789); + + // Assert + assert.approximately(codec.durationMilliseconds, 2571995, 0.5); + } + + private static getTestCodec(): Opus { + return new Opus(CodecPackets.getTestOpusPacket()); + } +} diff --git a/test-unit/ogg/theoraCodecTests.ts b/test-unit/ogg/theoraCodecTests.ts new file mode 100644 index 00000000..a95cb80d --- /dev/null +++ b/test-unit/ogg/theoraCodecTests.ts @@ -0,0 +1,235 @@ +import {assert} from "chai"; +import {suite, test} from "@testdeck/mocha"; + +import Theora from "../../src/ogg/codecs/theora"; +import XiphComment from "../../src/xiph/xiphComment"; +import {ByteVector, StringType} from "../../src/byteVector"; +import {MediaTypes} from "../../src/properties"; +import {Testers} from "../utilities/testers"; +import CodecPackets from "./codecPackets"; + +@suite class Ogg_TheoraTests { + @test + public constructor_invalidParameters() { + // Act / Assert + Testers.testTruthy((v: ByteVector) => new Theora(v)); + } + + @test + public constructor_doesNotStartWithSignature() { + // Arrange + const headerPacket = ByteVector.fromString("invalidString", StringType.UTF8); + + // Act / Assert + assert.throws(() => new Theora(headerPacket)); + } + + @test + public constructor_validPacket() { + // Arrange + const headerPacket = ByteVector.concatenate( + 0x80, ByteVector.fromString("theora", StringType.UTF8), + 0x01, 0x02, 0x03, // version + ByteVector.fromUint(0), // Size in macro blocks + 0xF0, 0x12, 0x34, // Width in pixels + 0xF0, 0x45, 0x67, // Height in pixels + 0x01, 0x02, // Picture offset in pixels + ByteVector.fromUint(1234), // Frame rate numerator + ByteVector.fromUint(2345), // Frame rate denominator + ByteVector.fromSize(10, 0xFF), // Stuff we don't care about + 0xFC, 0x56, 0xEF // "last bits" including keyframe granule shift + ); + + // Act + const codec = new Theora(headerPacket); + + // Assert + assert.isUndefined(codec.commentData); + assert.strictEqual(codec.description, "Theora v1.2 Video"); + assert.strictEqual(codec.durationMilliseconds, 0); + assert.strictEqual(codec.mediaTypes, MediaTypes.Video); + assert.strictEqual(codec.videoHeight, 17767); + assert.strictEqual(codec.videoWidth, 4660); + } + + @test + public readPacket_packetIsNotCommentData() { + // Arrange + const codec = Ogg_TheoraTests.getTestCodec(); + const packet = ByteVector.fromSize(20, 0x0F); + + // Act + const result = codec.readPacket(packet); + + // Assert + assert.isFalse(result); + assert.isUndefined(codec.commentData); + } + + @test + public readPacket_packetIsCommentData() { + // Arrange + const codec = Ogg_TheoraTests.getTestCodec(); + const packet = ByteVector.concatenate( + 0x81, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, + ByteVector.fromString("foobarbaz", StringType.UTF8) + ); + + // Act + const result = codec.readPacket(packet); + + // Assert + assert.isTrue(result); + Testers.bvEqual(codec.commentData, packet.subarray(7)); + } + + @test + public readPacket_commentsAlreadyRead() { + // Arrange + const codec = Ogg_TheoraTests.getTestCodec(); + const commentPacket1 = ByteVector.concatenate( + 0x81, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, + ByteVector.fromString("foobarbaz", StringType.UTF8) + ); + const commentPacket2 = ByteVector.concatenate( + 0x81, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, + ByteVector.fromString("fuxbuxquxx", StringType.UTF8) + ); + codec.readPacket(commentPacket1); + + // Act + const result = codec.readPacket(commentPacket2); + + // Assert + assert.isTrue(result); + Testers.bvEqual(codec.commentData, commentPacket1.subarray(7)); + } + + @test + public writeCommentPacket_invalidParameters() { + // Arrange + const codec = Ogg_TheoraTests.getTestCodec(); + const comment = XiphComment.fromEmpty(); + + // Act / Assert + Testers.testTruthy((v: ByteVector[]) => codec.writeCommentPacket(v, comment)); + Testers.testTruthy((v: XiphComment) => codec.writeCommentPacket([], v)); + } + + @test + public writeCommentPacket_noPackets() { + // Arrange + const codec = Ogg_TheoraTests.getTestCodec(); + const comment = XiphComment.fromEmpty(); + const packets: ByteVector[] = []; + + // Act + codec.writeCommentPacket(packets, comment); + + // Assert + assert.strictEqual(packets.length, 1); + + const expected = ByteVector.concatenate( + 0x81, ByteVector.fromString("theora", StringType.UTF8), + comment.render(true) + ); + Testers.bvEqual(packets[0], expected); + } + + @test + public writeCommentPacket_onePacket() { + // Arrange + const codec = Ogg_TheoraTests.getTestCodec(); + const comment = XiphComment.fromEmpty(); + const packets = [ + ByteVector.fromString("OpusHead", StringType.UTF8) + ]; + + // Act + codec.writeCommentPacket(packets, comment); + + // Assert + assert.strictEqual(packets.length, 2); + + const expected = ByteVector.concatenate( + 0x81, ByteVector.fromString("theora", StringType.UTF8), + comment.render(true) + ); + Testers.bvEqual(packets[1], expected); + } + + @test + public writeCommentPacket_noCommentPackets() { + // Arrange + const codec = Ogg_TheoraTests.getTestCodec(); + const comment = XiphComment.fromEmpty(); + const packets = [ + ByteVector.fromSize(10, 0x0C), + ByteVector.fromSize(10, 0x0F), + ]; + + // Act + codec.writeCommentPacket(packets, comment); + + // Assert + assert.strictEqual(packets.length, 3); + + const expected = ByteVector.concatenate( + 0x81, ByteVector.fromString("theora", StringType.UTF8), + comment.render(true) + ); + Testers.bvEqual(packets[1], expected); + } + + @test + public writeCommentPacket_hasCommentPacket() { + // Arrange + const codec = Ogg_TheoraTests.getTestCodec(); + const comment = XiphComment.fromEmpty(); + const packets = [ + ByteVector.fromSize(10, 0x0C), + ByteVector.concatenate(0x81, ByteVector.fromString("theora", StringType.UTF8)), + ByteVector.fromSize(10, 0x0F) + ]; + + // Act + codec.writeCommentPacket(packets, comment); + + // Assert + assert.strictEqual(packets.length, 3); + + const expected = ByteVector.concatenate( + 0x81, ByteVector.fromString("theora", StringType.UTF8), + comment.render(true) + ); + Testers.bvEqual(packets[1], expected); + } + + @test + public setDuration_invalidParameters() { + // Arrange + const codec = Ogg_TheoraTests.getTestCodec(); + + // Act / Assert + Testers.testSafeUint((v) => codec.setDuration(v, 123)); + Testers.testSafeUint((v) => codec.setDuration(123, v)); + + assert.strictEqual(codec.durationMilliseconds, 0); + } + + @test + public setDuration_validParameters() { + // Arrange + const codec = Ogg_TheoraTests.getTestCodec(); + + // Act + codec.setDuration(123456, 456789); + + // Assert + assert.approximately(codec.durationMilliseconds, 158361612, 1); + } + + private static getTestCodec(): Theora { + return new Theora(CodecPackets.getTestTheoraPacket()); + } +} diff --git a/test-unit/ogg/vorbisCodecTests.ts b/test-unit/ogg/vorbisCodecTests.ts new file mode 100644 index 00000000..9946db2b --- /dev/null +++ b/test-unit/ogg/vorbisCodecTests.ts @@ -0,0 +1,237 @@ +import {assert} from "chai"; +import {suite, test} from "@testdeck/mocha"; + +import CodecPackets from "./codecPackets"; +import Vorbis from "../../src/ogg/codecs/vorbis"; +import XiphComment from "../../src/xiph/xiphComment"; +import {ByteVector, StringType} from "../../src/byteVector"; +import {MediaTypes} from "../../src/properties"; +import {Testers} from "../utilities/testers"; + +@suite class Ogg_VorbisTests { + @test + public constructor_invalidParameters() { + // Act / Assert + Testers.testTruthy((v: ByteVector) => new Vorbis(v)); + } + + @test + public constructor_doesNotStartWithSignature() { + // Arrange + const headerPacket = ByteVector.fromString("invalidString", StringType.UTF8); + + // Act / Assert + assert.throws(() => new Vorbis(headerPacket)); + } + + @test + public constructor_validPacket() { + // Arrange + const headerPacket = ByteVector.concatenate( + 0x01, ByteVector.fromString("vorbis", StringType.UTF8), + ByteVector.fromUint(1234, false), // Version + 0x05, // Channels + ByteVector.fromUint(456789, false), // Sample rate + ByteVector.fromUint(200000, false), // bitrate max + ByteVector.fromUint(128000, false), // bitrate nominal + ByteVector.fromUint(100000, false), // bitrate min + // We don't care about anything after this + ); + + // Act + const codec = new Vorbis(headerPacket); + + // Assert + assert.strictEqual(codec.audioBitrate, 128); + assert.strictEqual(codec.audioChannels, 5); + assert.strictEqual(codec.audioSampleRate, 456789); + assert.isUndefined(codec.commentData); + assert.strictEqual(codec.description, "Vorbis v1234 Audio"); + assert.strictEqual(codec.durationMilliseconds, 0); + assert.strictEqual(codec.mediaTypes, MediaTypes.Audio); + } + + @test + public readPacket_packetIsNotCommentData() { + // Arrange + const codec = Ogg_VorbisTests.getTestCodec(); + const packet = ByteVector.fromSize(20, 0x0F); + + // Act + const result = codec.readPacket(packet); + + // Assert + assert.isFalse(result); + assert.isUndefined(codec.commentData); + } + + @test + public readPacket_packetIsCommentData() { + // Arrange + const codec = Ogg_VorbisTests.getTestCodec(); + const packet = ByteVector.concatenate( + 0x03, + ByteVector.fromString("vorbis", StringType.UTF8), + ByteVector.fromString("foobarbaz", StringType.UTF8) + ); + + // Act + const result = codec.readPacket(packet); + + // Assert + assert.isTrue(result); + Testers.bvEqual(codec.commentData, packet.subarray(7)); + } + + @test + public readPacket_commentsAlreadyRead() { + // Arrange + const codec = Ogg_VorbisTests.getTestCodec(); + const commentPacket1 = ByteVector.concatenate( + 0x03, + ByteVector.fromString("vorbis", StringType.UTF8), + ByteVector.fromString("foobarbaz", StringType.UTF8) + ); + const commentPacket2 = ByteVector.concatenate( + 0x03, + ByteVector.fromString("vorbis", StringType.UTF8), + ByteVector.fromString("fuxbuxquxx", StringType.UTF8) + ); + codec.readPacket(commentPacket1); + + // Act + const result = codec.readPacket(commentPacket2); + + // Assert + assert.isTrue(result); + Testers.bvEqual(codec.commentData, commentPacket1.subarray(7)); + } + + @test + public writeCommentPacket_invalidParameters() { + // Arrange + const codec = Ogg_VorbisTests.getTestCodec(); + const comment = XiphComment.fromEmpty(); + + // Act / Assert + Testers.testTruthy((v: ByteVector[]) => codec.writeCommentPacket(v, comment)); + Testers.testTruthy((v: XiphComment) => codec.writeCommentPacket([], v)); + } + + @test + public writeCommentPacket_noPackets() { + // Arrange + const codec = Ogg_VorbisTests.getTestCodec(); + const comment = XiphComment.fromEmpty(); + const packets: ByteVector[] = []; + + // Act + codec.writeCommentPacket(packets, comment); + + // Assert + assert.strictEqual(packets.length, 1); + + const expected = ByteVector.concatenate( + 0x03, ByteVector.fromString("vorbis", StringType.UTF8), + comment.render(true) + ); + Testers.bvEqual(packets[0], expected); + } + + @test + public writeCommentPacket_onePacket() { + // Arrange + const codec = Ogg_VorbisTests.getTestCodec(); + const comment = XiphComment.fromEmpty(); + const packets = [ + ByteVector.fromString("OpusHead", StringType.UTF8) + ]; + + // Act + codec.writeCommentPacket(packets, comment); + + // Assert + assert.strictEqual(packets.length, 2); + + const expected = ByteVector.concatenate( + 0x03, ByteVector.fromString("vorbis", StringType.UTF8), + comment.render(true) + ); + Testers.bvEqual(packets[1], expected); + } + + @test + public writeCommentPacket_noCommentPackets() { + // Arrange + const codec = Ogg_VorbisTests.getTestCodec(); + const comment = XiphComment.fromEmpty(); + const packets = [ + ByteVector.fromSize(10, 0x0C), + ByteVector.fromSize(10, 0x0F), + ]; + + // Act + codec.writeCommentPacket(packets, comment); + + // Assert + assert.strictEqual(packets.length, 3); + + const expected = ByteVector.concatenate( + 0x03, ByteVector.fromString("vorbis", StringType.UTF8), + comment.render(true) + ); + Testers.bvEqual(packets[1], expected); + } + + @test + public writeCommentPacket_hasCommentPacket() { + // Arrange + const codec = Ogg_VorbisTests.getTestCodec(); + const comment = XiphComment.fromEmpty(); + const packets = [ + ByteVector.fromSize(10, 0x0C), + ByteVector.concatenate(0x03, ByteVector.fromString("vorbis", StringType.UTF8)), + ByteVector.fromSize(10, 0x0F) + ]; + + // Act + codec.writeCommentPacket(packets, comment); + + // Assert + assert.strictEqual(packets.length, 3); + + const expected = ByteVector.concatenate( + 0x03, ByteVector.fromString("vorbis", StringType.UTF8), + comment.render(true) + ); + Testers.bvEqual(packets[1], expected); + } + + @test + public setDuration_invalidParameters() { + // Arrange + const codec = Ogg_VorbisTests.getTestCodec(); + + // Act / Assert + Testers.testSafeUint((v) => codec.setDuration(v, 123)); + Testers.testSafeUint((v) => codec.setDuration(123, v)); + + assert.strictEqual(codec.durationMilliseconds, 0); + } + + @test + public setDuration_validParameters() { + // Arrange + const codec = Ogg_VorbisTests.getTestCodec(); + + // Act + codec.setDuration(123456, 456789); + + // Assert + assert.approximately(codec.durationMilliseconds, 729, 1); + } + + private static getTestCodec(): Vorbis { + return new Vorbis(CodecPackets.getTestVorbisPacket()); + } +} diff --git a/test-unit/pictureLazyTests.ts b/test-unit/pictureLazyTests.ts index ef2d3442..e52d7b38 100644 --- a/test-unit/pictureLazyTests.ts +++ b/test-unit/pictureLazyTests.ts @@ -2,11 +2,10 @@ import * as Chai from "chai"; import * as TypeMoq from "typemoq"; import {suite, test} from "@testdeck/mocha"; -import PictureLazy from "../src/pictureLazy"; import TestStream from "./utilities/testStream"; import {IFileAbstraction} from "../src/fileAbstraction"; import {ByteVector, StringType} from "../src/byteVector"; -import {PictureType} from "../src/iPicture"; +import {PictureLazy, PictureType} from "../src/picture"; import {Testers} from "./utilities/testers"; // Setup chai @@ -72,7 +71,7 @@ const assert = Chai.assert; @test public fromFile_hasImageFilenameNoOffsetReadAll() { // Arrange - const data = ByteVector.fromString("foobarbaz"); + const data = ByteVector.fromString("foobarbaz", StringType.Latin1); const mockStream = new TestStream(data, false); const mockFile = TypeMoq.Mock.ofType(); @@ -97,7 +96,7 @@ const assert = Chai.assert; @test public fromFile_hasNonImageFilenameNoOffsetReadAll() { // Arrange - const data = ByteVector.fromString("foobarbaz"); + const data = ByteVector.fromString("foobarbaz", StringType.Latin1); const mockStream = new TestStream(data, false); const mockFile = TypeMoq.Mock.ofType(); @@ -124,7 +123,7 @@ const assert = Chai.assert; // Arrange const data = ByteVector.concatenate( 0xFF, 0xD8, 0xFF, - ByteVector.fromString("foobarbaz") + ByteVector.fromString("foobarbaz", StringType.Latin1) ); const mockStream = new TestStream(data, false); @@ -150,7 +149,7 @@ const assert = Chai.assert; @test public fromFile_noExtensionNotImageNoOffsetReadAll() { // Arrange - const data = ByteVector.fromString("foobarbaz"); + const data = ByteVector.fromString("foobarbaz", StringType.Latin1); const mockStream = new TestStream(data, false); const mockFile = TypeMoq.Mock.ofType(); @@ -175,7 +174,7 @@ const assert = Chai.assert; @test public fromFile_noFilenameNotImageFileNoOffsetReadAll() { // Arrange - const data = ByteVector.fromString("foobarbaz"); + const data = ByteVector.fromString("foobarbaz", StringType.Latin1); const mockStream = new TestStream(data, false); const mockFile = TypeMoq.Mock.ofType(); @@ -199,7 +198,7 @@ const assert = Chai.assert; @test public fromFile_hasOffsetReadAll() { - const data = ByteVector.fromString("foobarbaz"); + const data = ByteVector.fromString("foobarbaz", StringType.Latin1); const allData = ByteVector.concatenate( 0x00, 0x00, data diff --git a/test-unit/pictureTests.ts b/test-unit/pictureTests.ts index f5d880df..d5de9fd7 100644 --- a/test-unit/pictureTests.ts +++ b/test-unit/pictureTests.ts @@ -1,7 +1,7 @@ import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; -import Picture from "../src/picture"; +import {Picture} from "../src/picture"; import {ByteVector, StringType} from "../src/byteVector"; // Setup chai @@ -11,7 +11,7 @@ const assert = Chai.assert; @test public getExtensionFromData_noMatch() { // Arrange - const data = ByteVector.fromString("FOObarBaZ"); + const data = ByteVector.fromString("FOObarBaZ", StringType.Latin1); // Act const output = Picture.getExtensionFromData(data); @@ -37,7 +37,7 @@ const assert = Chai.assert; // Arrange const data = ByteVector.concatenate( 0xFF, 0xD8, 0xFF, - ByteVector.fromString("foobarbaz") + ByteVector.fromString("foobarbaz", StringType.Latin1) ); // Act diff --git a/test-unit/riff/aviHeaderTests.ts b/test-unit/riff/aviHeaderTests.ts index c6c90d01..6b8c1a45 100644 --- a/test-unit/riff/aviHeaderTests.ts +++ b/test-unit/riff/aviHeaderTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import AviHeader from "../../src/riff/avi/aviHeader"; import RiffList from "../../src/riff/riffList"; @@ -8,9 +8,6 @@ import {AviStream, AviStreamType} from "../../src/riff/avi/aviStream"; import {ByteVector} from "../../src/byteVector"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - @suite class Riff_AviHeaderTests { @test public constructor_invalidParams() { @@ -30,7 +27,7 @@ const assert = Chai.assert; @test public constructor_headerChunkMissing() { // Arrange - const list = RiffList.fromEmpty(AviHeader.headerListType); + const list = RiffList.fromEmpty(AviHeader.HEADER_LIST_TYPE); // Act / Assert assert.throws(() => new AviHeader(list)); @@ -39,8 +36,8 @@ const assert = Chai.assert; @test public constructor_headerInfoTooShort() { // Arrange - const list = RiffList.fromEmpty(AviHeader.headerListType); - list.setValues(AviHeader.headerChunkId, [ByteVector.empty()]); + const list = RiffList.fromEmpty(AviHeader.HEADER_LIST_TYPE); + list.setValues(AviHeader.HEADER_CHUNK_ID, [ByteVector.empty()]); // Act / Assert assert.throws(() => new AviHeader(list)); @@ -49,8 +46,8 @@ const assert = Chai.assert; @test public constructor_noStreams() { // Arrange - const list = RiffList.fromEmpty(AviHeader.headerListType); - list.setValues(AviHeader.headerChunkId, [Resources.getAviHeader()]); + const list = RiffList.fromEmpty(AviHeader.HEADER_LIST_TYPE); + list.setValues(AviHeader.HEADER_CHUNK_ID, [Resources.getAviHeader()]); // Act const header = new AviHeader(list); @@ -69,26 +66,26 @@ const assert = Chai.assert; @test public constructor_hasUnsupportedStreams() { // Arrange - const list = RiffList.fromEmpty(AviHeader.headerListType); - list.setValues(AviHeader.headerChunkId, [Resources.getAviHeader()]); + const list = RiffList.fromEmpty(AviHeader.HEADER_LIST_TYPE); + list.setValues(AviHeader.HEADER_CHUNK_ID, [Resources.getAviHeader()]); const header1Data = ByteVector.concatenate( - ByteVector.fromUInt(AviStreamType.MIDI_STREAM, false), + ByteVector.fromUint(AviStreamType.MidiStream, false), ByteVector.fromSize(52) ); - const streamList1 = RiffList.fromEmpty(AviStream.listType); - streamList1.setValues(AviStream.headerChunkId, [header1Data]); - streamList1.setValues(AviStream.formatChunkId, [ByteVector.empty()]); + const streamList1 = RiffList.fromEmpty(AviStream.LIST_TYPE); + streamList1.setValues(AviStream.HEADER_CHUNK_ID, [header1Data]); + streamList1.setValues(AviStream.FORMAT_CHUNK_ID, [ByteVector.empty()]); const header2Data = ByteVector.concatenate( - ByteVector.fromUInt(AviStreamType.TEXT_STREAM, false), + ByteVector.fromUint(AviStreamType.TextStream, false), ByteVector.fromSize(52) ); - const streamList2 = RiffList.fromEmpty(AviStream.listType); - streamList2.setValues(AviStream.headerChunkId, [header2Data]); - streamList2.setValues(AviStream.formatChunkId, [ByteVector.empty()]); + const streamList2 = RiffList.fromEmpty(AviStream.LIST_TYPE); + streamList2.setValues(AviStream.HEADER_CHUNK_ID, [header2Data]); + streamList2.setValues(AviStream.FORMAT_CHUNK_ID, [ByteVector.empty()]); - list.setLists(AviStream.listType, [streamList1, streamList2]); + list.setLists(AviStream.LIST_TYPE, [streamList1, streamList2]); // Act const header = new AviHeader(list); @@ -102,24 +99,24 @@ const assert = Chai.assert; assert.isOk(header.streams); assert.strictEqual(header.streams.length, 2); - assert.isOk(header.streams.find((s) => s.type === AviStreamType.MIDI_STREAM)); - assert.isOk(header.streams.find((s) => s.type === AviStreamType.TEXT_STREAM)); + assert.isOk(header.streams.find((s) => s.type === AviStreamType.MidiStream)); + assert.isOk(header.streams.find((s) => s.type === AviStreamType.TextStream)); } @test public constructor_hasSupportedStreams() { // Arrange - const list = RiffList.fromEmpty(AviHeader.headerListType); - list.setValues(AviHeader.headerChunkId, [Resources.getAviHeader()]); + const list = RiffList.fromEmpty(AviHeader.HEADER_LIST_TYPE); + list.setValues(AviHeader.HEADER_CHUNK_ID, [Resources.getAviHeader()]); const header1Data = ByteVector.concatenate( - ByteVector.fromUInt(AviStreamType.AUDIO_STREAM, false), + ByteVector.fromUint(AviStreamType.AudioStream, false), ByteVector.fromSize(52) ); - const streamList1 = RiffList.fromEmpty(AviStream.listType); - streamList1.setValues(AviStream.headerChunkId, [header1Data]); - streamList1.setValues(AviStream.formatChunkId, [ByteVector.fromSize(16)]); - list.setLists(AviStream.listType, [streamList1]); + const streamList1 = RiffList.fromEmpty(AviStream.LIST_TYPE); + streamList1.setValues(AviStream.HEADER_CHUNK_ID, [header1Data]); + streamList1.setValues(AviStream.FORMAT_CHUNK_ID, [ByteVector.fromSize(16)]); + list.setLists(AviStream.LIST_TYPE, [streamList1]); // Act const header = new AviHeader(list); @@ -133,7 +130,7 @@ const assert = Chai.assert; assert.isOk(header.streams); assert.strictEqual(header.streams.length, 1); - assert.isOk(header.streams.find((s) => s.type === AviStreamType.AUDIO_STREAM)); + assert.isOk(header.streams.find((s) => s.type === AviStreamType.AudioStream)); } private static assertTestHeader(header: AviHeader) { diff --git a/test-unit/riff/aviStreamTests.ts b/test-unit/riff/aviStreamTests.ts index 233b2c21..749c4b5c 100644 --- a/test-unit/riff/aviStreamTests.ts +++ b/test-unit/riff/aviStreamTests.ts @@ -1,17 +1,14 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import RiffBitmapInfoHeader from "../../src/riff/riffBitmapInfoHeader"; import RiffList from "../../src/riff/riffList"; import {default as Resources} from "./resources"; import {AviStream, AviStreamType} from "../../src/riff/avi/aviStream"; -import {ByteVector} from "../../src/byteVector"; +import {ByteVector, StringType} from "../../src/byteVector"; import {Testers} from "../utilities/testers"; import RiffWaveFormatEx from "../../src/riff/riffWaveFormatEx"; -// Setup chai -const assert = Chai.assert; - @suite class Riff_AviStreamTest { @test public constructor_invalidParams() { @@ -92,7 +89,7 @@ const assert = Chai.assert; public constructor_midiStream() { // Arrange const list = RiffList.fromEmpty("strl"); - list.setValues("strh", [Resources.getAviStreamHeaderData(AviStreamType.MIDI_STREAM)]); + list.setValues("strh", [Resources.getAviStreamHeaderData(AviStreamType.MidiStream)]); list.setValues("strf", [ByteVector.empty()]); // Act @@ -100,7 +97,7 @@ const assert = Chai.assert; // Assert assert.isOk(stream); - Riff_AviStreamTest.assertStreamHeaderData(stream, AviStreamType.MIDI_STREAM); + Riff_AviStreamTest.assertStreamHeaderData(stream, AviStreamType.MidiStream); assert.isUndefined(stream.codec); } @@ -108,7 +105,7 @@ const assert = Chai.assert; public constructor_textStream() { // Arrange const list = RiffList.fromEmpty("strl"); - list.setValues("strh", [Resources.getAviStreamHeaderData(AviStreamType.TEXT_STREAM)]); + list.setValues("strh", [Resources.getAviStreamHeaderData(AviStreamType.TextStream)]); list.setValues("strf", [ByteVector.empty()]); // Act @@ -116,7 +113,7 @@ const assert = Chai.assert; // Assert assert.isOk(stream); - Riff_AviStreamTest.assertStreamHeaderData(stream, AviStreamType.TEXT_STREAM); + Riff_AviStreamTest.assertStreamHeaderData(stream, AviStreamType.TextStream); assert.isUndefined(stream.codec); } @@ -124,9 +121,9 @@ const assert = Chai.assert; public constructor_audioStream() { // Arrange const list = RiffList.fromEmpty("strl"); - list.setValues("strh", [Resources.getAviStreamHeaderData(AviStreamType.AUDIO_STREAM)]); + list.setValues("strh", [Resources.getAviStreamHeaderData(AviStreamType.AudioStream)]); list.setValues("strf", [ByteVector.concatenate( - ByteVector.fromUShort(0xBBBB), + ByteVector.fromUshort(0xBBBB), ByteVector.fromSize(14) )]); @@ -135,21 +132,21 @@ const assert = Chai.assert; // Assert assert.isOk(stream); - Riff_AviStreamTest.assertStreamHeaderData(stream, AviStreamType.AUDIO_STREAM); + Riff_AviStreamTest.assertStreamHeaderData(stream, AviStreamType.AudioStream); assert.isOk(stream.codec); assert.instanceOf(stream.codec, RiffWaveFormatEx); - assert.isTrue(( stream.codec).description.indexOf("0xBBBB") >= 0); + assert.isTrue(( stream.codec).description.indexOf("0xBBBB") >= 0); } @test public constructor_videoStream() { // Arrange const list = RiffList.fromEmpty("strl"); - list.setValues("strh", [Resources.getAviStreamHeaderData(AviStreamType.VIDEO_STREAM)]); + list.setValues("strh", [Resources.getAviStreamHeaderData(AviStreamType.VideoStream)]); list.setValues("strf", [ByteVector.concatenate( ByteVector.fromSize(16), - ByteVector.fromString("fooo"), + ByteVector.fromString("fooo", StringType.UTF8), ByteVector.fromSize(20) )]); @@ -158,7 +155,7 @@ const assert = Chai.assert; // Assert assert.isOk(stream); - Riff_AviStreamTest.assertStreamHeaderData(stream, AviStreamType.VIDEO_STREAM); + Riff_AviStreamTest.assertStreamHeaderData(stream, AviStreamType.VideoStream); assert.isOk(stream.codec); assert.instanceOf(stream.codec, RiffBitmapInfoHeader); diff --git a/test-unit/riff/divxTagTests.ts b/test-unit/riff/divxTagTests.ts index 5353ec17..fa1e9ed8 100644 --- a/test-unit/riff/divxTagTests.ts +++ b/test-unit/riff/divxTagTests.ts @@ -1,16 +1,13 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import DivxTag from "../../src/riff/divxTag"; import {default as Resources} from "./resources"; -import {ByteVector} from "../../src/byteVector"; +import {ByteVector, StringType} from "../../src/byteVector"; import {TagTypes} from "../../src/tag"; import {TagTesters, Testers} from "../utilities/testers"; import PropertyTests from "../utilities/propertyTests"; -// Setup chai -const assert = Chai.assert; - @suite class Riff_DivxTagTests { @test public fromEmpty() { @@ -43,7 +40,7 @@ const assert = Chai.assert; // Arrange const data = ByteVector.concatenate( ByteVector.fromSize(DivxTag.SIZE), - ByteVector.fromString("FooBarBaz") + ByteVector.fromString("FooBarBaz", StringType.UTF8) ); // Act / Assert diff --git a/test-unit/riff/infoTagTests.ts b/test-unit/riff/infoTagTests.ts index 1996bcfe..9650a8b4 100644 --- a/test-unit/riff/infoTagTests.ts +++ b/test-unit/riff/infoTagTests.ts @@ -1,5 +1,5 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import InfoTag from "../../src/riff/infoTag"; import PropertyTests from "../utilities/propertyTests"; @@ -8,9 +8,6 @@ import {TagTypes} from "../../src/tag"; import {TagTesters, Testers} from "../utilities/testers"; import RiffList from "../../src/riff/riffList"; -// Setup chai -const assert = Chai.assert; - @suite class Riff_InfoTagTests { @test public fromEmpty() { @@ -286,20 +283,20 @@ const assert = Chai.assert; } private static getTestTagData(): RiffList { - const list = RiffList.fromEmpty(InfoTag.listType); - list.setValues("INAM", [ByteVector.fromString("foo")]); - list.setValues("ISBJ", [ByteVector.fromString("bar")]); - list.setValues("ISTR", [ByteVector.fromString("baz")]); - list.setValues("IART", [ByteVector.fromString("fux")]); - list.setValues("IWRI", [ByteVector.fromString("bux")]); - list.setValues("DIRC", [ByteVector.fromString("qux")]); - list.setValues("ICNM", [ByteVector.fromString("foobar")]); - list.setValues("ICMT", [ByteVector.fromString("barbaz")]); - list.setValues("IGNR", [ByteVector.fromString("bazfux")]); - list.setValues("ICRD", [ByteVector.fromString("1234")]); - list.setValues("IPRT", [ByteVector.fromString("2345")]); - list.setValues("IFRM", [ByteVector.fromString("3456")]); - list.setValues("ICOP", [ByteVector.fromString("buxqux")]); + const list = RiffList.fromEmpty(InfoTag.LIST_TYPE); + list.setValues("INAM", [ByteVector.fromString("foo", StringType.UTF8)]); + list.setValues("ISBJ", [ByteVector.fromString("bar", StringType.UTF8)]); + list.setValues("ISTR", [ByteVector.fromString("baz", StringType.UTF8)]); + list.setValues("IART", [ByteVector.fromString("fux", StringType.UTF8)]); + list.setValues("IWRI", [ByteVector.fromString("bux", StringType.UTF8)]); + list.setValues("DIRC", [ByteVector.fromString("qux", StringType.UTF8)]); + list.setValues("ICNM", [ByteVector.fromString("foobar", StringType.UTF8)]); + list.setValues("ICMT", [ByteVector.fromString("barbaz", StringType.UTF8)]); + list.setValues("IGNR", [ByteVector.fromString("bazfux", StringType.UTF8)]); + list.setValues("ICRD", [ByteVector.fromString("1234", StringType.UTF8)]); + list.setValues("IPRT", [ByteVector.fromString("2345", StringType.UTF8)]); + list.setValues("IFRM", [ByteVector.fromString("3456", StringType.UTF8)]); + list.setValues("ICOP", [ByteVector.fromString("buxqux", StringType.UTF8)]); return list; } diff --git a/test-unit/riff/movieIdTagTests.ts b/test-unit/riff/movieIdTagTests.ts index fc2e46a2..431ae911 100644 --- a/test-unit/riff/movieIdTagTests.ts +++ b/test-unit/riff/movieIdTagTests.ts @@ -1,15 +1,12 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import MovieIdTag from "../../src/riff/movieIdTag"; import PropertyTests from "../utilities/propertyTests"; +import RiffList from "../../src/riff/riffList"; import {ByteVector, StringType} from "../../src/byteVector"; import {TagTypes} from "../../src/tag"; import {TagTesters, Testers} from "../utilities/testers"; -import RiffList from "../../src/riff/riffList"; - -// Setup chai -const assert = Chai.assert; @suite class Riff_MovieIdTagTests { @test @@ -179,13 +176,13 @@ const assert = Chai.assert; } private static getTestTagData(): RiffList { - const list = RiffList.fromEmpty(MovieIdTag.listType); - list.setValues("TITL", [ByteVector.fromString("foo")]); - list.setValues("IART", [ByteVector.fromString("bar")]); - list.setValues("COMM", [ByteVector.fromString("baz")]); - list.setValues("GENR", [ByteVector.fromString("fux")]); - list.setValues("PRT1", [ByteVector.fromString("1234")]); - list.setValues("PRT2", [ByteVector.fromString("2345")]); + const list = RiffList.fromEmpty(MovieIdTag.LIST_TYPE); + list.setValues("TITL", [ByteVector.fromString("foo", StringType.UTF8)]); + list.setValues("IART", [ByteVector.fromString("bar", StringType.UTF8)]); + list.setValues("COMM", [ByteVector.fromString("baz", StringType.UTF8)]); + list.setValues("GENR", [ByteVector.fromString("fux", StringType.UTF8)]); + list.setValues("PRT1", [ByteVector.fromString("1234", StringType.UTF8)]); + list.setValues("PRT2", [ByteVector.fromString("2345", StringType.UTF8)]); return list; } diff --git a/test-unit/riff/resources.ts b/test-unit/riff/resources.ts index 313bd8d2..70a62ac2 100644 --- a/test-unit/riff/resources.ts +++ b/test-unit/riff/resources.ts @@ -1,132 +1,141 @@ import AviHeader from "../../src/riff/avi/aviHeader"; +import DivxTag from "../../src/riff/divxTag"; +import RiffChunk from "../../src/riff/riffChunk"; import RiffList from "../../src/riff/riffList"; import {AviStream, AviStreamType} from "../../src/riff/avi/aviStream"; -import {ByteVector} from "../../src/byteVector"; -import RiffChunk from "../../src/riff/riffChunk"; -import DivxTag from "../../src/riff/divxTag"; +import {ByteVector, StringType} from "../../src/byteVector"; -export default { - getAudioFormatBlock(type: number): ByteVector { +export default class Resources{ + public static getAudioFormatBlock(type: number): ByteVector { return ByteVector.concatenate( - ByteVector.fromUShort(type, false), // Format tag - ByteVector.fromUShort(3, false), // Number of channels - ByteVector.fromUInt(1234, false), // Samples per second - ByteVector.fromUInt(2345, false), // Average bytes per second - ByteVector.fromUShort(88, false), // Block align - ByteVector.fromUShort(16, false) // Bits per sample + ByteVector.fromUshort(type, false), // Format tag + ByteVector.fromUshort(3, false), // Number of channels + ByteVector.fromUint(1234, false), // Samples per second + ByteVector.fromUint(2345, false), // Average bytes per second + ByteVector.fromUshort(88, false), // Block align + ByteVector.fromUshort(16, false) // Bits per sample ); - }, - getAviHeaderBlock(addStreams: boolean): ByteVector { - const headerList = RiffList.fromEmpty(AviHeader.headerListType); - headerList.setValues(AviHeader.headerChunkId, [this.getAviHeader()]); + } + + public static getAviHeaderBlock(addStreams: boolean): ByteVector { + const headerList = RiffList.fromEmpty(AviHeader.HEADER_LIST_TYPE); + headerList.setValues(AviHeader.HEADER_CHUNK_ID, [this.getAviHeader()]); if (!addStreams) { return headerList.render(); } - const streamLists = []; + const streamLists: RiffList[] = []; const streamTypes = [ - AviStreamType.AUDIO_STREAM, - AviStreamType.VIDEO_STREAM, - AviStreamType.MIDI_STREAM, - AviStreamType.TEXT_STREAM + AviStreamType.AudioStream, + AviStreamType.VideoStream, + AviStreamType.MidiStream, + AviStreamType.TextStream ]; for (const streamType of streamTypes) { - const streamList = RiffList.fromEmpty(AviStream.listType); - streamList.setValues(AviStream.headerChunkId, [this.getAviStreamHeaderData(streamType)]); + const streamList = RiffList.fromEmpty(AviStream.LIST_TYPE); + streamList.setValues(AviStream.HEADER_CHUNK_ID, [Resources.getAviStreamHeaderData(streamType)]); switch (streamType) { - case AviStreamType.AUDIO_STREAM: - streamList.setValues(AviStream.formatChunkId, [this.getAudioFormatBlock(0xF1AC)]); + case AviStreamType.AudioStream: + streamList.setValues(AviStream.FORMAT_CHUNK_ID, [Resources.getAudioFormatBlock(0xF1AC)]); break; - case AviStreamType.VIDEO_STREAM: - streamList.setValues(AviStream.formatChunkId, [this.getVideoFormatBlock(0xBBBBBBBB)]); + case AviStreamType.VideoStream: + streamList.setValues(AviStream.FORMAT_CHUNK_ID, [Resources.getVideoFormatBlock(0xBBBBBBBB)]); break; - case AviStreamType.MIDI_STREAM: - case AviStreamType.TEXT_STREAM: - streamList.setValues(AviStream.formatChunkId, [ByteVector.fromSize(10)]); + case AviStreamType.MidiStream: + case AviStreamType.TextStream: + streamList.setValues(AviStream.FORMAT_CHUNK_ID, [ByteVector.fromSize(10)]); } streamLists.push(streamList); } - headerList.setLists(AviStream.listType, streamLists); + headerList.setLists(AviStream.LIST_TYPE, streamLists); return headerList.render(); - }, - getAviHeader(): ByteVector { + } + + public static getAviHeader(): ByteVector { return ByteVector.concatenate( - ByteVector.fromUInt(1234, false), // Microseconds per frame - ByteVector.fromUInt(2345, false), // Max bytes per second - ByteVector.fromUInt(3456, false), // Padding granularity - ByteVector.fromUInt(4567, false), // Flags - ByteVector.fromUInt(5678, false), // Total frames - ByteVector.fromUInt(6789, false), // Initial frames - ByteVector.fromUInt(7890, false), // Streams - ByteVector.fromUInt(8901, false), // Suggested buffer size - ByteVector.fromUInt(9012, false), // Width - ByteVector.fromUInt(123, false), // Height + ByteVector.fromUint(1234, false), // Microseconds per frame + ByteVector.fromUint(2345, false), // Max bytes per second + ByteVector.fromUint(3456, false), // Padding granularity + ByteVector.fromUint(4567, false), // Flags + ByteVector.fromUint(5678, false), // Total frames + ByteVector.fromUint(6789, false), // Initial frames + ByteVector.fromUint(7890, false), // Streams + ByteVector.fromUint(8901, false), // Suggested buffer size + ByteVector.fromUint(9012, false), // Width + ByteVector.fromUint(123, false), // Height ByteVector.fromSize(16), // Reserved ); - }, - getAviStreamHeaderData(type: AviStreamType) { + } + + public static getAviStreamHeaderData(type: AviStreamType): ByteVector { return ByteVector.concatenate( - ByteVector.fromUInt(type, false), // type - ByteVector.fromUInt(0x23456789, false), // handler - ByteVector.fromUInt(0x34567890, false), // Flags - ByteVector.fromUShort(0x1234, false), // Priority - ByteVector.fromUShort(0x2345, false), // Language - ByteVector.fromUInt(0x45678901, false), // Initial Frames - ByteVector.fromUInt(0x56789012, false), // Scale - ByteVector.fromUInt(0x67890123, false), // Rate - ByteVector.fromUInt(0x78901234, false), // Start - ByteVector.fromUInt(0x89012345, false), // Length - ByteVector.fromUInt(0x90123456, false), // Suggested Buffer Size - ByteVector.fromUInt(0x01234567, false), // Quality - ByteVector.fromUInt(0x11234567, false), // Sample size - ByteVector.fromUShort(0x3456, false), // left - ByteVector.fromUShort(0x4567, false), // top - ByteVector.fromUShort(0x5678, false), // right - ByteVector.fromUShort(0x6789, false), // bottom + ByteVector.fromUint(type, false), // type + ByteVector.fromUint(0x23456789, false), // handler + ByteVector.fromUint(0x34567890, false), // Flags + ByteVector.fromUshort(0x1234, false), // Priority + ByteVector.fromUshort(0x2345, false), // Language + ByteVector.fromUint(0x45678901, false), // Initial Frames + ByteVector.fromUint(0x56789012, false), // Scale + ByteVector.fromUint(0x67890123, false), // Rate + ByteVector.fromUint(0x78901234, false), // Start + ByteVector.fromUint(0x89012345, false), // Length + ByteVector.fromUint(0x90123456, false), // Suggested Buffer Size + ByteVector.fromUint(0x01234567, false), // Quality + ByteVector.fromUint(0x11234567, false), // Sample size + ByteVector.fromUshort(0x3456, false), // left + ByteVector.fromUshort(0x4567, false), // top + ByteVector.fromUshort(0x5678, false), // right + ByteVector.fromUshort(0x6789, false), // bottom ); - }, - getDataChunk() { + } + + public static getDataChunk(): ByteVector { const chunk = RiffChunk.fromData("data", ByteVector.fromSize(1000)); return chunk.render(); - }, - getDivxTagData() { + } + + public static getDivxTagData() { return ByteVector.concatenate( - ByteVector.fromString("foo "), - ByteVector.fromString("bar;bux "), - ByteVector.fromString("2021"), - ByteVector.fromString("baz "), - ByteVector.fromString("22 "), + ByteVector.fromString("foo ", StringType.Latin1), + ByteVector.fromString("bar;bux ", StringType.Latin1), + ByteVector.fromString("2021", StringType.Latin1), + ByteVector.fromString("baz ", StringType.Latin1), + ByteVector.fromString("22 ", StringType.Latin1), ByteVector.fromSize(6), DivxTag.FILE_IDENTIFIER ); - }, - getJunkChunk(size: number = 1000) { + } + + public static getJunkChunk(size: number = 1000) { const chunk = RiffChunk.fromData("JUNK", ByteVector.fromSize(size)); return chunk.render(); - }, - getMoviChunk(): ByteVector { + } + + public static getMoviChunk(): ByteVector { const chunk = RiffChunk.fromData("movi", ByteVector.fromSize(10)); return chunk.render(); - }, - getVideoFormatBlock(fourcc: number): ByteVector { + } + + public static getVideoFormatBlock(fourcc: number): ByteVector { return ByteVector.concatenate( ByteVector.fromSize(10), // Offset - ByteVector.fromUInt(40, false), // Size of the struct - ByteVector.fromUInt(123, false), // Width of image - ByteVector.fromUInt(234, false), // Height of image - ByteVector.fromUShort(345, false), // Number of planes - ByteVector.fromUShort(456, false), // Average bits per pixel - ByteVector.fromUInt(fourcc, false), // FOURCC - ByteVector.fromUInt(567, false), // Size of the image - ByteVector.fromUInt(678, false), // Pixels per meter X - ByteVector.fromUInt(789, false), // Pixels per meter Y - ByteVector.fromUInt(890, false), // Colors used - ByteVector.fromUInt(1234, false), // Important colors + ByteVector.fromUint(40, false), // Size of the struct + ByteVector.fromUint(123, false), // Width of image + ByteVector.fromUint(234, false), // Height of image + ByteVector.fromUshort(345, false), // Number of planes + ByteVector.fromUshort(456, false), // Average bits per pixel + ByteVector.fromUint(fourcc, false), // FOURCC + ByteVector.fromUint(567, false), // Size of the image + ByteVector.fromUint(678, false), // Pixels per meter X + ByteVector.fromUint(789, false), // Pixels per meter Y + ByteVector.fromUint(890, false), // Colors used + ByteVector.fromUint(1234, false), // Important colors ); - }, - getWaveFormatBlock(): ByteVector { + } + + public static getWaveFormatBlock(): ByteVector { const headerChunk = RiffChunk.fromData("fmt ", this.getAudioFormatBlock(0xF1AC)); return headerChunk.render(); } -}; +} diff --git a/test-unit/riff/riffBitmapInfoHeaderTests.ts b/test-unit/riff/riffBitmapInfoHeaderTests.ts index 5de14d4a..fd3c4e65 100644 --- a/test-unit/riff/riffBitmapInfoHeaderTests.ts +++ b/test-unit/riff/riffBitmapInfoHeaderTests.ts @@ -1,15 +1,12 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import RiffBitmapInfoHeader from "../../src/riff/riffBitmapInfoHeader"; import {default as Resources} from "./resources"; import {ByteVector} from "../../src/byteVector"; -import {MediaTypes} from "../../src/iCodec"; +import {MediaTypes} from "../../src/properties"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - @suite class Riff_BitmapInfoHeaderTests { @test public constructor_invalidParams() { diff --git a/test-unit/riff/riffFileTests.ts b/test-unit/riff/riffFileTests.ts index adf06d4f..c118c47a 100644 --- a/test-unit/riff/riffFileTests.ts +++ b/test-unit/riff/riffFileTests.ts @@ -14,7 +14,7 @@ import RiffWaveFormatEx from "../../src/riff/riffWaveFormatEx"; import WaveFileSettings from "../../src/riff/waveFileSettings"; import {default as TestFile, TestFileAbstraction} from "../utilities/testFile"; import {default as Resources} from "./resources"; -import {ByteVector} from "../../src/byteVector"; +import {ByteVector, StringType} from "../../src/byteVector"; import {FileAccessMode, ReadStyle} from "../../src/file"; import {IFileAbstraction} from "../../src/fileAbstraction"; import {Id3v2TagHeaderFlags} from "../../src/id3v2/id3v2TagHeader"; @@ -32,8 +32,8 @@ import {Testers} from "../utilities/testers"; public constructor_nonRiffFile() { // Arrange const fileBytes = ByteVector.concatenate( - ByteVector.fromString("FOOO"), - ByteVector.fromUInt(100, false), + ByteVector.fromString("FOOO", StringType.UTF8), + ByteVector.fromUint(100, false), Resources.getDataChunk() ); const testAbstraction = TestFile.getFileAbstraction(fileBytes); @@ -48,7 +48,7 @@ import {Testers} from "../utilities/testers"; const originalDefaults = AviFileSettings.defaultTagTypes; try { const dataBytes = ByteVector.concatenate( - ByteVector.fromString("AVI "), + ByteVector.fromString("AVI ", StringType.UTF8), Resources.getAviHeaderBlock(false), Resources.getMoviChunk() ); @@ -56,7 +56,7 @@ import {Testers} from "../utilities/testers"; const testAbstraction = TestFile.getFileAbstraction(fileBytes); // Act - AviFileSettings.defaultTagTypes = AviFileSettings.supportedTagTypes; + AviFileSettings.defaultTagTypes = AviFileSettings.SUPPORTED_TAG_TYPES; const file = new RiffFile(testAbstraction, ReadStyle.Average); // Assert @@ -67,12 +67,12 @@ import {Testers} from "../utilities/testers"; assert.isOk(file.tag); assert.instanceOf(file.tag, RiffTags); - assert.strictEqual(file.tag.tagTypes, AviFileSettings.supportedTagTypes); + assert.strictEqual(file.tag.tagTypes, AviFileSettings.SUPPORTED_TAG_TYPES); assert.strictEqual(( file.tag).tags.length, 4); assert.isTrue(file.tag.isEmpty); assert.strictEqual(file.mode, FileAccessMode.Closed); - assert.strictEqual(file.tagTypes, AviFileSettings.supportedTagTypes); + assert.strictEqual(file.tagTypes, AviFileSettings.SUPPORTED_TAG_TYPES); assert.strictEqual(file.tagTypesOnDisk, TagTypes.None); } finally { // Cleanup @@ -86,7 +86,7 @@ import {Testers} from "../utilities/testers"; const originalDefaults = AviFileSettings.defaultTagTypes; try { const dataBytes = ByteVector.concatenate( - ByteVector.fromString("AVI "), + ByteVector.fromString("AVI ", StringType.UTF8), Resources.getAviHeaderBlock(false), Resources.getMoviChunk() ); @@ -124,7 +124,7 @@ import {Testers} from "../utilities/testers"; const originalDefaults = AviFileSettings.defaultTagTypes; try { const dataBytes = ByteVector.concatenate( - ByteVector.fromString("AVI "), + ByteVector.fromString("AVI ", StringType.UTF8), Resources.getAviHeaderBlock(true), Resources.getMoviChunk() ); @@ -132,7 +132,7 @@ import {Testers} from "../utilities/testers"; const testAbstraction = TestFile.getFileAbstraction(fileBytes); // Act - AviFileSettings.defaultTagTypes = AviFileSettings.supportedTagTypes; + AviFileSettings.defaultTagTypes = AviFileSettings.SUPPORTED_TAG_TYPES; const file = new RiffFile(testAbstraction, ReadStyle.Average); // Assert @@ -145,12 +145,12 @@ import {Testers} from "../utilities/testers"; assert.isOk(file.tag); assert.instanceOf(file.tag, RiffTags); - assert.strictEqual(file.tag.tagTypes, AviFileSettings.supportedTagTypes); + assert.strictEqual(file.tag.tagTypes, AviFileSettings.SUPPORTED_TAG_TYPES); assert.strictEqual(( file.tag).tags.length, 4); assert.isTrue(file.tag.isEmpty); assert.strictEqual(file.mode, FileAccessMode.Closed); - assert.strictEqual(file.tagTypes, AviFileSettings.supportedTagTypes); + assert.strictEqual(file.tagTypes, AviFileSettings.SUPPORTED_TAG_TYPES); assert.strictEqual(file.tagTypesOnDisk, TagTypes.None); } finally { // Cleanup @@ -164,7 +164,7 @@ import {Testers} from "../utilities/testers"; const originalDefaults = AviFileSettings.defaultTagTypes; try { const dataBytes = ByteVector.concatenate( - ByteVector.fromString("AVI "), + ByteVector.fromString("AVI ", StringType.UTF8), Resources.getAviHeaderBlock(true), Resources.getMoviChunk() ); @@ -204,7 +204,7 @@ import {Testers} from "../utilities/testers"; const originalDefaults = AviFileSettings.defaultTagTypes; try { const dataBytes = ByteVector.concatenate( - ByteVector.fromString("AVI "), + ByteVector.fromString("AVI ", StringType.UTF8), Resources.getAviHeaderBlock(true), Resources.getMoviChunk() ); @@ -212,7 +212,7 @@ import {Testers} from "../utilities/testers"; const testAbstraction = TestFile.getFileAbstraction(fileBytes); // Act - AviFileSettings.defaultTagTypes = AviFileSettings.supportedTagTypes; + AviFileSettings.defaultTagTypes = AviFileSettings.SUPPORTED_TAG_TYPES; const file = new RiffFile(testAbstraction, ReadStyle.None); // Assert @@ -220,12 +220,12 @@ import {Testers} from "../utilities/testers"; assert.isOk(file.tag); assert.instanceOf(file.tag, RiffTags); - assert.strictEqual(file.tag.tagTypes, AviFileSettings.supportedTagTypes); + assert.strictEqual(file.tag.tagTypes, AviFileSettings.SUPPORTED_TAG_TYPES); assert.strictEqual(( file.tag).tags.length, 4); assert.isTrue(file.tag.isEmpty); assert.strictEqual(file.mode, FileAccessMode.Closed); - assert.strictEqual(file.tagTypes, AviFileSettings.supportedTagTypes); + assert.strictEqual(file.tagTypes, AviFileSettings.SUPPORTED_TAG_TYPES); assert.strictEqual(file.tagTypesOnDisk, TagTypes.None); } finally { // Cleanup @@ -239,7 +239,7 @@ import {Testers} from "../utilities/testers"; const originalDefaults = AviFileSettings.defaultTagTypes; try { const dataBytes = ByteVector.concatenate( - ByteVector.fromString("AVI "), + ByteVector.fromString("AVI ", StringType.UTF8), Resources.getAviHeaderBlock(true), Resources.getMoviChunk() ); @@ -272,7 +272,7 @@ import {Testers} from "../utilities/testers"; public constructor_aviFile_allTagsNoCodecs() { // Arrange const dataBytes = ByteVector.concatenate( - ByteVector.fromString("AVI "), + ByteVector.fromString("AVI ", StringType.UTF8), Resources.getAviHeaderBlock(false), RiffChunk.fromData(DivxTag.CHUNK_FOURCC, Resources.getDivxTagData()).render(), Riff_RiffFileTests.getInfoTagBytes(), @@ -312,7 +312,7 @@ import {Testers} from "../utilities/testers"; public constructor_aviFile_missingHeaders() { // Arrange const dataBytes = ByteVector.concatenate( - ByteVector.fromString("AVI "), + ByteVector.fromString("AVI ", StringType.UTF8), Resources.getMoviChunk() ); const fileBytes = Riff_RiffFileTests.getFileBytes(dataBytes); @@ -326,7 +326,7 @@ import {Testers} from "../utilities/testers"; public constructor_unsupportedType() { // Arrange const dataBytes = ByteVector.concatenate( - ByteVector.fromString("FOOO"), + ByteVector.fromString("FOOO", StringType.UTF8), Resources.getMoviChunk() ); const fileBytes = Riff_RiffFileTests.getFileBytes(dataBytes); @@ -342,7 +342,7 @@ import {Testers} from "../utilities/testers"; const originalDefaults = WaveFileSettings.defaultTagTypes; try { const dataBytes = ByteVector.concatenate( - ByteVector.fromString("WAVE"), + ByteVector.fromString("WAVE", StringType.UTF8), Resources.getWaveFormatBlock(), Resources.getDataChunk() ); @@ -350,7 +350,7 @@ import {Testers} from "../utilities/testers"; const testAbstraction = TestFile.getFileAbstraction(fileBytes); // Act - WaveFileSettings.defaultTagTypes = WaveFileSettings.supportedTagTypes; + WaveFileSettings.defaultTagTypes = WaveFileSettings.SUPPORTED_TAG_TYPES; const file = new RiffFile(testAbstraction, ReadStyle.Average); // Assert @@ -363,12 +363,12 @@ import {Testers} from "../utilities/testers"; assert.isOk(file.tag); assert.instanceOf(file.tag, RiffTags); - assert.strictEqual(file.tag.tagTypes, WaveFileSettings.supportedTagTypes); + assert.strictEqual(file.tag.tagTypes, WaveFileSettings.SUPPORTED_TAG_TYPES); assert.strictEqual(( file.tag).tags.length, 4); assert.isTrue(file.tag.isEmpty); assert.strictEqual(file.mode, FileAccessMode.Closed); - assert.strictEqual(file.tagTypes, WaveFileSettings.supportedTagTypes); + assert.strictEqual(file.tagTypes, WaveFileSettings.SUPPORTED_TAG_TYPES); assert.strictEqual(file.tagTypesOnDisk, TagTypes.None); } finally { // Cleanup @@ -382,7 +382,7 @@ import {Testers} from "../utilities/testers"; const originalDefaults = WaveFileSettings.defaultTagTypes; try { const dataBytes = ByteVector.concatenate( - ByteVector.fromString("WAVE"), + ByteVector.fromString("WAVE", StringType.UTF8), Resources.getWaveFormatBlock(), Resources.getDataChunk() ); @@ -422,7 +422,7 @@ import {Testers} from "../utilities/testers"; const originalDefaults = WaveFileSettings.defaultTagTypes; try { const dataBytes = ByteVector.concatenate( - ByteVector.fromString("WAVE"), + ByteVector.fromString("WAVE", StringType.UTF8), Resources.getWaveFormatBlock(), Resources.getDataChunk() ); @@ -430,19 +430,19 @@ import {Testers} from "../utilities/testers"; const testAbstraction = TestFile.getFileAbstraction(fileBytes); // Act - WaveFileSettings.defaultTagTypes = WaveFileSettings.supportedTagTypes; + WaveFileSettings.defaultTagTypes = WaveFileSettings.SUPPORTED_TAG_TYPES; const file = new RiffFile(testAbstraction, ReadStyle.None); // Assert assert.isNotOk(file.properties); assert.instanceOf(file.tag, RiffTags); - assert.strictEqual(file.tag.tagTypes, WaveFileSettings.supportedTagTypes); + assert.strictEqual(file.tag.tagTypes, WaveFileSettings.SUPPORTED_TAG_TYPES); assert.strictEqual(( file.tag).tags.length, 4); assert.isTrue(file.tag.isEmpty); assert.strictEqual(file.mode, FileAccessMode.Closed); - assert.strictEqual(file.tagTypes, WaveFileSettings.supportedTagTypes); + assert.strictEqual(file.tagTypes, WaveFileSettings.SUPPORTED_TAG_TYPES); assert.strictEqual(file.tagTypesOnDisk, TagTypes.None); } finally { // Cleanup @@ -456,7 +456,7 @@ import {Testers} from "../utilities/testers"; const originalDefaults = WaveFileSettings.defaultTagTypes; try { const dataBytes = ByteVector.concatenate( - ByteVector.fromString("WAVE"), + ByteVector.fromString("WAVE", StringType.UTF8), Resources.getWaveFormatBlock(), Resources.getDataChunk() ); @@ -488,7 +488,7 @@ import {Testers} from "../utilities/testers"; public constructor_waveFile_allTags() { // Arrange const dataBytes = ByteVector.concatenate( - ByteVector.fromString("WAVE"), + ByteVector.fromString("WAVE", StringType.UTF8), Resources.getWaveFormatBlock(), RiffChunk.fromData(DivxTag.CHUNK_FOURCC, Resources.getDivxTagData()).render(), Riff_RiffFileTests.getInfoTagBytes(), @@ -529,7 +529,7 @@ import {Testers} from "../utilities/testers"; public constructor_waveFile_missingHeaders() { // Arrange const dataBytes = ByteVector.concatenate( - ByteVector.fromString("WAVE"), + ByteVector.fromString("WAVE", StringType.UTF8), Resources.getDataChunk() ); const fileBytes = Riff_RiffFileTests.getFileBytes(dataBytes); @@ -543,7 +543,7 @@ import {Testers} from "../utilities/testers"; public constructor_waveFile_noDataBlock() { // Arrange const dataBytes = ByteVector.concatenate( - ByteVector.fromString("WAVE"), + ByteVector.fromString("WAVE", StringType.UTF8), Resources.getWaveFormatBlock() ); const fileBytes = Riff_RiffFileTests.getFileBytes(dataBytes); @@ -697,7 +697,7 @@ import {Testers} from "../utilities/testers"; public removeTags_tagDoesNotExist() { // Arrange const dataBytes = ByteVector.concatenate( - ByteVector.fromString("WAVE"), + ByteVector.fromString("WAVE", StringType.UTF8), Resources.getWaveFormatBlock(), RiffChunk.fromData(DivxTag.CHUNK_FOURCC, Resources.getDivxTagData()).render(), Riff_RiffFileTests.getInfoTagBytes(), @@ -768,13 +768,13 @@ import {Testers} from "../utilities/testers"; public save_waveNoTagsOriginally_noTagsStored() { // Arrange const dataBytes = ByteVector.concatenate( - ByteVector.fromString("WAVE"), + ByteVector.fromString("WAVE", StringType.UTF8), Resources.getWaveFormatBlock(), Resources.getJunkChunk(), Resources.getDataChunk() ); const fileBytes = Riff_RiffFileTests.getFileBytes(dataBytes); - const testAbstraction = TestFile.getFileAbstraction(fileBytes); + const testAbstraction = TestFile.getFileAbstraction(fileBytes.toByteVector()); const file = new RiffFile(testAbstraction, ReadStyle.Average); file.removeTags(TagTypes.AllTags); @@ -794,7 +794,7 @@ import {Testers} from "../utilities/testers"; public save_waveNoTagsOriginally_addingTags() { // Arrange const dataBytes = ByteVector.concatenate( - ByteVector.fromString("WAVE"), + ByteVector.fromString("WAVE", StringType.UTF8), Resources.getWaveFormatBlock(), Resources.getJunkChunk(10), Resources.getDataChunk() @@ -814,7 +814,7 @@ import {Testers} from "../utilities/testers"; // Assert // - Make sure bytes were written const expectedDataBytes = ByteVector.concatenate( - ByteVector.fromString("WAVE"), + ByteVector.fromString("WAVE", StringType.UTF8), Resources.getWaveFormatBlock(), Resources.getJunkChunk(10), Riff_RiffFileTests.getSavedId3v2Bytes("id3 "), @@ -836,7 +836,7 @@ import {Testers} from "../utilities/testers"; public save_waveNoTagsNoDataChunk_addingTags() { // Arrange const dataBytes = ByteVector.concatenate( - ByteVector.fromString("WAVE"), + ByteVector.fromString("WAVE", StringType.UTF8), Resources.getWaveFormatBlock(), Resources.getJunkChunk(10), ); @@ -855,7 +855,7 @@ import {Testers} from "../utilities/testers"; // Assert // - Make sure bytes were written const expectedDataBytes = ByteVector.concatenate( - ByteVector.fromString("WAVE"), + ByteVector.fromString("WAVE", StringType.UTF8), Resources.getWaveFormatBlock(), Resources.getJunkChunk(10), Riff_RiffFileTests.getSavedId3v2Bytes("id3 "), @@ -889,7 +889,7 @@ import {Testers} from "../utilities/testers"; // Assert const expectedDataBytes = ByteVector.concatenate( - ByteVector.fromString("WAVE"), + ByteVector.fromString("WAVE", StringType.UTF8), Resources.getWaveFormatBlock(), Riff_RiffFileTests.getSavedId3v2Bytes("id3 "), Riff_RiffFileTests.getSavedInfoTagBytes(), @@ -922,7 +922,7 @@ import {Testers} from "../utilities/testers"; // Assert const expectedDataBytes = ByteVector.concatenate( - ByteVector.fromString("WAVE"), + ByteVector.fromString("WAVE", StringType.UTF8), Resources.getWaveFormatBlock(), Riff_RiffFileTests.getSavedId3v2Bytes("id3 "), Riff_RiffFileTests.getSavedInfoTagBytes(), @@ -955,7 +955,7 @@ import {Testers} from "../utilities/testers"; // Assert const expectedDataBytes = ByteVector.concatenate( - ByteVector.fromString("WAVE"), + ByteVector.fromString("WAVE", StringType.UTF8), Resources.getWaveFormatBlock(), Riff_RiffFileTests.getSavedId3v2Bytes("id3 "), Riff_RiffFileTests.getSavedInfoTagBytes(), @@ -989,7 +989,7 @@ import {Testers} from "../utilities/testers"; // Assert const expectedDataBytes = ByteVector.concatenate( - ByteVector.fromString("WAVE"), + ByteVector.fromString("WAVE", StringType.UTF8), Resources.getWaveFormatBlock(), Riff_RiffFileTests.getSavedId3v2Bytes("id3 "), Riff_RiffFileTests.getSavedInfoTagBytes(), @@ -1010,13 +1010,13 @@ import {Testers} from "../utilities/testers"; public save_aviNoTagsOriginally_noTagsStored() { // Arrange const dataBytes = ByteVector.concatenate( - ByteVector.fromString("AVI "), + ByteVector.fromString("AVI ", StringType.UTF8), Resources.getAviHeaderBlock(true), Resources.getJunkChunk(), Resources.getMoviChunk() ); const fileBytes = Riff_RiffFileTests.getFileBytes(dataBytes); - const testAbstraction = TestFile.getFileAbstraction(fileBytes); + const testAbstraction = TestFile.getFileAbstraction(fileBytes.toByteVector()); const file = new RiffFile(testAbstraction, ReadStyle.Average); file.removeTags(TagTypes.AllTags); @@ -1036,7 +1036,7 @@ import {Testers} from "../utilities/testers"; public save_aviNoTagsOriginally_addingTags() { // Arrange const dataBytes = ByteVector.concatenate( - ByteVector.fromString("AVI "), + ByteVector.fromString("AVI ", StringType.UTF8), Resources.getAviHeaderBlock(true), Resources.getJunkChunk(10), Resources.getMoviChunk() @@ -1056,7 +1056,7 @@ import {Testers} from "../utilities/testers"; // Assert // - Make sure bytes were written const expectedDataBytes = ByteVector.concatenate( - ByteVector.fromString("AVI "), + ByteVector.fromString("AVI ", StringType.UTF8), Resources.getAviHeaderBlock(true), Resources.getJunkChunk(10), Riff_RiffFileTests.getSavedId3v2Bytes("id3 "), @@ -1078,7 +1078,7 @@ import {Testers} from "../utilities/testers"; public save_aviNoTagsNoMoviChunk_addingTags() { // Arrange const dataBytes = ByteVector.concatenate( - ByteVector.fromString("AVI "), + ByteVector.fromString("AVI ", StringType.UTF8), Resources.getAviHeaderBlock(true), Resources.getJunkChunk(10), ); @@ -1097,7 +1097,7 @@ import {Testers} from "../utilities/testers"; // Assert // - Make sure bytes were written const expectedDataBytes = ByteVector.concatenate( - ByteVector.fromString("AVI "), + ByteVector.fromString("AVI ", StringType.UTF8), Resources.getAviHeaderBlock(true), Resources.getJunkChunk(10), Riff_RiffFileTests.getSavedId3v2Bytes("id3 "), @@ -1131,7 +1131,7 @@ import {Testers} from "../utilities/testers"; // Assert const expectedDataBytes = ByteVector.concatenate( - ByteVector.fromString("AVI "), + ByteVector.fromString("AVI ", StringType.UTF8), Resources.getAviHeaderBlock(true), Riff_RiffFileTests.getSavedId3v2Bytes("id3 "), Riff_RiffFileTests.getSavedInfoTagBytes(), @@ -1164,7 +1164,7 @@ import {Testers} from "../utilities/testers"; // Assert const expectedDataBytes = ByteVector.concatenate( - ByteVector.fromString("AVI "), + ByteVector.fromString("AVI ", StringType.UTF8), Resources.getAviHeaderBlock(true), Riff_RiffFileTests.getSavedId3v2Bytes("id3 "), Riff_RiffFileTests.getSavedInfoTagBytes(), @@ -1197,7 +1197,7 @@ import {Testers} from "../utilities/testers"; // Assert const expectedDataBytes = ByteVector.concatenate( - ByteVector.fromString("AVI "), + ByteVector.fromString("AVI ", StringType.UTF8), Resources.getAviHeaderBlock(true), Riff_RiffFileTests.getSavedId3v2Bytes("id3 "), Riff_RiffFileTests.getSavedInfoTagBytes(), @@ -1231,7 +1231,7 @@ import {Testers} from "../utilities/testers"; // Assert const expectedDataBytes = ByteVector.concatenate( - ByteVector.fromString("AVI "), + ByteVector.fromString("AVI ", StringType.UTF8), Resources.getAviHeaderBlock(true), Riff_RiffFileTests.getSavedId3v2Bytes("id3 "), Riff_RiffFileTests.getSavedInfoTagBytes(), @@ -1275,7 +1275,7 @@ import {Testers} from "../utilities/testers"; private static getAviAllTagsContiguousFile(trailingJunkChunkSize: number): TestFileAbstraction { // 1308 bytes in the contiguous tagging chunk const dataBytes = ByteVector.concatenate( - ByteVector.fromString("AVI "), + ByteVector.fromString("AVI ", StringType.UTF8), Resources.getAviHeaderBlock(true), Riff_RiffFileTests.getDivxBytes(), Riff_RiffFileTests.getInfoTagBytes(), @@ -1291,7 +1291,7 @@ import {Testers} from "../utilities/testers"; private static getAviAllTagsDiscontiguousFile(): TestFileAbstraction { const dataBytes = ByteVector.concatenate( - ByteVector.fromString("AVI "), + ByteVector.fromString("AVI ", StringType.UTF8), Resources.getAviHeaderBlock(true), Riff_RiffFileTests.getDivxBytes(), Resources.getJunkChunk(10), @@ -1306,8 +1306,8 @@ import {Testers} from "../utilities/testers"; private static getFileBytes(dataBytes: ByteVector): ByteVector { return ByteVector.concatenate( - RiffFile.fileIdentifier, - ByteVector.fromUInt(dataBytes.length, false), + RiffFile.FILE_IDENTIFIER, + ByteVector.fromUint(dataBytes.length, false), dataBytes ); } @@ -1373,7 +1373,7 @@ import {Testers} from "../utilities/testers"; private static getWaveAllTagsContiguousFile(trailingJunkChunkSize: number): TestFileAbstraction { // 1308 bytes in the contiguous tagging chunk const dataBytes = ByteVector.concatenate( - ByteVector.fromString("WAVE"), + ByteVector.fromString("WAVE", StringType.UTF8), Resources.getWaveFormatBlock(), Riff_RiffFileTests.getDivxBytes(), Riff_RiffFileTests.getInfoTagBytes(), @@ -1389,7 +1389,7 @@ import {Testers} from "../utilities/testers"; private static getWaveAllTagsDiscontiguousFile(): TestFileAbstraction { const dataBytes = ByteVector.concatenate( - ByteVector.fromString("WAVE"), + ByteVector.fromString("WAVE", StringType.UTF8), Resources.getWaveFormatBlock(), Riff_RiffFileTests.getDivxBytes(), Resources.getJunkChunk(10), diff --git a/test-unit/riff/riffListTagTests.ts b/test-unit/riff/riffListTagTests.ts index 77f69831..5e3ef464 100644 --- a/test-unit/riff/riffListTagTests.ts +++ b/test-unit/riff/riffListTagTests.ts @@ -250,11 +250,11 @@ class Riff_RiffListTagTests { assert.isEmpty(tag.getValues("TXT1")); } - private static readonly data1 = ByteVector.fromString("foo", undefined, undefined, true); - private static readonly data2 = ByteVector.fromString("barbaz", undefined, undefined, true); - private static readonly data3 = ByteVector.fromString("buxfux", undefined, undefined, true); - private static readonly data4 = ByteVector.fromString("nan", undefined, undefined, false); - private static readonly data5 = ByteVector.fromString("234", undefined, undefined, false); + private static readonly data1 = ByteVector.fromString("foo", StringType.UTF8); + private static readonly data2 = ByteVector.fromString("barbaz", StringType.UTF8); + private static readonly data3 = ByteVector.fromString("buxfux", StringType.UTF8); + private static readonly data4 = ByteVector.fromString("nan", StringType.UTF8); + private static readonly data5 = ByteVector.fromString("234", StringType.UTF8); private static getTestList(): RiffList { const list = RiffList.fromEmpty("TEST"); diff --git a/test-unit/riff/riffListTests.ts b/test-unit/riff/riffListTests.ts index 151dfabe..0845e7cd 100644 --- a/test-unit/riff/riffListTests.ts +++ b/test-unit/riff/riffListTests.ts @@ -1,50 +1,47 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import {Mock} from "typemoq"; import RiffList from "../../src/riff/riffList"; import TestFile from "../utilities/testFile"; -import {ByteVector} from "../../src/byteVector"; +import {ByteVector, StringType} from "../../src/byteVector"; import {File} from "../../src/File"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - -const data1 = ByteVector.fromString("foo", undefined, undefined, true); -const data2 = ByteVector.fromString("barbaz", undefined, undefined, true); -const data3 = ByteVector.fromString("buxfux", undefined, undefined, true); -const data4 = ByteVector.fromString("nan", undefined, undefined, false); -const data5 = ByteVector.fromString("234", undefined, undefined, false); +const data1 = ByteVector.fromString("foo", StringType.UTF8); +const data2 = ByteVector.fromString("barbaz", StringType.UTF8); +const data3 = ByteVector.fromString("buxfux", StringType.UTF8); +const data4 = ByteVector.fromString("nan", StringType.UTF8); +const data5 = ByteVector.fromString("234", StringType.UTF8); const sampleData = ByteVector.concatenate( - ByteVector.fromString("TXT1"), - ByteVector.fromUInt(data1.length, false), + ByteVector.fromString("TXT1", StringType.UTF8), + ByteVector.fromUint(data1.length, false), data1, 0x00, - ByteVector.fromString("TXT1"), - ByteVector.fromUInt(data2.length, false), + ByteVector.fromString("TXT1", StringType.UTF8), + ByteVector.fromUint(data2.length, false), data2, - ByteVector.fromString("TXT2"), - ByteVector.fromUInt(data3.length, false), + ByteVector.fromString("TXT2", StringType.UTF8), + ByteVector.fromUint(data3.length, false), data3, - ByteVector.fromString("TXT3"), - ByteVector.fromUInt(data4.length, false), + ByteVector.fromString("TXT3", StringType.UTF8), + ByteVector.fromUint(data4.length, false), data4, 0x00, - ByteVector.fromString("TXT3"), - ByteVector.fromUInt(data5.length, false), + ByteVector.fromString("TXT3", StringType.UTF8), + ByteVector.fromUint(data5.length, false), data5, 0x00 ); const sampleList = ByteVector.concatenate( - ByteVector.fromString(RiffList.identifierFourcc), - ByteVector.fromUInt(sampleData.length + 4, false), - ByteVector.fromString("fooo"), + ByteVector.fromString(RiffList.IDENTIFIER_FOURCC, StringType.UTF8), + ByteVector.fromUint(sampleData.length + 4, false), + ByteVector.fromString("fooo", StringType.UTF8), sampleData ); const sampleNestedList = ByteVector.concatenate( - ByteVector.fromString(RiffList.identifierFourcc), - ByteVector.fromUInt(sampleList.length + 4, false), - ByteVector.fromString("baar"), + ByteVector.fromString(RiffList.IDENTIFIER_FOURCC, StringType.UTF8), + ByteVector.fromUint(sampleList.length + 4, false), + ByteVector.fromString("baar", StringType.UTF8), sampleList ); @@ -64,8 +61,8 @@ const sampleNestedList = ByteVector.concatenate( public fromFile_emptyList() { // Arrange const data = ByteVector.concatenate( - ByteVector.fromString(RiffList.identifierFourcc), - ByteVector.fromUInt(0, false) + ByteVector.fromString(RiffList.IDENTIFIER_FOURCC, StringType.UTF8), + ByteVector.fromUint(0, false) ); const mockFile = TestFile.getFile(data); @@ -113,7 +110,7 @@ const sampleNestedList = ByteVector.concatenate( assert.isOk(list); assert.isFalse(list.isLoaded); assert.strictEqual(list.chunkStart, 10); - assert.strictEqual(list.fourcc, RiffList.identifierFourcc); + assert.strictEqual(list.fourcc, RiffList.IDENTIFIER_FOURCC); assert.strictEqual(list.originalTotalSize, 88); assert.strictEqual(list.type, "baar"); @@ -132,7 +129,7 @@ const sampleNestedList = ByteVector.concatenate( private static verifySample(list: RiffList): void { assert.isOk(list); assert.isFalse(list.isLoaded); - assert.strictEqual(list.fourcc, RiffList.identifierFourcc); + assert.strictEqual(list.fourcc, RiffList.IDENTIFIER_FOURCC); assert.strictEqual(list.originalTotalSize, 76); assert.strictEqual(list.type, "fooo"); @@ -251,9 +248,9 @@ const sampleNestedList = ByteVector.concatenate( // Assert const expected = ByteVector.concatenate( - ByteVector.fromString(RiffList.identifierFourcc), - ByteVector.fromUInt(4, false), - ByteVector.fromString("fooo") + ByteVector.fromString(RiffList.IDENTIFIER_FOURCC, StringType.UTF8), + ByteVector.fromUint(4, false), + ByteVector.fromString("fooo", StringType.UTF8) ); assert.isOk(result); Testers.bvEqual(result, expected); @@ -277,7 +274,7 @@ const sampleNestedList = ByteVector.concatenate( public setValues_keyDoesNotExist() { // Arrange const list = RiffList.fromFile(TestFile.getFile(sampleList), 0); - const data = ByteVector.fromString("foobarbaz"); + const data = ByteVector.fromString("foobarbaz", StringType.UTF8); const originalLength = list.valueCount; // Act @@ -293,7 +290,7 @@ const sampleNestedList = ByteVector.concatenate( public setValues_keyExists() { // Arrange const list = RiffList.fromFile(TestFile.getFile(sampleList), 0); - const data = ByteVector.fromString("foobarbaz"); + const data = ByteVector.fromString("foobarbaz", StringType.UTF8); // Act list.setValues("TXT1", [data, data]); diff --git a/test-unit/riff/riffWaveFormatExTests.ts b/test-unit/riff/riffWaveFormatExTests.ts index 032c0f99..69dadde3 100644 --- a/test-unit/riff/riffWaveFormatExTests.ts +++ b/test-unit/riff/riffWaveFormatExTests.ts @@ -1,15 +1,12 @@ -import * as Chai from "chai"; import {suite, test} from "@testdeck/mocha"; +import {assert} from "chai"; import RiffWaveFormatEx from "../../src/riff/riffWaveFormatEx"; import {default as Resources} from "./resources"; import {ByteVector} from "../../src/byteVector"; -import {MediaTypes} from "../../src/iCodec"; +import {MediaTypes} from "../../src/properties"; import {Testers} from "../utilities/testers"; -// Setup chai -const assert = Chai.assert; - @suite class Riff_WaveFormatExTests { @test public constructor_invalidParams() { diff --git a/test-unit/sandwich/endTagTests.ts b/test-unit/sandwich/endTagTests.ts index cb9fec49..0838a35e 100644 --- a/test-unit/sandwich/endTagTests.ts +++ b/test-unit/sandwich/endTagTests.ts @@ -12,6 +12,7 @@ import {File, ReadStyle} from "../../src/file"; import {Id3v2TagHeaderFlags} from "../../src/id3v2/id3v2TagHeader"; import {TagTypes} from "../../src/tag"; import {TagTesters, Testers} from "../utilities/testers"; +import {NumberUtils} from "../../src/utils"; @suite class Sandwich_EndTagTests { @test @@ -209,7 +210,7 @@ import {TagTesters, Testers} from "../utilities/testers"; assert.isOk(newTag); assert.strictEqual(newTag.tagTypes, TagTypes.Id3v2); assert.strictEqual(( newTag).version, 4); - assert.notEqual(( newTag).flags & Id3v2TagHeaderFlags.FooterPresent, 0); + assert.isTrue(NumberUtils.hasFlag(( newTag).flags, Id3v2TagHeaderFlags.FooterPresent)); assert.strictEqual(tag.tags.length, 1); assert.strictEqual(tag.tagTypes, TagTypes.Id3v2); diff --git a/test-unit/sandwich/sandwichFileTests.ts b/test-unit/sandwich/sandwichFileTests.ts index 3e0f6058..99411c8e 100644 --- a/test-unit/sandwich/sandwichFileTests.ts +++ b/test-unit/sandwich/sandwichFileTests.ts @@ -5,13 +5,13 @@ import ApeTag from "../../src/ape/apeTag"; import EndTag from "../../src/sandwich/endTag"; import Id3v1Tag from "../../src/id3v1/id3v1Tag"; import Id3v2Tag from "../../src/id3v2/id3v2Tag"; -import Properties from "../../src/properties"; import SandwichFile from "../../src/sandwich/sandwichFile"; import StartTag from "../../src/sandwich/startTag"; import {default as TestFile} from "../utilities/testFile"; import {ByteVector} from "../../src/byteVector"; import {IFileAbstraction} from "../../src/fileAbstraction"; import {FileAccessMode, ReadStyle} from "../../src/file"; +import {Properties} from "../../src/properties"; import {TagTypes} from "../../src/tag"; import {Testers} from "../utilities/testers"; @@ -285,7 +285,7 @@ import {Testers} from "../utilities/testers"; public save_noTags() { // Arrange const fileBytes = ByteVector.fromSize(100); - const testAbstraction = TestFile.getFileAbstraction(fileBytes); + const testAbstraction = TestFile.getFileAbstraction(fileBytes.toByteVector()); const file = new TestSandwichFile(testAbstraction, ReadStyle.None, this.testMapping, TagTypes.None); // Act @@ -304,8 +304,7 @@ import {Testers} from "../utilities/testers"; @test public save_noTags_addTags() { // Arrange - const fileBytes = ByteVector.fromSize(100); - const testAbstraction = TestFile.getFileAbstraction(fileBytes); + const testAbstraction = TestFile.getFileAbstraction(ByteVector.fromSize(100)); const testMapping = new Map boolean>([ [TagTypes.Ape, () => false], [TagTypes.Id3v2, () => true] @@ -323,13 +322,13 @@ import {Testers} from "../utilities/testers"; // Assert const expectedBytes = ByteVector.concatenate( ( startTag).render(), - fileBytes, + ByteVector.fromSize(100), ( endTag).render() ); Testers.bvEqual(testAbstraction.allBytes, expectedBytes); assert.strictEqual(file.mode, FileAccessMode.Closed); assert.strictEqual(file.mediaStartPosition, startTag.sizeOnDisk); - assert.strictEqual(file.mediaEndPosition, startTag.sizeOnDisk + fileBytes.length); + assert.strictEqual(file.mediaEndPosition, 100 + startTag.sizeOnDisk); assert.strictEqual(file.tagTypes, TagTypes.Ape | TagTypes.Id3v2); assert.strictEqual(file.tagTypesOnDisk, TagTypes.Ape | TagTypes.Id3v2); @@ -350,7 +349,7 @@ import {Testers} from "../utilities/testers"; ByteVector.fromSize(100), id3v1Tag.render() ); - const testAbstraction = TestFile.getFileAbstraction(fileBytes); + const testAbstraction = TestFile.getFileAbstraction(fileBytes.toByteVector()); const file = new TestSandwichFile(testAbstraction, ReadStyle.PictureLazy, this.testMapping, TagTypes.None); // Act diff --git a/test-unit/streamTest.ts b/test-unit/streamTest.ts index 59b22597..8bac9850 100644 --- a/test-unit/streamTest.ts +++ b/test-unit/streamTest.ts @@ -5,7 +5,7 @@ import {suite, test} from "@testdeck/mocha"; import PropertyTests from "./utilities/propertyTests"; import TestConstants from "./testConstants"; -import {ByteVector} from "../src/byteVector"; +import {ByteVector, StringType} from "../src/byteVector"; import {SeekOrigin, Stream} from "../src/stream"; import {Testers} from "./utilities/testers"; @@ -371,11 +371,11 @@ const assert = Chai.assert; assert.strictEqual(stream.position, 3); const contents = fs.readFileSync(testFilePath); - const expected = ByteVector.fromString(testFilePath); + const expected = ByteVector.fromString(testFilePath, StringType.Latin1); expected.set(0, 0x01); expected.set(1, 0x02); expected.set(2, 0x03); - assert.deepStrictEqual(contents, expected.data); + assert.deepStrictEqual(contents, expected["_bytes"]); }; StreamTests.testWithFile(testAction, true); } @@ -395,11 +395,11 @@ const assert = Chai.assert; assert.strictEqual(stream.position, 6); const contents = fs.readFileSync(testFilePath); - const expected = ByteVector.fromString(testFilePath); + const expected = ByteVector.fromString(testFilePath, StringType.Latin1); expected.set(3, 0x01); expected.set(4, 0x02); expected.set(5, 0x03); - assert.deepStrictEqual(contents, expected.data); + assert.deepStrictEqual(contents, expected["_bytes"]); }; StreamTests.testWithFile(testAction, true); } @@ -419,9 +419,11 @@ const assert = Chai.assert; assert.strictEqual(stream.position, testFilePath.length + 3); const contents = fs.readFileSync(testFilePath); - const expected = ByteVector.fromString(testFilePath); - expected.addByteArray(buffer); - assert.deepStrictEqual(contents, expected.data); + const expected = ByteVector.concatenate( + ByteVector.fromString(testFilePath, StringType.Latin1), + buffer + ); + assert.deepStrictEqual(contents, expected["_bytes"]); }; StreamTests.testWithFile(testAction, true); } @@ -440,10 +442,10 @@ const assert = Chai.assert; assert.strictEqual(stream.position, 2); const contents = fs.readFileSync(testFilePath); - const expected = ByteVector.fromString(testFilePath); + const expected = ByteVector.fromString(testFilePath, StringType.Latin1); expected.set(0, 0x02); expected.set(1, 0x03); - assert.deepStrictEqual(contents, expected.data); + assert.deepStrictEqual(contents, expected["_bytes"]); }; StreamTests.testWithFile(testAction, true); } diff --git a/test-unit/testConstants.ts b/test-unit/testConstants.ts index 949f194b..7ad72959 100644 --- a/test-unit/testConstants.ts +++ b/test-unit/testConstants.ts @@ -1,12 +1,15 @@ import * as Path from "path"; import {v4 as Uuidv4} from "uuid"; -import {ByteVector} from "../src/byteVector"; +import {ByteVector, StringType} from "../src/byteVector"; export default class TestConstants { public static testFileFolderPath: string = "./test-unit/resources/"; - public static testFilePath: string = Path.join(TestConstants.testFileFolderPath, "testFile.txt"); - public static testFileContents: number[] = [0x31, 0x32, 0x33, 0x34, 0x35, 0x61, 0x62, 0x63, 0x64, 0x65]; + public static testFileName = "testFile.txt"; + public static testFilePath: string = Path.join(TestConstants.testFileFolderPath, TestConstants.testFileName); + public static testFileContents: Uint8Array = new Uint8Array( + [0x31, 0x32, 0x33, 0x34, 0x35, 0x61, 0x62, 0x63, 0x64, 0x65] + ); public static testFileContentsStr: string = "12345abcde"; public static getTestFilePath: () => string = () => { @@ -14,45 +17,45 @@ export default class TestConstants { return Path.join(TestConstants.testFileFolderPath, `testFile_${fileUid}.txt`); } - public static testStrings: {[key: string]: {bytes: number[], str: string}} = { + public static testStrings: {[key: string]: {bytes: Uint8Array, str: string}} = { Latin1: { - bytes: [ - 0x21, 0x31, 0x32, 0x33, 0x41, 0x42, 0x43, 0x61, 0x62, 0x63, 0xC1, 0xD1, 0xFC, 0xAE, 0xBE - ], - str: "!123ABCabcÁÑü®¾" + bytes: new Uint8Array([ + 0x21, 0x31, 0x32, 0x33, 0x41, 0x42, 0x43, 0x61, 0x62, 0x63, 0xC1, 0xD1, 0xFC, 0xAE, 0xBE + ]), + str: "!123ABCabcÁÑü®¾" }, UTF16BE: { - bytes: [ + bytes: new Uint8Array([ 0x00, 0x61, 0x00, 0x62, 0x00, 0x63, 0x03, 0xBA, 0x03, 0xCC, 0x03, 0xC3, 0x03, 0xBC, 0x03, 0xB5 - ], + ]), str: "abcκόσμε" }, UTF16LE: { - bytes: [ + bytes: new Uint8Array([ 0x61, 0x00, 0x62, 0x00, 0x63, 0x00, 0xBA, 0x03, 0xCC, 0x03, 0xC3, 0x03, 0xBC, 0x03, 0xB5, 0x03 - ], + ]), str: "abcκόσμε" }, UTF16LEWithBOM: { - bytes: [ + bytes: new Uint8Array([ 0xFF, 0xFE, 0x61, 0x00, 0x62, 0x00, 0x63, 0x00, 0xBA, 0x03, 0xCC, 0x03, 0xC3, 0x03, 0xBC, 0x03, 0xB5, 0x03 - ], + ]), str: "abcκόσμε" }, UTF8: { - bytes: [ + bytes: new Uint8Array([ 0x61, 0x62, 0x63, 0xCE, 0xBA, 0xCF, 0x8C, 0xCF, 0x83, 0xCE, 0xBC, 0xCE, 0xB5 - ], + ]), str: "abcκόσμε" } }; - public static testByteVector: ByteVector = ByteVector.fromString("foobarbaz"); + public static testByteVector: ByteVector = ByteVector.fromString("foobarbaz", StringType.UTF8); public static syncedUint = 0x2040810; public static syncedUintBytes = ByteVector.fromSize(4, 0x10); diff --git a/test-unit/tsconfig.json b/test-unit/tsconfig.json new file mode 100644 index 00000000..b7d15a6d --- /dev/null +++ b/test-unit/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "declaration": true, + "experimentalDecorators": true, + "inlineSources": true, + "module": "commonjs", + "noImplicitAny": true, + "outDir": "./dist", + "sourceMap": true, + "baseUrl": ".", + "paths": { + "*": ["node_modules/*"] + }, + "target": "es6" + }, + "include": [ "./**/*" ] +} diff --git a/test-unit/tslint.json b/test-unit/tslint.json deleted file mode 100644 index d8f5946f..00000000 --- a/test-unit/tslint.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "../tslint.json", - "rules": { - "class-name": false - } -} \ No newline at end of file diff --git a/test-unit/utilities/propertyTests.ts b/test-unit/utilities/propertyTests.ts index 3fc7cb8e..d1a8941f 100644 --- a/test-unit/utilities/propertyTests.ts +++ b/test-unit/utilities/propertyTests.ts @@ -1,7 +1,4 @@ -import * as Chai from "chai"; - -// Setup Chai -const assert = Chai.assert; +import {assert} from "chai"; export default class PropertyTests { public static propertyRoundTrip(set: (v: T) => void, get: () => T, val: T) { diff --git a/test-unit/utilities/testFile.ts b/test-unit/utilities/testFile.ts index 26171f5e..b6b8c4b8 100644 --- a/test-unit/utilities/testFile.ts +++ b/test-unit/utilities/testFile.ts @@ -1,22 +1,23 @@ import * as TypeMoq from "typemoq"; +import TestConstants from "../testConstants"; +import TestStream from "./testStream"; import {ByteVector} from "../../src/byteVector"; import {File} from "../../src/file"; import {IStream, SeekOrigin} from "../../src/stream"; import {IFileAbstraction} from "../../src/fileAbstraction"; -import TestStream from "./testStream"; export type TestFileAbstraction = IFileAbstraction & {allBytes: ByteVector}; export default { - getFile(data: ByteVector): File { + getFile: (data: ByteVector): File => { const mockFile = TypeMoq.Mock.ofType(); let position = 0; mockFile.setup((f) => f.length).returns(() => data.length); - mockFile.setup((f) => f.seek(TypeMoq.It.isAnyNumber(), TypeMoq.It.isAny())) - .returns((p, o) => { - switch (o) { + mockFile.setup((f) => f.seek(TypeMoq.It.isAnyNumber(), TypeMoq.It.isAny())) + .returns((p: number, o: SeekOrigin) => { + switch (o || SeekOrigin.Begin) { case SeekOrigin.Begin: - position = Math.min(data.length, position); + position = Math.min(data.length, p); break; case SeekOrigin.Current: position = Math.min(data.length, position + p); @@ -25,10 +26,9 @@ export default { position = Math.min(data.length, data.length + p); break; } - position = p; }); mockFile.setup((f) => f.readBlock(TypeMoq.It.isAnyNumber())) - .returns((s) => { + .returns((s: number) => { if (position + s > data.length) { s = data.length - position; } @@ -36,7 +36,7 @@ export default { return ByteVector.empty(); } - const output = data.mid(position, s); + const output = data.subarray(position, s); position += s; return output; }); @@ -47,14 +47,13 @@ export default { return mockFile.object; }, - getFileAbstraction(data: ByteVector): TestFileAbstraction { - const clonedData = ByteVector.fromByteVector(data); + getFileAbstraction: (data: ByteVector): TestFileAbstraction => { return { - name: "test_file", - get allBytes(): ByteVector { return clonedData; }, - get readStream(): IStream { return new TestStream(clonedData, false, false); }, - get writeStream(): IStream { return new TestStream(clonedData, true, false); }, - closeStream(stream: IStream): void { stream.close(); } + name: TestConstants.name, + get allBytes(): ByteVector { return data; }, + get readStream(): IStream { return new TestStream(data, false); }, + get writeStream(): IStream { return new TestStream(data, true); }, + closeStream: (stream: IStream): void => { stream.close(); } }; } }; diff --git a/test-unit/utilities/testStream.ts b/test-unit/utilities/testStream.ts index 59584373..7ecf44b0 100644 --- a/test-unit/utilities/testStream.ts +++ b/test-unit/utilities/testStream.ts @@ -3,11 +3,11 @@ import {IStream, SeekOrigin} from "../../src/stream"; export default class TestStream implements IStream { private readonly _isWritable: boolean; - private _data: ByteVector; + private readonly _data: ByteVector; private _position: number; - public constructor(bytesToReturn: ByteVector, isWritable: boolean, cloneData: boolean = true) { - this._data = cloneData ? ByteVector.fromByteVector(bytesToReturn) : bytesToReturn; + public constructor(bytesToReturn: ByteVector, isWritable: boolean) { + this._data = bytesToReturn; this._position = 0; this._isWritable = isWritable; } @@ -57,21 +57,13 @@ export default class TestStream implements IStream { } public setLength(length: number): void { - if (this.length < length) { - // Extend - this._data.addByteVector(ByteVector.fromSize(length - this.length)); - } else if (this.length > length) { - // Shrink - const bytesToRemove = this.length - length; - const startIndex = this.length - bytesToRemove; - this._data.removeRange(startIndex, bytesToRemove); - } + this._data.resize(length); this._position = Math.max(this.length, this._position); } public write(buffer: ByteVector | Uint8Array, bufferOffset: number, length: number): number { - if (buffer instanceof ByteVector) { - buffer = buffer.data; + if (buffer instanceof Uint8Array) { + buffer = ByteVector.fromByteArray(buffer); } if (!this._isWritable) { @@ -80,13 +72,11 @@ export default class TestStream implements IStream { const bufferStart = bufferOffset; const bufferEnd = bufferOffset + length; - const bytesToWrite = ByteVector.fromByteArray(Buffer.from(buffer.slice(bufferStart, bufferEnd))); - if (this._position < this._data.length) { - this._data.removeRange(this._position, bytesToWrite.length); - } - this._data.insertByteVector(this._position, bytesToWrite); + const bytesToWrite = buffer.subarray(bufferStart, bufferEnd); + this._data.splice(this._position, bytesToWrite.length, bytesToWrite); + this._position = bufferOffset + bytesToWrite.length; - return length; + return bytesToWrite.length; } } diff --git a/test-unit/utilities/testers.ts b/test-unit/utilities/testers.ts index 42b99a31..7d46d31d 100644 --- a/test-unit/utilities/testers.ts +++ b/test-unit/utilities/testers.ts @@ -2,7 +2,7 @@ import {assert} from "chai"; import {IMock} from "typemoq"; import {Tag} from "../../src/tag"; -import {ByteVector} from "../../src"; +import {ByteVector, StringType} from "../../src/byteVector"; export class Testers { public static testByte(testFunc: (testValue: number) => void): void { @@ -68,7 +68,7 @@ export class Testers { public static testUlong(testFunc: (testValue: bigint) => void, allowUndefined = false): void { assert.throws(() => testFunc(BigInt(-1))); assert.throws(() => testFunc(BigInt(1.23))); - assert.throws(() => testFunc(BigInt(0xFFFFFFFFFFFFFFFF) + BigInt(1))); + assert.throws(() => testFunc(BigInt("18446744073709551615") + BigInt(1))); assert.throws(() => testFunc(null)); if (!allowUndefined) { @@ -91,22 +91,25 @@ export class Testers { const getPortion = (bv: ByteVector, pointer: number) => { const min = Math.max(pointer - 10, 0); const max = Math.min(pointer + 10, bv.length - 1); - const mid = bv.mid(min, max - min); + const mid = bv.subarray(min, max - min); return { offset: Math.min(10, pointer) + 1, - portion: mid.toString() + portion: mid.toString(StringType.UTF8) }; }; const getMessage = (bvX: ByteVector, bvY: ByteVector, position: number): string => { const xPort = getPortion(bvX, position); + const xByte = position >= bvX.length ? "" : `0x${bvX.get(position).toString(16).padStart(2, "0")}`; const yPort = getPortion(bvY, position); const spacing = new Array(xPort.offset).join(" "); + const yByte = position >= bvY.length ? "" : `0x${bvY.get(position).toString(16).padStart(2, "0")}`; + return `Difference at index: ${position}\n` + `Actual: ${xPort.portion}\n` - + ` ${spacing}^\n` + + ` ${spacing}^ ${xByte}\n` + `Expected: ${yPort.portion}\n` - + ` ${spacing}^\n`; + + ` ${spacing}^ ${yByte}\n`; }; let pos = 0; @@ -121,9 +124,6 @@ export class Testers { if (pos < actual.length || pos < expected.length) { assert.fail(getMessage(actual, expected, pos)); } - - // Last chance catch if I completely effed this up - assert.isTrue(ByteVector.equal(actual, expected)); } } diff --git a/test-unit/xiph/resources.ts b/test-unit/xiph/resources.ts index bf147e83..5dac09ac 100644 --- a/test-unit/xiph/resources.ts +++ b/test-unit/xiph/resources.ts @@ -1,7 +1,7 @@ -import {ByteVector, PictureType} from "../../src"; +import {ByteVector, PictureType, StringType} from "../../src"; export default class XiphTestResources { - public static readonly pictureData = ByteVector.fromString("foobarbaz"); + public static readonly pictureData = ByteVector.fromString("foobarbaz", StringType.UTF8); public static readonly pictureMimeType = "application/octet-stream"; public static readonly pictureDescription = "image"; public static readonly pictureWidth = 640; @@ -10,18 +10,17 @@ export default class XiphTestResources { public static readonly pictureIndexedColors = 234; public static readonly pictureType = PictureType.ColoredFish; public static readonly pictureBytes = ByteVector.concatenate( - ByteVector.fromUInt(XiphTestResources.pictureType), - ByteVector.fromUInt(XiphTestResources.pictureMimeType.length), - ByteVector.fromString(XiphTestResources.pictureMimeType), - ByteVector.fromUInt(XiphTestResources.pictureDescription.length), - ByteVector.fromString(XiphTestResources.pictureDescription), - ByteVector.fromUInt(XiphTestResources.pictureWidth), - ByteVector.fromUInt(XiphTestResources.pictureHeight), - ByteVector.fromUInt(XiphTestResources.pictureColorDepth), - ByteVector.fromUInt(XiphTestResources.pictureIndexedColors), - ByteVector.fromUInt(XiphTestResources.pictureData.length), + ByteVector.fromUint(XiphTestResources.pictureType), + ByteVector.fromUint(XiphTestResources.pictureMimeType.length), + ByteVector.fromString(XiphTestResources.pictureMimeType, StringType.UTF8), + ByteVector.fromUint(XiphTestResources.pictureDescription.length), + ByteVector.fromString(XiphTestResources.pictureDescription, StringType.UTF8), + ByteVector.fromUint(XiphTestResources.pictureWidth), + ByteVector.fromUint(XiphTestResources.pictureHeight), + ByteVector.fromUint(XiphTestResources.pictureColorDepth), + ByteVector.fromUint(XiphTestResources.pictureIndexedColors), + ByteVector.fromUint(XiphTestResources.pictureData.length), XiphTestResources.pictureData ); - public static readonly pictureEncodedBytes = Buffer.from(XiphTestResources.pictureBytes.data) - .toString("base64"); + public static readonly pictureEncodedBytes = XiphTestResources.pictureBytes.toBase64String(); } diff --git a/test-unit/xiph/xiphCommentTests.ts b/test-unit/xiph/xiphCommentTests.ts index 02203eae..402048bb 100644 --- a/test-unit/xiph/xiphCommentTests.ts +++ b/test-unit/xiph/xiphCommentTests.ts @@ -2,14 +2,13 @@ import {suite, test} from "@testdeck/mocha"; import {assert} from "chai"; import {Mock} from "typemoq"; -import Picture from "../../src/picture"; import PropertyTests from "../utilities/propertyTests"; import XiphComment from "../../src/xiph/xiphComment"; import XiphPicture from "../../src/xiph/xiphPicture"; import XiphSettings from "../../src/xiph/xiphSettings"; import XiphTestResources from "./resources"; -import {ByteVector} from "../../src/byteVector"; -import {IPicture, PictureType} from "../../src/iPicture"; +import {ByteVector, StringType} from "../../src/byteVector"; +import {IPicture, Picture, PictureType} from "../../src/picture"; import {TagTypes} from "../../src/tag"; import {TagTesters, Testers} from "../utilities/testers"; @@ -17,20 +16,20 @@ import {TagTesters, Testers} from "../utilities/testers"; @test public fromData_invalidParameters() { // Act / Assert - Testers.testTruthy((v: ByteVector) => XiphComment.fromData(v)); + Testers.testTruthy((v: ByteVector) => XiphComment.fromData(v, false)); } @test public fromData_noData() { // Arrange const data = ByteVector.concatenate( - ByteVector.fromUInt(9, false), - ByteVector.fromString("foobarbaz"), - ByteVector.fromUInt(0, false) + ByteVector.fromUint(9, false), + ByteVector.fromString("foobarbaz", StringType.UTF8), + ByteVector.fromUint(0, false) ); // Act - const comment = XiphComment.fromData(data); + const comment = XiphComment.fromData(data, false); // Assert assert.strictEqual(comment.fieldValueCount, 0); @@ -46,21 +45,21 @@ import {TagTesters, Testers} from "../utilities/testers"; public fromData_hasValues() { // Arrange const data = ByteVector.concatenate( - ByteVector.fromUInt(3, false), - ByteVector.fromString("foo"), - ByteVector.fromUInt(4, false), - ByteVector.fromUInt(9, false), - ByteVector.fromString("TITLE=bar"), - ByteVector.fromUInt(7, false), - ByteVector.fromString("FUX=bux"), - ByteVector.fromUInt(7, false), - ByteVector.fromString("FUX=qux"), - ByteVector.fromUInt(15, false), - ByteVector.fromString("Malformed_field") + ByteVector.fromUint(3, false), + ByteVector.fromString("foo", StringType.UTF8), + ByteVector.fromUint(4, false), + ByteVector.fromUint(9, false), + ByteVector.fromString("TITLE=bar", StringType.UTF8), + ByteVector.fromUint(7, false), + ByteVector.fromString("FUX=bux", StringType.UTF8), + ByteVector.fromUint(7, false), + ByteVector.fromString("FUX=qux", StringType.UTF8), + ByteVector.fromUint(15, false), + ByteVector.fromString("Malformed_field", StringType.UTF8) ); // Act - const comment = XiphComment.fromData(data); + const comment = XiphComment.fromData(data, false); // Assert assert.strictEqual(comment.fieldValueCount, 3); @@ -75,25 +74,25 @@ import {TagTesters, Testers} from "../utilities/testers"; } @test - public fromData_hasPictures() { + public fromData_hasPictures_eagerLoading() { // Arrange - const oldPictureData = ByteVector.fromString("fuxbuxqux"); - const oldPictureItem = `COVERART=${Buffer.from(oldPictureData.data).toString("base64")}`; + const oldPictureData = ByteVector.fromString("fuxbuxqux", StringType.UTF8); + const oldPictureItem = `COVERART=${oldPictureData.toBase64String()}`; const newPictureItem = `METADATA_BLOCK_PICTURE=${XiphTestResources.pictureEncodedBytes}`; const data = ByteVector.concatenate( - ByteVector.fromUInt(3, false), - ByteVector.fromString("foo"), - ByteVector.fromUInt(3, false), - ByteVector.fromUInt(9, false), - ByteVector.fromString("TITLE=bar"), - ByteVector.fromUInt(oldPictureItem.length, false), - ByteVector.fromString(oldPictureItem), - ByteVector.fromUInt(newPictureItem.length, false), - ByteVector.fromString(newPictureItem) + ByteVector.fromUint(3, false), + ByteVector.fromString("foo", StringType.UTF8), + ByteVector.fromUint(3, false), + ByteVector.fromUint(9, false), + ByteVector.fromString("TITLE=bar", StringType.UTF8), + ByteVector.fromUint(oldPictureItem.length, false), + ByteVector.fromString(oldPictureItem, StringType.UTF8), + ByteVector.fromUint(newPictureItem.length, false), + ByteVector.fromString(newPictureItem, StringType.UTF8) ); // Act - const comment = XiphComment.fromData(data); + const comment = XiphComment.fromData(data, false); // Assert assert.strictEqual(comment.fieldValueCount, 3); @@ -116,6 +115,49 @@ import {TagTesters, Testers} from "../utilities/testers"; assert.instanceOf(newPicture, XiphPicture); } + @test + public fromData_hasPictures_lazyLoading() { + // Arrange + const oldPictureData = ByteVector.fromString("fuxbuxqux", StringType.UTF8); + const oldPictureItem = `COVERART=${oldPictureData.toBase64String()}`; + const newPictureItem = `METADATA_BLOCK_PICTURE=${XiphTestResources.pictureEncodedBytes}`; + const data = ByteVector.concatenate( + ByteVector.fromUint(3, false), + ByteVector.fromString("foo", StringType.UTF8), + ByteVector.fromUint(3, false), + ByteVector.fromUint(9, false), + ByteVector.fromString("TITLE=bar", StringType.UTF8), + ByteVector.fromUint(oldPictureItem.length, false), + ByteVector.fromString(oldPictureItem, StringType.UTF8), + ByteVector.fromUint(newPictureItem.length, false), + ByteVector.fromString(newPictureItem, StringType.UTF8) + ); + + // Act + const comment = XiphComment.fromData(data, true); + + // Assert + assert.strictEqual(comment.fieldValueCount, 3); + assert.sameMembers(comment.fieldNames, ["TITLE"]); + assert.strictEqual(comment.vendorId, "foo"); + assert.strictEqual(comment.tagTypes, TagTypes.Xiph); + assert.strictEqual(comment.sizeOnDisk, data.length); + assert.isFalse(comment.isEmpty); + + assert.strictEqual(comment.title, "bar"); + const pictures = comment.pictures; + assert.strictEqual(pictures.length, 2); + + // ... Pic 1 should be the old one (and should be loaded already) + assert.instanceOf(pictures[0], Picture); + Testers.bvEqual(pictures[0].data, oldPictureData); + assert.strictEqual(pictures[0].type, PictureType.NotAPicture); + + // ... Pic 2 should be the new one (and should be lazily loaded) + assert.instanceOf(pictures[1], XiphPicture); + assert.isFalse(( pictures[1]).isLoaded); + } + @test public fromEmpty() { // Act @@ -847,32 +889,33 @@ import {TagTesters, Testers} from "../utilities/testers"; private static readonly vendorId = "foo"; private static readonly title1 = "bar"; private static readonly title2 = "baz"; - private static readonly encodedOldPictureData = Buffer.from(ByteVector.fromString("fuxbuxqux").data).toString("base64"); - private getTestComment() { + private static readonly encodedOldPictureData = ByteVector.fromString("fuxbuxqux", StringType.UTF8) + .toBase64String(); + private static getTestComment() { const oldPictureItem = `COVERART=${Xiph_Comment_MethodTests.encodedOldPictureData}`; const newPictureItem = `METADATA_BLOCK_PICTURE=${XiphTestResources.pictureEncodedBytes}`; const titleItem1 = `TITLE=${Xiph_Comment_MethodTests.title1}`; const titleItem2 = `TITLE=${Xiph_Comment_MethodTests.title2}`; const data = ByteVector.concatenate( - ByteVector.fromUInt(Xiph_Comment_MethodTests.vendorId.length, false), - ByteVector.fromString(Xiph_Comment_MethodTests.vendorId), - ByteVector.fromUInt(4, false), - ByteVector.fromUInt(titleItem1.length, false), - ByteVector.fromString(titleItem1), - ByteVector.fromUInt(titleItem2.length, false), - ByteVector.fromString(titleItem2), - ByteVector.fromUInt(oldPictureItem.length, false), - ByteVector.fromString(oldPictureItem), - ByteVector.fromUInt(newPictureItem.length, false), - ByteVector.fromString(newPictureItem) + ByteVector.fromUint(Xiph_Comment_MethodTests.vendorId.length, false), + ByteVector.fromString(Xiph_Comment_MethodTests.vendorId, StringType.UTF8), + ByteVector.fromUint(4, false), + ByteVector.fromUint(titleItem1.length, false), + ByteVector.fromString(titleItem1, StringType.UTF8), + ByteVector.fromUint(titleItem2.length, false), + ByteVector.fromString(titleItem2, StringType.UTF8), + ByteVector.fromUint(oldPictureItem.length, false), + ByteVector.fromString(oldPictureItem, StringType.UTF8), + ByteVector.fromUint(newPictureItem.length, false), + ByteVector.fromString(newPictureItem, StringType.UTF8) ); - return XiphComment.fromData(data); + return XiphComment.fromData(data, false); } @test public clear() { // Arrange - const comment = this.getTestComment(); + const comment = Xiph_Comment_MethodTests.getTestComment(); // Act comment.clear(); @@ -890,10 +933,10 @@ import {TagTesters, Testers} from "../utilities/testers"; @test public getField_invalidParameters() { // Arrange - const comment = this.getTestComment(); + const comment = Xiph_Comment_MethodTests.getTestComment(); // Act / Assert - Testers.testString(comment.getField); + Testers.testTruthy((s) => comment.getField(s)); assert.throws(() => comment.getField("COVERART")); assert.throws(() => comment.getField("METADATA_BLOCK_PICTURE")); } @@ -901,7 +944,7 @@ import {TagTesters, Testers} from "../utilities/testers"; @test public getField_fieldExists() { // Arrange - const comment = this.getTestComment(); + const comment = Xiph_Comment_MethodTests.getTestComment(); // Act const output = comment.getField("TitlE"); @@ -941,10 +984,10 @@ import {TagTesters, Testers} from "../utilities/testers"; @test public getFieldFirstValue_invalidValues() { // Arrange - const comment = this.getTestComment(); + const comment = Xiph_Comment_MethodTests.getTestComment(); // Act / Assert - Testers.testString(comment.getFieldFirstValue); + Testers.testTruthy((s) => comment.getFieldFirstValue(s)); assert.throws(() => comment.getFieldFirstValue("COVERART")); assert.throws(() => comment.getFieldFirstValue("METADATA_BLOCK_PICTURE")); } @@ -952,7 +995,7 @@ import {TagTesters, Testers} from "../utilities/testers"; @test public getFieldFirstValue_fieldExists() { // Arrange - const comment = this.getTestComment(); + const comment = Xiph_Comment_MethodTests.getTestComment(); // Act const output = comment.getFieldFirstValue("TitlE"); @@ -964,7 +1007,7 @@ import {TagTesters, Testers} from "../utilities/testers"; @test public getFieldFirstValue_fieldDoesNotExist() { // Arrange - const comment = this.getTestComment(); + const comment = Xiph_Comment_MethodTests.getTestComment(); // Act const output = comment.getFieldFirstValue("foobar"); @@ -976,10 +1019,10 @@ import {TagTesters, Testers} from "../utilities/testers"; @test public removeField_invalidValues() { // Arrange - const comment = this.getTestComment(); + const comment = Xiph_Comment_MethodTests.getTestComment(); // Act / Assert - Testers.testString(comment.removeField); + Testers.testTruthy((s) => comment.removeField(s)); assert.throws(() => comment.removeField("COVERART")); assert.throws(() => comment.removeField("METADATA_BLOCK_PICTURE")); } @@ -987,7 +1030,7 @@ import {TagTesters, Testers} from "../utilities/testers"; @test public removeValue_fieldExists() { // Arrange - const comment = this.getTestComment(); + const comment = Xiph_Comment_MethodTests.getTestComment(); // Act comment.removeField("TitlE"); @@ -1000,7 +1043,7 @@ import {TagTesters, Testers} from "../utilities/testers"; @test public removeValue_fieldDoesNotExist() { // Arrange - const comment = this.getTestComment(); + const comment = Xiph_Comment_MethodTests.getTestComment(); // Act comment.removeField("foobar"); @@ -1019,10 +1062,10 @@ import {TagTesters, Testers} from "../utilities/testers"; // Assert const expectedOutput = ByteVector.concatenate( - ByteVector.fromUInt(0, false), - ByteVector.fromUInt(0, false), + ByteVector.fromUint(0, false), + ByteVector.fromUint(0, false), ); - assert.isTrue(ByteVector.equal(output, expectedOutput)); + Testers.bvEqual(output, expectedOutput); } @test @@ -1035,8 +1078,8 @@ import {TagTesters, Testers} from "../utilities/testers"; // Assert const expectedOutput = ByteVector.concatenate( - ByteVector.fromUInt(0, false), - ByteVector.fromUInt(0, false), + ByteVector.fromUint(0, false), + ByteVector.fromUint(0, false), 0x01 ); Testers.bvEqual(output, expectedOutput); @@ -1045,7 +1088,7 @@ import {TagTesters, Testers} from "../utilities/testers"; @test public render_hasContents() { // Arrange - const comment = this.getTestComment(); + const comment = Xiph_Comment_MethodTests.getTestComment(); // Act const output = comment.render(false); @@ -1057,17 +1100,17 @@ import {TagTesters, Testers} from "../utilities/testers"; const pictureItem1 = `METADATA_BLOCK_PICTURE=${picture1EncodedBytes}`; const pictureItem2 = `METADATA_BLOCK_PICTURE=${XiphTestResources.pictureEncodedBytes}`; const expected = ByteVector.concatenate( - ByteVector.fromUInt(Xiph_Comment_MethodTests.vendorId.length, false), - ByteVector.fromString(Xiph_Comment_MethodTests.vendorId), - ByteVector.fromUInt(4, false), - ByteVector.fromUInt(titleItem1.length, false), - ByteVector.fromString(titleItem1), - ByteVector.fromUInt(titleItem2.length, false), - ByteVector.fromString(titleItem2), - ByteVector.fromUInt(pictureItem1.length, false), - ByteVector.fromString(pictureItem1), - ByteVector.fromUInt(pictureItem2.length, false), - ByteVector.fromString(pictureItem2) + ByteVector.fromUint(Xiph_Comment_MethodTests.vendorId.length, false), + ByteVector.fromString(Xiph_Comment_MethodTests.vendorId, StringType.UTF8), + ByteVector.fromUint(4, false), + ByteVector.fromUint(titleItem1.length, false), + ByteVector.fromString(titleItem1, StringType.UTF8), + ByteVector.fromUint(titleItem2.length, false), + ByteVector.fromString(titleItem2, StringType.UTF8), + ByteVector.fromUint(pictureItem1.length, false), + ByteVector.fromString(pictureItem1, StringType.UTF8), + ByteVector.fromUint(pictureItem2.length, false), + ByteVector.fromString(pictureItem2, StringType.UTF8) ); Testers.bvEqual(output, expected); } @@ -1075,7 +1118,7 @@ import {TagTesters, Testers} from "../utilities/testers"; @test public setFieldAsString_invalidValues() { // Arrange - const comment = this.getTestComment(); + const comment = Xiph_Comment_MethodTests.getTestComment(); // Act / Assert Testers.testString((v: string) => comment.setFieldAsStrings(v)); @@ -1086,7 +1129,7 @@ import {TagTesters, Testers} from "../utilities/testers"; @test public setFieldAsString_removesField() { // Arrange - const comment = this.getTestComment(); + const comment = Xiph_Comment_MethodTests.getTestComment(); // Act comment.setFieldAsStrings("TitlE"); @@ -1099,7 +1142,7 @@ import {TagTesters, Testers} from "../utilities/testers"; @test public setFieldAsString_allValuesFilteredOutRemovesField() { // Arrange - const comment = this.getTestComment(); + const comment = Xiph_Comment_MethodTests.getTestComment(); // Act comment.setFieldAsStrings("TitlE", "", undefined, null, " "); @@ -1112,7 +1155,7 @@ import {TagTesters, Testers} from "../utilities/testers"; @test public setFieldAsString_fieldExists() { // Arrange - const comment = this.getTestComment(); + const comment = Xiph_Comment_MethodTests.getTestComment(); // Act comment.setFieldAsStrings("TitlE", "nobody's", "accusing", "you"); @@ -1138,7 +1181,7 @@ import {TagTesters, Testers} from "../utilities/testers"; @test public setFieldAsUint_invalidValues() { // Arrange - const comment = this.getTestComment(); + const comment = Xiph_Comment_MethodTests.getTestComment(); // Act / Assert Testers.testString((v: string) => comment.setFieldAsUint(v, 0, 0)); @@ -1151,7 +1194,7 @@ import {TagTesters, Testers} from "../utilities/testers"; @test public setFieldAsUint_removesField() { // Arrange - const comment = this.getTestComment(); + const comment = Xiph_Comment_MethodTests.getTestComment(); // Act comment.setFieldAsUint("TitlE", 0); @@ -1164,7 +1207,7 @@ import {TagTesters, Testers} from "../utilities/testers"; @test public setFieldAsUint_fieldExists() { // Arrange - const comment = this.getTestComment(); + const comment = Xiph_Comment_MethodTests.getTestComment(); // Act comment.setFieldAsUint("TitlE", 3, 3); diff --git a/test-unit/xiph/xiphPictureTests.ts b/test-unit/xiph/xiphPictureTests.ts index 49034b2c..de2b906b 100644 --- a/test-unit/xiph/xiphPictureTests.ts +++ b/test-unit/xiph/xiphPictureTests.ts @@ -7,7 +7,7 @@ import XiphPicture from "../../src/xiph/xiphPicture"; import XiphTestResources from "./resources"; import {ByteVector} from "../../src/byteVector"; import {FlacBlock, FlacBlockType} from "../../src/flac/flacBlock"; -import {IPicture, PictureType} from "../../src/iPicture"; +import {IPicture, PictureType} from "../../src/picture"; import {Testers} from "../utilities/testers"; @suite @@ -27,7 +27,7 @@ class Xiph_PictureTests { // Assert assert.isTrue(picture.isLoaded); assert.strictEqual(picture.colorDepth, XiphTestResources.pictureColorDepth); - assert.isTrue(ByteVector.equal(picture.data, XiphTestResources.pictureData)); + Testers.bvEqual(picture.data, XiphTestResources.pictureData); assert.strictEqual(picture.description, XiphTestResources.pictureDescription); assert.isUndefined(picture.filename); assert.strictEqual(picture.height, XiphTestResources.pictureHeight); @@ -73,7 +73,7 @@ class Xiph_PictureTests { // Assert assert.isTrue(picture.isLoaded); assert.strictEqual(picture.colorDepth, XiphTestResources.pictureColorDepth); - assert.isTrue(ByteVector.equal(picture.data, XiphTestResources.pictureData)); + Testers.bvEqual(picture.data, XiphTestResources.pictureData); assert.strictEqual(picture.description, XiphTestResources.pictureDescription); assert.isUndefined(picture.filename); assert.strictEqual(picture.height, XiphTestResources.pictureHeight); @@ -117,7 +117,7 @@ class Xiph_PictureTests { // Assert assert.isTrue(picture.isLoaded); assert.strictEqual(picture.colorDepth, 0); - assert.isTrue(ByteVector.equal(picture.data, XiphTestResources.pictureData)); + Testers.bvEqual(picture.data, XiphTestResources.pictureData); assert.strictEqual(picture.description, XiphTestResources.pictureDescription); assert.strictEqual(picture.filename, "foobarbaz"); assert.strictEqual(picture.height, 0); @@ -138,7 +138,7 @@ class Xiph_PictureTests { // Assert assert.isTrue(picture.isLoaded); assert.strictEqual(picture.colorDepth, XiphTestResources.pictureColorDepth); - assert.isTrue(ByteVector.equal(picture.data, XiphTestResources.pictureData)); + Testers.bvEqual(picture.data, XiphTestResources.pictureData); assert.strictEqual(picture.description, XiphTestResources.pictureDescription); assert.isUndefined(picture.filename); assert.strictEqual(picture.height, XiphTestResources.pictureHeight); @@ -246,7 +246,7 @@ class Xiph_PictureTests { const output = picture.renderForFlacBlock(); // Assert - assert.isTrue(ByteVector.equal(output, XiphTestResources.pictureBytes)); + Testers.bvEqual(output, XiphTestResources.pictureBytes); } @test diff --git a/tsconfig.json b/tsconfig.json index b8ae7db6..ee81e1fd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,7 +14,8 @@ "target": "es6" }, "include": [ - "./src/**/*" + "./src/**/*", + ".eslintrc.js" ], "typedocOptions": { "entryPoints": ["./src/index.ts"], @@ -23,4 +24,4 @@ "disableSources": true, "listInvalidSymbolLinks": true } -} \ No newline at end of file +} diff --git a/tslint.json b/tslint.json deleted file mode 100644 index f056380e..00000000 --- a/tslint.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": "tslint:recommended", - "rules": { - "max-classes-per-file": false, - "member-ordering": false, - "new-parens": true, - "no-arg": true, - "no-angle-bracket-type-assertion": false, - "no-bitwise": false, - "no-conditional-assignment": true, - "no-consecutive-blank-lines": false, - "no-console": false, - "no-reference": false, - "no-var-requires": false, - "object-literal-shorthand": false, - "ordered-imports": false, - "trailing-comma": false, - "variable-name": [false] - } -} \ No newline at end of file