forked from m0g/node-libraw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
libraw.js
41 lines (35 loc) · 924 Bytes
/
libraw.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const fs = require('fs');
const raw = require('./build/Release/node_libraw');
const libraw = {
extract: function(input, output) {
return new Promise(function(resolve, reject) {
fs.access(input, fs.R_OK | fs.W_OK, function(err) {
if (err)
reject(err);
else
raw.extract(input, output, function(err, output) {
if (err)
reject(err);
else
resolve(output);
});
});
});
},
extractThumb: function(input, output) {
return new Promise(function(resolve, reject) {
fs.access(input, fs.R_OK | fs.W_OK, function(err) {
if (err)
reject(err);
else
raw.extractThumb(input, output, function(err, output) {
if (err)
reject(err);
else
resolve(output);
});
});
});
}
};
module.exports = libraw;