exifreader 4.36.0 → 4.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exif-reader.js +1 -1
- package/dist/exif-reader.js.map +1 -1
- package/package.json +1 -1
- package/src/tag-decoder.js +3 -0
- package/src/utils.js +10 -0
package/package.json
CHANGED
package/src/tag-decoder.js
CHANGED
|
@@ -12,6 +12,9 @@ export default {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
function decode(encoding, tagValue) {
|
|
15
|
+
if (typeof tagValue === 'string') {
|
|
16
|
+
return decodeAsciiValue(tagValue);
|
|
17
|
+
}
|
|
15
18
|
const Decoder = TextDecoder.get();
|
|
16
19
|
if ((typeof Decoder !== 'undefined') && (encoding !== undefined)) {
|
|
17
20
|
try {
|
package/src/utils.js
CHANGED
|
@@ -165,5 +165,15 @@ export function decompress(dataView, compressionMethod, encoding, returnType = '
|
|
|
165
165
|
if (compressionMethod !== undefined) {
|
|
166
166
|
return Promise.reject(`Unknown compression method ${compressionMethod}.`);
|
|
167
167
|
}
|
|
168
|
+
|
|
169
|
+
// handle uncompressed iTXT with proper encoding awareness
|
|
170
|
+
if (returnType === 'string') {
|
|
171
|
+
try {
|
|
172
|
+
return new TextDecoder(encoding).decode(dataView);
|
|
173
|
+
} catch (error) {
|
|
174
|
+
const bytes = new Uint8Array(dataView.buffer, dataView.byteOffset, dataView.byteLength);
|
|
175
|
+
return Array.from(bytes, (byte) => String.fromCharCode(byte)).join('');
|
|
176
|
+
}
|
|
177
|
+
}
|
|
168
178
|
return dataView;
|
|
169
179
|
}
|