Created
May 29, 2017 13:06
-
-
Save tatat/054aa40596d3085c325ba2fb4cf131d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isZip(path, callback) { | |
fs.open(path, 'r', (error, fd) => { | |
if (error) | |
return callback(error) | |
fs.read(fd, Buffer.alloc(4), 0, 4, 0, (error, bytesRead, buffer) => { | |
if (error) | |
return callback(error) | |
callback(null, buffer.readUInt32LE(0) === 0x04034b50) | |
}) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment