1 | 'use strict';
|
2 |
|
3 |
|
4 | var ParserStream = require('../common').ParserStream;
|
5 | var str2arr = require('../common').str2arr;
|
6 | var sliceEq = require('../common').sliceEq;
|
7 |
|
8 |
|
9 | var SIG_BM = str2arr('BM');
|
10 |
|
11 |
|
12 | module.exports = function () {
|
13 | var parser = new ParserStream();
|
14 |
|
15 | parser._bytes(26, function (data) {
|
16 | parser._skipBytes(Infinity);
|
17 |
|
18 | if (!sliceEq(data, 0, SIG_BM)) {
|
19 | parser.push(null);
|
20 | return;
|
21 | }
|
22 |
|
23 | parser.push({
|
24 | width: data.readUInt16LE(18),
|
25 | height: data.readUInt16LE(22),
|
26 | type: 'bmp',
|
27 | mime: 'image/bmp',
|
28 | wUnits: 'px',
|
29 | hUnits: 'px'
|
30 | });
|
31 |
|
32 | parser.push(null);
|
33 | });
|
34 |
|
35 | return parser;
|
36 | };
|