@eris/exif
Advanced tools
Comparing version 0.4.2-alpha.10 to 0.4.2-alpha.11
@@ -20,2 +20,3 @@ import { IBufferLike, IGenericMetadata } from '../utils/types'; | ||
private _readFileMarkers; | ||
extractJPEG(): IBufferLike; | ||
extractMetadata(): IGenericMetadata; | ||
@@ -22,0 +23,0 @@ extractEXIFBuffer(): IBufferLike | undefined; |
@@ -126,2 +126,5 @@ "use strict"; | ||
} | ||
extractJPEG() { | ||
return this._buffer; | ||
} | ||
extractMetadata() { | ||
@@ -128,0 +131,0 @@ this._readFileMarkers(); |
@@ -7,4 +7,5 @@ import { IBufferLike, IGenericMetadata } from '../utils/types'; | ||
private _decodeKeywords; | ||
extractJPEG(): IBufferLike; | ||
extractMetadata(): IGenericMetadata; | ||
static isXMP(buffer: IBufferLike): boolean; | ||
} |
@@ -62,2 +62,5 @@ "use strict"; | ||
} | ||
extractJPEG() { | ||
throw new Error('No image preview available from XMP'); | ||
} | ||
extractMetadata() { | ||
@@ -64,0 +67,0 @@ const metadata = {}; |
@@ -9,2 +9,3 @@ import { JPEGDecoder } from './decoder/jpeg-decoder'; | ||
import { IDecoder, IBufferLike, INormalizedMetadata } from './utils/types'; | ||
export declare function isParseable(buffer: IBufferLike): boolean; | ||
export declare function createDecoder(bufferOrDecoder: IBufferLike | IDecoder): IDecoder; | ||
@@ -11,0 +12,0 @@ export declare function parse(bufferOrDecoder: IBufferLike | IDecoder): INormalizedMetadata; |
@@ -30,3 +30,3 @@ "use strict"; | ||
} | ||
function createDecoder(bufferOrDecoder) { | ||
function createDecoder_(bufferOrDecoder) { | ||
if (isDecoder(bufferOrDecoder)) { | ||
@@ -47,5 +47,12 @@ return bufferOrDecoder; | ||
} | ||
else { | ||
} | ||
function isParseable(buffer) { | ||
return !!createDecoder_(buffer); | ||
} | ||
exports.isParseable = isParseable; | ||
function createDecoder(bufferOrDecoder) { | ||
const decoder = createDecoder_(bufferOrDecoder); | ||
if (!decoder) | ||
throw new Error('Unrecognizable file type'); | ||
} | ||
return decoder; | ||
} | ||
@@ -52,0 +59,0 @@ exports.createDecoder = createDecoder; |
@@ -37,2 +37,3 @@ /// <reference types="node" /> | ||
extractMetadata(): IGenericMetadata; | ||
extractJPEG(): IBufferLike; | ||
} | ||
@@ -39,0 +40,0 @@ export interface IIFD { |
@@ -163,2 +163,6 @@ import {TIFFDecoder} from '../decoder/tiff-decoder' | ||
public extractJPEG(): IBufferLike { | ||
return this._buffer | ||
} | ||
public extractMetadata(): IGenericMetadata { | ||
@@ -165,0 +169,0 @@ this._readFileMarkers() |
@@ -67,2 +67,6 @@ import {IBufferLike, IGenericMetadata, IFDTagName, XMPTagName} from '../utils/types' | ||
public extractJPEG(): IBufferLike { | ||
throw new Error('No image preview available from XMP') | ||
} | ||
public extractMetadata(): IGenericMetadata { | ||
@@ -69,0 +73,0 @@ const metadata: IGenericMetadata = {} |
@@ -26,3 +26,3 @@ import {JPEGDecoder} from './decoder/jpeg-decoder' | ||
export function createDecoder(bufferOrDecoder: IBufferLike | IDecoder): IDecoder { | ||
function createDecoder_(bufferOrDecoder: IBufferLike | IDecoder): IDecoder | undefined { | ||
if (isDecoder(bufferOrDecoder)) { | ||
@@ -38,7 +38,15 @@ return bufferOrDecoder | ||
return new XMPDecoder(bufferOrDecoder) | ||
} else { | ||
throw new Error('Unrecognizable file type') | ||
} | ||
} | ||
export function isParseable(buffer: IBufferLike): boolean { | ||
return !!createDecoder_(buffer) | ||
} | ||
export function createDecoder(bufferOrDecoder: IBufferLike | IDecoder): IDecoder { | ||
const decoder = createDecoder_(bufferOrDecoder) | ||
if (!decoder) throw new Error('Unrecognizable file type') | ||
return decoder | ||
} | ||
export function parse(bufferOrDecoder: IBufferLike | IDecoder): INormalizedMetadata { | ||
@@ -45,0 +53,0 @@ return normalizeMetadata(createDecoder(bufferOrDecoder).extractMetadata()) |
@@ -42,2 +42,3 @@ export interface ILogger { | ||
extractMetadata(): IGenericMetadata | ||
extractJPEG(): IBufferLike | ||
} | ||
@@ -44,0 +45,0 @@ |
{ | ||
"name": "@eris/exif", | ||
"version": "0.4.2-alpha.10", | ||
"version": "0.4.2-alpha.11", | ||
"description": "Parses EXIF data.", | ||
@@ -40,3 +40,3 @@ "main": "./dist/index.js", | ||
}, | ||
"gitHead": "5c0400259b4be16eb1deeffc855d3ba62874a626" | ||
"gitHead": "1963467d76289070ef6e24a7d8e6e89cbc37777b" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
240830
4440