• 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/flac/flacFileSettings.ts
1
import {TagTypes} from "../tag";
1✔
2
import {NumberUtils} from "../utils";
1✔
3

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

15
    private static _defaultTagTypes = TagTypes.Xiph;
1✔
16
    private static _preferApeTagAtFileEnd = true;
1✔
17
    private static _preferId3v2TagAtFileEnd = false;
1✔
18

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

37
        this._defaultTagTypes = value;
34✔
38
    }
39

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

57
    /**
58
     * Gets whether or not *new* ID3v2 tags should be stored at the end of the file. If `true` new
59
     * ID3v2 tags will be stored at the end of the file. If `false` new ID3v2 tags will be stored
60
     * at the beginning of the file. Note, this only affects *new* ID3v2 tags. Existing ID3v2 tags
61
     * will not be moved unless removed and re-added.
62
     * @remarks
63
     *     In order to store an ID3v2 tag at the end of a file, it must have a tag footer. Tag
64
     *     footers are only supported in ID3v2.4. If the ID3v2 version is changed, it will cause an
65
     *     error to be thrown when the tag is rendered.
66
     * @default `false`
67
     */
68
    public static get preferId3v2TagAtFileEnd(): boolean { return this._preferId3v2TagAtFileEnd; }
12✔
69
    /**
70
     * Sets whether or not *new* ID3v2 tags should be stored at the end of the file. If `true` new
71
     * ID3v2 tags will be stored at the end of the file. If `false` new ID3v2 tags will be stored
72
     * at the beginning of the file. Note, this only affects *new* ID3v2 tags. Existing ID3v2 tags
73
     * will not be moved unless removed and re-added.
74
     * @remarks
75
     *     In order to store an ID3v2 tag at the end of a file, it must have a tag footer. Tag
76
     *     footers are only supported in ID3v2.4. If the ID3v2 version is changed, it will cause an
77
     *     error to be thrown when the tag is rendered.
78
     * @default `false`
79
     */
80
    public static set preferId3v2TagAtFileEnd(value: boolean) { this._preferId3v2TagAtFileEnd = value; }
12✔
81
}
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