Created
April 8, 2019 05:22
Revisions
-
Deliaz created this gist
Apr 8, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ #!/usr/bin/env node const fs = require('fs'); const filePath = process.argv[2]; if(!filePath) { console.error('No file specified.\nUsage:\n\tnode crxver.js my-extensions.crx\n'); process.exit(-1); } const buf = fs.readFileSync(filePath); const VERSION_POS_BYTE_OFFSET = 4; const VERSION_LENGTH_BYTE = 1; const type = buf.subarray(0, 4).toString('ascii'); const version = buf.readIntBE(VERSION_POS_BYTE_OFFSET, VERSION_LENGTH_BYTE).toString(16); console.log('File type:\t', type); console.log('Version:\t', version);