UNPKG

582 BJavaScriptView Raw
1'use strict';
2
3/* eslint-disable consistent-return */
4
5var str2arr = require('../common').str2arr;
6var sliceEq = require('../common').sliceEq;
7var readUInt32BE = require('../common').readUInt32BE;
8
9
10var SIG_8BPS = str2arr('8BPS\x00\x01');
11
12
13module.exports = function (data) {
14 if (data.length < 6 + 16) return;
15
16 // signature + version
17 if (!sliceEq(data, 0, SIG_8BPS)) return;
18
19 return {
20 width: readUInt32BE(data, 6 + 12),
21 height: readUInt32BE(data, 6 + 8),
22 type: 'psd',
23 mime: 'image/vnd.adobe.photoshop',
24 wUnits: 'px',
25 hUnits: 'px'
26 };
27};