You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Modifying the detection behavior of existing `FileTypeResult` types.
140
+
- [@file-type/xml](https://github.com/Borewit/file-type-xml): Detects common XML file types, such as GLM, KML, MusicXML, RSS, SVG, and XHTML
126
141
127
142
### Detector execution flow
128
143
@@ -131,7 +146,7 @@ If a detector returns `undefined`, the following rules apply:
131
146
1. **No Tokenizer Interaction**: If the detector does not modify the tokenizer's position, the next detector in the sequence is executed.
132
147
2. **Tokenizer Interaction**: If the detector modifies the tokenizer's position (`tokenizer.position` is advanced), no further detectors are executed. In this case, the file type remains `undefined`, as subsequent detectors cannot evaluate the content. This is an exceptional scenario, as it prevents any other detectors from determining the file type.
133
148
134
-
### Example usage
149
+
### Example writing a custom detector
135
150
136
151
Below is an example of a custom detector array. This can be passed to the `FileTypeParser` via the `fileTypeOptions` argument.
- Modifying the detection behavior of existing `FileTypeResult` types.
367
+
- [@file-type/xml](https://github.com/Borewit/file-type-xml): Detects common XML file types, such as GLM, KML, MusicXML, RSS, SVG, and XHTML
355
368
356
369
### Detector execution flow
357
370
@@ -360,7 +373,7 @@ If a detector returns `undefined`, the following rules apply:
360
373
1. **No Tokenizer Interaction**: If the detector does not modify the tokenizer's position, the next detector in the sequence is executed.
361
374
2. **Tokenizer Interaction**: If the detector modifies the tokenizer's position (`tokenizer.position` is advanced), no further detectors are executed. In this case, the file type remains `undefined`, as subsequent detectors cannot evaluate the content. This is an exceptional scenario, as it prevents any other detectors from determining the file type.
362
375
363
-
### Example usage
376
+
### Writing your own custom detector
364
377
365
378
Below is an example of a custom detector array. This can be passed to the `FileTypeParser` via the `fileTypeOptions` argument.
366
379
@@ -597,7 +610,7 @@ The following file types will not be accepted:
0 commit comments