Wraps LibRaw's functionality.
- accessLibRaw
- cameraCount
- cameraList
- errorCount
- getMetadata
- getThumbnail
- getXmp
- openBuffer
- openFile
- readBuffer
- recycle
- recycleDatastream
- strerror
- unpack
- unpackThumb
- version
- versionNumber
• new LibRaw()
• Private
libraw: LibRawWrapper
▸ Private
accessLibRaw<T
>(executor
): Promise
<T
>
Abstracts interactions with LibRaw to avoid boilerplate async code repetitions in public methods.
Name |
---|
T |
Name | Type | Description |
---|---|---|
executor |
() => T |
the interaction with LibRaw |
Promise
<T
>
▸ cameraCount(): Promise
<number
>
Promise
<number
>
▸ cameraList(): Promise
<string
[]>
Promise
<string
[]>
▸ errorCount(): Promise
<number
>
This call returns count of non-fatal data errors (out of range, etc) occured in unpack() stage.
Promise
<number
>
▸ getMetadata(): Promise
<{ [key: string]
: unknown
; }>
Returns an object containing the RAW metadata.
Promise
<{ [key: string]
: unknown
; }>
▸ getThumbnail(): Promise
<Buffer
>
Unpacks and returns the bytes for the image's thumbnail.
Promise
<Buffer
>
▸ getXmp(): Promise
<Buffer
>
Helper function that returns the XMP data of the RAW file.
Promise
<Buffer
>
▸ openBuffer(buffer
): Promise
<number
>
Created an LibRaw_buffer_datastream object, calls open_datastream(). If succeed, sets internal flag which signals to destroy internal datastream object on recycle(). On failure, just created file_datastream destroyed immediately.
The function returns an integer number in accordance with the return code convention: positive if any system call has returned an error, negative (from the LibRaw error list) if there has been an error situation within LibRaw.
Name | Type | Description |
---|---|---|
buffer |
Buffer |
the image data |
Promise
<number
>
▸ openFile(filename
, bigFileSize?
): Promise
<number
>
Creates an LibRaw_file_datastream object, calls open_datastream(). If succeed, sets internal flag which signals to destroy internal datastream object on recycle(). On failure, just created file_datastream destroyed immediately.
Name | Type | Description |
---|---|---|
filename |
string |
the file path to open |
bigFileSize? |
number |
- |
Promise
<number
>
▸ readBuffer(buffer
): Promise
<void
>
Initializes a LibRaw instance from a file in memory.
Name | Type | Description |
---|---|---|
buffer |
Buffer |
the RAW file data |
Promise
<void
>
▸ recycle(): Promise
<void
>
Frees the allocated data of LibRaw instance, enabling one to process the next file using the same processor. Repeated calls of recycle() are quite possible and do not conflict with anything.
Promise
<void
>
▸ recycleDatastream(): Promise
<void
>
This call closes input datastream with associated data buffer and unblocks opened file.
Promise
<void
>
▸ strerror(errorCode
): Promise
<string
>
Analog of strerror(3) function: outputs the text descriptions of LibRaw error codes (in English).
Name | Type |
---|---|
errorCode |
number |
Promise
<string
>
▸ unpack(): Promise
<number
>
Unpacks the RAW files of the image, calculates the black level (not for all formats).
Promise
<number
>
▸ unpackThumb(): Promise
<number
>
Reads (or unpacks) the image preview (thumbnail), placing the result into the imgdata.thumbnail.thumb buffer.
Promise
<number
>
▸ version(): Promise
<string
>
Promise
<string
>
▸ versionNumber(): Promise
<number
>
Promise
<number
>