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
Adds the following to README:
- Refer to third-party detectors where SVG is supported
- Describe how to add a third party file-type detector
- Add a list of third-party detectors
- Modifying the detection behavior of existing `FileTypeResult` types.
138
+
### Available third party file-type detectors
139
+
* [@file-type/xml](https://github.com/Borewit/file-type-xml): Detects common XML file types, such as: GLM, KML, MusicXML, RSS, SVG, XHTML
126
140
127
141
### Detector execution flow
128
142
@@ -131,7 +145,7 @@ If a detector returns `undefined`, the following rules apply:
131
145
1. **No Tokenizer Interaction**: If the detector does not modify the tokenizer's position, the next detector in the sequence is executed.
132
146
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
147
134
-
### Example usage
148
+
### Example writing a custom detector
135
149
136
150
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.
365
+
### Available third party file-type detectors
366
+
* [@file-type/xml](https://github.com/Borewit/file-type-xml): Detects common XML file types, such as: GLM, KML, MusicXML, RSS, SVG, XHTML
355
367
356
368
### Detector execution flow
357
369
@@ -360,7 +372,7 @@ If a detector returns `undefined`, the following rules apply:
360
372
1. **No Tokenizer Interaction**: If the detector does not modify the tokenizer's position, the next detector in the sequence is executed.
361
373
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
374
363
-
### Example usage
375
+
### Writing your own custom detector
364
376
365
377
Below is an example of a custom detector array. This can be passed to the `FileTypeParser` via the `fileTypeOptions` argument.
366
378
@@ -597,7 +609,7 @@ The following file types will not be accepted:
- `.svg` - Detecting it requires a full-blown parser. Check out [`is-svg`](https://github.com/sindresorhus/is-svg) for something that mostly works.
612
+
- `.svg` - Supported by [third party detector](#available-third-party-file-type-detectors).
0 commit comments