• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

benrr101 / node-taglib-sharp / 46462135

pending completion
46462135

push

appveyor

Benjamin Russell
Merge branch 'release/v5.1.0'

3096 of 3788 branches covered (81.73%)

Branch coverage included in aggregate %.

2171 of 2171 new or added lines in 47 files covered. (100.0%)

25320 of 26463 relevant lines covered (95.68%)

437.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.89
/src/aac/aacFileSettings.ts
1
import {TagTypes} from "../tag";
1✔
2
import {NumberUtils} from "../utils";
1✔
3

4
/**
5
 * This class contains settings related to AAC file operations. Open files will need to be re-read
6
 * in order for changes to take effect.
7
 */
8
export default class AacFileSettings {
1✔
9
    /**
10
     * List of the tag types that are supported by the AAC file.
11
     */
12
    public static readonly SUPPORTED_TAG_TYPES: TagTypes = TagTypes.Id3v1 | TagTypes.Id3v2 | TagTypes.Ape;
1✔
13

14
    private static _defaultTagTypes = TagTypes.Id3v1 | TagTypes.Id3v2;
1✔
15
    private static _preferApeTagAtFileEnd = true;
1✔
16
    private static _preferId3v2TagAtFileEnd = false;
1✔
17

18
    /**
19
     * Gets the default types of tags for an AAC file. When opening a file, if these tag types do
20
     * not exist on the file, they will be created.
21
     */
22
    public static get defaultTagTypes(): TagTypes { return this._defaultTagTypes; }
6✔
23
    /**
24
     * Sets the default types of tags for an AAC file. When opening a file, if these tag types do
25
     * not exist on the file, they will be created. See {@link SUPPORTED_TAG_TYPES} for a list of tag
26
     * types that are supported by node-taglib-sharp for AAC files.
27
     */
28
    public static set defaultTagTypes(value: TagTypes) {
29
        const unsupportedTagTypes = NumberUtils.uintAnd(value, ~this.SUPPORTED_TAG_TYPES);
6✔
30
        if (unsupportedTagTypes !== 0) {
6!
31
            throw new Error(
×
32
                `Argument error: node-taglib-sharp does not support tag types ${unsupportedTagTypes} for AAC files`
33
            );
34
        }
35

36
        this._defaultTagTypes = value;
6✔
37
    }
38

39
    /**
40
     * Gets whether or not *new* APE tags should be stored at the end of the file. If `true` new
41
     * APE tags will be stored at the end of the file. If `false` new APE tags will be stored at
42
     * the beginning of the file (not recommended). Note, this only affects *new* APE tags.
43
     * Existing APE tags will not be moved unless removed and re-added.
44
     * @default `true`
45
     */
46
    public static get preferApeTagAtFileEnd(): boolean { return this._preferApeTagAtFileEnd; }
4✔
47
    /**
48
     * Gets whether or not *new* APE tags should be stored at the end of the file. If `true` new
49
     * APE tags will be stored at the end of the file. If `false` new APE tags will be stored at
50
     * the beginning of the file (not recommended). Note, this only affects *new* APE tags.
51
     * Existing APE tags will not be moved unless removed and re-added.
52
     * @default `true`
53
     */
54
    public static set preferApeTagAtFileEnd(value: boolean) { this._preferApeTagAtFileEnd = value; }
4✔
55

56
    /**
57
     * Gets whether or not *new* ID3v2 tags should be stored at the end of the file. If `true` new
58
     * ID3v2 tags will be stored at the end of the file. If `false` new ID3v2 tags will be stored
59
     * at the beginning of the file. Note, this only affects *new* ID3v2 tags. Existing ID3v2 tags
60
     * will not be moved unless removed and re-added.
61
     * @remarks
62
     *     In order to store an ID3v2 tag at the end of a file, it must have a tag footer. Tag
63
     *     footers are only supported in ID3v2.4. If the ID3v2 version is changed, it will cause an
64
     *     error to be thrown when the tag is rendered.
65
     * @default `false`
66
     */
67
    public static get preferId3v2TagAtFileEnd(): boolean { return this._preferId3v2TagAtFileEnd; }
4✔
68
    /**
69
     * Sets whether or not *new* ID3v2 tags should be stored at the end of the file. If `true` new
70
     * ID3v2 tags will be stored at the end of the file. If `false` new ID3v2 tags will be stored
71
     * at the beginning of the file. Note, this only affects *new* ID3v2 tags. Existing ID3v2 tags
72
     * will not be moved unless removed and re-added.
73
     * @remarks
74
     *   In order to store an ID3v2 tag at the end of a file, it must have a tag footer. Tag
75
     *   footers are only supported in ID3v2.4. If the ID3v2 version is changed, it will cause an
76
     *   error to be thrown when the tag is rendered.
77
     * @default `false`
78
     */
79
    public static set preferId3v2TagAtFileEnd(value: boolean) { this._preferId3v2TagAtFileEnd = value; }
4✔
80
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc