• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nodeca / probe-image-size / 25267957022

03 May 2026 02:40AM UTC coverage: 99.538% (+0.001%) from 99.537%
25267957022

push

github

puzrin
lint fix: semi

707 of 713 branches covered (99.16%)

772 of 777 new or added lines in 27 files covered. (99.36%)

1078 of 1083 relevant lines covered (99.54%)

329.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.44
/lib/parse_sync/bmp.js
1
'use strict'
2

3

4
var str2arr = require('../common').str2arr
4✔
5
var sliceEq = require('../common').sliceEq
4✔
6
var readInt16LE = require('../common').readInt16LE
4✔
7
var readInt32LE = require('../common').readInt32LE
4✔
8
var readUInt32LE = require('../common').readUInt32LE
4✔
9

10
var SIG_BM = str2arr('BM')
4✔
11

12

13
module.exports = function (data) {
4✔
14
  if (data.length < 26) return
70✔
15

16
  if (!sliceEq(data, 0, SIG_BM)) return
52✔
17

18
  var h
19
  var w
20
  var headerSize = readUInt32LE(data, 14)
2✔
21

22
  if (headerSize === 12) {
2✔
23
    // BMP v2 header
24
    w = readInt16LE(data, 18)
1✔
25
    h = readInt16LE(data, 20)
1✔
26
  } else if (headerSize > 12) {
1!
27
    // BMP v3+ header
28
    w = readInt32LE(data, 18)
1✔
29
    h = readInt32LE(data, 22)
1✔
30
  } else {
31
    // BPM v1 and other garbage (10 bytes usually)
NEW
32
    return
×
33
  }
34

35
  return {
2✔
36
    width: w,
37
    // Height can be negative to indicate a top-down bitmap
38
    height: Math.abs(h),
39
    type: 'bmp',
40
    mime: 'image/bmp',
41
    wUnits: 'px',
42
    hUnits: 'px'
43
  }
44
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc