Skip to content

Commit 394f626

Browse files
committed
WIP: sidecar debug file & added exif ext support
1 parent 20f36ae commit 394f626

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

debug/sidecar.mjs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import * as exifr from '../src/bundles/full.mjs'
2+
import {promises as fs} from 'fs'
3+
4+
;(async () => {
5+
let output1 = await exifr.sidecar('../test/fixtures/sidecar/IMG_5910.xmp')
6+
console.log('output1', output1)
7+
8+
let output2 = await exifr.sidecar('../test/fixtures/sidecar/IMG_5910.exif')
9+
console.log('output2', output2)
10+
11+
let output3 = await exifr.sidecar('../test/fixtures/icc/sRGB_v4_ICC_preference.icc')
12+
console.log('output3', output3)
13+
/*
14+
let buffer1 = await fs.readFile('../test/fixtures/sidecar/IMG_5910.xmp')
15+
let output1 = await exifr.sidecar(buffer1)
16+
console.log('output1', output1)
17+
18+
let buffer2 = await fs.readFile('../test/fixtures/sidecar/IMG_5910.exif')
19+
let output2 = await exifr.sidecar(buffer2)
20+
console.log('output2', output2)
21+
22+
let buffer3 = await fs.readFile('../test/fixtures/icc/sRGB_v4_ICC_preference.icc')
23+
let output3 = await exifr.sidecar(buffer3)
24+
console.log('output3', output3)
25+
*/
26+
})().catch(console.error);

src/highlevel/sidecar.mjs

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {read} from '../reader.mjs'
44
import {throwError} from '../util/helpers.mjs'
55

66

7-
const allowedSidecars = ['xmp', 'icc', 'iptc']
7+
const allowedSidecars = ['xmp', 'icc', 'iptc', 'tiff']
88
const noop = () => {}
99

1010
export async function sidecar(input, opts, segType) {
@@ -39,5 +39,6 @@ async function handleSeg(type, chunk, options) {
3939

4040
function guessTypeFromName(filename) {
4141
let ext = filename.toLowerCase().split('.').pop()
42+
if (ext === 'exif') return 'tiff'
4243
if (allowedSidecars.includes(ext)) return ext
4344
}
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)