psd.js 289 B

1234567891011121314151617
  1. 'use strict';
  2. function isPSD (buffer) {
  3. return ('8BPS' === buffer.toString('ascii', 0, 4));
  4. }
  5. function calculate (buffer) {
  6. return {
  7. 'width': buffer.readUInt32BE(18),
  8. 'height': buffer.readUInt32BE(14)
  9. };
  10. }
  11. module.exports = {
  12. 'detect': isPSD,
  13. 'calculate': calculate
  14. };